diff options
Diffstat (limited to 'ext')
362 files changed, 11953 insertions, 55662 deletions
diff --git a/ext/-test-/RUBY_ALIGNOF/depend b/ext/-test-/RUBY_ALIGNOF/depend index 21ef8c6dd0..25364e55fb 100644 --- a/ext/-test-/RUBY_ALIGNOF/depend +++ b/ext/-test-/RUBY_ALIGNOF/depend @@ -52,6 +52,7 @@ c.o: $(hdrdir)/ruby/internal/attr/noexcept.h c.o: $(hdrdir)/ruby/internal/attr/noinline.h c.o: $(hdrdir)/ruby/internal/attr/nonnull.h c.o: $(hdrdir)/ruby/internal/attr/noreturn.h +c.o: $(hdrdir)/ruby/internal/attr/packed_struct.h c.o: $(hdrdir)/ruby/internal/attr/pure.h c.o: $(hdrdir)/ruby/internal/attr/restrict.h c.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ c.o: $(hdrdir)/ruby/internal/intern/enumerator.h c.o: $(hdrdir)/ruby/internal/intern/error.h c.o: $(hdrdir)/ruby/internal/intern/eval.h c.o: $(hdrdir)/ruby/internal/intern/file.h -c.o: $(hdrdir)/ruby/internal/intern/gc.h c.o: $(hdrdir)/ruby/internal/intern/hash.h c.o: $(hdrdir)/ruby/internal/intern/io.h c.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ c.o: $(hdrdir)/ruby/internal/memory.h c.o: $(hdrdir)/ruby/internal/method.h c.o: $(hdrdir)/ruby/internal/module.h c.o: $(hdrdir)/ruby/internal/newobj.h -c.o: $(hdrdir)/ruby/internal/rgengc.h c.o: $(hdrdir)/ruby/internal/scan_args.h c.o: $(hdrdir)/ruby/internal/special_consts.h c.o: $(hdrdir)/ruby/internal/static_assert.h c.o: $(hdrdir)/ruby/internal/stdalign.h c.o: $(hdrdir)/ruby/internal/stdbool.h +c.o: $(hdrdir)/ruby/internal/stdckdint.h c.o: $(hdrdir)/ruby/internal/symbol.h c.o: $(hdrdir)/ruby/internal/value.h c.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/arith_seq/beg_len_step/depend b/ext/-test-/arith_seq/beg_len_step/depend index 36a2c4c71b..702a0037a8 100644 --- a/ext/-test-/arith_seq/beg_len_step/depend +++ b/ext/-test-/arith_seq/beg_len_step/depend @@ -51,6 +51,7 @@ beg_len_step.o: $(hdrdir)/ruby/internal/attr/noexcept.h beg_len_step.o: $(hdrdir)/ruby/internal/attr/noinline.h beg_len_step.o: $(hdrdir)/ruby/internal/attr/nonnull.h beg_len_step.o: $(hdrdir)/ruby/internal/attr/noreturn.h +beg_len_step.o: $(hdrdir)/ruby/internal/attr/packed_struct.h beg_len_step.o: $(hdrdir)/ruby/internal/attr/pure.h beg_len_step.o: $(hdrdir)/ruby/internal/attr/restrict.h beg_len_step.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ beg_len_step.o: $(hdrdir)/ruby/internal/intern/enumerator.h beg_len_step.o: $(hdrdir)/ruby/internal/intern/error.h beg_len_step.o: $(hdrdir)/ruby/internal/intern/eval.h beg_len_step.o: $(hdrdir)/ruby/internal/intern/file.h -beg_len_step.o: $(hdrdir)/ruby/internal/intern/gc.h beg_len_step.o: $(hdrdir)/ruby/internal/intern/hash.h beg_len_step.o: $(hdrdir)/ruby/internal/intern/io.h beg_len_step.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ beg_len_step.o: $(hdrdir)/ruby/internal/memory.h beg_len_step.o: $(hdrdir)/ruby/internal/method.h beg_len_step.o: $(hdrdir)/ruby/internal/module.h beg_len_step.o: $(hdrdir)/ruby/internal/newobj.h -beg_len_step.o: $(hdrdir)/ruby/internal/rgengc.h beg_len_step.o: $(hdrdir)/ruby/internal/scan_args.h beg_len_step.o: $(hdrdir)/ruby/internal/special_consts.h beg_len_step.o: $(hdrdir)/ruby/internal/static_assert.h beg_len_step.o: $(hdrdir)/ruby/internal/stdalign.h beg_len_step.o: $(hdrdir)/ruby/internal/stdbool.h +beg_len_step.o: $(hdrdir)/ruby/internal/stdckdint.h beg_len_step.o: $(hdrdir)/ruby/internal/symbol.h beg_len_step.o: $(hdrdir)/ruby/internal/value.h beg_len_step.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/arith_seq/extract/depend b/ext/-test-/arith_seq/extract/depend index 57cbaa9a0c..fdbd71dfbc 100644 --- a/ext/-test-/arith_seq/extract/depend +++ b/ext/-test-/arith_seq/extract/depend @@ -51,6 +51,7 @@ extract.o: $(hdrdir)/ruby/internal/attr/noexcept.h extract.o: $(hdrdir)/ruby/internal/attr/noinline.h extract.o: $(hdrdir)/ruby/internal/attr/nonnull.h extract.o: $(hdrdir)/ruby/internal/attr/noreturn.h +extract.o: $(hdrdir)/ruby/internal/attr/packed_struct.h extract.o: $(hdrdir)/ruby/internal/attr/pure.h extract.o: $(hdrdir)/ruby/internal/attr/restrict.h extract.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ extract.o: $(hdrdir)/ruby/internal/intern/enumerator.h extract.o: $(hdrdir)/ruby/internal/intern/error.h extract.o: $(hdrdir)/ruby/internal/intern/eval.h extract.o: $(hdrdir)/ruby/internal/intern/file.h -extract.o: $(hdrdir)/ruby/internal/intern/gc.h extract.o: $(hdrdir)/ruby/internal/intern/hash.h extract.o: $(hdrdir)/ruby/internal/intern/io.h extract.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ extract.o: $(hdrdir)/ruby/internal/memory.h extract.o: $(hdrdir)/ruby/internal/method.h extract.o: $(hdrdir)/ruby/internal/module.h extract.o: $(hdrdir)/ruby/internal/newobj.h -extract.o: $(hdrdir)/ruby/internal/rgengc.h extract.o: $(hdrdir)/ruby/internal/scan_args.h extract.o: $(hdrdir)/ruby/internal/special_consts.h extract.o: $(hdrdir)/ruby/internal/static_assert.h extract.o: $(hdrdir)/ruby/internal/stdalign.h extract.o: $(hdrdir)/ruby/internal/stdbool.h +extract.o: $(hdrdir)/ruby/internal/stdckdint.h extract.o: $(hdrdir)/ruby/internal/symbol.h extract.o: $(hdrdir)/ruby/internal/value.h extract.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/array/concat/depend b/ext/-test-/array/concat/depend index 79c833738e..f2213a42ea 100644 --- a/ext/-test-/array/concat/depend +++ b/ext/-test-/array/concat/depend @@ -52,6 +52,7 @@ to_ary_concat.o: $(hdrdir)/ruby/internal/attr/noexcept.h to_ary_concat.o: $(hdrdir)/ruby/internal/attr/noinline.h to_ary_concat.o: $(hdrdir)/ruby/internal/attr/nonnull.h to_ary_concat.o: $(hdrdir)/ruby/internal/attr/noreturn.h +to_ary_concat.o: $(hdrdir)/ruby/internal/attr/packed_struct.h to_ary_concat.o: $(hdrdir)/ruby/internal/attr/pure.h to_ary_concat.o: $(hdrdir)/ruby/internal/attr/restrict.h to_ary_concat.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ to_ary_concat.o: $(hdrdir)/ruby/internal/intern/enumerator.h to_ary_concat.o: $(hdrdir)/ruby/internal/intern/error.h to_ary_concat.o: $(hdrdir)/ruby/internal/intern/eval.h to_ary_concat.o: $(hdrdir)/ruby/internal/intern/file.h -to_ary_concat.o: $(hdrdir)/ruby/internal/intern/gc.h to_ary_concat.o: $(hdrdir)/ruby/internal/intern/hash.h to_ary_concat.o: $(hdrdir)/ruby/internal/intern/io.h to_ary_concat.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ to_ary_concat.o: $(hdrdir)/ruby/internal/memory.h to_ary_concat.o: $(hdrdir)/ruby/internal/method.h to_ary_concat.o: $(hdrdir)/ruby/internal/module.h to_ary_concat.o: $(hdrdir)/ruby/internal/newobj.h -to_ary_concat.o: $(hdrdir)/ruby/internal/rgengc.h to_ary_concat.o: $(hdrdir)/ruby/internal/scan_args.h to_ary_concat.o: $(hdrdir)/ruby/internal/special_consts.h to_ary_concat.o: $(hdrdir)/ruby/internal/static_assert.h to_ary_concat.o: $(hdrdir)/ruby/internal/stdalign.h to_ary_concat.o: $(hdrdir)/ruby/internal/stdbool.h +to_ary_concat.o: $(hdrdir)/ruby/internal/stdckdint.h to_ary_concat.o: $(hdrdir)/ruby/internal/symbol.h to_ary_concat.o: $(hdrdir)/ruby/internal/value.h to_ary_concat.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/array/resize/depend b/ext/-test-/array/resize/depend index 49e0f346d3..f88a9d03c1 100644 --- a/ext/-test-/array/resize/depend +++ b/ext/-test-/array/resize/depend @@ -51,6 +51,7 @@ resize.o: $(hdrdir)/ruby/internal/attr/noexcept.h resize.o: $(hdrdir)/ruby/internal/attr/noinline.h resize.o: $(hdrdir)/ruby/internal/attr/nonnull.h resize.o: $(hdrdir)/ruby/internal/attr/noreturn.h +resize.o: $(hdrdir)/ruby/internal/attr/packed_struct.h resize.o: $(hdrdir)/ruby/internal/attr/pure.h resize.o: $(hdrdir)/ruby/internal/attr/restrict.h resize.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ resize.o: $(hdrdir)/ruby/internal/intern/enumerator.h resize.o: $(hdrdir)/ruby/internal/intern/error.h resize.o: $(hdrdir)/ruby/internal/intern/eval.h resize.o: $(hdrdir)/ruby/internal/intern/file.h -resize.o: $(hdrdir)/ruby/internal/intern/gc.h resize.o: $(hdrdir)/ruby/internal/intern/hash.h resize.o: $(hdrdir)/ruby/internal/intern/io.h resize.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ resize.o: $(hdrdir)/ruby/internal/memory.h resize.o: $(hdrdir)/ruby/internal/method.h resize.o: $(hdrdir)/ruby/internal/module.h resize.o: $(hdrdir)/ruby/internal/newobj.h -resize.o: $(hdrdir)/ruby/internal/rgengc.h resize.o: $(hdrdir)/ruby/internal/scan_args.h resize.o: $(hdrdir)/ruby/internal/special_consts.h resize.o: $(hdrdir)/ruby/internal/static_assert.h resize.o: $(hdrdir)/ruby/internal/stdalign.h resize.o: $(hdrdir)/ruby/internal/stdbool.h +resize.o: $(hdrdir)/ruby/internal/stdckdint.h resize.o: $(hdrdir)/ruby/internal/symbol.h resize.o: $(hdrdir)/ruby/internal/value.h resize.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/asan/asan.c b/ext/-test-/asan/asan.c new file mode 100644 index 0000000000..45b6253fda --- /dev/null +++ b/ext/-test-/asan/asan.c @@ -0,0 +1,24 @@ +#include "ruby/ruby.h" + +static VALUE +asan_enabled_p(VALUE self) +{ +#if defined(__has_feature) + /* clang uses __has_feature for determining asan */ + return __has_feature(address_sanitizer) ? Qtrue : Qfalse; +#elif defined(__SANITIZE_ADDRESS__) + /* GCC sets __SANITIZE_ADDRESS__ for determining asan */ + return Qtrue; +#else + return Qfalse; +#endif +} + +void +Init_asan(void) +{ + VALUE m = rb_define_module("Test"); + VALUE c = rb_define_class_under(m, "ASAN", rb_cObject); + rb_define_singleton_method(c, "enabled?", asan_enabled_p, 0); +} + diff --git a/ext/-test-/asan/extconf.rb b/ext/-test-/asan/extconf.rb new file mode 100644 index 0000000000..ec02742b81 --- /dev/null +++ b/ext/-test-/asan/extconf.rb @@ -0,0 +1,2 @@ +require 'mkmf' +create_makefile('-test-/asan') diff --git a/ext/-test-/bignum/depend b/ext/-test-/bignum/depend index d4072fb35c..078915ab72 100644 --- a/ext/-test-/bignum/depend +++ b/ext/-test-/bignum/depend @@ -51,6 +51,7 @@ big2str.o: $(hdrdir)/ruby/internal/attr/noexcept.h big2str.o: $(hdrdir)/ruby/internal/attr/noinline.h big2str.o: $(hdrdir)/ruby/internal/attr/nonnull.h big2str.o: $(hdrdir)/ruby/internal/attr/noreturn.h +big2str.o: $(hdrdir)/ruby/internal/attr/packed_struct.h big2str.o: $(hdrdir)/ruby/internal/attr/pure.h big2str.o: $(hdrdir)/ruby/internal/attr/restrict.h big2str.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ big2str.o: $(hdrdir)/ruby/internal/intern/enumerator.h big2str.o: $(hdrdir)/ruby/internal/intern/error.h big2str.o: $(hdrdir)/ruby/internal/intern/eval.h big2str.o: $(hdrdir)/ruby/internal/intern/file.h -big2str.o: $(hdrdir)/ruby/internal/intern/gc.h big2str.o: $(hdrdir)/ruby/internal/intern/hash.h big2str.o: $(hdrdir)/ruby/internal/intern/io.h big2str.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ big2str.o: $(hdrdir)/ruby/internal/memory.h big2str.o: $(hdrdir)/ruby/internal/method.h big2str.o: $(hdrdir)/ruby/internal/module.h big2str.o: $(hdrdir)/ruby/internal/newobj.h -big2str.o: $(hdrdir)/ruby/internal/rgengc.h big2str.o: $(hdrdir)/ruby/internal/scan_args.h big2str.o: $(hdrdir)/ruby/internal/special_consts.h big2str.o: $(hdrdir)/ruby/internal/static_assert.h big2str.o: $(hdrdir)/ruby/internal/stdalign.h big2str.o: $(hdrdir)/ruby/internal/stdbool.h +big2str.o: $(hdrdir)/ruby/internal/stdckdint.h big2str.o: $(hdrdir)/ruby/internal/symbol.h big2str.o: $(hdrdir)/ruby/internal/value.h big2str.o: $(hdrdir)/ruby/internal/value_type.h @@ -211,6 +211,7 @@ bigzero.o: $(hdrdir)/ruby/internal/attr/noexcept.h bigzero.o: $(hdrdir)/ruby/internal/attr/noinline.h bigzero.o: $(hdrdir)/ruby/internal/attr/nonnull.h bigzero.o: $(hdrdir)/ruby/internal/attr/noreturn.h +bigzero.o: $(hdrdir)/ruby/internal/attr/packed_struct.h bigzero.o: $(hdrdir)/ruby/internal/attr/pure.h bigzero.o: $(hdrdir)/ruby/internal/attr/restrict.h bigzero.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -270,7 +271,6 @@ bigzero.o: $(hdrdir)/ruby/internal/intern/enumerator.h bigzero.o: $(hdrdir)/ruby/internal/intern/error.h bigzero.o: $(hdrdir)/ruby/internal/intern/eval.h bigzero.o: $(hdrdir)/ruby/internal/intern/file.h -bigzero.o: $(hdrdir)/ruby/internal/intern/gc.h bigzero.o: $(hdrdir)/ruby/internal/intern/hash.h bigzero.o: $(hdrdir)/ruby/internal/intern/io.h bigzero.o: $(hdrdir)/ruby/internal/intern/load.h @@ -301,12 +301,12 @@ bigzero.o: $(hdrdir)/ruby/internal/memory.h bigzero.o: $(hdrdir)/ruby/internal/method.h bigzero.o: $(hdrdir)/ruby/internal/module.h bigzero.o: $(hdrdir)/ruby/internal/newobj.h -bigzero.o: $(hdrdir)/ruby/internal/rgengc.h bigzero.o: $(hdrdir)/ruby/internal/scan_args.h bigzero.o: $(hdrdir)/ruby/internal/special_consts.h bigzero.o: $(hdrdir)/ruby/internal/static_assert.h bigzero.o: $(hdrdir)/ruby/internal/stdalign.h bigzero.o: $(hdrdir)/ruby/internal/stdbool.h +bigzero.o: $(hdrdir)/ruby/internal/stdckdint.h bigzero.o: $(hdrdir)/ruby/internal/symbol.h bigzero.o: $(hdrdir)/ruby/internal/value.h bigzero.o: $(hdrdir)/ruby/internal/value_type.h @@ -371,6 +371,7 @@ div.o: $(hdrdir)/ruby/internal/attr/noexcept.h div.o: $(hdrdir)/ruby/internal/attr/noinline.h div.o: $(hdrdir)/ruby/internal/attr/nonnull.h div.o: $(hdrdir)/ruby/internal/attr/noreturn.h +div.o: $(hdrdir)/ruby/internal/attr/packed_struct.h div.o: $(hdrdir)/ruby/internal/attr/pure.h div.o: $(hdrdir)/ruby/internal/attr/restrict.h div.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -430,7 +431,6 @@ div.o: $(hdrdir)/ruby/internal/intern/enumerator.h div.o: $(hdrdir)/ruby/internal/intern/error.h div.o: $(hdrdir)/ruby/internal/intern/eval.h div.o: $(hdrdir)/ruby/internal/intern/file.h -div.o: $(hdrdir)/ruby/internal/intern/gc.h div.o: $(hdrdir)/ruby/internal/intern/hash.h div.o: $(hdrdir)/ruby/internal/intern/io.h div.o: $(hdrdir)/ruby/internal/intern/load.h @@ -461,12 +461,12 @@ div.o: $(hdrdir)/ruby/internal/memory.h div.o: $(hdrdir)/ruby/internal/method.h div.o: $(hdrdir)/ruby/internal/module.h div.o: $(hdrdir)/ruby/internal/newobj.h -div.o: $(hdrdir)/ruby/internal/rgengc.h div.o: $(hdrdir)/ruby/internal/scan_args.h div.o: $(hdrdir)/ruby/internal/special_consts.h div.o: $(hdrdir)/ruby/internal/static_assert.h div.o: $(hdrdir)/ruby/internal/stdalign.h div.o: $(hdrdir)/ruby/internal/stdbool.h +div.o: $(hdrdir)/ruby/internal/stdckdint.h div.o: $(hdrdir)/ruby/internal/symbol.h div.o: $(hdrdir)/ruby/internal/value.h div.o: $(hdrdir)/ruby/internal/value_type.h @@ -532,6 +532,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -591,7 +592,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -622,12 +622,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -691,6 +691,7 @@ intpack.o: $(hdrdir)/ruby/internal/attr/noexcept.h intpack.o: $(hdrdir)/ruby/internal/attr/noinline.h intpack.o: $(hdrdir)/ruby/internal/attr/nonnull.h intpack.o: $(hdrdir)/ruby/internal/attr/noreturn.h +intpack.o: $(hdrdir)/ruby/internal/attr/packed_struct.h intpack.o: $(hdrdir)/ruby/internal/attr/pure.h intpack.o: $(hdrdir)/ruby/internal/attr/restrict.h intpack.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -750,7 +751,6 @@ intpack.o: $(hdrdir)/ruby/internal/intern/enumerator.h intpack.o: $(hdrdir)/ruby/internal/intern/error.h intpack.o: $(hdrdir)/ruby/internal/intern/eval.h intpack.o: $(hdrdir)/ruby/internal/intern/file.h -intpack.o: $(hdrdir)/ruby/internal/intern/gc.h intpack.o: $(hdrdir)/ruby/internal/intern/hash.h intpack.o: $(hdrdir)/ruby/internal/intern/io.h intpack.o: $(hdrdir)/ruby/internal/intern/load.h @@ -781,12 +781,12 @@ intpack.o: $(hdrdir)/ruby/internal/memory.h intpack.o: $(hdrdir)/ruby/internal/method.h intpack.o: $(hdrdir)/ruby/internal/module.h intpack.o: $(hdrdir)/ruby/internal/newobj.h -intpack.o: $(hdrdir)/ruby/internal/rgengc.h intpack.o: $(hdrdir)/ruby/internal/scan_args.h intpack.o: $(hdrdir)/ruby/internal/special_consts.h intpack.o: $(hdrdir)/ruby/internal/static_assert.h intpack.o: $(hdrdir)/ruby/internal/stdalign.h intpack.o: $(hdrdir)/ruby/internal/stdbool.h +intpack.o: $(hdrdir)/ruby/internal/stdckdint.h intpack.o: $(hdrdir)/ruby/internal/symbol.h intpack.o: $(hdrdir)/ruby/internal/value.h intpack.o: $(hdrdir)/ruby/internal/value_type.h @@ -851,6 +851,7 @@ mul.o: $(hdrdir)/ruby/internal/attr/noexcept.h mul.o: $(hdrdir)/ruby/internal/attr/noinline.h mul.o: $(hdrdir)/ruby/internal/attr/nonnull.h mul.o: $(hdrdir)/ruby/internal/attr/noreturn.h +mul.o: $(hdrdir)/ruby/internal/attr/packed_struct.h mul.o: $(hdrdir)/ruby/internal/attr/pure.h mul.o: $(hdrdir)/ruby/internal/attr/restrict.h mul.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -910,7 +911,6 @@ mul.o: $(hdrdir)/ruby/internal/intern/enumerator.h mul.o: $(hdrdir)/ruby/internal/intern/error.h mul.o: $(hdrdir)/ruby/internal/intern/eval.h mul.o: $(hdrdir)/ruby/internal/intern/file.h -mul.o: $(hdrdir)/ruby/internal/intern/gc.h mul.o: $(hdrdir)/ruby/internal/intern/hash.h mul.o: $(hdrdir)/ruby/internal/intern/io.h mul.o: $(hdrdir)/ruby/internal/intern/load.h @@ -941,12 +941,12 @@ mul.o: $(hdrdir)/ruby/internal/memory.h mul.o: $(hdrdir)/ruby/internal/method.h mul.o: $(hdrdir)/ruby/internal/module.h mul.o: $(hdrdir)/ruby/internal/newobj.h -mul.o: $(hdrdir)/ruby/internal/rgengc.h mul.o: $(hdrdir)/ruby/internal/scan_args.h mul.o: $(hdrdir)/ruby/internal/special_consts.h mul.o: $(hdrdir)/ruby/internal/static_assert.h mul.o: $(hdrdir)/ruby/internal/stdalign.h mul.o: $(hdrdir)/ruby/internal/stdbool.h +mul.o: $(hdrdir)/ruby/internal/stdckdint.h mul.o: $(hdrdir)/ruby/internal/symbol.h mul.o: $(hdrdir)/ruby/internal/value.h mul.o: $(hdrdir)/ruby/internal/value_type.h @@ -1011,6 +1011,7 @@ str2big.o: $(hdrdir)/ruby/internal/attr/noexcept.h str2big.o: $(hdrdir)/ruby/internal/attr/noinline.h str2big.o: $(hdrdir)/ruby/internal/attr/nonnull.h str2big.o: $(hdrdir)/ruby/internal/attr/noreturn.h +str2big.o: $(hdrdir)/ruby/internal/attr/packed_struct.h str2big.o: $(hdrdir)/ruby/internal/attr/pure.h str2big.o: $(hdrdir)/ruby/internal/attr/restrict.h str2big.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1070,7 +1071,6 @@ str2big.o: $(hdrdir)/ruby/internal/intern/enumerator.h str2big.o: $(hdrdir)/ruby/internal/intern/error.h str2big.o: $(hdrdir)/ruby/internal/intern/eval.h str2big.o: $(hdrdir)/ruby/internal/intern/file.h -str2big.o: $(hdrdir)/ruby/internal/intern/gc.h str2big.o: $(hdrdir)/ruby/internal/intern/hash.h str2big.o: $(hdrdir)/ruby/internal/intern/io.h str2big.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1101,12 +1101,12 @@ str2big.o: $(hdrdir)/ruby/internal/memory.h str2big.o: $(hdrdir)/ruby/internal/method.h str2big.o: $(hdrdir)/ruby/internal/module.h str2big.o: $(hdrdir)/ruby/internal/newobj.h -str2big.o: $(hdrdir)/ruby/internal/rgengc.h str2big.o: $(hdrdir)/ruby/internal/scan_args.h str2big.o: $(hdrdir)/ruby/internal/special_consts.h str2big.o: $(hdrdir)/ruby/internal/static_assert.h str2big.o: $(hdrdir)/ruby/internal/stdalign.h str2big.o: $(hdrdir)/ruby/internal/stdbool.h +str2big.o: $(hdrdir)/ruby/internal/stdckdint.h str2big.o: $(hdrdir)/ruby/internal/symbol.h str2big.o: $(hdrdir)/ruby/internal/value.h str2big.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/bug-14834/depend b/ext/-test-/bug-14834/depend index 7bac8409e8..695094fa7a 100644 --- a/ext/-test-/bug-14834/depend +++ b/ext/-test-/bug-14834/depend @@ -52,6 +52,7 @@ bug-14384.o: $(hdrdir)/ruby/internal/attr/noexcept.h bug-14384.o: $(hdrdir)/ruby/internal/attr/noinline.h bug-14384.o: $(hdrdir)/ruby/internal/attr/nonnull.h bug-14384.o: $(hdrdir)/ruby/internal/attr/noreturn.h +bug-14384.o: $(hdrdir)/ruby/internal/attr/packed_struct.h bug-14384.o: $(hdrdir)/ruby/internal/attr/pure.h bug-14384.o: $(hdrdir)/ruby/internal/attr/restrict.h bug-14384.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ bug-14384.o: $(hdrdir)/ruby/internal/intern/enumerator.h bug-14384.o: $(hdrdir)/ruby/internal/intern/error.h bug-14384.o: $(hdrdir)/ruby/internal/intern/eval.h bug-14384.o: $(hdrdir)/ruby/internal/intern/file.h -bug-14384.o: $(hdrdir)/ruby/internal/intern/gc.h bug-14384.o: $(hdrdir)/ruby/internal/intern/hash.h bug-14384.o: $(hdrdir)/ruby/internal/intern/io.h bug-14384.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ bug-14384.o: $(hdrdir)/ruby/internal/memory.h bug-14384.o: $(hdrdir)/ruby/internal/method.h bug-14384.o: $(hdrdir)/ruby/internal/module.h bug-14384.o: $(hdrdir)/ruby/internal/newobj.h -bug-14384.o: $(hdrdir)/ruby/internal/rgengc.h bug-14384.o: $(hdrdir)/ruby/internal/scan_args.h bug-14384.o: $(hdrdir)/ruby/internal/special_consts.h bug-14384.o: $(hdrdir)/ruby/internal/static_assert.h bug-14384.o: $(hdrdir)/ruby/internal/stdalign.h bug-14384.o: $(hdrdir)/ruby/internal/stdbool.h +bug-14384.o: $(hdrdir)/ruby/internal/stdckdint.h bug-14384.o: $(hdrdir)/ruby/internal/symbol.h bug-14384.o: $(hdrdir)/ruby/internal/value.h bug-14384.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/bug-3571/depend b/ext/-test-/bug-3571/depend index 2303f47594..84517a9c15 100644 --- a/ext/-test-/bug-3571/depend +++ b/ext/-test-/bug-3571/depend @@ -52,6 +52,7 @@ bug.o: $(hdrdir)/ruby/internal/attr/noexcept.h bug.o: $(hdrdir)/ruby/internal/attr/noinline.h bug.o: $(hdrdir)/ruby/internal/attr/nonnull.h bug.o: $(hdrdir)/ruby/internal/attr/noreturn.h +bug.o: $(hdrdir)/ruby/internal/attr/packed_struct.h bug.o: $(hdrdir)/ruby/internal/attr/pure.h bug.o: $(hdrdir)/ruby/internal/attr/restrict.h bug.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ bug.o: $(hdrdir)/ruby/internal/intern/enumerator.h bug.o: $(hdrdir)/ruby/internal/intern/error.h bug.o: $(hdrdir)/ruby/internal/intern/eval.h bug.o: $(hdrdir)/ruby/internal/intern/file.h -bug.o: $(hdrdir)/ruby/internal/intern/gc.h bug.o: $(hdrdir)/ruby/internal/intern/hash.h bug.o: $(hdrdir)/ruby/internal/intern/io.h bug.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ bug.o: $(hdrdir)/ruby/internal/memory.h bug.o: $(hdrdir)/ruby/internal/method.h bug.o: $(hdrdir)/ruby/internal/module.h bug.o: $(hdrdir)/ruby/internal/newobj.h -bug.o: $(hdrdir)/ruby/internal/rgengc.h bug.o: $(hdrdir)/ruby/internal/scan_args.h bug.o: $(hdrdir)/ruby/internal/special_consts.h bug.o: $(hdrdir)/ruby/internal/static_assert.h bug.o: $(hdrdir)/ruby/internal/stdalign.h bug.o: $(hdrdir)/ruby/internal/stdbool.h +bug.o: $(hdrdir)/ruby/internal/stdckdint.h bug.o: $(hdrdir)/ruby/internal/symbol.h bug.o: $(hdrdir)/ruby/internal/value.h bug.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/bug-5832/depend b/ext/-test-/bug-5832/depend index 2303f47594..84517a9c15 100644 --- a/ext/-test-/bug-5832/depend +++ b/ext/-test-/bug-5832/depend @@ -52,6 +52,7 @@ bug.o: $(hdrdir)/ruby/internal/attr/noexcept.h bug.o: $(hdrdir)/ruby/internal/attr/noinline.h bug.o: $(hdrdir)/ruby/internal/attr/nonnull.h bug.o: $(hdrdir)/ruby/internal/attr/noreturn.h +bug.o: $(hdrdir)/ruby/internal/attr/packed_struct.h bug.o: $(hdrdir)/ruby/internal/attr/pure.h bug.o: $(hdrdir)/ruby/internal/attr/restrict.h bug.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ bug.o: $(hdrdir)/ruby/internal/intern/enumerator.h bug.o: $(hdrdir)/ruby/internal/intern/error.h bug.o: $(hdrdir)/ruby/internal/intern/eval.h bug.o: $(hdrdir)/ruby/internal/intern/file.h -bug.o: $(hdrdir)/ruby/internal/intern/gc.h bug.o: $(hdrdir)/ruby/internal/intern/hash.h bug.o: $(hdrdir)/ruby/internal/intern/io.h bug.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ bug.o: $(hdrdir)/ruby/internal/memory.h bug.o: $(hdrdir)/ruby/internal/method.h bug.o: $(hdrdir)/ruby/internal/module.h bug.o: $(hdrdir)/ruby/internal/newobj.h -bug.o: $(hdrdir)/ruby/internal/rgengc.h bug.o: $(hdrdir)/ruby/internal/scan_args.h bug.o: $(hdrdir)/ruby/internal/special_consts.h bug.o: $(hdrdir)/ruby/internal/static_assert.h bug.o: $(hdrdir)/ruby/internal/stdalign.h bug.o: $(hdrdir)/ruby/internal/stdbool.h +bug.o: $(hdrdir)/ruby/internal/stdckdint.h bug.o: $(hdrdir)/ruby/internal/symbol.h bug.o: $(hdrdir)/ruby/internal/value.h bug.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/bug_reporter/depend b/ext/-test-/bug_reporter/depend index 603dd53ebf..1c73234247 100644 --- a/ext/-test-/bug_reporter/depend +++ b/ext/-test-/bug_reporter/depend @@ -52,6 +52,7 @@ bug_reporter.o: $(hdrdir)/ruby/internal/attr/noexcept.h bug_reporter.o: $(hdrdir)/ruby/internal/attr/noinline.h bug_reporter.o: $(hdrdir)/ruby/internal/attr/nonnull.h bug_reporter.o: $(hdrdir)/ruby/internal/attr/noreturn.h +bug_reporter.o: $(hdrdir)/ruby/internal/attr/packed_struct.h bug_reporter.o: $(hdrdir)/ruby/internal/attr/pure.h bug_reporter.o: $(hdrdir)/ruby/internal/attr/restrict.h bug_reporter.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ bug_reporter.o: $(hdrdir)/ruby/internal/intern/enumerator.h bug_reporter.o: $(hdrdir)/ruby/internal/intern/error.h bug_reporter.o: $(hdrdir)/ruby/internal/intern/eval.h bug_reporter.o: $(hdrdir)/ruby/internal/intern/file.h -bug_reporter.o: $(hdrdir)/ruby/internal/intern/gc.h bug_reporter.o: $(hdrdir)/ruby/internal/intern/hash.h bug_reporter.o: $(hdrdir)/ruby/internal/intern/io.h bug_reporter.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ bug_reporter.o: $(hdrdir)/ruby/internal/memory.h bug_reporter.o: $(hdrdir)/ruby/internal/method.h bug_reporter.o: $(hdrdir)/ruby/internal/module.h bug_reporter.o: $(hdrdir)/ruby/internal/newobj.h -bug_reporter.o: $(hdrdir)/ruby/internal/rgengc.h bug_reporter.o: $(hdrdir)/ruby/internal/scan_args.h bug_reporter.o: $(hdrdir)/ruby/internal/special_consts.h bug_reporter.o: $(hdrdir)/ruby/internal/static_assert.h bug_reporter.o: $(hdrdir)/ruby/internal/stdalign.h bug_reporter.o: $(hdrdir)/ruby/internal/stdbool.h +bug_reporter.o: $(hdrdir)/ruby/internal/stdckdint.h bug_reporter.o: $(hdrdir)/ruby/internal/symbol.h bug_reporter.o: $(hdrdir)/ruby/internal/value.h bug_reporter.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/class/depend b/ext/-test-/class/depend index a615eacd74..b0595fdc46 100644 --- a/ext/-test-/class/depend +++ b/ext/-test-/class/depend @@ -51,6 +51,7 @@ class2name.o: $(hdrdir)/ruby/internal/attr/noexcept.h class2name.o: $(hdrdir)/ruby/internal/attr/noinline.h class2name.o: $(hdrdir)/ruby/internal/attr/nonnull.h class2name.o: $(hdrdir)/ruby/internal/attr/noreturn.h +class2name.o: $(hdrdir)/ruby/internal/attr/packed_struct.h class2name.o: $(hdrdir)/ruby/internal/attr/pure.h class2name.o: $(hdrdir)/ruby/internal/attr/restrict.h class2name.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ class2name.o: $(hdrdir)/ruby/internal/intern/enumerator.h class2name.o: $(hdrdir)/ruby/internal/intern/error.h class2name.o: $(hdrdir)/ruby/internal/intern/eval.h class2name.o: $(hdrdir)/ruby/internal/intern/file.h -class2name.o: $(hdrdir)/ruby/internal/intern/gc.h class2name.o: $(hdrdir)/ruby/internal/intern/hash.h class2name.o: $(hdrdir)/ruby/internal/intern/io.h class2name.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ class2name.o: $(hdrdir)/ruby/internal/memory.h class2name.o: $(hdrdir)/ruby/internal/method.h class2name.o: $(hdrdir)/ruby/internal/module.h class2name.o: $(hdrdir)/ruby/internal/newobj.h -class2name.o: $(hdrdir)/ruby/internal/rgengc.h class2name.o: $(hdrdir)/ruby/internal/scan_args.h class2name.o: $(hdrdir)/ruby/internal/special_consts.h class2name.o: $(hdrdir)/ruby/internal/static_assert.h class2name.o: $(hdrdir)/ruby/internal/stdalign.h class2name.o: $(hdrdir)/ruby/internal/stdbool.h +class2name.o: $(hdrdir)/ruby/internal/stdckdint.h class2name.o: $(hdrdir)/ruby/internal/symbol.h class2name.o: $(hdrdir)/ruby/internal/value.h class2name.o: $(hdrdir)/ruby/internal/value_type.h @@ -211,6 +211,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -270,7 +271,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -301,12 +301,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/debug/depend b/ext/-test-/debug/depend index c3a0c278aa..67e32c6aa6 100644 --- a/ext/-test-/debug/depend +++ b/ext/-test-/debug/depend @@ -52,6 +52,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ inspector.o: $(hdrdir)/ruby/internal/attr/noexcept.h inspector.o: $(hdrdir)/ruby/internal/attr/noinline.h inspector.o: $(hdrdir)/ruby/internal/attr/nonnull.h inspector.o: $(hdrdir)/ruby/internal/attr/noreturn.h +inspector.o: $(hdrdir)/ruby/internal/attr/packed_struct.h inspector.o: $(hdrdir)/ruby/internal/attr/pure.h inspector.o: $(hdrdir)/ruby/internal/attr/restrict.h inspector.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ inspector.o: $(hdrdir)/ruby/internal/intern/enumerator.h inspector.o: $(hdrdir)/ruby/internal/intern/error.h inspector.o: $(hdrdir)/ruby/internal/intern/eval.h inspector.o: $(hdrdir)/ruby/internal/intern/file.h -inspector.o: $(hdrdir)/ruby/internal/intern/gc.h inspector.o: $(hdrdir)/ruby/internal/intern/hash.h inspector.o: $(hdrdir)/ruby/internal/intern/io.h inspector.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ inspector.o: $(hdrdir)/ruby/internal/memory.h inspector.o: $(hdrdir)/ruby/internal/method.h inspector.o: $(hdrdir)/ruby/internal/module.h inspector.o: $(hdrdir)/ruby/internal/newobj.h -inspector.o: $(hdrdir)/ruby/internal/rgengc.h inspector.o: $(hdrdir)/ruby/internal/scan_args.h inspector.o: $(hdrdir)/ruby/internal/special_consts.h inspector.o: $(hdrdir)/ruby/internal/static_assert.h inspector.o: $(hdrdir)/ruby/internal/stdalign.h inspector.o: $(hdrdir)/ruby/internal/stdbool.h +inspector.o: $(hdrdir)/ruby/internal/stdckdint.h inspector.o: $(hdrdir)/ruby/internal/symbol.h inspector.o: $(hdrdir)/ruby/internal/value.h inspector.o: $(hdrdir)/ruby/internal/value_type.h @@ -372,6 +372,7 @@ profile_frames.o: $(hdrdir)/ruby/internal/attr/noexcept.h profile_frames.o: $(hdrdir)/ruby/internal/attr/noinline.h profile_frames.o: $(hdrdir)/ruby/internal/attr/nonnull.h profile_frames.o: $(hdrdir)/ruby/internal/attr/noreturn.h +profile_frames.o: $(hdrdir)/ruby/internal/attr/packed_struct.h profile_frames.o: $(hdrdir)/ruby/internal/attr/pure.h profile_frames.o: $(hdrdir)/ruby/internal/attr/restrict.h profile_frames.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -431,7 +432,6 @@ profile_frames.o: $(hdrdir)/ruby/internal/intern/enumerator.h profile_frames.o: $(hdrdir)/ruby/internal/intern/error.h profile_frames.o: $(hdrdir)/ruby/internal/intern/eval.h profile_frames.o: $(hdrdir)/ruby/internal/intern/file.h -profile_frames.o: $(hdrdir)/ruby/internal/intern/gc.h profile_frames.o: $(hdrdir)/ruby/internal/intern/hash.h profile_frames.o: $(hdrdir)/ruby/internal/intern/io.h profile_frames.o: $(hdrdir)/ruby/internal/intern/load.h @@ -462,12 +462,12 @@ profile_frames.o: $(hdrdir)/ruby/internal/memory.h profile_frames.o: $(hdrdir)/ruby/internal/method.h profile_frames.o: $(hdrdir)/ruby/internal/module.h profile_frames.o: $(hdrdir)/ruby/internal/newobj.h -profile_frames.o: $(hdrdir)/ruby/internal/rgengc.h profile_frames.o: $(hdrdir)/ruby/internal/scan_args.h profile_frames.o: $(hdrdir)/ruby/internal/special_consts.h profile_frames.o: $(hdrdir)/ruby/internal/static_assert.h profile_frames.o: $(hdrdir)/ruby/internal/stdalign.h profile_frames.o: $(hdrdir)/ruby/internal/stdbool.h +profile_frames.o: $(hdrdir)/ruby/internal/stdckdint.h profile_frames.o: $(hdrdir)/ruby/internal/symbol.h profile_frames.o: $(hdrdir)/ruby/internal/value.h profile_frames.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/debug/profile_frames.c b/ext/-test-/debug/profile_frames.c index d2bba7d183..f9a77a5a78 100644 --- a/ext/-test-/debug/profile_frames.c +++ b/ext/-test-/debug/profile_frames.c @@ -37,8 +37,29 @@ profile_frames(VALUE self, VALUE start_v, VALUE num_v) return result; } +static VALUE +profile_thread_frames(VALUE self, VALUE thread, 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_thread_frames(thread, start, buff_size, buff, lines); + for (i=0; i<collected_size; i++) { + rb_ary_push(result, rb_profile_frame_full_label(buff[i])); + } + + return result; +} + void Init_profile_frames(VALUE klass) { rb_define_module_function(klass, "profile_frames", profile_frames, 2); + rb_define_module_function(klass, "profile_thread_frames", profile_thread_frames, 3); } diff --git a/ext/-test-/dln/empty/depend b/ext/-test-/dln/empty/depend index e16082a7dc..d3e606df57 100644 --- a/ext/-test-/dln/empty/depend +++ b/ext/-test-/dln/empty/depend @@ -52,6 +52,7 @@ empty.o: $(hdrdir)/ruby/internal/attr/noexcept.h empty.o: $(hdrdir)/ruby/internal/attr/noinline.h empty.o: $(hdrdir)/ruby/internal/attr/nonnull.h empty.o: $(hdrdir)/ruby/internal/attr/noreturn.h +empty.o: $(hdrdir)/ruby/internal/attr/packed_struct.h empty.o: $(hdrdir)/ruby/internal/attr/pure.h empty.o: $(hdrdir)/ruby/internal/attr/restrict.h empty.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ empty.o: $(hdrdir)/ruby/internal/intern/enumerator.h empty.o: $(hdrdir)/ruby/internal/intern/error.h empty.o: $(hdrdir)/ruby/internal/intern/eval.h empty.o: $(hdrdir)/ruby/internal/intern/file.h -empty.o: $(hdrdir)/ruby/internal/intern/gc.h empty.o: $(hdrdir)/ruby/internal/intern/hash.h empty.o: $(hdrdir)/ruby/internal/intern/io.h empty.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ empty.o: $(hdrdir)/ruby/internal/memory.h empty.o: $(hdrdir)/ruby/internal/method.h empty.o: $(hdrdir)/ruby/internal/module.h empty.o: $(hdrdir)/ruby/internal/newobj.h -empty.o: $(hdrdir)/ruby/internal/rgengc.h empty.o: $(hdrdir)/ruby/internal/scan_args.h empty.o: $(hdrdir)/ruby/internal/special_consts.h empty.o: $(hdrdir)/ruby/internal/static_assert.h empty.o: $(hdrdir)/ruby/internal/stdalign.h empty.o: $(hdrdir)/ruby/internal/stdbool.h +empty.o: $(hdrdir)/ruby/internal/stdckdint.h empty.o: $(hdrdir)/ruby/internal/symbol.h empty.o: $(hdrdir)/ruby/internal/value.h empty.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/enumerator_kw/depend b/ext/-test-/enumerator_kw/depend index 14a9557e41..85daa55b53 100644 --- a/ext/-test-/enumerator_kw/depend +++ b/ext/-test-/enumerator_kw/depend @@ -52,6 +52,7 @@ enumerator_kw.o: $(hdrdir)/ruby/internal/attr/noexcept.h enumerator_kw.o: $(hdrdir)/ruby/internal/attr/noinline.h enumerator_kw.o: $(hdrdir)/ruby/internal/attr/nonnull.h enumerator_kw.o: $(hdrdir)/ruby/internal/attr/noreturn.h +enumerator_kw.o: $(hdrdir)/ruby/internal/attr/packed_struct.h enumerator_kw.o: $(hdrdir)/ruby/internal/attr/pure.h enumerator_kw.o: $(hdrdir)/ruby/internal/attr/restrict.h enumerator_kw.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ enumerator_kw.o: $(hdrdir)/ruby/internal/intern/enumerator.h enumerator_kw.o: $(hdrdir)/ruby/internal/intern/error.h enumerator_kw.o: $(hdrdir)/ruby/internal/intern/eval.h enumerator_kw.o: $(hdrdir)/ruby/internal/intern/file.h -enumerator_kw.o: $(hdrdir)/ruby/internal/intern/gc.h enumerator_kw.o: $(hdrdir)/ruby/internal/intern/hash.h enumerator_kw.o: $(hdrdir)/ruby/internal/intern/io.h enumerator_kw.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ enumerator_kw.o: $(hdrdir)/ruby/internal/memory.h enumerator_kw.o: $(hdrdir)/ruby/internal/method.h enumerator_kw.o: $(hdrdir)/ruby/internal/module.h enumerator_kw.o: $(hdrdir)/ruby/internal/newobj.h -enumerator_kw.o: $(hdrdir)/ruby/internal/rgengc.h enumerator_kw.o: $(hdrdir)/ruby/internal/scan_args.h enumerator_kw.o: $(hdrdir)/ruby/internal/special_consts.h enumerator_kw.o: $(hdrdir)/ruby/internal/static_assert.h enumerator_kw.o: $(hdrdir)/ruby/internal/stdalign.h enumerator_kw.o: $(hdrdir)/ruby/internal/stdbool.h +enumerator_kw.o: $(hdrdir)/ruby/internal/stdckdint.h enumerator_kw.o: $(hdrdir)/ruby/internal/symbol.h enumerator_kw.o: $(hdrdir)/ruby/internal/value.h enumerator_kw.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/exception/depend b/ext/-test-/exception/depend index e00f0b279d..7a0544b1e1 100644 --- a/ext/-test-/exception/depend +++ b/ext/-test-/exception/depend @@ -51,6 +51,7 @@ dataerror.o: $(hdrdir)/ruby/internal/attr/noexcept.h dataerror.o: $(hdrdir)/ruby/internal/attr/noinline.h dataerror.o: $(hdrdir)/ruby/internal/attr/nonnull.h dataerror.o: $(hdrdir)/ruby/internal/attr/noreturn.h +dataerror.o: $(hdrdir)/ruby/internal/attr/packed_struct.h dataerror.o: $(hdrdir)/ruby/internal/attr/pure.h dataerror.o: $(hdrdir)/ruby/internal/attr/restrict.h dataerror.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ dataerror.o: $(hdrdir)/ruby/internal/intern/enumerator.h dataerror.o: $(hdrdir)/ruby/internal/intern/error.h dataerror.o: $(hdrdir)/ruby/internal/intern/eval.h dataerror.o: $(hdrdir)/ruby/internal/intern/file.h -dataerror.o: $(hdrdir)/ruby/internal/intern/gc.h dataerror.o: $(hdrdir)/ruby/internal/intern/hash.h dataerror.o: $(hdrdir)/ruby/internal/intern/io.h dataerror.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ dataerror.o: $(hdrdir)/ruby/internal/memory.h dataerror.o: $(hdrdir)/ruby/internal/method.h dataerror.o: $(hdrdir)/ruby/internal/module.h dataerror.o: $(hdrdir)/ruby/internal/newobj.h -dataerror.o: $(hdrdir)/ruby/internal/rgengc.h dataerror.o: $(hdrdir)/ruby/internal/scan_args.h dataerror.o: $(hdrdir)/ruby/internal/special_consts.h dataerror.o: $(hdrdir)/ruby/internal/static_assert.h dataerror.o: $(hdrdir)/ruby/internal/stdalign.h dataerror.o: $(hdrdir)/ruby/internal/stdbool.h +dataerror.o: $(hdrdir)/ruby/internal/stdckdint.h dataerror.o: $(hdrdir)/ruby/internal/symbol.h dataerror.o: $(hdrdir)/ruby/internal/value.h dataerror.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ enc_raise.o: $(hdrdir)/ruby/internal/attr/noexcept.h enc_raise.o: $(hdrdir)/ruby/internal/attr/noinline.h enc_raise.o: $(hdrdir)/ruby/internal/attr/nonnull.h enc_raise.o: $(hdrdir)/ruby/internal/attr/noreturn.h +enc_raise.o: $(hdrdir)/ruby/internal/attr/packed_struct.h enc_raise.o: $(hdrdir)/ruby/internal/attr/pure.h enc_raise.o: $(hdrdir)/ruby/internal/attr/restrict.h enc_raise.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -280,7 +281,6 @@ enc_raise.o: $(hdrdir)/ruby/internal/intern/enumerator.h enc_raise.o: $(hdrdir)/ruby/internal/intern/error.h enc_raise.o: $(hdrdir)/ruby/internal/intern/eval.h enc_raise.o: $(hdrdir)/ruby/internal/intern/file.h -enc_raise.o: $(hdrdir)/ruby/internal/intern/gc.h enc_raise.o: $(hdrdir)/ruby/internal/intern/hash.h enc_raise.o: $(hdrdir)/ruby/internal/intern/io.h enc_raise.o: $(hdrdir)/ruby/internal/intern/load.h @@ -311,12 +311,12 @@ enc_raise.o: $(hdrdir)/ruby/internal/memory.h enc_raise.o: $(hdrdir)/ruby/internal/method.h enc_raise.o: $(hdrdir)/ruby/internal/module.h enc_raise.o: $(hdrdir)/ruby/internal/newobj.h -enc_raise.o: $(hdrdir)/ruby/internal/rgengc.h enc_raise.o: $(hdrdir)/ruby/internal/scan_args.h enc_raise.o: $(hdrdir)/ruby/internal/special_consts.h enc_raise.o: $(hdrdir)/ruby/internal/static_assert.h enc_raise.o: $(hdrdir)/ruby/internal/stdalign.h enc_raise.o: $(hdrdir)/ruby/internal/stdbool.h +enc_raise.o: $(hdrdir)/ruby/internal/stdckdint.h enc_raise.o: $(hdrdir)/ruby/internal/symbol.h enc_raise.o: $(hdrdir)/ruby/internal/value.h enc_raise.o: $(hdrdir)/ruby/internal/value_type.h @@ -383,6 +383,7 @@ ensured.o: $(hdrdir)/ruby/internal/attr/noexcept.h ensured.o: $(hdrdir)/ruby/internal/attr/noinline.h ensured.o: $(hdrdir)/ruby/internal/attr/nonnull.h ensured.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ensured.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ensured.o: $(hdrdir)/ruby/internal/attr/pure.h ensured.o: $(hdrdir)/ruby/internal/attr/restrict.h ensured.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -442,7 +443,6 @@ ensured.o: $(hdrdir)/ruby/internal/intern/enumerator.h ensured.o: $(hdrdir)/ruby/internal/intern/error.h ensured.o: $(hdrdir)/ruby/internal/intern/eval.h ensured.o: $(hdrdir)/ruby/internal/intern/file.h -ensured.o: $(hdrdir)/ruby/internal/intern/gc.h ensured.o: $(hdrdir)/ruby/internal/intern/hash.h ensured.o: $(hdrdir)/ruby/internal/intern/io.h ensured.o: $(hdrdir)/ruby/internal/intern/load.h @@ -473,12 +473,12 @@ ensured.o: $(hdrdir)/ruby/internal/memory.h ensured.o: $(hdrdir)/ruby/internal/method.h ensured.o: $(hdrdir)/ruby/internal/module.h ensured.o: $(hdrdir)/ruby/internal/newobj.h -ensured.o: $(hdrdir)/ruby/internal/rgengc.h ensured.o: $(hdrdir)/ruby/internal/scan_args.h ensured.o: $(hdrdir)/ruby/internal/special_consts.h ensured.o: $(hdrdir)/ruby/internal/static_assert.h ensured.o: $(hdrdir)/ruby/internal/stdalign.h ensured.o: $(hdrdir)/ruby/internal/stdbool.h +ensured.o: $(hdrdir)/ruby/internal/stdckdint.h ensured.o: $(hdrdir)/ruby/internal/symbol.h ensured.o: $(hdrdir)/ruby/internal/value.h ensured.o: $(hdrdir)/ruby/internal/value_type.h @@ -543,6 +543,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -602,7 +603,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -633,12 +633,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/fatal/depend b/ext/-test-/fatal/depend index 5b1adb6607..36b0ad4205 100644 --- a/ext/-test-/fatal/depend +++ b/ext/-test-/fatal/depend @@ -1,4 +1,325 @@ # AUTOGENERATED DEPENDENCIES START + +init.o: $(RUBY_EXTCONF_H) +init.o: $(arch_hdrdir)/ruby/config.h +init.o: $(hdrdir)/ruby.h +init.o: $(hdrdir)/ruby/assert.h +init.o: $(hdrdir)/ruby/backward.h +init.o: $(hdrdir)/ruby/backward/2/assume.h +init.o: $(hdrdir)/ruby/backward/2/attributes.h +init.o: $(hdrdir)/ruby/backward/2/bool.h +init.o: $(hdrdir)/ruby/backward/2/inttypes.h +init.o: $(hdrdir)/ruby/backward/2/limits.h +init.o: $(hdrdir)/ruby/backward/2/long_long.h +init.o: $(hdrdir)/ruby/backward/2/stdalign.h +init.o: $(hdrdir)/ruby/backward/2/stdarg.h +init.o: $(hdrdir)/ruby/defines.h +init.o: $(hdrdir)/ruby/intern.h +init.o: $(hdrdir)/ruby/internal/abi.h +init.o: $(hdrdir)/ruby/internal/anyargs.h +init.o: $(hdrdir)/ruby/internal/arithmetic.h +init.o: $(hdrdir)/ruby/internal/arithmetic/char.h +init.o: $(hdrdir)/ruby/internal/arithmetic/double.h +init.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +init.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +init.o: $(hdrdir)/ruby/internal/arithmetic/int.h +init.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +init.o: $(hdrdir)/ruby/internal/arithmetic/long.h +init.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +init.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +init.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +init.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +init.o: $(hdrdir)/ruby/internal/arithmetic/short.h +init.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +init.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +init.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +init.o: $(hdrdir)/ruby/internal/assume.h +init.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +init.o: $(hdrdir)/ruby/internal/attr/artificial.h +init.o: $(hdrdir)/ruby/internal/attr/cold.h +init.o: $(hdrdir)/ruby/internal/attr/const.h +init.o: $(hdrdir)/ruby/internal/attr/constexpr.h +init.o: $(hdrdir)/ruby/internal/attr/deprecated.h +init.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +init.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +init.o: $(hdrdir)/ruby/internal/attr/error.h +init.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +init.o: $(hdrdir)/ruby/internal/attr/forceinline.h +init.o: $(hdrdir)/ruby/internal/attr/format.h +init.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +init.o: $(hdrdir)/ruby/internal/attr/noalias.h +init.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +init.o: $(hdrdir)/ruby/internal/attr/noexcept.h +init.o: $(hdrdir)/ruby/internal/attr/noinline.h +init.o: $(hdrdir)/ruby/internal/attr/nonnull.h +init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +init.o: $(hdrdir)/ruby/internal/attr/pure.h +init.o: $(hdrdir)/ruby/internal/attr/restrict.h +init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +init.o: $(hdrdir)/ruby/internal/attr/warning.h +init.o: $(hdrdir)/ruby/internal/attr/weakref.h +init.o: $(hdrdir)/ruby/internal/cast.h +init.o: $(hdrdir)/ruby/internal/compiler_is.h +init.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +init.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +init.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +init.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +init.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +init.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +init.o: $(hdrdir)/ruby/internal/compiler_since.h +init.o: $(hdrdir)/ruby/internal/config.h +init.o: $(hdrdir)/ruby/internal/constant_p.h +init.o: $(hdrdir)/ruby/internal/core.h +init.o: $(hdrdir)/ruby/internal/core/rarray.h +init.o: $(hdrdir)/ruby/internal/core/rbasic.h +init.o: $(hdrdir)/ruby/internal/core/rbignum.h +init.o: $(hdrdir)/ruby/internal/core/rclass.h +init.o: $(hdrdir)/ruby/internal/core/rdata.h +init.o: $(hdrdir)/ruby/internal/core/rfile.h +init.o: $(hdrdir)/ruby/internal/core/rhash.h +init.o: $(hdrdir)/ruby/internal/core/robject.h +init.o: $(hdrdir)/ruby/internal/core/rregexp.h +init.o: $(hdrdir)/ruby/internal/core/rstring.h +init.o: $(hdrdir)/ruby/internal/core/rstruct.h +init.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +init.o: $(hdrdir)/ruby/internal/ctype.h +init.o: $(hdrdir)/ruby/internal/dllexport.h +init.o: $(hdrdir)/ruby/internal/dosish.h +init.o: $(hdrdir)/ruby/internal/error.h +init.o: $(hdrdir)/ruby/internal/eval.h +init.o: $(hdrdir)/ruby/internal/event.h +init.o: $(hdrdir)/ruby/internal/fl_type.h +init.o: $(hdrdir)/ruby/internal/gc.h +init.o: $(hdrdir)/ruby/internal/glob.h +init.o: $(hdrdir)/ruby/internal/globals.h +init.o: $(hdrdir)/ruby/internal/has/attribute.h +init.o: $(hdrdir)/ruby/internal/has/builtin.h +init.o: $(hdrdir)/ruby/internal/has/c_attribute.h +init.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +init.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +init.o: $(hdrdir)/ruby/internal/has/extension.h +init.o: $(hdrdir)/ruby/internal/has/feature.h +init.o: $(hdrdir)/ruby/internal/has/warning.h +init.o: $(hdrdir)/ruby/internal/intern/array.h +init.o: $(hdrdir)/ruby/internal/intern/bignum.h +init.o: $(hdrdir)/ruby/internal/intern/class.h +init.o: $(hdrdir)/ruby/internal/intern/compar.h +init.o: $(hdrdir)/ruby/internal/intern/complex.h +init.o: $(hdrdir)/ruby/internal/intern/cont.h +init.o: $(hdrdir)/ruby/internal/intern/dir.h +init.o: $(hdrdir)/ruby/internal/intern/enum.h +init.o: $(hdrdir)/ruby/internal/intern/enumerator.h +init.o: $(hdrdir)/ruby/internal/intern/error.h +init.o: $(hdrdir)/ruby/internal/intern/eval.h +init.o: $(hdrdir)/ruby/internal/intern/file.h +init.o: $(hdrdir)/ruby/internal/intern/hash.h +init.o: $(hdrdir)/ruby/internal/intern/io.h +init.o: $(hdrdir)/ruby/internal/intern/load.h +init.o: $(hdrdir)/ruby/internal/intern/marshal.h +init.o: $(hdrdir)/ruby/internal/intern/numeric.h +init.o: $(hdrdir)/ruby/internal/intern/object.h +init.o: $(hdrdir)/ruby/internal/intern/parse.h +init.o: $(hdrdir)/ruby/internal/intern/proc.h +init.o: $(hdrdir)/ruby/internal/intern/process.h +init.o: $(hdrdir)/ruby/internal/intern/random.h +init.o: $(hdrdir)/ruby/internal/intern/range.h +init.o: $(hdrdir)/ruby/internal/intern/rational.h +init.o: $(hdrdir)/ruby/internal/intern/re.h +init.o: $(hdrdir)/ruby/internal/intern/ruby.h +init.o: $(hdrdir)/ruby/internal/intern/select.h +init.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +init.o: $(hdrdir)/ruby/internal/intern/signal.h +init.o: $(hdrdir)/ruby/internal/intern/sprintf.h +init.o: $(hdrdir)/ruby/internal/intern/string.h +init.o: $(hdrdir)/ruby/internal/intern/struct.h +init.o: $(hdrdir)/ruby/internal/intern/thread.h +init.o: $(hdrdir)/ruby/internal/intern/time.h +init.o: $(hdrdir)/ruby/internal/intern/variable.h +init.o: $(hdrdir)/ruby/internal/intern/vm.h +init.o: $(hdrdir)/ruby/internal/interpreter.h +init.o: $(hdrdir)/ruby/internal/iterator.h +init.o: $(hdrdir)/ruby/internal/memory.h +init.o: $(hdrdir)/ruby/internal/method.h +init.o: $(hdrdir)/ruby/internal/module.h +init.o: $(hdrdir)/ruby/internal/newobj.h +init.o: $(hdrdir)/ruby/internal/scan_args.h +init.o: $(hdrdir)/ruby/internal/special_consts.h +init.o: $(hdrdir)/ruby/internal/static_assert.h +init.o: $(hdrdir)/ruby/internal/stdalign.h +init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h +init.o: $(hdrdir)/ruby/internal/symbol.h +init.o: $(hdrdir)/ruby/internal/value.h +init.o: $(hdrdir)/ruby/internal/value_type.h +init.o: $(hdrdir)/ruby/internal/variable.h +init.o: $(hdrdir)/ruby/internal/warning_push.h +init.o: $(hdrdir)/ruby/internal/xmalloc.h +init.o: $(hdrdir)/ruby/missing.h +init.o: $(hdrdir)/ruby/ruby.h +init.o: $(hdrdir)/ruby/st.h +init.o: $(hdrdir)/ruby/subst.h +init.o: init.c +invalid.o: $(RUBY_EXTCONF_H) +invalid.o: $(arch_hdrdir)/ruby/config.h +invalid.o: $(hdrdir)/ruby.h +invalid.o: $(hdrdir)/ruby/assert.h +invalid.o: $(hdrdir)/ruby/backward.h +invalid.o: $(hdrdir)/ruby/backward/2/assume.h +invalid.o: $(hdrdir)/ruby/backward/2/attributes.h +invalid.o: $(hdrdir)/ruby/backward/2/bool.h +invalid.o: $(hdrdir)/ruby/backward/2/inttypes.h +invalid.o: $(hdrdir)/ruby/backward/2/limits.h +invalid.o: $(hdrdir)/ruby/backward/2/long_long.h +invalid.o: $(hdrdir)/ruby/backward/2/stdalign.h +invalid.o: $(hdrdir)/ruby/backward/2/stdarg.h +invalid.o: $(hdrdir)/ruby/defines.h +invalid.o: $(hdrdir)/ruby/intern.h +invalid.o: $(hdrdir)/ruby/internal/abi.h +invalid.o: $(hdrdir)/ruby/internal/anyargs.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/char.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/double.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/int.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/long.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/short.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +invalid.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +invalid.o: $(hdrdir)/ruby/internal/assume.h +invalid.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +invalid.o: $(hdrdir)/ruby/internal/attr/artificial.h +invalid.o: $(hdrdir)/ruby/internal/attr/cold.h +invalid.o: $(hdrdir)/ruby/internal/attr/const.h +invalid.o: $(hdrdir)/ruby/internal/attr/constexpr.h +invalid.o: $(hdrdir)/ruby/internal/attr/deprecated.h +invalid.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +invalid.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +invalid.o: $(hdrdir)/ruby/internal/attr/error.h +invalid.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +invalid.o: $(hdrdir)/ruby/internal/attr/forceinline.h +invalid.o: $(hdrdir)/ruby/internal/attr/format.h +invalid.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +invalid.o: $(hdrdir)/ruby/internal/attr/noalias.h +invalid.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +invalid.o: $(hdrdir)/ruby/internal/attr/noexcept.h +invalid.o: $(hdrdir)/ruby/internal/attr/noinline.h +invalid.o: $(hdrdir)/ruby/internal/attr/nonnull.h +invalid.o: $(hdrdir)/ruby/internal/attr/noreturn.h +invalid.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +invalid.o: $(hdrdir)/ruby/internal/attr/pure.h +invalid.o: $(hdrdir)/ruby/internal/attr/restrict.h +invalid.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +invalid.o: $(hdrdir)/ruby/internal/attr/warning.h +invalid.o: $(hdrdir)/ruby/internal/attr/weakref.h +invalid.o: $(hdrdir)/ruby/internal/cast.h +invalid.o: $(hdrdir)/ruby/internal/compiler_is.h +invalid.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +invalid.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +invalid.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +invalid.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +invalid.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +invalid.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +invalid.o: $(hdrdir)/ruby/internal/compiler_since.h +invalid.o: $(hdrdir)/ruby/internal/config.h +invalid.o: $(hdrdir)/ruby/internal/constant_p.h +invalid.o: $(hdrdir)/ruby/internal/core.h +invalid.o: $(hdrdir)/ruby/internal/core/rarray.h +invalid.o: $(hdrdir)/ruby/internal/core/rbasic.h +invalid.o: $(hdrdir)/ruby/internal/core/rbignum.h +invalid.o: $(hdrdir)/ruby/internal/core/rclass.h +invalid.o: $(hdrdir)/ruby/internal/core/rdata.h +invalid.o: $(hdrdir)/ruby/internal/core/rfile.h +invalid.o: $(hdrdir)/ruby/internal/core/rhash.h +invalid.o: $(hdrdir)/ruby/internal/core/robject.h +invalid.o: $(hdrdir)/ruby/internal/core/rregexp.h +invalid.o: $(hdrdir)/ruby/internal/core/rstring.h +invalid.o: $(hdrdir)/ruby/internal/core/rstruct.h +invalid.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +invalid.o: $(hdrdir)/ruby/internal/ctype.h +invalid.o: $(hdrdir)/ruby/internal/dllexport.h +invalid.o: $(hdrdir)/ruby/internal/dosish.h +invalid.o: $(hdrdir)/ruby/internal/error.h +invalid.o: $(hdrdir)/ruby/internal/eval.h +invalid.o: $(hdrdir)/ruby/internal/event.h +invalid.o: $(hdrdir)/ruby/internal/fl_type.h +invalid.o: $(hdrdir)/ruby/internal/gc.h +invalid.o: $(hdrdir)/ruby/internal/glob.h +invalid.o: $(hdrdir)/ruby/internal/globals.h +invalid.o: $(hdrdir)/ruby/internal/has/attribute.h +invalid.o: $(hdrdir)/ruby/internal/has/builtin.h +invalid.o: $(hdrdir)/ruby/internal/has/c_attribute.h +invalid.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +invalid.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +invalid.o: $(hdrdir)/ruby/internal/has/extension.h +invalid.o: $(hdrdir)/ruby/internal/has/feature.h +invalid.o: $(hdrdir)/ruby/internal/has/warning.h +invalid.o: $(hdrdir)/ruby/internal/intern/array.h +invalid.o: $(hdrdir)/ruby/internal/intern/bignum.h +invalid.o: $(hdrdir)/ruby/internal/intern/class.h +invalid.o: $(hdrdir)/ruby/internal/intern/compar.h +invalid.o: $(hdrdir)/ruby/internal/intern/complex.h +invalid.o: $(hdrdir)/ruby/internal/intern/cont.h +invalid.o: $(hdrdir)/ruby/internal/intern/dir.h +invalid.o: $(hdrdir)/ruby/internal/intern/enum.h +invalid.o: $(hdrdir)/ruby/internal/intern/enumerator.h +invalid.o: $(hdrdir)/ruby/internal/intern/error.h +invalid.o: $(hdrdir)/ruby/internal/intern/eval.h +invalid.o: $(hdrdir)/ruby/internal/intern/file.h +invalid.o: $(hdrdir)/ruby/internal/intern/hash.h +invalid.o: $(hdrdir)/ruby/internal/intern/io.h +invalid.o: $(hdrdir)/ruby/internal/intern/load.h +invalid.o: $(hdrdir)/ruby/internal/intern/marshal.h +invalid.o: $(hdrdir)/ruby/internal/intern/numeric.h +invalid.o: $(hdrdir)/ruby/internal/intern/object.h +invalid.o: $(hdrdir)/ruby/internal/intern/parse.h +invalid.o: $(hdrdir)/ruby/internal/intern/proc.h +invalid.o: $(hdrdir)/ruby/internal/intern/process.h +invalid.o: $(hdrdir)/ruby/internal/intern/random.h +invalid.o: $(hdrdir)/ruby/internal/intern/range.h +invalid.o: $(hdrdir)/ruby/internal/intern/rational.h +invalid.o: $(hdrdir)/ruby/internal/intern/re.h +invalid.o: $(hdrdir)/ruby/internal/intern/ruby.h +invalid.o: $(hdrdir)/ruby/internal/intern/select.h +invalid.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +invalid.o: $(hdrdir)/ruby/internal/intern/signal.h +invalid.o: $(hdrdir)/ruby/internal/intern/sprintf.h +invalid.o: $(hdrdir)/ruby/internal/intern/string.h +invalid.o: $(hdrdir)/ruby/internal/intern/struct.h +invalid.o: $(hdrdir)/ruby/internal/intern/thread.h +invalid.o: $(hdrdir)/ruby/internal/intern/time.h +invalid.o: $(hdrdir)/ruby/internal/intern/variable.h +invalid.o: $(hdrdir)/ruby/internal/intern/vm.h +invalid.o: $(hdrdir)/ruby/internal/interpreter.h +invalid.o: $(hdrdir)/ruby/internal/iterator.h +invalid.o: $(hdrdir)/ruby/internal/memory.h +invalid.o: $(hdrdir)/ruby/internal/method.h +invalid.o: $(hdrdir)/ruby/internal/module.h +invalid.o: $(hdrdir)/ruby/internal/newobj.h +invalid.o: $(hdrdir)/ruby/internal/scan_args.h +invalid.o: $(hdrdir)/ruby/internal/special_consts.h +invalid.o: $(hdrdir)/ruby/internal/static_assert.h +invalid.o: $(hdrdir)/ruby/internal/stdalign.h +invalid.o: $(hdrdir)/ruby/internal/stdbool.h +invalid.o: $(hdrdir)/ruby/internal/stdckdint.h +invalid.o: $(hdrdir)/ruby/internal/symbol.h +invalid.o: $(hdrdir)/ruby/internal/value.h +invalid.o: $(hdrdir)/ruby/internal/value_type.h +invalid.o: $(hdrdir)/ruby/internal/variable.h +invalid.o: $(hdrdir)/ruby/internal/warning_push.h +invalid.o: $(hdrdir)/ruby/internal/xmalloc.h +invalid.o: $(hdrdir)/ruby/missing.h +invalid.o: $(hdrdir)/ruby/ruby.h +invalid.o: $(hdrdir)/ruby/st.h +invalid.o: $(hdrdir)/ruby/subst.h +invalid.o: invalid.c rb_fatal.o: $(RUBY_EXTCONF_H) rb_fatal.o: $(arch_hdrdir)/ruby/config.h rb_fatal.o: $(hdrdir)/ruby.h @@ -52,6 +373,7 @@ rb_fatal.o: $(hdrdir)/ruby/internal/attr/noexcept.h rb_fatal.o: $(hdrdir)/ruby/internal/attr/noinline.h rb_fatal.o: $(hdrdir)/ruby/internal/attr/nonnull.h rb_fatal.o: $(hdrdir)/ruby/internal/attr/noreturn.h +rb_fatal.o: $(hdrdir)/ruby/internal/attr/packed_struct.h rb_fatal.o: $(hdrdir)/ruby/internal/attr/pure.h rb_fatal.o: $(hdrdir)/ruby/internal/attr/restrict.h rb_fatal.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +433,6 @@ rb_fatal.o: $(hdrdir)/ruby/internal/intern/enumerator.h rb_fatal.o: $(hdrdir)/ruby/internal/intern/error.h rb_fatal.o: $(hdrdir)/ruby/internal/intern/eval.h rb_fatal.o: $(hdrdir)/ruby/internal/intern/file.h -rb_fatal.o: $(hdrdir)/ruby/internal/intern/gc.h rb_fatal.o: $(hdrdir)/ruby/internal/intern/hash.h rb_fatal.o: $(hdrdir)/ruby/internal/intern/io.h rb_fatal.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +463,12 @@ rb_fatal.o: $(hdrdir)/ruby/internal/memory.h rb_fatal.o: $(hdrdir)/ruby/internal/method.h rb_fatal.o: $(hdrdir)/ruby/internal/module.h rb_fatal.o: $(hdrdir)/ruby/internal/newobj.h -rb_fatal.o: $(hdrdir)/ruby/internal/rgengc.h rb_fatal.o: $(hdrdir)/ruby/internal/scan_args.h rb_fatal.o: $(hdrdir)/ruby/internal/special_consts.h rb_fatal.o: $(hdrdir)/ruby/internal/static_assert.h rb_fatal.o: $(hdrdir)/ruby/internal/stdalign.h rb_fatal.o: $(hdrdir)/ruby/internal/stdbool.h +rb_fatal.o: $(hdrdir)/ruby/internal/stdckdint.h rb_fatal.o: $(hdrdir)/ruby/internal/symbol.h rb_fatal.o: $(hdrdir)/ruby/internal/value.h rb_fatal.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/fatal/extconf.rb b/ext/-test-/fatal/extconf.rb index d5849c0733..ca51178a18 100644 --- a/ext/-test-/fatal/extconf.rb +++ b/ext/-test-/fatal/extconf.rb @@ -1,2 +1,3 @@ # frozen_string_literal: false -create_makefile("-test-/fatal/rb_fatal") +require_relative "../auto_ext.rb" +auto_ext diff --git a/ext/-test-/fatal/init.c b/ext/-test-/fatal/init.c new file mode 100644 index 0000000000..3b71708789 --- /dev/null +++ b/ext/-test-/fatal/init.c @@ -0,0 +1,10 @@ +#include "ruby.h" + +#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} + +void +Init_fatal(void) +{ + VALUE klass = rb_define_module("Bug"); + TEST_INIT_FUNCS(init); +} diff --git a/ext/-test-/fatal/invalid.c b/ext/-test-/fatal/invalid.c new file mode 100644 index 0000000000..f0726edb52 --- /dev/null +++ b/ext/-test-/fatal/invalid.c @@ -0,0 +1,28 @@ +#include <ruby.h> + +#if SIZEOF_LONG == SIZEOF_VOIDP +# define NUM2PTR(x) (void *)NUM2ULONG(x) +#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP +# define NUM2PTR(x) (void *)NUM2ULL(x) +#endif + +static VALUE +invalid_call(VALUE obj, VALUE address) +{ + typedef VALUE (*func_type)(VALUE); + + return (*(func_type)NUM2PTR(address))(obj); +} + +static VALUE +invalid_access(VALUE obj, VALUE address) +{ + return *(VALUE *)NUM2PTR(address) == obj ? Qtrue : Qfalse; +} + +void +Init_invalid(VALUE mBug) +{ + rb_define_singleton_method(mBug, "invalid_call", invalid_call, 1); + rb_define_singleton_method(mBug, "invalid_access", invalid_access, 1); +} diff --git a/ext/-test-/fatal/rb_fatal.c b/ext/-test-/fatal/rb_fatal.c index eedbc51f8b..6c7bb89628 100644 --- a/ext/-test-/fatal/rb_fatal.c +++ b/ext/-test-/fatal/rb_fatal.c @@ -13,8 +13,7 @@ ruby_fatal(VALUE obj, VALUE msg) } void -Init_rb_fatal(void) +Init_rb_fatal(VALUE mBug) { - VALUE mBug = rb_define_module("Bug"); rb_define_singleton_method(mBug, "rb_fatal", ruby_fatal, 1); } diff --git a/ext/-test-/file/depend b/ext/-test-/file/depend index f0fffc2485..e985f914b2 100644 --- a/ext/-test-/file/depend +++ b/ext/-test-/file/depend @@ -52,6 +52,7 @@ fs.o: $(hdrdir)/ruby/internal/attr/noexcept.h fs.o: $(hdrdir)/ruby/internal/attr/noinline.h fs.o: $(hdrdir)/ruby/internal/attr/nonnull.h fs.o: $(hdrdir)/ruby/internal/attr/noreturn.h +fs.o: $(hdrdir)/ruby/internal/attr/packed_struct.h fs.o: $(hdrdir)/ruby/internal/attr/pure.h fs.o: $(hdrdir)/ruby/internal/attr/restrict.h fs.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -120,7 +121,6 @@ fs.o: $(hdrdir)/ruby/internal/intern/enumerator.h fs.o: $(hdrdir)/ruby/internal/intern/error.h fs.o: $(hdrdir)/ruby/internal/intern/eval.h fs.o: $(hdrdir)/ruby/internal/intern/file.h -fs.o: $(hdrdir)/ruby/internal/intern/gc.h fs.o: $(hdrdir)/ruby/internal/intern/hash.h fs.o: $(hdrdir)/ruby/internal/intern/io.h fs.o: $(hdrdir)/ruby/internal/intern/load.h @@ -151,12 +151,12 @@ fs.o: $(hdrdir)/ruby/internal/memory.h fs.o: $(hdrdir)/ruby/internal/method.h fs.o: $(hdrdir)/ruby/internal/module.h fs.o: $(hdrdir)/ruby/internal/newobj.h -fs.o: $(hdrdir)/ruby/internal/rgengc.h fs.o: $(hdrdir)/ruby/internal/scan_args.h fs.o: $(hdrdir)/ruby/internal/special_consts.h fs.o: $(hdrdir)/ruby/internal/static_assert.h fs.o: $(hdrdir)/ruby/internal/stdalign.h fs.o: $(hdrdir)/ruby/internal/stdbool.h +fs.o: $(hdrdir)/ruby/internal/stdckdint.h fs.o: $(hdrdir)/ruby/internal/symbol.h fs.o: $(hdrdir)/ruby/internal/value.h fs.o: $(hdrdir)/ruby/internal/value_type.h @@ -224,6 +224,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -283,7 +284,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -314,12 +314,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -331,6 +331,178 @@ init.o: $(hdrdir)/ruby/ruby.h init.o: $(hdrdir)/ruby/st.h init.o: $(hdrdir)/ruby/subst.h init.o: init.c +newline_conv.o: $(RUBY_EXTCONF_H) +newline_conv.o: $(arch_hdrdir)/ruby/config.h +newline_conv.o: $(hdrdir)/ruby/assert.h +newline_conv.o: $(hdrdir)/ruby/backward.h +newline_conv.o: $(hdrdir)/ruby/backward/2/assume.h +newline_conv.o: $(hdrdir)/ruby/backward/2/attributes.h +newline_conv.o: $(hdrdir)/ruby/backward/2/bool.h +newline_conv.o: $(hdrdir)/ruby/backward/2/inttypes.h +newline_conv.o: $(hdrdir)/ruby/backward/2/limits.h +newline_conv.o: $(hdrdir)/ruby/backward/2/long_long.h +newline_conv.o: $(hdrdir)/ruby/backward/2/stdalign.h +newline_conv.o: $(hdrdir)/ruby/backward/2/stdarg.h +newline_conv.o: $(hdrdir)/ruby/defines.h +newline_conv.o: $(hdrdir)/ruby/encoding.h +newline_conv.o: $(hdrdir)/ruby/intern.h +newline_conv.o: $(hdrdir)/ruby/internal/abi.h +newline_conv.o: $(hdrdir)/ruby/internal/anyargs.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/char.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/double.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/int.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/long.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/short.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +newline_conv.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +newline_conv.o: $(hdrdir)/ruby/internal/assume.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/artificial.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/cold.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/const.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/constexpr.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/deprecated.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/error.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/forceinline.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/format.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/noalias.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/noexcept.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/noinline.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/nonnull.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/noreturn.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/pure.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/restrict.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/warning.h +newline_conv.o: $(hdrdir)/ruby/internal/attr/weakref.h +newline_conv.o: $(hdrdir)/ruby/internal/cast.h +newline_conv.o: $(hdrdir)/ruby/internal/compiler_is.h +newline_conv.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +newline_conv.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +newline_conv.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +newline_conv.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +newline_conv.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +newline_conv.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +newline_conv.o: $(hdrdir)/ruby/internal/compiler_since.h +newline_conv.o: $(hdrdir)/ruby/internal/config.h +newline_conv.o: $(hdrdir)/ruby/internal/constant_p.h +newline_conv.o: $(hdrdir)/ruby/internal/core.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rarray.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rbasic.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rbignum.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rclass.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rdata.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rfile.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rhash.h +newline_conv.o: $(hdrdir)/ruby/internal/core/robject.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rregexp.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rstring.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rstruct.h +newline_conv.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +newline_conv.o: $(hdrdir)/ruby/internal/ctype.h +newline_conv.o: $(hdrdir)/ruby/internal/dllexport.h +newline_conv.o: $(hdrdir)/ruby/internal/dosish.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/coderange.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/ctype.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/encoding.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/pathname.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/re.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/sprintf.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/string.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/symbol.h +newline_conv.o: $(hdrdir)/ruby/internal/encoding/transcode.h +newline_conv.o: $(hdrdir)/ruby/internal/error.h +newline_conv.o: $(hdrdir)/ruby/internal/eval.h +newline_conv.o: $(hdrdir)/ruby/internal/event.h +newline_conv.o: $(hdrdir)/ruby/internal/fl_type.h +newline_conv.o: $(hdrdir)/ruby/internal/gc.h +newline_conv.o: $(hdrdir)/ruby/internal/glob.h +newline_conv.o: $(hdrdir)/ruby/internal/globals.h +newline_conv.o: $(hdrdir)/ruby/internal/has/attribute.h +newline_conv.o: $(hdrdir)/ruby/internal/has/builtin.h +newline_conv.o: $(hdrdir)/ruby/internal/has/c_attribute.h +newline_conv.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +newline_conv.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +newline_conv.o: $(hdrdir)/ruby/internal/has/extension.h +newline_conv.o: $(hdrdir)/ruby/internal/has/feature.h +newline_conv.o: $(hdrdir)/ruby/internal/has/warning.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/array.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/bignum.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/class.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/compar.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/complex.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/cont.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/dir.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/enum.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/enumerator.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/error.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/eval.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/file.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/hash.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/io.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/load.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/marshal.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/numeric.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/object.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/parse.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/proc.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/process.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/random.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/range.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/rational.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/re.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/ruby.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/select.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/signal.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/sprintf.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/string.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/struct.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/thread.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/time.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/variable.h +newline_conv.o: $(hdrdir)/ruby/internal/intern/vm.h +newline_conv.o: $(hdrdir)/ruby/internal/interpreter.h +newline_conv.o: $(hdrdir)/ruby/internal/iterator.h +newline_conv.o: $(hdrdir)/ruby/internal/memory.h +newline_conv.o: $(hdrdir)/ruby/internal/method.h +newline_conv.o: $(hdrdir)/ruby/internal/module.h +newline_conv.o: $(hdrdir)/ruby/internal/newobj.h +newline_conv.o: $(hdrdir)/ruby/internal/scan_args.h +newline_conv.o: $(hdrdir)/ruby/internal/special_consts.h +newline_conv.o: $(hdrdir)/ruby/internal/static_assert.h +newline_conv.o: $(hdrdir)/ruby/internal/stdalign.h +newline_conv.o: $(hdrdir)/ruby/internal/stdbool.h +newline_conv.o: $(hdrdir)/ruby/internal/stdckdint.h +newline_conv.o: $(hdrdir)/ruby/internal/symbol.h +newline_conv.o: $(hdrdir)/ruby/internal/value.h +newline_conv.o: $(hdrdir)/ruby/internal/value_type.h +newline_conv.o: $(hdrdir)/ruby/internal/variable.h +newline_conv.o: $(hdrdir)/ruby/internal/warning_push.h +newline_conv.o: $(hdrdir)/ruby/internal/xmalloc.h +newline_conv.o: $(hdrdir)/ruby/io.h +newline_conv.o: $(hdrdir)/ruby/missing.h +newline_conv.o: $(hdrdir)/ruby/onigmo.h +newline_conv.o: $(hdrdir)/ruby/oniguruma.h +newline_conv.o: $(hdrdir)/ruby/ruby.h +newline_conv.o: $(hdrdir)/ruby/st.h +newline_conv.o: $(hdrdir)/ruby/subst.h +newline_conv.o: newline_conv.c stat.o: $(RUBY_EXTCONF_H) stat.o: $(arch_hdrdir)/ruby/config.h stat.o: $(hdrdir)/ruby/assert.h @@ -384,6 +556,7 @@ stat.o: $(hdrdir)/ruby/internal/attr/noexcept.h stat.o: $(hdrdir)/ruby/internal/attr/noinline.h stat.o: $(hdrdir)/ruby/internal/attr/nonnull.h stat.o: $(hdrdir)/ruby/internal/attr/noreturn.h +stat.o: $(hdrdir)/ruby/internal/attr/packed_struct.h stat.o: $(hdrdir)/ruby/internal/attr/pure.h stat.o: $(hdrdir)/ruby/internal/attr/restrict.h stat.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -452,7 +625,6 @@ stat.o: $(hdrdir)/ruby/internal/intern/enumerator.h stat.o: $(hdrdir)/ruby/internal/intern/error.h stat.o: $(hdrdir)/ruby/internal/intern/eval.h stat.o: $(hdrdir)/ruby/internal/intern/file.h -stat.o: $(hdrdir)/ruby/internal/intern/gc.h stat.o: $(hdrdir)/ruby/internal/intern/hash.h stat.o: $(hdrdir)/ruby/internal/intern/io.h stat.o: $(hdrdir)/ruby/internal/intern/load.h @@ -483,12 +655,12 @@ stat.o: $(hdrdir)/ruby/internal/memory.h stat.o: $(hdrdir)/ruby/internal/method.h stat.o: $(hdrdir)/ruby/internal/module.h stat.o: $(hdrdir)/ruby/internal/newobj.h -stat.o: $(hdrdir)/ruby/internal/rgengc.h stat.o: $(hdrdir)/ruby/internal/scan_args.h stat.o: $(hdrdir)/ruby/internal/special_consts.h stat.o: $(hdrdir)/ruby/internal/static_assert.h stat.o: $(hdrdir)/ruby/internal/stdalign.h stat.o: $(hdrdir)/ruby/internal/stdbool.h +stat.o: $(hdrdir)/ruby/internal/stdckdint.h stat.o: $(hdrdir)/ruby/internal/symbol.h stat.o: $(hdrdir)/ruby/internal/value.h stat.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/file/newline_conv.c b/ext/-test-/file/newline_conv.c new file mode 100644 index 0000000000..2ac5aef801 --- /dev/null +++ b/ext/-test-/file/newline_conv.c @@ -0,0 +1,73 @@ +#include "ruby/ruby.h" +#include "ruby/io.h" +#include <fcntl.h> + +static VALUE +open_with_rb_file_open(VALUE self, VALUE filename, VALUE read_or_write, VALUE binary_or_text) +{ + char fmode[3] = { 0 }; + if (rb_sym2id(read_or_write) == rb_intern("read")) { + fmode[0] = 'r'; + } + else if (rb_sym2id(read_or_write) == rb_intern("write")) { + fmode[0] = 'w'; + } + else { + rb_raise(rb_eArgError, "read_or_write param must be :read or :write"); + } + + if (rb_sym2id(binary_or_text) == rb_intern("binary")) { + fmode[1] = 'b'; + } + else if (rb_sym2id(binary_or_text) == rb_intern("text")) { + + } + else { + rb_raise(rb_eArgError, "binary_or_text param must be :binary or :text"); + } + + return rb_file_open(StringValueCStr(filename), fmode); +} + +static VALUE +open_with_rb_io_fdopen(VALUE self, VALUE filename, VALUE read_or_write, VALUE binary_or_text) +{ + int omode = 0; + if (rb_sym2id(read_or_write) == rb_intern("read")) { + omode |= O_RDONLY; + } + else if (rb_sym2id(read_or_write) == rb_intern("write")) { + omode |= O_WRONLY; + } + else { + rb_raise(rb_eArgError, "read_or_write param must be :read or :write"); + } + + if (rb_sym2id(binary_or_text) == rb_intern("binary")) { +#ifdef O_BINARY + omode |= O_BINARY; +#endif + } + else if (rb_sym2id(binary_or_text) == rb_intern("text")) { + + } + else { + rb_raise(rb_eArgError, "binary_or_text param must be :binary or :text"); + } + + int fd = rb_cloexec_open(StringValueCStr(filename), omode, 0); + if (fd < 0) { + rb_raise(rb_eIOError, "failed to open the file"); + } + + rb_update_max_fd(fd); + return rb_io_fdopen(fd, omode, StringValueCStr(filename)); +} + +void +Init_newline_conv(VALUE module) +{ + VALUE newline_conv = rb_define_module_under(module, "NewlineConv"); + rb_define_module_function(newline_conv, "rb_file_open", open_with_rb_file_open, 3); + rb_define_module_function(newline_conv, "rb_io_fdopen", open_with_rb_io_fdopen, 3); +} diff --git a/ext/-test-/float/depend b/ext/-test-/float/depend index 9391a445a3..3e34818d5f 100644 --- a/ext/-test-/float/depend +++ b/ext/-test-/float/depend @@ -55,6 +55,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -114,7 +115,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -145,12 +145,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -215,6 +215,7 @@ nextafter.o: $(hdrdir)/ruby/internal/attr/noexcept.h nextafter.o: $(hdrdir)/ruby/internal/attr/noinline.h nextafter.o: $(hdrdir)/ruby/internal/attr/nonnull.h nextafter.o: $(hdrdir)/ruby/internal/attr/noreturn.h +nextafter.o: $(hdrdir)/ruby/internal/attr/packed_struct.h nextafter.o: $(hdrdir)/ruby/internal/attr/pure.h nextafter.o: $(hdrdir)/ruby/internal/attr/restrict.h nextafter.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -274,7 +275,6 @@ nextafter.o: $(hdrdir)/ruby/internal/intern/enumerator.h nextafter.o: $(hdrdir)/ruby/internal/intern/error.h nextafter.o: $(hdrdir)/ruby/internal/intern/eval.h nextafter.o: $(hdrdir)/ruby/internal/intern/file.h -nextafter.o: $(hdrdir)/ruby/internal/intern/gc.h nextafter.o: $(hdrdir)/ruby/internal/intern/hash.h nextafter.o: $(hdrdir)/ruby/internal/intern/io.h nextafter.o: $(hdrdir)/ruby/internal/intern/load.h @@ -305,12 +305,12 @@ nextafter.o: $(hdrdir)/ruby/internal/memory.h nextafter.o: $(hdrdir)/ruby/internal/method.h nextafter.o: $(hdrdir)/ruby/internal/module.h nextafter.o: $(hdrdir)/ruby/internal/newobj.h -nextafter.o: $(hdrdir)/ruby/internal/rgengc.h nextafter.o: $(hdrdir)/ruby/internal/scan_args.h nextafter.o: $(hdrdir)/ruby/internal/special_consts.h nextafter.o: $(hdrdir)/ruby/internal/static_assert.h nextafter.o: $(hdrdir)/ruby/internal/stdalign.h nextafter.o: $(hdrdir)/ruby/internal/stdbool.h +nextafter.o: $(hdrdir)/ruby/internal/stdckdint.h nextafter.o: $(hdrdir)/ruby/internal/symbol.h nextafter.o: $(hdrdir)/ruby/internal/value.h nextafter.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/funcall/depend b/ext/-test-/funcall/depend index 24e8c54bd9..a5a30873ac 100644 --- a/ext/-test-/funcall/depend +++ b/ext/-test-/funcall/depend @@ -52,6 +52,7 @@ funcall.o: $(hdrdir)/ruby/internal/attr/noexcept.h funcall.o: $(hdrdir)/ruby/internal/attr/noinline.h funcall.o: $(hdrdir)/ruby/internal/attr/nonnull.h funcall.o: $(hdrdir)/ruby/internal/attr/noreturn.h +funcall.o: $(hdrdir)/ruby/internal/attr/packed_struct.h funcall.o: $(hdrdir)/ruby/internal/attr/pure.h funcall.o: $(hdrdir)/ruby/internal/attr/restrict.h funcall.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ funcall.o: $(hdrdir)/ruby/internal/intern/enumerator.h funcall.o: $(hdrdir)/ruby/internal/intern/error.h funcall.o: $(hdrdir)/ruby/internal/intern/eval.h funcall.o: $(hdrdir)/ruby/internal/intern/file.h -funcall.o: $(hdrdir)/ruby/internal/intern/gc.h funcall.o: $(hdrdir)/ruby/internal/intern/hash.h funcall.o: $(hdrdir)/ruby/internal/intern/io.h funcall.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ funcall.o: $(hdrdir)/ruby/internal/memory.h funcall.o: $(hdrdir)/ruby/internal/method.h funcall.o: $(hdrdir)/ruby/internal/module.h funcall.o: $(hdrdir)/ruby/internal/newobj.h -funcall.o: $(hdrdir)/ruby/internal/rgengc.h funcall.o: $(hdrdir)/ruby/internal/scan_args.h funcall.o: $(hdrdir)/ruby/internal/special_consts.h funcall.o: $(hdrdir)/ruby/internal/static_assert.h funcall.o: $(hdrdir)/ruby/internal/stdalign.h funcall.o: $(hdrdir)/ruby/internal/stdbool.h +funcall.o: $(hdrdir)/ruby/internal/stdckdint.h funcall.o: $(hdrdir)/ruby/internal/symbol.h funcall.o: $(hdrdir)/ruby/internal/value.h funcall.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/gvl/call_without_gvl/depend b/ext/-test-/gvl/call_without_gvl/depend index cd184aa01c..6463d4527d 100644 --- a/ext/-test-/gvl/call_without_gvl/depend +++ b/ext/-test-/gvl/call_without_gvl/depend @@ -51,6 +51,7 @@ call_without_gvl.o: $(hdrdir)/ruby/internal/attr/noexcept.h call_without_gvl.o: $(hdrdir)/ruby/internal/attr/noinline.h call_without_gvl.o: $(hdrdir)/ruby/internal/attr/nonnull.h call_without_gvl.o: $(hdrdir)/ruby/internal/attr/noreturn.h +call_without_gvl.o: $(hdrdir)/ruby/internal/attr/packed_struct.h call_without_gvl.o: $(hdrdir)/ruby/internal/attr/pure.h call_without_gvl.o: $(hdrdir)/ruby/internal/attr/restrict.h call_without_gvl.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ call_without_gvl.o: $(hdrdir)/ruby/internal/intern/enumerator.h call_without_gvl.o: $(hdrdir)/ruby/internal/intern/error.h call_without_gvl.o: $(hdrdir)/ruby/internal/intern/eval.h call_without_gvl.o: $(hdrdir)/ruby/internal/intern/file.h -call_without_gvl.o: $(hdrdir)/ruby/internal/intern/gc.h call_without_gvl.o: $(hdrdir)/ruby/internal/intern/hash.h call_without_gvl.o: $(hdrdir)/ruby/internal/intern/io.h call_without_gvl.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ call_without_gvl.o: $(hdrdir)/ruby/internal/memory.h call_without_gvl.o: $(hdrdir)/ruby/internal/method.h call_without_gvl.o: $(hdrdir)/ruby/internal/module.h call_without_gvl.o: $(hdrdir)/ruby/internal/newobj.h -call_without_gvl.o: $(hdrdir)/ruby/internal/rgengc.h call_without_gvl.o: $(hdrdir)/ruby/internal/scan_args.h call_without_gvl.o: $(hdrdir)/ruby/internal/special_consts.h call_without_gvl.o: $(hdrdir)/ruby/internal/static_assert.h call_without_gvl.o: $(hdrdir)/ruby/internal/stdalign.h call_without_gvl.o: $(hdrdir)/ruby/internal/stdbool.h +call_without_gvl.o: $(hdrdir)/ruby/internal/stdckdint.h call_without_gvl.o: $(hdrdir)/ruby/internal/symbol.h call_without_gvl.o: $(hdrdir)/ruby/internal/value.h call_without_gvl.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/hash/depend b/ext/-test-/hash/depend index a8bc47e640..4bc4bfcdd6 100644 --- a/ext/-test-/hash/depend +++ b/ext/-test-/hash/depend @@ -52,6 +52,7 @@ delete.o: $(hdrdir)/ruby/internal/attr/noexcept.h delete.o: $(hdrdir)/ruby/internal/attr/noinline.h delete.o: $(hdrdir)/ruby/internal/attr/nonnull.h delete.o: $(hdrdir)/ruby/internal/attr/noreturn.h +delete.o: $(hdrdir)/ruby/internal/attr/packed_struct.h delete.o: $(hdrdir)/ruby/internal/attr/pure.h delete.o: $(hdrdir)/ruby/internal/attr/restrict.h delete.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ delete.o: $(hdrdir)/ruby/internal/intern/enumerator.h delete.o: $(hdrdir)/ruby/internal/intern/error.h delete.o: $(hdrdir)/ruby/internal/intern/eval.h delete.o: $(hdrdir)/ruby/internal/intern/file.h -delete.o: $(hdrdir)/ruby/internal/intern/gc.h delete.o: $(hdrdir)/ruby/internal/intern/hash.h delete.o: $(hdrdir)/ruby/internal/intern/io.h delete.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ delete.o: $(hdrdir)/ruby/internal/memory.h delete.o: $(hdrdir)/ruby/internal/method.h delete.o: $(hdrdir)/ruby/internal/module.h delete.o: $(hdrdir)/ruby/internal/newobj.h -delete.o: $(hdrdir)/ruby/internal/rgengc.h delete.o: $(hdrdir)/ruby/internal/scan_args.h delete.o: $(hdrdir)/ruby/internal/special_consts.h delete.o: $(hdrdir)/ruby/internal/static_assert.h delete.o: $(hdrdir)/ruby/internal/stdalign.h delete.o: $(hdrdir)/ruby/internal/stdbool.h +delete.o: $(hdrdir)/ruby/internal/stdckdint.h delete.o: $(hdrdir)/ruby/internal/symbol.h delete.o: $(hdrdir)/ruby/internal/value.h delete.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/integer/depend b/ext/-test-/integer/depend index b12159f308..d89965e3d9 100644 --- a/ext/-test-/integer/depend +++ b/ext/-test-/integer/depend @@ -52,6 +52,7 @@ core_ext.o: $(hdrdir)/ruby/internal/attr/noexcept.h core_ext.o: $(hdrdir)/ruby/internal/attr/noinline.h core_ext.o: $(hdrdir)/ruby/internal/attr/nonnull.h core_ext.o: $(hdrdir)/ruby/internal/attr/noreturn.h +core_ext.o: $(hdrdir)/ruby/internal/attr/packed_struct.h core_ext.o: $(hdrdir)/ruby/internal/attr/pure.h core_ext.o: $(hdrdir)/ruby/internal/attr/restrict.h core_ext.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ core_ext.o: $(hdrdir)/ruby/internal/intern/enumerator.h core_ext.o: $(hdrdir)/ruby/internal/intern/error.h core_ext.o: $(hdrdir)/ruby/internal/intern/eval.h core_ext.o: $(hdrdir)/ruby/internal/intern/file.h -core_ext.o: $(hdrdir)/ruby/internal/intern/gc.h core_ext.o: $(hdrdir)/ruby/internal/intern/hash.h core_ext.o: $(hdrdir)/ruby/internal/intern/io.h core_ext.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ core_ext.o: $(hdrdir)/ruby/internal/memory.h core_ext.o: $(hdrdir)/ruby/internal/method.h core_ext.o: $(hdrdir)/ruby/internal/module.h core_ext.o: $(hdrdir)/ruby/internal/newobj.h -core_ext.o: $(hdrdir)/ruby/internal/rgengc.h core_ext.o: $(hdrdir)/ruby/internal/scan_args.h core_ext.o: $(hdrdir)/ruby/internal/special_consts.h core_ext.o: $(hdrdir)/ruby/internal/static_assert.h core_ext.o: $(hdrdir)/ruby/internal/stdalign.h core_ext.o: $(hdrdir)/ruby/internal/stdbool.h +core_ext.o: $(hdrdir)/ruby/internal/stdckdint.h core_ext.o: $(hdrdir)/ruby/internal/symbol.h core_ext.o: $(hdrdir)/ruby/internal/value.h core_ext.o: $(hdrdir)/ruby/internal/value_type.h @@ -220,6 +220,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -279,7 +280,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -310,12 +310,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -380,6 +380,7 @@ my_integer.o: $(hdrdir)/ruby/internal/attr/noexcept.h my_integer.o: $(hdrdir)/ruby/internal/attr/noinline.h my_integer.o: $(hdrdir)/ruby/internal/attr/nonnull.h my_integer.o: $(hdrdir)/ruby/internal/attr/noreturn.h +my_integer.o: $(hdrdir)/ruby/internal/attr/packed_struct.h my_integer.o: $(hdrdir)/ruby/internal/attr/pure.h my_integer.o: $(hdrdir)/ruby/internal/attr/restrict.h my_integer.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -439,7 +440,6 @@ my_integer.o: $(hdrdir)/ruby/internal/intern/enumerator.h my_integer.o: $(hdrdir)/ruby/internal/intern/error.h my_integer.o: $(hdrdir)/ruby/internal/intern/eval.h my_integer.o: $(hdrdir)/ruby/internal/intern/file.h -my_integer.o: $(hdrdir)/ruby/internal/intern/gc.h my_integer.o: $(hdrdir)/ruby/internal/intern/hash.h my_integer.o: $(hdrdir)/ruby/internal/intern/io.h my_integer.o: $(hdrdir)/ruby/internal/intern/load.h @@ -470,12 +470,12 @@ my_integer.o: $(hdrdir)/ruby/internal/memory.h my_integer.o: $(hdrdir)/ruby/internal/method.h my_integer.o: $(hdrdir)/ruby/internal/module.h my_integer.o: $(hdrdir)/ruby/internal/newobj.h -my_integer.o: $(hdrdir)/ruby/internal/rgengc.h my_integer.o: $(hdrdir)/ruby/internal/scan_args.h my_integer.o: $(hdrdir)/ruby/internal/special_consts.h my_integer.o: $(hdrdir)/ruby/internal/static_assert.h my_integer.o: $(hdrdir)/ruby/internal/stdalign.h my_integer.o: $(hdrdir)/ruby/internal/stdbool.h +my_integer.o: $(hdrdir)/ruby/internal/stdckdint.h my_integer.o: $(hdrdir)/ruby/internal/symbol.h my_integer.o: $(hdrdir)/ruby/internal/value.h my_integer.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/iseq_load/depend b/ext/-test-/iseq_load/depend index 308956550c..fd07b3199c 100644 --- a/ext/-test-/iseq_load/depend +++ b/ext/-test-/iseq_load/depend @@ -52,6 +52,7 @@ iseq_load.o: $(hdrdir)/ruby/internal/attr/noexcept.h iseq_load.o: $(hdrdir)/ruby/internal/attr/noinline.h iseq_load.o: $(hdrdir)/ruby/internal/attr/nonnull.h iseq_load.o: $(hdrdir)/ruby/internal/attr/noreturn.h +iseq_load.o: $(hdrdir)/ruby/internal/attr/packed_struct.h iseq_load.o: $(hdrdir)/ruby/internal/attr/pure.h iseq_load.o: $(hdrdir)/ruby/internal/attr/restrict.h iseq_load.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ iseq_load.o: $(hdrdir)/ruby/internal/intern/enumerator.h iseq_load.o: $(hdrdir)/ruby/internal/intern/error.h iseq_load.o: $(hdrdir)/ruby/internal/intern/eval.h iseq_load.o: $(hdrdir)/ruby/internal/intern/file.h -iseq_load.o: $(hdrdir)/ruby/internal/intern/gc.h iseq_load.o: $(hdrdir)/ruby/internal/intern/hash.h iseq_load.o: $(hdrdir)/ruby/internal/intern/io.h iseq_load.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ iseq_load.o: $(hdrdir)/ruby/internal/memory.h iseq_load.o: $(hdrdir)/ruby/internal/method.h iseq_load.o: $(hdrdir)/ruby/internal/module.h iseq_load.o: $(hdrdir)/ruby/internal/newobj.h -iseq_load.o: $(hdrdir)/ruby/internal/rgengc.h iseq_load.o: $(hdrdir)/ruby/internal/scan_args.h iseq_load.o: $(hdrdir)/ruby/internal/special_consts.h iseq_load.o: $(hdrdir)/ruby/internal/static_assert.h iseq_load.o: $(hdrdir)/ruby/internal/stdalign.h iseq_load.o: $(hdrdir)/ruby/internal/stdbool.h +iseq_load.o: $(hdrdir)/ruby/internal/stdckdint.h iseq_load.o: $(hdrdir)/ruby/internal/symbol.h iseq_load.o: $(hdrdir)/ruby/internal/value.h iseq_load.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/iter/depend b/ext/-test-/iter/depend index d14c164cd4..cff4b1bb43 100644 --- a/ext/-test-/iter/depend +++ b/ext/-test-/iter/depend @@ -52,6 +52,7 @@ break.o: $(hdrdir)/ruby/internal/attr/noexcept.h break.o: $(hdrdir)/ruby/internal/attr/noinline.h break.o: $(hdrdir)/ruby/internal/attr/nonnull.h break.o: $(hdrdir)/ruby/internal/attr/noreturn.h +break.o: $(hdrdir)/ruby/internal/attr/packed_struct.h break.o: $(hdrdir)/ruby/internal/attr/pure.h break.o: $(hdrdir)/ruby/internal/attr/restrict.h break.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ break.o: $(hdrdir)/ruby/internal/intern/enumerator.h break.o: $(hdrdir)/ruby/internal/intern/error.h break.o: $(hdrdir)/ruby/internal/intern/eval.h break.o: $(hdrdir)/ruby/internal/intern/file.h -break.o: $(hdrdir)/ruby/internal/intern/gc.h break.o: $(hdrdir)/ruby/internal/intern/hash.h break.o: $(hdrdir)/ruby/internal/intern/io.h break.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ break.o: $(hdrdir)/ruby/internal/memory.h break.o: $(hdrdir)/ruby/internal/method.h break.o: $(hdrdir)/ruby/internal/module.h break.o: $(hdrdir)/ruby/internal/newobj.h -break.o: $(hdrdir)/ruby/internal/rgengc.h break.o: $(hdrdir)/ruby/internal/scan_args.h break.o: $(hdrdir)/ruby/internal/special_consts.h break.o: $(hdrdir)/ruby/internal/static_assert.h break.o: $(hdrdir)/ruby/internal/stdalign.h break.o: $(hdrdir)/ruby/internal/stdbool.h +break.o: $(hdrdir)/ruby/internal/stdckdint.h break.o: $(hdrdir)/ruby/internal/symbol.h break.o: $(hdrdir)/ruby/internal/value.h break.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -372,6 +372,7 @@ yield.o: $(hdrdir)/ruby/internal/attr/noexcept.h yield.o: $(hdrdir)/ruby/internal/attr/noinline.h yield.o: $(hdrdir)/ruby/internal/attr/nonnull.h yield.o: $(hdrdir)/ruby/internal/attr/noreturn.h +yield.o: $(hdrdir)/ruby/internal/attr/packed_struct.h yield.o: $(hdrdir)/ruby/internal/attr/pure.h yield.o: $(hdrdir)/ruby/internal/attr/restrict.h yield.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -431,7 +432,6 @@ yield.o: $(hdrdir)/ruby/internal/intern/enumerator.h yield.o: $(hdrdir)/ruby/internal/intern/error.h yield.o: $(hdrdir)/ruby/internal/intern/eval.h yield.o: $(hdrdir)/ruby/internal/intern/file.h -yield.o: $(hdrdir)/ruby/internal/intern/gc.h yield.o: $(hdrdir)/ruby/internal/intern/hash.h yield.o: $(hdrdir)/ruby/internal/intern/io.h yield.o: $(hdrdir)/ruby/internal/intern/load.h @@ -462,12 +462,12 @@ yield.o: $(hdrdir)/ruby/internal/memory.h yield.o: $(hdrdir)/ruby/internal/method.h yield.o: $(hdrdir)/ruby/internal/module.h yield.o: $(hdrdir)/ruby/internal/newobj.h -yield.o: $(hdrdir)/ruby/internal/rgengc.h yield.o: $(hdrdir)/ruby/internal/scan_args.h yield.o: $(hdrdir)/ruby/internal/special_consts.h yield.o: $(hdrdir)/ruby/internal/static_assert.h yield.o: $(hdrdir)/ruby/internal/stdalign.h yield.o: $(hdrdir)/ruby/internal/stdbool.h +yield.o: $(hdrdir)/ruby/internal/stdckdint.h yield.o: $(hdrdir)/ruby/internal/symbol.h yield.o: $(hdrdir)/ruby/internal/value.h yield.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/load/dot.dot/depend b/ext/-test-/load/dot.dot/depend index d8b8937c3c..f9be79e957 100644 --- a/ext/-test-/load/dot.dot/depend +++ b/ext/-test-/load/dot.dot/depend @@ -52,6 +52,7 @@ dot.dot.o: $(hdrdir)/ruby/internal/attr/noexcept.h dot.dot.o: $(hdrdir)/ruby/internal/attr/noinline.h dot.dot.o: $(hdrdir)/ruby/internal/attr/nonnull.h dot.dot.o: $(hdrdir)/ruby/internal/attr/noreturn.h +dot.dot.o: $(hdrdir)/ruby/internal/attr/packed_struct.h dot.dot.o: $(hdrdir)/ruby/internal/attr/pure.h dot.dot.o: $(hdrdir)/ruby/internal/attr/restrict.h dot.dot.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ dot.dot.o: $(hdrdir)/ruby/internal/intern/enumerator.h dot.dot.o: $(hdrdir)/ruby/internal/intern/error.h dot.dot.o: $(hdrdir)/ruby/internal/intern/eval.h dot.dot.o: $(hdrdir)/ruby/internal/intern/file.h -dot.dot.o: $(hdrdir)/ruby/internal/intern/gc.h dot.dot.o: $(hdrdir)/ruby/internal/intern/hash.h dot.dot.o: $(hdrdir)/ruby/internal/intern/io.h dot.dot.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ dot.dot.o: $(hdrdir)/ruby/internal/memory.h dot.dot.o: $(hdrdir)/ruby/internal/method.h dot.dot.o: $(hdrdir)/ruby/internal/module.h dot.dot.o: $(hdrdir)/ruby/internal/newobj.h -dot.dot.o: $(hdrdir)/ruby/internal/rgengc.h dot.dot.o: $(hdrdir)/ruby/internal/scan_args.h dot.dot.o: $(hdrdir)/ruby/internal/special_consts.h dot.dot.o: $(hdrdir)/ruby/internal/static_assert.h dot.dot.o: $(hdrdir)/ruby/internal/stdalign.h dot.dot.o: $(hdrdir)/ruby/internal/stdbool.h +dot.dot.o: $(hdrdir)/ruby/internal/stdckdint.h dot.dot.o: $(hdrdir)/ruby/internal/symbol.h dot.dot.o: $(hdrdir)/ruby/internal/value.h dot.dot.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/load/protect/depend b/ext/-test-/load/protect/depend index dd4ee71b62..324c17237a 100644 --- a/ext/-test-/load/protect/depend +++ b/ext/-test-/load/protect/depend @@ -52,6 +52,7 @@ protect.o: $(hdrdir)/ruby/internal/attr/noexcept.h protect.o: $(hdrdir)/ruby/internal/attr/noinline.h protect.o: $(hdrdir)/ruby/internal/attr/nonnull.h protect.o: $(hdrdir)/ruby/internal/attr/noreturn.h +protect.o: $(hdrdir)/ruby/internal/attr/packed_struct.h protect.o: $(hdrdir)/ruby/internal/attr/pure.h protect.o: $(hdrdir)/ruby/internal/attr/restrict.h protect.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ protect.o: $(hdrdir)/ruby/internal/intern/enumerator.h protect.o: $(hdrdir)/ruby/internal/intern/error.h protect.o: $(hdrdir)/ruby/internal/intern/eval.h protect.o: $(hdrdir)/ruby/internal/intern/file.h -protect.o: $(hdrdir)/ruby/internal/intern/gc.h protect.o: $(hdrdir)/ruby/internal/intern/hash.h protect.o: $(hdrdir)/ruby/internal/intern/io.h protect.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ protect.o: $(hdrdir)/ruby/internal/memory.h protect.o: $(hdrdir)/ruby/internal/method.h protect.o: $(hdrdir)/ruby/internal/module.h protect.o: $(hdrdir)/ruby/internal/newobj.h -protect.o: $(hdrdir)/ruby/internal/rgengc.h protect.o: $(hdrdir)/ruby/internal/scan_args.h protect.o: $(hdrdir)/ruby/internal/special_consts.h protect.o: $(hdrdir)/ruby/internal/static_assert.h protect.o: $(hdrdir)/ruby/internal/stdalign.h protect.o: $(hdrdir)/ruby/internal/stdbool.h +protect.o: $(hdrdir)/ruby/internal/stdckdint.h protect.o: $(hdrdir)/ruby/internal/symbol.h protect.o: $(hdrdir)/ruby/internal/value.h protect.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/load/resolve_symbol_resolver/extconf.rb b/ext/-test-/load/resolve_symbol_resolver/extconf.rb new file mode 100644 index 0000000000..2299efcfd3 --- /dev/null +++ b/ext/-test-/load/resolve_symbol_resolver/extconf.rb @@ -0,0 +1 @@ +create_makefile('-test-/load/resolve_symbol_resolver') diff --git a/ext/-test-/load/resolve_symbol_resolver/resolve_symbol_resolver.c b/ext/-test-/load/resolve_symbol_resolver/resolve_symbol_resolver.c new file mode 100644 index 0000000000..a856319cfb --- /dev/null +++ b/ext/-test-/load/resolve_symbol_resolver/resolve_symbol_resolver.c @@ -0,0 +1,55 @@ +#include <ruby.h> +#include "ruby/internal/intern/load.h" + +typedef VALUE(*target_func)(VALUE); + +static target_func rst_any_method; + +VALUE +rsr_any_method(VALUE klass) +{ + return rst_any_method((VALUE)NULL); +} + +VALUE +rsr_try_resolve_fname(VALUE klass) +{ + target_func rst_something_missing = + (target_func) rb_ext_resolve_symbol("-test-/load/resolve_symbol_missing", "rst_any_method"); + if (rst_something_missing == NULL) { + // This should be done in Init_*, so the error is LoadError + rb_raise(rb_eLoadError, "symbol not found: missing fname"); + } + return Qtrue; +} + +VALUE +rsr_try_resolve_sname(VALUE klass) +{ + target_func rst_something_missing = + (target_func)rb_ext_resolve_symbol("-test-/load/resolve_symbol_target", "rst_something_missing"); + if (rst_something_missing == NULL) { + // This should be done in Init_*, so the error is LoadError + rb_raise(rb_eLoadError, "symbol not found: missing sname"); + } + return Qtrue; +} + +void +Init_resolve_symbol_resolver(void) +{ + /* + * Resolving symbols at the head of Init_ because it raises LoadError (in cases). + * If the module and methods are defined before raising LoadError, retrying `require "this.so"` will + * cause re-defining those methods (and will be warned). + */ + rst_any_method = (target_func)rb_ext_resolve_symbol("-test-/load/resolve_symbol_target", "rst_any_method"); + if (rst_any_method == NULL) { + rb_raise(rb_eLoadError, "resolve_symbol_target is not loaded"); + } + + VALUE mod = rb_define_module("ResolveSymbolResolver"); + rb_define_singleton_method(mod, "any_method", rsr_any_method, 0); + rb_define_singleton_method(mod, "try_resolve_fname", rsr_try_resolve_fname, 0); + rb_define_singleton_method(mod, "try_resolve_sname", rsr_try_resolve_sname, 0); +} diff --git a/ext/-test-/load/resolve_symbol_target/extconf.rb b/ext/-test-/load/resolve_symbol_target/extconf.rb new file mode 100644 index 0000000000..b5a99ca7f1 --- /dev/null +++ b/ext/-test-/load/resolve_symbol_target/extconf.rb @@ -0,0 +1 @@ +create_makefile('-test-/load/resolve_symbol_target') diff --git a/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c b/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c new file mode 100644 index 0000000000..b5bc9e8ee0 --- /dev/null +++ b/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c @@ -0,0 +1,15 @@ +#include <ruby.h> +#include "resolve_symbol_target.h" + +VALUE +rst_any_method(VALUE klass) +{ + return rb_str_new_cstr("from target"); +} + +void +Init_resolve_symbol_target(void) +{ + VALUE mod = rb_define_module("ResolveSymbolTarget"); + rb_define_singleton_method(mod, "any_method", rst_any_method, 0); +} diff --git a/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.def b/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.def new file mode 100644 index 0000000000..c2ed3610fe --- /dev/null +++ b/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.def @@ -0,0 +1,4 @@ +LIBRARY resolve_symbol_target +EXPORTS + Init_resolve_symbol_target + rst_any_method diff --git a/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.h b/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.h new file mode 100644 index 0000000000..847dcb7dd3 --- /dev/null +++ b/ext/-test-/load/resolve_symbol_target/resolve_symbol_target.h @@ -0,0 +1,4 @@ +#include <ruby.h> +#include "ruby/internal/dllexport.h" + +RUBY_FUNC_EXPORTED VALUE rst_any_method(VALUE); diff --git a/ext/-test-/load/stringify_symbols/extconf.rb b/ext/-test-/load/stringify_symbols/extconf.rb new file mode 100644 index 0000000000..ac39c15f09 --- /dev/null +++ b/ext/-test-/load/stringify_symbols/extconf.rb @@ -0,0 +1 @@ +create_makefile('-test-/load/stringify_symbols') diff --git a/ext/-test-/load/stringify_symbols/stringify_symbols.c b/ext/-test-/load/stringify_symbols/stringify_symbols.c new file mode 100644 index 0000000000..11a5ee3bc5 --- /dev/null +++ b/ext/-test-/load/stringify_symbols/stringify_symbols.c @@ -0,0 +1,29 @@ +#include <ruby.h> +#include "ruby/internal/intern/load.h" +#include "ruby/util.h" + +#if SIZEOF_INTPTR_T == SIZEOF_LONG_LONG +# define UINTPTR2NUM ULL2NUM +#elif SIZEOF_INTPTR_T == SIZEOF_LONG +# define UINTPTR2NUM ULONG2NUM +#else +# define UINTPTR2NUM UINT2NUM +#endif + +static VALUE +stringify_symbol(VALUE klass, VALUE fname, VALUE sname) +{ + void *ptr = rb_ext_resolve_symbol(StringValueCStr(fname), StringValueCStr(sname)); + if (ptr == NULL) { + return Qnil; + } + uintptr_t uintptr = (uintptr_t)ptr; + return UINTPTR2NUM(uintptr); +} + +void +Init_stringify_symbols(void) +{ + VALUE mod = rb_define_module("StringifySymbols"); + rb_define_singleton_method(mod, "stringify_symbol", stringify_symbol, 2); +} diff --git a/ext/-test-/load/stringify_target/extconf.rb b/ext/-test-/load/stringify_target/extconf.rb new file mode 100644 index 0000000000..4aa201cb09 --- /dev/null +++ b/ext/-test-/load/stringify_target/extconf.rb @@ -0,0 +1 @@ +create_makefile('-test-/load/stringify_target') diff --git a/ext/-test-/load/stringify_target/stringify_target.c b/ext/-test-/load/stringify_target/stringify_target.c new file mode 100644 index 0000000000..ce09b8fd77 --- /dev/null +++ b/ext/-test-/load/stringify_target/stringify_target.c @@ -0,0 +1,15 @@ +#include <ruby.h> +#include "stringify_target.h" + +VALUE +stt_any_method(VALUE klass) +{ + return rb_str_new_cstr("from target"); +} + +void +Init_stringify_target(void) +{ + VALUE mod = rb_define_module("StringifyTarget"); + rb_define_singleton_method(mod, "any_method", stt_any_method, 0); +} diff --git a/ext/-test-/load/stringify_target/stringify_target.def b/ext/-test-/load/stringify_target/stringify_target.def new file mode 100644 index 0000000000..89c2b762de --- /dev/null +++ b/ext/-test-/load/stringify_target/stringify_target.def @@ -0,0 +1,4 @@ +LIBRARY stringify_target +EXPORTS + Init_stringify_target + stt_any_method diff --git a/ext/-test-/load/stringify_target/stringify_target.h b/ext/-test-/load/stringify_target/stringify_target.h new file mode 100644 index 0000000000..d95fb65d7c --- /dev/null +++ b/ext/-test-/load/stringify_target/stringify_target.h @@ -0,0 +1,4 @@ +#include <ruby.h> +#include "ruby/internal/dllexport.h" + +RUBY_FUNC_EXPORTED VALUE stt_any_method(VALUE); diff --git a/ext/-test-/marshal/compat/depend b/ext/-test-/marshal/compat/depend index 2c3ecf1ab9..8bcd9f8b5e 100644 --- a/ext/-test-/marshal/compat/depend +++ b/ext/-test-/marshal/compat/depend @@ -52,6 +52,7 @@ usrcompat.o: $(hdrdir)/ruby/internal/attr/noexcept.h usrcompat.o: $(hdrdir)/ruby/internal/attr/noinline.h usrcompat.o: $(hdrdir)/ruby/internal/attr/nonnull.h usrcompat.o: $(hdrdir)/ruby/internal/attr/noreturn.h +usrcompat.o: $(hdrdir)/ruby/internal/attr/packed_struct.h usrcompat.o: $(hdrdir)/ruby/internal/attr/pure.h usrcompat.o: $(hdrdir)/ruby/internal/attr/restrict.h usrcompat.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ usrcompat.o: $(hdrdir)/ruby/internal/intern/enumerator.h usrcompat.o: $(hdrdir)/ruby/internal/intern/error.h usrcompat.o: $(hdrdir)/ruby/internal/intern/eval.h usrcompat.o: $(hdrdir)/ruby/internal/intern/file.h -usrcompat.o: $(hdrdir)/ruby/internal/intern/gc.h usrcompat.o: $(hdrdir)/ruby/internal/intern/hash.h usrcompat.o: $(hdrdir)/ruby/internal/intern/io.h usrcompat.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ usrcompat.o: $(hdrdir)/ruby/internal/memory.h usrcompat.o: $(hdrdir)/ruby/internal/method.h usrcompat.o: $(hdrdir)/ruby/internal/module.h usrcompat.o: $(hdrdir)/ruby/internal/newobj.h -usrcompat.o: $(hdrdir)/ruby/internal/rgengc.h usrcompat.o: $(hdrdir)/ruby/internal/scan_args.h usrcompat.o: $(hdrdir)/ruby/internal/special_consts.h usrcompat.o: $(hdrdir)/ruby/internal/static_assert.h usrcompat.o: $(hdrdir)/ruby/internal/stdalign.h usrcompat.o: $(hdrdir)/ruby/internal/stdbool.h +usrcompat.o: $(hdrdir)/ruby/internal/stdckdint.h usrcompat.o: $(hdrdir)/ruby/internal/symbol.h usrcompat.o: $(hdrdir)/ruby/internal/value.h usrcompat.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/marshal/internal_ivar/depend b/ext/-test-/marshal/internal_ivar/depend index cacb54a1a7..f8be031efc 100644 --- a/ext/-test-/marshal/internal_ivar/depend +++ b/ext/-test-/marshal/internal_ivar/depend @@ -52,6 +52,7 @@ internal_ivar.o: $(hdrdir)/ruby/internal/attr/noexcept.h internal_ivar.o: $(hdrdir)/ruby/internal/attr/noinline.h internal_ivar.o: $(hdrdir)/ruby/internal/attr/nonnull.h internal_ivar.o: $(hdrdir)/ruby/internal/attr/noreturn.h +internal_ivar.o: $(hdrdir)/ruby/internal/attr/packed_struct.h internal_ivar.o: $(hdrdir)/ruby/internal/attr/pure.h internal_ivar.o: $(hdrdir)/ruby/internal/attr/restrict.h internal_ivar.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ internal_ivar.o: $(hdrdir)/ruby/internal/intern/enumerator.h internal_ivar.o: $(hdrdir)/ruby/internal/intern/error.h internal_ivar.o: $(hdrdir)/ruby/internal/intern/eval.h internal_ivar.o: $(hdrdir)/ruby/internal/intern/file.h -internal_ivar.o: $(hdrdir)/ruby/internal/intern/gc.h internal_ivar.o: $(hdrdir)/ruby/internal/intern/hash.h internal_ivar.o: $(hdrdir)/ruby/internal/intern/io.h internal_ivar.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ internal_ivar.o: $(hdrdir)/ruby/internal/memory.h internal_ivar.o: $(hdrdir)/ruby/internal/method.h internal_ivar.o: $(hdrdir)/ruby/internal/module.h internal_ivar.o: $(hdrdir)/ruby/internal/newobj.h -internal_ivar.o: $(hdrdir)/ruby/internal/rgengc.h internal_ivar.o: $(hdrdir)/ruby/internal/scan_args.h internal_ivar.o: $(hdrdir)/ruby/internal/special_consts.h internal_ivar.o: $(hdrdir)/ruby/internal/static_assert.h internal_ivar.o: $(hdrdir)/ruby/internal/stdalign.h internal_ivar.o: $(hdrdir)/ruby/internal/stdbool.h +internal_ivar.o: $(hdrdir)/ruby/internal/stdckdint.h internal_ivar.o: $(hdrdir)/ruby/internal/symbol.h internal_ivar.o: $(hdrdir)/ruby/internal/value.h internal_ivar.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/marshal/usr/depend b/ext/-test-/marshal/usr/depend index 717101cbcf..09e8207d3a 100644 --- a/ext/-test-/marshal/usr/depend +++ b/ext/-test-/marshal/usr/depend @@ -52,6 +52,7 @@ usrmarshal.o: $(hdrdir)/ruby/internal/attr/noexcept.h usrmarshal.o: $(hdrdir)/ruby/internal/attr/noinline.h usrmarshal.o: $(hdrdir)/ruby/internal/attr/nonnull.h usrmarshal.o: $(hdrdir)/ruby/internal/attr/noreturn.h +usrmarshal.o: $(hdrdir)/ruby/internal/attr/packed_struct.h usrmarshal.o: $(hdrdir)/ruby/internal/attr/pure.h usrmarshal.o: $(hdrdir)/ruby/internal/attr/restrict.h usrmarshal.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ usrmarshal.o: $(hdrdir)/ruby/internal/intern/enumerator.h usrmarshal.o: $(hdrdir)/ruby/internal/intern/error.h usrmarshal.o: $(hdrdir)/ruby/internal/intern/eval.h usrmarshal.o: $(hdrdir)/ruby/internal/intern/file.h -usrmarshal.o: $(hdrdir)/ruby/internal/intern/gc.h usrmarshal.o: $(hdrdir)/ruby/internal/intern/hash.h usrmarshal.o: $(hdrdir)/ruby/internal/intern/io.h usrmarshal.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ usrmarshal.o: $(hdrdir)/ruby/internal/memory.h usrmarshal.o: $(hdrdir)/ruby/internal/method.h usrmarshal.o: $(hdrdir)/ruby/internal/module.h usrmarshal.o: $(hdrdir)/ruby/internal/newobj.h -usrmarshal.o: $(hdrdir)/ruby/internal/rgengc.h usrmarshal.o: $(hdrdir)/ruby/internal/scan_args.h usrmarshal.o: $(hdrdir)/ruby/internal/special_consts.h usrmarshal.o: $(hdrdir)/ruby/internal/static_assert.h usrmarshal.o: $(hdrdir)/ruby/internal/stdalign.h usrmarshal.o: $(hdrdir)/ruby/internal/stdbool.h +usrmarshal.o: $(hdrdir)/ruby/internal/stdckdint.h usrmarshal.o: $(hdrdir)/ruby/internal/symbol.h usrmarshal.o: $(hdrdir)/ruby/internal/value.h usrmarshal.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/memory_status/depend b/ext/-test-/memory_status/depend index a65fe66ae3..52e2fe8e1f 100644 --- a/ext/-test-/memory_status/depend +++ b/ext/-test-/memory_status/depend @@ -52,6 +52,7 @@ memory_status.o: $(hdrdir)/ruby/internal/attr/noexcept.h memory_status.o: $(hdrdir)/ruby/internal/attr/noinline.h memory_status.o: $(hdrdir)/ruby/internal/attr/nonnull.h memory_status.o: $(hdrdir)/ruby/internal/attr/noreturn.h +memory_status.o: $(hdrdir)/ruby/internal/attr/packed_struct.h memory_status.o: $(hdrdir)/ruby/internal/attr/pure.h memory_status.o: $(hdrdir)/ruby/internal/attr/restrict.h memory_status.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ memory_status.o: $(hdrdir)/ruby/internal/intern/enumerator.h memory_status.o: $(hdrdir)/ruby/internal/intern/error.h memory_status.o: $(hdrdir)/ruby/internal/intern/eval.h memory_status.o: $(hdrdir)/ruby/internal/intern/file.h -memory_status.o: $(hdrdir)/ruby/internal/intern/gc.h memory_status.o: $(hdrdir)/ruby/internal/intern/hash.h memory_status.o: $(hdrdir)/ruby/internal/intern/io.h memory_status.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,7 +142,6 @@ memory_status.o: $(hdrdir)/ruby/internal/memory.h memory_status.o: $(hdrdir)/ruby/internal/method.h memory_status.o: $(hdrdir)/ruby/internal/module.h memory_status.o: $(hdrdir)/ruby/internal/newobj.h -memory_status.o: $(hdrdir)/ruby/internal/rgengc.h memory_status.o: $(hdrdir)/ruby/internal/scan_args.h memory_status.o: $(hdrdir)/ruby/internal/special_consts.h memory_status.o: $(hdrdir)/ruby/internal/static_assert.h diff --git a/ext/-test-/memory_view/depend b/ext/-test-/memory_view/depend index 7ce2d0374c..0c92fc1236 100644 --- a/ext/-test-/memory_view/depend +++ b/ext/-test-/memory_view/depend @@ -52,6 +52,7 @@ memory_view.o: $(hdrdir)/ruby/internal/attr/noexcept.h memory_view.o: $(hdrdir)/ruby/internal/attr/noinline.h memory_view.o: $(hdrdir)/ruby/internal/attr/nonnull.h memory_view.o: $(hdrdir)/ruby/internal/attr/noreturn.h +memory_view.o: $(hdrdir)/ruby/internal/attr/packed_struct.h memory_view.o: $(hdrdir)/ruby/internal/attr/pure.h memory_view.o: $(hdrdir)/ruby/internal/attr/restrict.h memory_view.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ memory_view.o: $(hdrdir)/ruby/internal/intern/enumerator.h memory_view.o: $(hdrdir)/ruby/internal/intern/error.h memory_view.o: $(hdrdir)/ruby/internal/intern/eval.h memory_view.o: $(hdrdir)/ruby/internal/intern/file.h -memory_view.o: $(hdrdir)/ruby/internal/intern/gc.h memory_view.o: $(hdrdir)/ruby/internal/intern/hash.h memory_view.o: $(hdrdir)/ruby/internal/intern/io.h memory_view.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ memory_view.o: $(hdrdir)/ruby/internal/memory.h memory_view.o: $(hdrdir)/ruby/internal/method.h memory_view.o: $(hdrdir)/ruby/internal/module.h memory_view.o: $(hdrdir)/ruby/internal/newobj.h -memory_view.o: $(hdrdir)/ruby/internal/rgengc.h memory_view.o: $(hdrdir)/ruby/internal/scan_args.h memory_view.o: $(hdrdir)/ruby/internal/special_consts.h memory_view.o: $(hdrdir)/ruby/internal/static_assert.h memory_view.o: $(hdrdir)/ruby/internal/stdalign.h memory_view.o: $(hdrdir)/ruby/internal/stdbool.h +memory_view.o: $(hdrdir)/ruby/internal/stdckdint.h memory_view.o: $(hdrdir)/ruby/internal/symbol.h memory_view.o: $(hdrdir)/ruby/internal/value.h memory_view.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/memory_view/memory_view.c b/ext/-test-/memory_view/memory_view.c index c1df0353cf..63f0beb81e 100644 --- a/ext/-test-/memory_view/memory_view.c +++ b/ext/-test-/memory_view/memory_view.c @@ -313,8 +313,8 @@ mdview_get_memory_view(VALUE obj, rb_memory_view_t *view, int flags) static bool mdview_release_memory_view(VALUE obj, rb_memory_view_t *view) { - if (view->shape) xfree((void *)view->shape); - if (view->strides) xfree((void *)view->strides); + xfree((void *)view->shape); + xfree((void *)view->strides); return true; } diff --git a/ext/-test-/method/depend b/ext/-test-/method/depend index 85cf4d174a..dce2a815a4 100644 --- a/ext/-test-/method/depend +++ b/ext/-test-/method/depend @@ -52,6 +52,7 @@ arity.o: $(hdrdir)/ruby/internal/attr/noexcept.h arity.o: $(hdrdir)/ruby/internal/attr/noinline.h arity.o: $(hdrdir)/ruby/internal/attr/nonnull.h arity.o: $(hdrdir)/ruby/internal/attr/noreturn.h +arity.o: $(hdrdir)/ruby/internal/attr/packed_struct.h arity.o: $(hdrdir)/ruby/internal/attr/pure.h arity.o: $(hdrdir)/ruby/internal/attr/restrict.h arity.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ arity.o: $(hdrdir)/ruby/internal/intern/enumerator.h arity.o: $(hdrdir)/ruby/internal/intern/error.h arity.o: $(hdrdir)/ruby/internal/intern/eval.h arity.o: $(hdrdir)/ruby/internal/intern/file.h -arity.o: $(hdrdir)/ruby/internal/intern/gc.h arity.o: $(hdrdir)/ruby/internal/intern/hash.h arity.o: $(hdrdir)/ruby/internal/intern/io.h arity.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ arity.o: $(hdrdir)/ruby/internal/memory.h arity.o: $(hdrdir)/ruby/internal/method.h arity.o: $(hdrdir)/ruby/internal/module.h arity.o: $(hdrdir)/ruby/internal/newobj.h -arity.o: $(hdrdir)/ruby/internal/rgengc.h arity.o: $(hdrdir)/ruby/internal/scan_args.h arity.o: $(hdrdir)/ruby/internal/special_consts.h arity.o: $(hdrdir)/ruby/internal/static_assert.h arity.o: $(hdrdir)/ruby/internal/stdalign.h arity.o: $(hdrdir)/ruby/internal/stdbool.h +arity.o: $(hdrdir)/ruby/internal/stdckdint.h arity.o: $(hdrdir)/ruby/internal/symbol.h arity.o: $(hdrdir)/ruby/internal/value.h arity.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/notimplement/depend b/ext/-test-/notimplement/depend index 2303f47594..84517a9c15 100644 --- a/ext/-test-/notimplement/depend +++ b/ext/-test-/notimplement/depend @@ -52,6 +52,7 @@ bug.o: $(hdrdir)/ruby/internal/attr/noexcept.h bug.o: $(hdrdir)/ruby/internal/attr/noinline.h bug.o: $(hdrdir)/ruby/internal/attr/nonnull.h bug.o: $(hdrdir)/ruby/internal/attr/noreturn.h +bug.o: $(hdrdir)/ruby/internal/attr/packed_struct.h bug.o: $(hdrdir)/ruby/internal/attr/pure.h bug.o: $(hdrdir)/ruby/internal/attr/restrict.h bug.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ bug.o: $(hdrdir)/ruby/internal/intern/enumerator.h bug.o: $(hdrdir)/ruby/internal/intern/error.h bug.o: $(hdrdir)/ruby/internal/intern/eval.h bug.o: $(hdrdir)/ruby/internal/intern/file.h -bug.o: $(hdrdir)/ruby/internal/intern/gc.h bug.o: $(hdrdir)/ruby/internal/intern/hash.h bug.o: $(hdrdir)/ruby/internal/intern/io.h bug.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ bug.o: $(hdrdir)/ruby/internal/memory.h bug.o: $(hdrdir)/ruby/internal/method.h bug.o: $(hdrdir)/ruby/internal/module.h bug.o: $(hdrdir)/ruby/internal/newobj.h -bug.o: $(hdrdir)/ruby/internal/rgengc.h bug.o: $(hdrdir)/ruby/internal/scan_args.h bug.o: $(hdrdir)/ruby/internal/special_consts.h bug.o: $(hdrdir)/ruby/internal/static_assert.h bug.o: $(hdrdir)/ruby/internal/stdalign.h bug.o: $(hdrdir)/ruby/internal/stdbool.h +bug.o: $(hdrdir)/ruby/internal/stdckdint.h bug.o: $(hdrdir)/ruby/internal/symbol.h bug.o: $(hdrdir)/ruby/internal/value.h bug.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/num2int/depend b/ext/-test-/num2int/depend index a3283838dd..5550033be7 100644 --- a/ext/-test-/num2int/depend +++ b/ext/-test-/num2int/depend @@ -52,6 +52,7 @@ num2int.o: $(hdrdir)/ruby/internal/attr/noexcept.h num2int.o: $(hdrdir)/ruby/internal/attr/noinline.h num2int.o: $(hdrdir)/ruby/internal/attr/nonnull.h num2int.o: $(hdrdir)/ruby/internal/attr/noreturn.h +num2int.o: $(hdrdir)/ruby/internal/attr/packed_struct.h num2int.o: $(hdrdir)/ruby/internal/attr/pure.h num2int.o: $(hdrdir)/ruby/internal/attr/restrict.h num2int.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ num2int.o: $(hdrdir)/ruby/internal/intern/enumerator.h num2int.o: $(hdrdir)/ruby/internal/intern/error.h num2int.o: $(hdrdir)/ruby/internal/intern/eval.h num2int.o: $(hdrdir)/ruby/internal/intern/file.h -num2int.o: $(hdrdir)/ruby/internal/intern/gc.h num2int.o: $(hdrdir)/ruby/internal/intern/hash.h num2int.o: $(hdrdir)/ruby/internal/intern/io.h num2int.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ num2int.o: $(hdrdir)/ruby/internal/memory.h num2int.o: $(hdrdir)/ruby/internal/method.h num2int.o: $(hdrdir)/ruby/internal/module.h num2int.o: $(hdrdir)/ruby/internal/newobj.h -num2int.o: $(hdrdir)/ruby/internal/rgengc.h num2int.o: $(hdrdir)/ruby/internal/scan_args.h num2int.o: $(hdrdir)/ruby/internal/special_consts.h num2int.o: $(hdrdir)/ruby/internal/static_assert.h num2int.o: $(hdrdir)/ruby/internal/stdalign.h num2int.o: $(hdrdir)/ruby/internal/stdbool.h +num2int.o: $(hdrdir)/ruby/internal/stdckdint.h num2int.o: $(hdrdir)/ruby/internal/symbol.h num2int.o: $(hdrdir)/ruby/internal/value.h num2int.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/path_to_class/depend b/ext/-test-/path_to_class/depend index 17f8e957c3..a1657c9574 100644 --- a/ext/-test-/path_to_class/depend +++ b/ext/-test-/path_to_class/depend @@ -52,6 +52,7 @@ path_to_class.o: $(hdrdir)/ruby/internal/attr/noexcept.h path_to_class.o: $(hdrdir)/ruby/internal/attr/noinline.h path_to_class.o: $(hdrdir)/ruby/internal/attr/nonnull.h path_to_class.o: $(hdrdir)/ruby/internal/attr/noreturn.h +path_to_class.o: $(hdrdir)/ruby/internal/attr/packed_struct.h path_to_class.o: $(hdrdir)/ruby/internal/attr/pure.h path_to_class.o: $(hdrdir)/ruby/internal/attr/restrict.h path_to_class.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ path_to_class.o: $(hdrdir)/ruby/internal/intern/enumerator.h path_to_class.o: $(hdrdir)/ruby/internal/intern/error.h path_to_class.o: $(hdrdir)/ruby/internal/intern/eval.h path_to_class.o: $(hdrdir)/ruby/internal/intern/file.h -path_to_class.o: $(hdrdir)/ruby/internal/intern/gc.h path_to_class.o: $(hdrdir)/ruby/internal/intern/hash.h path_to_class.o: $(hdrdir)/ruby/internal/intern/io.h path_to_class.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ path_to_class.o: $(hdrdir)/ruby/internal/memory.h path_to_class.o: $(hdrdir)/ruby/internal/method.h path_to_class.o: $(hdrdir)/ruby/internal/module.h path_to_class.o: $(hdrdir)/ruby/internal/newobj.h -path_to_class.o: $(hdrdir)/ruby/internal/rgengc.h path_to_class.o: $(hdrdir)/ruby/internal/scan_args.h path_to_class.o: $(hdrdir)/ruby/internal/special_consts.h path_to_class.o: $(hdrdir)/ruby/internal/static_assert.h path_to_class.o: $(hdrdir)/ruby/internal/stdalign.h path_to_class.o: $(hdrdir)/ruby/internal/stdbool.h +path_to_class.o: $(hdrdir)/ruby/internal/stdckdint.h path_to_class.o: $(hdrdir)/ruby/internal/symbol.h path_to_class.o: $(hdrdir)/ruby/internal/value.h path_to_class.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/popen_deadlock/depend b/ext/-test-/popen_deadlock/depend index 22da87f2fe..1904e64e59 100644 --- a/ext/-test-/popen_deadlock/depend +++ b/ext/-test-/popen_deadlock/depend @@ -52,6 +52,7 @@ infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/attr/noexcept.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/attr/noinline.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/attr/nonnull.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/attr/noreturn.h +infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/attr/packed_struct.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/attr/pure.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/attr/restrict.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/intern/enumerator.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/intern/error.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/intern/eval.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/intern/file.h -infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/intern/gc.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/intern/hash.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/intern/io.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/memory.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/method.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/module.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/newobj.h -infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/rgengc.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/scan_args.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/special_consts.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/static_assert.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/stdalign.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/stdbool.h +infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/stdckdint.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/symbol.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/value.h infinite_loop_dlsym.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/postponed_job/depend b/ext/-test-/postponed_job/depend index 35aca7f2b0..72250896b0 100644 --- a/ext/-test-/postponed_job/depend +++ b/ext/-test-/postponed_job/depend @@ -53,6 +53,7 @@ postponed_job.o: $(hdrdir)/ruby/internal/attr/noexcept.h postponed_job.o: $(hdrdir)/ruby/internal/attr/noinline.h postponed_job.o: $(hdrdir)/ruby/internal/attr/nonnull.h postponed_job.o: $(hdrdir)/ruby/internal/attr/noreturn.h +postponed_job.o: $(hdrdir)/ruby/internal/attr/packed_struct.h postponed_job.o: $(hdrdir)/ruby/internal/attr/pure.h postponed_job.o: $(hdrdir)/ruby/internal/attr/restrict.h postponed_job.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -112,7 +113,6 @@ postponed_job.o: $(hdrdir)/ruby/internal/intern/enumerator.h postponed_job.o: $(hdrdir)/ruby/internal/intern/error.h postponed_job.o: $(hdrdir)/ruby/internal/intern/eval.h postponed_job.o: $(hdrdir)/ruby/internal/intern/file.h -postponed_job.o: $(hdrdir)/ruby/internal/intern/gc.h postponed_job.o: $(hdrdir)/ruby/internal/intern/hash.h postponed_job.o: $(hdrdir)/ruby/internal/intern/io.h postponed_job.o: $(hdrdir)/ruby/internal/intern/load.h @@ -143,12 +143,12 @@ postponed_job.o: $(hdrdir)/ruby/internal/memory.h postponed_job.o: $(hdrdir)/ruby/internal/method.h postponed_job.o: $(hdrdir)/ruby/internal/module.h postponed_job.o: $(hdrdir)/ruby/internal/newobj.h -postponed_job.o: $(hdrdir)/ruby/internal/rgengc.h postponed_job.o: $(hdrdir)/ruby/internal/scan_args.h postponed_job.o: $(hdrdir)/ruby/internal/special_consts.h postponed_job.o: $(hdrdir)/ruby/internal/static_assert.h postponed_job.o: $(hdrdir)/ruby/internal/stdalign.h postponed_job.o: $(hdrdir)/ruby/internal/stdbool.h +postponed_job.o: $(hdrdir)/ruby/internal/stdckdint.h postponed_job.o: $(hdrdir)/ruby/internal/symbol.h postponed_job.o: $(hdrdir)/ruby/internal/value.h postponed_job.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/postponed_job/postponed_job.c b/ext/-test-/postponed_job/postponed_job.c index fa57bef6f5..9ac866ae77 100644 --- a/ext/-test-/postponed_job/postponed_job.c +++ b/ext/-test-/postponed_job/postponed_job.c @@ -1,6 +1,29 @@ #include "ruby.h" #include "ruby/debug.h" +// We're testing deprecated things, don't print the compiler warnings +#if 0 + +#elif defined(_MSC_VER) +#pragma warning(disable : 4996) + +#elif defined(__INTEL_COMPILER) +#pragma warning(disable : 1786) + +#elif defined(__clang__) +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + +#elif defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#elif defined(__SUNPRO_CC) +#pragma error_messages (off,symdeprecated) + +#else +// :FIXME: improve here for your compiler. + +#endif + static int counter; static void @@ -58,6 +81,22 @@ pjob_call_direct(VALUE self, VALUE obj) return self; } +static void pjob_noop_callback(void *data) { } + +static VALUE +pjob_register_one_same(VALUE self) +{ + rb_gc_start(); + int r1 = rb_postponed_job_register_one(0, pjob_noop_callback, NULL); + int r2 = rb_postponed_job_register_one(0, pjob_noop_callback, NULL); + int r3 = rb_postponed_job_register_one(0, pjob_noop_callback, NULL); + VALUE ary = rb_ary_new(); + rb_ary_push(ary, INT2FIX(r1)); + rb_ary_push(ary, INT2FIX(r2)); + rb_ary_push(ary, INT2FIX(r3)); + return ary; +} + #ifdef HAVE_PTHREAD_H #include <pthread.h> @@ -86,6 +125,93 @@ pjob_register_in_c_thread(VALUE self, VALUE obj) } #endif +static void +pjob_preregistered_callback(void *data) +{ + VALUE ary = (VALUE)data; + Check_Type(ary, T_ARRAY); + rb_ary_push(ary, INT2FIX(counter)); +} + +static VALUE +pjob_preregister_and_call_with_sleep(VALUE self, VALUE obj) +{ + counter = 0; + rb_postponed_job_handle_t h = rb_postponed_job_preregister(0, pjob_preregistered_callback, (void *)obj); + counter++; + rb_postponed_job_trigger(h); + rb_thread_sleep(0); + counter++; + rb_postponed_job_trigger(h); + rb_thread_sleep(0); + counter++; + rb_postponed_job_trigger(h); + rb_thread_sleep(0); + return self; +} + +static VALUE +pjob_preregister_and_call_without_sleep(VALUE self, VALUE obj) +{ + counter = 0; + rb_postponed_job_handle_t h = rb_postponed_job_preregister(0, pjob_preregistered_callback, (void *)obj); + counter = 3; + rb_postponed_job_trigger(h); + rb_postponed_job_trigger(h); + rb_postponed_job_trigger(h); + return self; +} + +static VALUE +pjob_preregister_multiple_times(VALUE self) +{ + int r1 = rb_postponed_job_preregister(0, pjob_noop_callback, NULL); + int r2 = rb_postponed_job_preregister(0, pjob_noop_callback, NULL); + int r3 = rb_postponed_job_preregister(0, pjob_noop_callback, NULL); + VALUE ary = rb_ary_new(); + rb_ary_push(ary, INT2FIX(r1)); + rb_ary_push(ary, INT2FIX(r2)); + rb_ary_push(ary, INT2FIX(r3)); + return ary; + +} + +struct pjob_append_data_args { + VALUE ary; + VALUE data; +}; + +static void +pjob_append_data_callback(void *vctx) { + struct pjob_append_data_args *ctx = (struct pjob_append_data_args *)vctx; + Check_Type(ctx->ary, T_ARRAY); + rb_ary_push(ctx->ary, ctx->data); +} + +static VALUE +pjob_preregister_calls_with_last_argument(VALUE self) +{ + VALUE ary = rb_ary_new(); + + struct pjob_append_data_args arg1 = { .ary = ary, .data = INT2FIX(1) }; + struct pjob_append_data_args arg2 = { .ary = ary, .data = INT2FIX(2) }; + struct pjob_append_data_args arg3 = { .ary = ary, .data = INT2FIX(3) }; + struct pjob_append_data_args arg4 = { .ary = ary, .data = INT2FIX(4) }; + + rb_postponed_job_handle_t h; + h = rb_postponed_job_preregister(0, pjob_append_data_callback, &arg1); + rb_postponed_job_preregister(0, pjob_append_data_callback, &arg2); + rb_postponed_job_trigger(h); + rb_postponed_job_preregister(0, pjob_append_data_callback, &arg3); + rb_thread_sleep(0); // should execute with arg3 + + rb_postponed_job_preregister(0, pjob_append_data_callback, &arg4); + rb_postponed_job_trigger(h); + rb_thread_sleep(0); // should execute with arg4 + + return ary; +} + void Init_postponed_job(VALUE self) { @@ -93,8 +219,13 @@ Init_postponed_job(VALUE self) 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); + rb_define_module_function(mBug, "postponed_job_register_one_same", pjob_register_one_same, 0); #ifdef HAVE_PTHREAD_H rb_define_module_function(mBug, "postponed_job_register_in_c_thread", pjob_register_in_c_thread, 1); #endif + rb_define_module_function(mBug, "postponed_job_preregister_and_call_with_sleep", pjob_preregister_and_call_with_sleep, 1); + rb_define_module_function(mBug, "postponed_job_preregister_and_call_without_sleep", pjob_preregister_and_call_without_sleep, 1); + rb_define_module_function(mBug, "postponed_job_preregister_multiple_times", pjob_preregister_multiple_times, 0); + rb_define_module_function(mBug, "postponed_job_preregister_calls_with_last_argument", pjob_preregister_calls_with_last_argument, 0); } diff --git a/ext/-test-/printf/depend b/ext/-test-/printf/depend index 6dfe1fe03d..0530df78bf 100644 --- a/ext/-test-/printf/depend +++ b/ext/-test-/printf/depend @@ -53,6 +53,7 @@ printf.o: $(hdrdir)/ruby/internal/attr/noexcept.h printf.o: $(hdrdir)/ruby/internal/attr/noinline.h printf.o: $(hdrdir)/ruby/internal/attr/nonnull.h printf.o: $(hdrdir)/ruby/internal/attr/noreturn.h +printf.o: $(hdrdir)/ruby/internal/attr/packed_struct.h printf.o: $(hdrdir)/ruby/internal/attr/pure.h printf.o: $(hdrdir)/ruby/internal/attr/restrict.h printf.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ printf.o: $(hdrdir)/ruby/internal/intern/enumerator.h printf.o: $(hdrdir)/ruby/internal/intern/error.h printf.o: $(hdrdir)/ruby/internal/intern/eval.h printf.o: $(hdrdir)/ruby/internal/intern/file.h -printf.o: $(hdrdir)/ruby/internal/intern/gc.h printf.o: $(hdrdir)/ruby/internal/intern/hash.h printf.o: $(hdrdir)/ruby/internal/intern/io.h printf.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ printf.o: $(hdrdir)/ruby/internal/memory.h printf.o: $(hdrdir)/ruby/internal/method.h printf.o: $(hdrdir)/ruby/internal/module.h printf.o: $(hdrdir)/ruby/internal/newobj.h -printf.o: $(hdrdir)/ruby/internal/rgengc.h printf.o: $(hdrdir)/ruby/internal/scan_args.h printf.o: $(hdrdir)/ruby/internal/special_consts.h printf.o: $(hdrdir)/ruby/internal/static_assert.h printf.o: $(hdrdir)/ruby/internal/stdalign.h printf.o: $(hdrdir)/ruby/internal/stdbool.h +printf.o: $(hdrdir)/ruby/internal/stdckdint.h printf.o: $(hdrdir)/ruby/internal/symbol.h printf.o: $(hdrdir)/ruby/internal/value.h printf.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/proc/depend b/ext/-test-/proc/depend index e3f1cf6ce9..45e12bcd09 100644 --- a/ext/-test-/proc/depend +++ b/ext/-test-/proc/depend @@ -52,6 +52,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ receiver.o: $(hdrdir)/ruby/internal/attr/noexcept.h receiver.o: $(hdrdir)/ruby/internal/attr/noinline.h receiver.o: $(hdrdir)/ruby/internal/attr/nonnull.h receiver.o: $(hdrdir)/ruby/internal/attr/noreturn.h +receiver.o: $(hdrdir)/ruby/internal/attr/packed_struct.h receiver.o: $(hdrdir)/ruby/internal/attr/pure.h receiver.o: $(hdrdir)/ruby/internal/attr/restrict.h receiver.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ receiver.o: $(hdrdir)/ruby/internal/intern/enumerator.h receiver.o: $(hdrdir)/ruby/internal/intern/error.h receiver.o: $(hdrdir)/ruby/internal/intern/eval.h receiver.o: $(hdrdir)/ruby/internal/intern/file.h -receiver.o: $(hdrdir)/ruby/internal/intern/gc.h receiver.o: $(hdrdir)/ruby/internal/intern/hash.h receiver.o: $(hdrdir)/ruby/internal/intern/io.h receiver.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ receiver.o: $(hdrdir)/ruby/internal/memory.h receiver.o: $(hdrdir)/ruby/internal/method.h receiver.o: $(hdrdir)/ruby/internal/module.h receiver.o: $(hdrdir)/ruby/internal/newobj.h -receiver.o: $(hdrdir)/ruby/internal/rgengc.h receiver.o: $(hdrdir)/ruby/internal/scan_args.h receiver.o: $(hdrdir)/ruby/internal/special_consts.h receiver.o: $(hdrdir)/ruby/internal/static_assert.h receiver.o: $(hdrdir)/ruby/internal/stdalign.h receiver.o: $(hdrdir)/ruby/internal/stdbool.h +receiver.o: $(hdrdir)/ruby/internal/stdckdint.h receiver.o: $(hdrdir)/ruby/internal/symbol.h receiver.o: $(hdrdir)/ruby/internal/value.h receiver.o: $(hdrdir)/ruby/internal/value_type.h @@ -372,6 +372,7 @@ super.o: $(hdrdir)/ruby/internal/attr/noexcept.h super.o: $(hdrdir)/ruby/internal/attr/noinline.h super.o: $(hdrdir)/ruby/internal/attr/nonnull.h super.o: $(hdrdir)/ruby/internal/attr/noreturn.h +super.o: $(hdrdir)/ruby/internal/attr/packed_struct.h super.o: $(hdrdir)/ruby/internal/attr/pure.h super.o: $(hdrdir)/ruby/internal/attr/restrict.h super.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -431,7 +432,6 @@ super.o: $(hdrdir)/ruby/internal/intern/enumerator.h super.o: $(hdrdir)/ruby/internal/intern/error.h super.o: $(hdrdir)/ruby/internal/intern/eval.h super.o: $(hdrdir)/ruby/internal/intern/file.h -super.o: $(hdrdir)/ruby/internal/intern/gc.h super.o: $(hdrdir)/ruby/internal/intern/hash.h super.o: $(hdrdir)/ruby/internal/intern/io.h super.o: $(hdrdir)/ruby/internal/intern/load.h @@ -462,12 +462,12 @@ super.o: $(hdrdir)/ruby/internal/memory.h super.o: $(hdrdir)/ruby/internal/method.h super.o: $(hdrdir)/ruby/internal/module.h super.o: $(hdrdir)/ruby/internal/newobj.h -super.o: $(hdrdir)/ruby/internal/rgengc.h super.o: $(hdrdir)/ruby/internal/scan_args.h super.o: $(hdrdir)/ruby/internal/special_consts.h super.o: $(hdrdir)/ruby/internal/static_assert.h super.o: $(hdrdir)/ruby/internal/stdalign.h super.o: $(hdrdir)/ruby/internal/stdbool.h +super.o: $(hdrdir)/ruby/internal/stdckdint.h super.o: $(hdrdir)/ruby/internal/symbol.h super.o: $(hdrdir)/ruby/internal/value.h super.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/random/depend b/ext/-test-/random/depend index f2cbf7fc14..71f5f6e1e6 100644 --- a/ext/-test-/random/depend +++ b/ext/-test-/random/depend @@ -51,6 +51,7 @@ bad_version.o: $(hdrdir)/ruby/internal/attr/noexcept.h bad_version.o: $(hdrdir)/ruby/internal/attr/noinline.h bad_version.o: $(hdrdir)/ruby/internal/attr/nonnull.h bad_version.o: $(hdrdir)/ruby/internal/attr/noreturn.h +bad_version.o: $(hdrdir)/ruby/internal/attr/packed_struct.h bad_version.o: $(hdrdir)/ruby/internal/attr/pure.h bad_version.o: $(hdrdir)/ruby/internal/attr/restrict.h bad_version.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ bad_version.o: $(hdrdir)/ruby/internal/intern/enumerator.h bad_version.o: $(hdrdir)/ruby/internal/intern/error.h bad_version.o: $(hdrdir)/ruby/internal/intern/eval.h bad_version.o: $(hdrdir)/ruby/internal/intern/file.h -bad_version.o: $(hdrdir)/ruby/internal/intern/gc.h bad_version.o: $(hdrdir)/ruby/internal/intern/hash.h bad_version.o: $(hdrdir)/ruby/internal/intern/io.h bad_version.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ bad_version.o: $(hdrdir)/ruby/internal/memory.h bad_version.o: $(hdrdir)/ruby/internal/method.h bad_version.o: $(hdrdir)/ruby/internal/module.h bad_version.o: $(hdrdir)/ruby/internal/newobj.h -bad_version.o: $(hdrdir)/ruby/internal/rgengc.h bad_version.o: $(hdrdir)/ruby/internal/scan_args.h bad_version.o: $(hdrdir)/ruby/internal/special_consts.h bad_version.o: $(hdrdir)/ruby/internal/static_assert.h bad_version.o: $(hdrdir)/ruby/internal/stdalign.h bad_version.o: $(hdrdir)/ruby/internal/stdbool.h +bad_version.o: $(hdrdir)/ruby/internal/stdckdint.h bad_version.o: $(hdrdir)/ruby/internal/symbol.h bad_version.o: $(hdrdir)/ruby/internal/value.h bad_version.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -371,6 +371,7 @@ loop.o: $(hdrdir)/ruby/internal/attr/noexcept.h loop.o: $(hdrdir)/ruby/internal/attr/noinline.h loop.o: $(hdrdir)/ruby/internal/attr/nonnull.h loop.o: $(hdrdir)/ruby/internal/attr/noreturn.h +loop.o: $(hdrdir)/ruby/internal/attr/packed_struct.h loop.o: $(hdrdir)/ruby/internal/attr/pure.h loop.o: $(hdrdir)/ruby/internal/attr/restrict.h loop.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -430,7 +431,6 @@ loop.o: $(hdrdir)/ruby/internal/intern/enumerator.h loop.o: $(hdrdir)/ruby/internal/intern/error.h loop.o: $(hdrdir)/ruby/internal/intern/eval.h loop.o: $(hdrdir)/ruby/internal/intern/file.h -loop.o: $(hdrdir)/ruby/internal/intern/gc.h loop.o: $(hdrdir)/ruby/internal/intern/hash.h loop.o: $(hdrdir)/ruby/internal/intern/io.h loop.o: $(hdrdir)/ruby/internal/intern/load.h @@ -461,12 +461,12 @@ loop.o: $(hdrdir)/ruby/internal/memory.h loop.o: $(hdrdir)/ruby/internal/method.h loop.o: $(hdrdir)/ruby/internal/module.h loop.o: $(hdrdir)/ruby/internal/newobj.h -loop.o: $(hdrdir)/ruby/internal/rgengc.h loop.o: $(hdrdir)/ruby/internal/scan_args.h loop.o: $(hdrdir)/ruby/internal/special_consts.h loop.o: $(hdrdir)/ruby/internal/static_assert.h loop.o: $(hdrdir)/ruby/internal/stdalign.h loop.o: $(hdrdir)/ruby/internal/stdbool.h +loop.o: $(hdrdir)/ruby/internal/stdckdint.h loop.o: $(hdrdir)/ruby/internal/symbol.h loop.o: $(hdrdir)/ruby/internal/value.h loop.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/rational/depend b/ext/-test-/rational/depend index ce977821b8..363d779302 100644 --- a/ext/-test-/rational/depend +++ b/ext/-test-/rational/depend @@ -56,6 +56,7 @@ rat.o: $(hdrdir)/ruby/internal/attr/noexcept.h rat.o: $(hdrdir)/ruby/internal/attr/noinline.h rat.o: $(hdrdir)/ruby/internal/attr/nonnull.h rat.o: $(hdrdir)/ruby/internal/attr/noreturn.h +rat.o: $(hdrdir)/ruby/internal/attr/packed_struct.h rat.o: $(hdrdir)/ruby/internal/attr/pure.h rat.o: $(hdrdir)/ruby/internal/attr/restrict.h rat.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -115,7 +116,6 @@ rat.o: $(hdrdir)/ruby/internal/intern/enumerator.h rat.o: $(hdrdir)/ruby/internal/intern/error.h rat.o: $(hdrdir)/ruby/internal/intern/eval.h rat.o: $(hdrdir)/ruby/internal/intern/file.h -rat.o: $(hdrdir)/ruby/internal/intern/gc.h rat.o: $(hdrdir)/ruby/internal/intern/hash.h rat.o: $(hdrdir)/ruby/internal/intern/io.h rat.o: $(hdrdir)/ruby/internal/intern/load.h @@ -146,12 +146,12 @@ rat.o: $(hdrdir)/ruby/internal/memory.h rat.o: $(hdrdir)/ruby/internal/method.h rat.o: $(hdrdir)/ruby/internal/module.h rat.o: $(hdrdir)/ruby/internal/newobj.h -rat.o: $(hdrdir)/ruby/internal/rgengc.h rat.o: $(hdrdir)/ruby/internal/scan_args.h rat.o: $(hdrdir)/ruby/internal/special_consts.h rat.o: $(hdrdir)/ruby/internal/static_assert.h rat.o: $(hdrdir)/ruby/internal/stdalign.h rat.o: $(hdrdir)/ruby/internal/stdbool.h +rat.o: $(hdrdir)/ruby/internal/stdckdint.h rat.o: $(hdrdir)/ruby/internal/symbol.h rat.o: $(hdrdir)/ruby/internal/value.h rat.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/rb_call_super_kw/depend b/ext/-test-/rb_call_super_kw/depend index 3512a081c9..04a0fac12c 100644 --- a/ext/-test-/rb_call_super_kw/depend +++ b/ext/-test-/rb_call_super_kw/depend @@ -52,6 +52,7 @@ rb_call_super_kw.o: $(hdrdir)/ruby/internal/attr/noexcept.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/attr/noinline.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/attr/nonnull.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/attr/noreturn.h +rb_call_super_kw.o: $(hdrdir)/ruby/internal/attr/packed_struct.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/attr/pure.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/attr/restrict.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ rb_call_super_kw.o: $(hdrdir)/ruby/internal/intern/enumerator.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/intern/error.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/intern/eval.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/intern/file.h -rb_call_super_kw.o: $(hdrdir)/ruby/internal/intern/gc.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/intern/hash.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/intern/io.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ rb_call_super_kw.o: $(hdrdir)/ruby/internal/memory.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/method.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/module.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/newobj.h -rb_call_super_kw.o: $(hdrdir)/ruby/internal/rgengc.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/scan_args.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/special_consts.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/static_assert.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/stdalign.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/stdbool.h +rb_call_super_kw.o: $(hdrdir)/ruby/internal/stdckdint.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/symbol.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/value.h rb_call_super_kw.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/recursion/depend b/ext/-test-/recursion/depend index e499f95e73..2a65c98b09 100644 --- a/ext/-test-/recursion/depend +++ b/ext/-test-/recursion/depend @@ -52,6 +52,7 @@ recursion.o: $(hdrdir)/ruby/internal/attr/noexcept.h recursion.o: $(hdrdir)/ruby/internal/attr/noinline.h recursion.o: $(hdrdir)/ruby/internal/attr/nonnull.h recursion.o: $(hdrdir)/ruby/internal/attr/noreturn.h +recursion.o: $(hdrdir)/ruby/internal/attr/packed_struct.h recursion.o: $(hdrdir)/ruby/internal/attr/pure.h recursion.o: $(hdrdir)/ruby/internal/attr/restrict.h recursion.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ recursion.o: $(hdrdir)/ruby/internal/intern/enumerator.h recursion.o: $(hdrdir)/ruby/internal/intern/error.h recursion.o: $(hdrdir)/ruby/internal/intern/eval.h recursion.o: $(hdrdir)/ruby/internal/intern/file.h -recursion.o: $(hdrdir)/ruby/internal/intern/gc.h recursion.o: $(hdrdir)/ruby/internal/intern/hash.h recursion.o: $(hdrdir)/ruby/internal/intern/io.h recursion.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ recursion.o: $(hdrdir)/ruby/internal/memory.h recursion.o: $(hdrdir)/ruby/internal/method.h recursion.o: $(hdrdir)/ruby/internal/module.h recursion.o: $(hdrdir)/ruby/internal/newobj.h -recursion.o: $(hdrdir)/ruby/internal/rgengc.h recursion.o: $(hdrdir)/ruby/internal/scan_args.h recursion.o: $(hdrdir)/ruby/internal/special_consts.h recursion.o: $(hdrdir)/ruby/internal/static_assert.h recursion.o: $(hdrdir)/ruby/internal/stdalign.h recursion.o: $(hdrdir)/ruby/internal/stdbool.h +recursion.o: $(hdrdir)/ruby/internal/stdckdint.h recursion.o: $(hdrdir)/ruby/internal/symbol.h recursion.o: $(hdrdir)/ruby/internal/value.h recursion.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/regexp/depend b/ext/-test-/regexp/depend index fa431e013a..0127a66a2e 100644 --- a/ext/-test-/regexp/depend +++ b/ext/-test-/regexp/depend @@ -52,6 +52,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ parse_depth_limit.o: $(hdrdir)/ruby/internal/attr/noexcept.h parse_depth_limit.o: $(hdrdir)/ruby/internal/attr/noinline.h parse_depth_limit.o: $(hdrdir)/ruby/internal/attr/nonnull.h parse_depth_limit.o: $(hdrdir)/ruby/internal/attr/noreturn.h +parse_depth_limit.o: $(hdrdir)/ruby/internal/attr/packed_struct.h parse_depth_limit.o: $(hdrdir)/ruby/internal/attr/pure.h parse_depth_limit.o: $(hdrdir)/ruby/internal/attr/restrict.h parse_depth_limit.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ parse_depth_limit.o: $(hdrdir)/ruby/internal/intern/enumerator.h parse_depth_limit.o: $(hdrdir)/ruby/internal/intern/error.h parse_depth_limit.o: $(hdrdir)/ruby/internal/intern/eval.h parse_depth_limit.o: $(hdrdir)/ruby/internal/intern/file.h -parse_depth_limit.o: $(hdrdir)/ruby/internal/intern/gc.h parse_depth_limit.o: $(hdrdir)/ruby/internal/intern/hash.h parse_depth_limit.o: $(hdrdir)/ruby/internal/intern/io.h parse_depth_limit.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ parse_depth_limit.o: $(hdrdir)/ruby/internal/memory.h parse_depth_limit.o: $(hdrdir)/ruby/internal/method.h parse_depth_limit.o: $(hdrdir)/ruby/internal/module.h parse_depth_limit.o: $(hdrdir)/ruby/internal/newobj.h -parse_depth_limit.o: $(hdrdir)/ruby/internal/rgengc.h parse_depth_limit.o: $(hdrdir)/ruby/internal/scan_args.h parse_depth_limit.o: $(hdrdir)/ruby/internal/special_consts.h parse_depth_limit.o: $(hdrdir)/ruby/internal/static_assert.h parse_depth_limit.o: $(hdrdir)/ruby/internal/stdalign.h parse_depth_limit.o: $(hdrdir)/ruby/internal/stdbool.h +parse_depth_limit.o: $(hdrdir)/ruby/internal/stdckdint.h parse_depth_limit.o: $(hdrdir)/ruby/internal/symbol.h parse_depth_limit.o: $(hdrdir)/ruby/internal/value.h parse_depth_limit.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/scan_args/depend b/ext/-test-/scan_args/depend index 2194936b04..922e5bbd5c 100644 --- a/ext/-test-/scan_args/depend +++ b/ext/-test-/scan_args/depend @@ -52,6 +52,7 @@ scan_args.o: $(hdrdir)/ruby/internal/attr/noexcept.h scan_args.o: $(hdrdir)/ruby/internal/attr/noinline.h scan_args.o: $(hdrdir)/ruby/internal/attr/nonnull.h scan_args.o: $(hdrdir)/ruby/internal/attr/noreturn.h +scan_args.o: $(hdrdir)/ruby/internal/attr/packed_struct.h scan_args.o: $(hdrdir)/ruby/internal/attr/pure.h scan_args.o: $(hdrdir)/ruby/internal/attr/restrict.h scan_args.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ scan_args.o: $(hdrdir)/ruby/internal/intern/enumerator.h scan_args.o: $(hdrdir)/ruby/internal/intern/error.h scan_args.o: $(hdrdir)/ruby/internal/intern/eval.h scan_args.o: $(hdrdir)/ruby/internal/intern/file.h -scan_args.o: $(hdrdir)/ruby/internal/intern/gc.h scan_args.o: $(hdrdir)/ruby/internal/intern/hash.h scan_args.o: $(hdrdir)/ruby/internal/intern/io.h scan_args.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ scan_args.o: $(hdrdir)/ruby/internal/memory.h scan_args.o: $(hdrdir)/ruby/internal/method.h scan_args.o: $(hdrdir)/ruby/internal/module.h scan_args.o: $(hdrdir)/ruby/internal/newobj.h -scan_args.o: $(hdrdir)/ruby/internal/rgengc.h scan_args.o: $(hdrdir)/ruby/internal/scan_args.h scan_args.o: $(hdrdir)/ruby/internal/special_consts.h scan_args.o: $(hdrdir)/ruby/internal/static_assert.h scan_args.o: $(hdrdir)/ruby/internal/stdalign.h scan_args.o: $(hdrdir)/ruby/internal/stdbool.h +scan_args.o: $(hdrdir)/ruby/internal/stdckdint.h scan_args.o: $(hdrdir)/ruby/internal/symbol.h scan_args.o: $(hdrdir)/ruby/internal/value.h scan_args.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/st/foreach/depend b/ext/-test-/st/foreach/depend index 0464ee3c53..36273f8df8 100644 --- a/ext/-test-/st/foreach/depend +++ b/ext/-test-/st/foreach/depend @@ -52,6 +52,7 @@ foreach.o: $(hdrdir)/ruby/internal/attr/noexcept.h foreach.o: $(hdrdir)/ruby/internal/attr/noinline.h foreach.o: $(hdrdir)/ruby/internal/attr/nonnull.h foreach.o: $(hdrdir)/ruby/internal/attr/noreturn.h +foreach.o: $(hdrdir)/ruby/internal/attr/packed_struct.h foreach.o: $(hdrdir)/ruby/internal/attr/pure.h foreach.o: $(hdrdir)/ruby/internal/attr/restrict.h foreach.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ foreach.o: $(hdrdir)/ruby/internal/intern/enumerator.h foreach.o: $(hdrdir)/ruby/internal/intern/error.h foreach.o: $(hdrdir)/ruby/internal/intern/eval.h foreach.o: $(hdrdir)/ruby/internal/intern/file.h -foreach.o: $(hdrdir)/ruby/internal/intern/gc.h foreach.o: $(hdrdir)/ruby/internal/intern/hash.h foreach.o: $(hdrdir)/ruby/internal/intern/io.h foreach.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ foreach.o: $(hdrdir)/ruby/internal/memory.h foreach.o: $(hdrdir)/ruby/internal/method.h foreach.o: $(hdrdir)/ruby/internal/module.h foreach.o: $(hdrdir)/ruby/internal/newobj.h -foreach.o: $(hdrdir)/ruby/internal/rgengc.h foreach.o: $(hdrdir)/ruby/internal/scan_args.h foreach.o: $(hdrdir)/ruby/internal/special_consts.h foreach.o: $(hdrdir)/ruby/internal/static_assert.h foreach.o: $(hdrdir)/ruby/internal/stdalign.h foreach.o: $(hdrdir)/ruby/internal/stdbool.h +foreach.o: $(hdrdir)/ruby/internal/stdckdint.h foreach.o: $(hdrdir)/ruby/internal/symbol.h foreach.o: $(hdrdir)/ruby/internal/value.h foreach.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/st/foreach/foreach.c b/ext/-test-/st/foreach/foreach.c index cde49fb26d..7fbf064694 100644 --- a/ext/-test-/st/foreach/foreach.c +++ b/ext/-test-/st/foreach/foreach.c @@ -14,20 +14,20 @@ force_unpack_check(struct checker *c, st_data_t key, st_data_t val) if (c->nr == 0) { st_data_t i; - if (c->tbl->bins != NULL) rb_bug("should be packed\n"); + if (c->tbl->bins != NULL) rb_bug("should be packed"); /* force unpacking during iteration: */ for (i = 1; i < expect_size; i++) st_add_direct(c->tbl, i, i); - if (c->tbl->bins == NULL) rb_bug("should be unpacked\n"); + if (c->tbl->bins == NULL) rb_bug("should be unpacked"); } if (key != c->nr) { - rb_bug("unexpected key: %"PRIuVALUE" (expected %"PRIuVALUE")\n", (VALUE)key, (VALUE)c->nr); + rb_bug("unexpected key: %"PRIuVALUE" (expected %"PRIuVALUE")", (VALUE)key, (VALUE)c->nr); } if (val != c->nr) { - rb_bug("unexpected val: %"PRIuVALUE" (expected %"PRIuVALUE")\n", (VALUE)val, (VALUE)c->nr); + rb_bug("unexpected val: %"PRIuVALUE" (expected %"PRIuVALUE")", (VALUE)val, (VALUE)c->nr); } c->nr++; @@ -60,7 +60,7 @@ unp_fec_i(st_data_t key, st_data_t val, st_data_t args, int error) st_data_t v; if (!st_delete(c->tbl, &k, &v)) { - rb_bug("failed to delete\n"); + rb_bug("failed to delete"); } if (v != 0) { rb_bug("unexpected value deleted: %"PRIuVALUE" (expected 0)", (VALUE)v); @@ -84,21 +84,21 @@ unp_fec(VALUE self, VALUE test) st_add_direct(tbl, 0, 0); - if (tbl->bins != NULL) rb_bug("should still be packed\n"); + if (tbl->bins != NULL) rb_bug("should still be packed"); st_foreach_check(tbl, unp_fec_i, (st_data_t)&c, -1); if (c.test == ID2SYM(rb_intern("delete2"))) { if (c.nr != 1) { - rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)\n", (VALUE)c.nr); + rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)", (VALUE)c.nr); } } else if (c.nr != expect_size) { - rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE")\n", + rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE")", (VALUE)c.nr, (VALUE)expect_size); } - if (tbl->bins == NULL) rb_bug("should be unpacked\n"); + if (tbl->bins == NULL) rb_bug("should be unpacked"); st_free_table(tbl); @@ -120,14 +120,14 @@ unp_fe_i(st_data_t key, st_data_t val, st_data_t args) st_data_t v; if (!st_delete(c->tbl, &k, &v)) { - rb_bug("failed to delete\n"); + rb_bug("failed to delete"); } if (v != 0) { rb_bug("unexpected value deleted: %"PRIuVALUE" (expected 0)", (VALUE)v); } return ST_CONTINUE; } - rb_bug("should never get here\n"); + rb_bug("should never get here"); } rb_raise(rb_eArgError, "unexpected arg: %+"PRIsVALUE, c->test); @@ -145,21 +145,21 @@ unp_fe(VALUE self, VALUE test) st_add_direct(tbl, 0, 0); - if (tbl->bins != NULL) rb_bug("should still be packed\n"); + if (tbl->bins != NULL) rb_bug("should still be packed"); st_foreach(tbl, unp_fe_i, (st_data_t)&c); if (c.test == ID2SYM(rb_intern("unpack_delete"))) { if (c.nr != 1) { - rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)\n", (VALUE)c.nr); + rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)", (VALUE)c.nr); } } else if (c.nr != expect_size) { - rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE"o)\n", + rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE"o)", (VALUE)c.nr, (VALUE)expect_size); } - if (tbl->bins == NULL) rb_bug("should be unpacked\n"); + if (tbl->bins == NULL) rb_bug("should be unpacked"); st_free_table(tbl); diff --git a/ext/-test-/st/numhash/depend b/ext/-test-/st/numhash/depend index 9665ed6e39..a0916183b6 100644 --- a/ext/-test-/st/numhash/depend +++ b/ext/-test-/st/numhash/depend @@ -52,6 +52,7 @@ numhash.o: $(hdrdir)/ruby/internal/attr/noexcept.h numhash.o: $(hdrdir)/ruby/internal/attr/noinline.h numhash.o: $(hdrdir)/ruby/internal/attr/nonnull.h numhash.o: $(hdrdir)/ruby/internal/attr/noreturn.h +numhash.o: $(hdrdir)/ruby/internal/attr/packed_struct.h numhash.o: $(hdrdir)/ruby/internal/attr/pure.h numhash.o: $(hdrdir)/ruby/internal/attr/restrict.h numhash.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ numhash.o: $(hdrdir)/ruby/internal/intern/enumerator.h numhash.o: $(hdrdir)/ruby/internal/intern/error.h numhash.o: $(hdrdir)/ruby/internal/intern/eval.h numhash.o: $(hdrdir)/ruby/internal/intern/file.h -numhash.o: $(hdrdir)/ruby/internal/intern/gc.h numhash.o: $(hdrdir)/ruby/internal/intern/hash.h numhash.o: $(hdrdir)/ruby/internal/intern/io.h numhash.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ numhash.o: $(hdrdir)/ruby/internal/memory.h numhash.o: $(hdrdir)/ruby/internal/method.h numhash.o: $(hdrdir)/ruby/internal/module.h numhash.o: $(hdrdir)/ruby/internal/newobj.h -numhash.o: $(hdrdir)/ruby/internal/rgengc.h numhash.o: $(hdrdir)/ruby/internal/scan_args.h numhash.o: $(hdrdir)/ruby/internal/special_consts.h numhash.o: $(hdrdir)/ruby/internal/static_assert.h numhash.o: $(hdrdir)/ruby/internal/stdalign.h numhash.o: $(hdrdir)/ruby/internal/stdbool.h +numhash.o: $(hdrdir)/ruby/internal/stdckdint.h numhash.o: $(hdrdir)/ruby/internal/symbol.h numhash.o: $(hdrdir)/ruby/internal/value.h numhash.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/st/update/depend b/ext/-test-/st/update/depend index 01960df965..96ba194df0 100644 --- a/ext/-test-/st/update/depend +++ b/ext/-test-/st/update/depend @@ -52,6 +52,7 @@ update.o: $(hdrdir)/ruby/internal/attr/noexcept.h update.o: $(hdrdir)/ruby/internal/attr/noinline.h update.o: $(hdrdir)/ruby/internal/attr/nonnull.h update.o: $(hdrdir)/ruby/internal/attr/noreturn.h +update.o: $(hdrdir)/ruby/internal/attr/packed_struct.h update.o: $(hdrdir)/ruby/internal/attr/pure.h update.o: $(hdrdir)/ruby/internal/attr/restrict.h update.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ update.o: $(hdrdir)/ruby/internal/intern/enumerator.h update.o: $(hdrdir)/ruby/internal/intern/error.h update.o: $(hdrdir)/ruby/internal/intern/eval.h update.o: $(hdrdir)/ruby/internal/intern/file.h -update.o: $(hdrdir)/ruby/internal/intern/gc.h update.o: $(hdrdir)/ruby/internal/intern/hash.h update.o: $(hdrdir)/ruby/internal/intern/io.h update.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ update.o: $(hdrdir)/ruby/internal/memory.h update.o: $(hdrdir)/ruby/internal/method.h update.o: $(hdrdir)/ruby/internal/module.h update.o: $(hdrdir)/ruby/internal/newobj.h -update.o: $(hdrdir)/ruby/internal/rgengc.h update.o: $(hdrdir)/ruby/internal/scan_args.h update.o: $(hdrdir)/ruby/internal/special_consts.h update.o: $(hdrdir)/ruby/internal/static_assert.h update.o: $(hdrdir)/ruby/internal/stdalign.h update.o: $(hdrdir)/ruby/internal/stdbool.h +update.o: $(hdrdir)/ruby/internal/stdckdint.h update.o: $(hdrdir)/ruby/internal/symbol.h update.o: $(hdrdir)/ruby/internal/value.h update.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/string/chilled.c b/ext/-test-/string/chilled.c new file mode 100644 index 0000000000..c98fc72c47 --- /dev/null +++ b/ext/-test-/string/chilled.c @@ -0,0 +1,13 @@ +#include "ruby.h" + +static VALUE +bug_s_rb_str_chilled_p(VALUE self, VALUE str) +{ + return rb_str_chilled_p(str) ? Qtrue : Qfalse; +} + +void +Init_string_chilled(VALUE klass) +{ + rb_define_singleton_method(klass, "rb_str_chilled_p", bug_s_rb_str_chilled_p, 1); +} diff --git a/ext/-test-/string/cstr.c b/ext/-test-/string/cstr.c index 468ee7a3b1..b0b1ef5374 100644 --- a/ext/-test-/string/cstr.c +++ b/ext/-test-/string/cstr.c @@ -61,18 +61,12 @@ bug_str_unterminated_substring(VALUE str, VALUE vbeg, VALUE vlen) if (RSTRING_LEN(str) < beg) rb_raise(rb_eIndexError, "beg: %ld", beg); if (RSTRING_LEN(str) < beg + len) rb_raise(rb_eIndexError, "end: %ld", beg + len); str = rb_str_new_shared(str); + RSTRING(str)->len = len; if (STR_EMBED_P(str)) { -#if USE_RVARGC - RSTRING(str)->as.embed.len = (short)len; -#else - RSTRING(str)->basic.flags &= ~RSTRING_EMBED_LEN_MASK; - RSTRING(str)->basic.flags |= len << RSTRING_EMBED_LEN_SHIFT; -#endif memmove(RSTRING(str)->as.embed.ary, RSTRING(str)->as.embed.ary + beg, len); } else { RSTRING(str)->as.heap.ptr += beg; - RSTRING(str)->as.heap.len = len; } return str; } @@ -116,14 +110,10 @@ bug_str_s_cstr_noembed(VALUE self, VALUE str) Check_Type(str, T_STRING); FL_SET((str2), STR_NOEMBED); memcpy(buf, RSTRING_PTR(str), capacity); -#if USE_RVARGC RBASIC(str2)->flags &= ~(STR_SHARED | FL_USER5 | FL_USER6); -#else - RBASIC(str2)->flags &= ~RSTRING_EMBED_LEN_MASK; -#endif RSTRING(str2)->as.heap.aux.capa = capacity; RSTRING(str2)->as.heap.ptr = buf; - RSTRING(str2)->as.heap.len = RSTRING_LEN(str); + RSTRING(str2)->len = RSTRING_LEN(str); TERM_FILL(RSTRING_END(str2), TERM_LEN(str)); return str2; } diff --git a/ext/-test-/string/depend b/ext/-test-/string/depend index 773231047e..044b6109ff 100644 --- a/ext/-test-/string/depend +++ b/ext/-test-/string/depend @@ -54,6 +54,7 @@ capacity.o: $(hdrdir)/ruby/internal/attr/noexcept.h capacity.o: $(hdrdir)/ruby/internal/attr/noinline.h capacity.o: $(hdrdir)/ruby/internal/attr/nonnull.h capacity.o: $(hdrdir)/ruby/internal/attr/noreturn.h +capacity.o: $(hdrdir)/ruby/internal/attr/packed_struct.h capacity.o: $(hdrdir)/ruby/internal/attr/pure.h capacity.o: $(hdrdir)/ruby/internal/attr/restrict.h capacity.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -122,7 +123,6 @@ capacity.o: $(hdrdir)/ruby/internal/intern/enumerator.h capacity.o: $(hdrdir)/ruby/internal/intern/error.h capacity.o: $(hdrdir)/ruby/internal/intern/eval.h capacity.o: $(hdrdir)/ruby/internal/intern/file.h -capacity.o: $(hdrdir)/ruby/internal/intern/gc.h capacity.o: $(hdrdir)/ruby/internal/intern/hash.h capacity.o: $(hdrdir)/ruby/internal/intern/io.h capacity.o: $(hdrdir)/ruby/internal/intern/load.h @@ -153,12 +153,12 @@ capacity.o: $(hdrdir)/ruby/internal/memory.h capacity.o: $(hdrdir)/ruby/internal/method.h capacity.o: $(hdrdir)/ruby/internal/module.h capacity.o: $(hdrdir)/ruby/internal/newobj.h -capacity.o: $(hdrdir)/ruby/internal/rgengc.h capacity.o: $(hdrdir)/ruby/internal/scan_args.h capacity.o: $(hdrdir)/ruby/internal/special_consts.h capacity.o: $(hdrdir)/ruby/internal/static_assert.h capacity.o: $(hdrdir)/ruby/internal/stdalign.h capacity.o: $(hdrdir)/ruby/internal/stdbool.h +capacity.o: $(hdrdir)/ruby/internal/stdckdint.h capacity.o: $(hdrdir)/ruby/internal/symbol.h capacity.o: $(hdrdir)/ruby/internal/value.h capacity.o: $(hdrdir)/ruby/internal/value_type.h @@ -174,6 +174,166 @@ capacity.o: $(hdrdir)/ruby/subst.h capacity.o: $(top_srcdir)/internal/compilers.h capacity.o: $(top_srcdir)/internal/string.h capacity.o: capacity.c +chilled.o: $(RUBY_EXTCONF_H) +chilled.o: $(arch_hdrdir)/ruby/config.h +chilled.o: $(hdrdir)/ruby.h +chilled.o: $(hdrdir)/ruby/assert.h +chilled.o: $(hdrdir)/ruby/backward.h +chilled.o: $(hdrdir)/ruby/backward/2/assume.h +chilled.o: $(hdrdir)/ruby/backward/2/attributes.h +chilled.o: $(hdrdir)/ruby/backward/2/bool.h +chilled.o: $(hdrdir)/ruby/backward/2/inttypes.h +chilled.o: $(hdrdir)/ruby/backward/2/limits.h +chilled.o: $(hdrdir)/ruby/backward/2/long_long.h +chilled.o: $(hdrdir)/ruby/backward/2/stdalign.h +chilled.o: $(hdrdir)/ruby/backward/2/stdarg.h +chilled.o: $(hdrdir)/ruby/defines.h +chilled.o: $(hdrdir)/ruby/intern.h +chilled.o: $(hdrdir)/ruby/internal/abi.h +chilled.o: $(hdrdir)/ruby/internal/anyargs.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/char.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/double.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/int.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/long.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/short.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +chilled.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +chilled.o: $(hdrdir)/ruby/internal/assume.h +chilled.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +chilled.o: $(hdrdir)/ruby/internal/attr/artificial.h +chilled.o: $(hdrdir)/ruby/internal/attr/cold.h +chilled.o: $(hdrdir)/ruby/internal/attr/const.h +chilled.o: $(hdrdir)/ruby/internal/attr/constexpr.h +chilled.o: $(hdrdir)/ruby/internal/attr/deprecated.h +chilled.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +chilled.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +chilled.o: $(hdrdir)/ruby/internal/attr/error.h +chilled.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +chilled.o: $(hdrdir)/ruby/internal/attr/forceinline.h +chilled.o: $(hdrdir)/ruby/internal/attr/format.h +chilled.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +chilled.o: $(hdrdir)/ruby/internal/attr/noalias.h +chilled.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +chilled.o: $(hdrdir)/ruby/internal/attr/noexcept.h +chilled.o: $(hdrdir)/ruby/internal/attr/noinline.h +chilled.o: $(hdrdir)/ruby/internal/attr/nonnull.h +chilled.o: $(hdrdir)/ruby/internal/attr/noreturn.h +chilled.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +chilled.o: $(hdrdir)/ruby/internal/attr/pure.h +chilled.o: $(hdrdir)/ruby/internal/attr/restrict.h +chilled.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +chilled.o: $(hdrdir)/ruby/internal/attr/warning.h +chilled.o: $(hdrdir)/ruby/internal/attr/weakref.h +chilled.o: $(hdrdir)/ruby/internal/cast.h +chilled.o: $(hdrdir)/ruby/internal/compiler_is.h +chilled.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +chilled.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +chilled.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +chilled.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +chilled.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +chilled.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +chilled.o: $(hdrdir)/ruby/internal/compiler_since.h +chilled.o: $(hdrdir)/ruby/internal/config.h +chilled.o: $(hdrdir)/ruby/internal/constant_p.h +chilled.o: $(hdrdir)/ruby/internal/core.h +chilled.o: $(hdrdir)/ruby/internal/core/rarray.h +chilled.o: $(hdrdir)/ruby/internal/core/rbasic.h +chilled.o: $(hdrdir)/ruby/internal/core/rbignum.h +chilled.o: $(hdrdir)/ruby/internal/core/rclass.h +chilled.o: $(hdrdir)/ruby/internal/core/rdata.h +chilled.o: $(hdrdir)/ruby/internal/core/rfile.h +chilled.o: $(hdrdir)/ruby/internal/core/rhash.h +chilled.o: $(hdrdir)/ruby/internal/core/robject.h +chilled.o: $(hdrdir)/ruby/internal/core/rregexp.h +chilled.o: $(hdrdir)/ruby/internal/core/rstring.h +chilled.o: $(hdrdir)/ruby/internal/core/rstruct.h +chilled.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +chilled.o: $(hdrdir)/ruby/internal/ctype.h +chilled.o: $(hdrdir)/ruby/internal/dllexport.h +chilled.o: $(hdrdir)/ruby/internal/dosish.h +chilled.o: $(hdrdir)/ruby/internal/error.h +chilled.o: $(hdrdir)/ruby/internal/eval.h +chilled.o: $(hdrdir)/ruby/internal/event.h +chilled.o: $(hdrdir)/ruby/internal/fl_type.h +chilled.o: $(hdrdir)/ruby/internal/gc.h +chilled.o: $(hdrdir)/ruby/internal/glob.h +chilled.o: $(hdrdir)/ruby/internal/globals.h +chilled.o: $(hdrdir)/ruby/internal/has/attribute.h +chilled.o: $(hdrdir)/ruby/internal/has/builtin.h +chilled.o: $(hdrdir)/ruby/internal/has/c_attribute.h +chilled.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +chilled.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +chilled.o: $(hdrdir)/ruby/internal/has/extension.h +chilled.o: $(hdrdir)/ruby/internal/has/feature.h +chilled.o: $(hdrdir)/ruby/internal/has/warning.h +chilled.o: $(hdrdir)/ruby/internal/intern/array.h +chilled.o: $(hdrdir)/ruby/internal/intern/bignum.h +chilled.o: $(hdrdir)/ruby/internal/intern/class.h +chilled.o: $(hdrdir)/ruby/internal/intern/compar.h +chilled.o: $(hdrdir)/ruby/internal/intern/complex.h +chilled.o: $(hdrdir)/ruby/internal/intern/cont.h +chilled.o: $(hdrdir)/ruby/internal/intern/dir.h +chilled.o: $(hdrdir)/ruby/internal/intern/enum.h +chilled.o: $(hdrdir)/ruby/internal/intern/enumerator.h +chilled.o: $(hdrdir)/ruby/internal/intern/error.h +chilled.o: $(hdrdir)/ruby/internal/intern/eval.h +chilled.o: $(hdrdir)/ruby/internal/intern/file.h +chilled.o: $(hdrdir)/ruby/internal/intern/hash.h +chilled.o: $(hdrdir)/ruby/internal/intern/io.h +chilled.o: $(hdrdir)/ruby/internal/intern/load.h +chilled.o: $(hdrdir)/ruby/internal/intern/marshal.h +chilled.o: $(hdrdir)/ruby/internal/intern/numeric.h +chilled.o: $(hdrdir)/ruby/internal/intern/object.h +chilled.o: $(hdrdir)/ruby/internal/intern/parse.h +chilled.o: $(hdrdir)/ruby/internal/intern/proc.h +chilled.o: $(hdrdir)/ruby/internal/intern/process.h +chilled.o: $(hdrdir)/ruby/internal/intern/random.h +chilled.o: $(hdrdir)/ruby/internal/intern/range.h +chilled.o: $(hdrdir)/ruby/internal/intern/rational.h +chilled.o: $(hdrdir)/ruby/internal/intern/re.h +chilled.o: $(hdrdir)/ruby/internal/intern/ruby.h +chilled.o: $(hdrdir)/ruby/internal/intern/select.h +chilled.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +chilled.o: $(hdrdir)/ruby/internal/intern/signal.h +chilled.o: $(hdrdir)/ruby/internal/intern/sprintf.h +chilled.o: $(hdrdir)/ruby/internal/intern/string.h +chilled.o: $(hdrdir)/ruby/internal/intern/struct.h +chilled.o: $(hdrdir)/ruby/internal/intern/thread.h +chilled.o: $(hdrdir)/ruby/internal/intern/time.h +chilled.o: $(hdrdir)/ruby/internal/intern/variable.h +chilled.o: $(hdrdir)/ruby/internal/intern/vm.h +chilled.o: $(hdrdir)/ruby/internal/interpreter.h +chilled.o: $(hdrdir)/ruby/internal/iterator.h +chilled.o: $(hdrdir)/ruby/internal/memory.h +chilled.o: $(hdrdir)/ruby/internal/method.h +chilled.o: $(hdrdir)/ruby/internal/module.h +chilled.o: $(hdrdir)/ruby/internal/newobj.h +chilled.o: $(hdrdir)/ruby/internal/scan_args.h +chilled.o: $(hdrdir)/ruby/internal/special_consts.h +chilled.o: $(hdrdir)/ruby/internal/static_assert.h +chilled.o: $(hdrdir)/ruby/internal/stdalign.h +chilled.o: $(hdrdir)/ruby/internal/stdbool.h +chilled.o: $(hdrdir)/ruby/internal/stdckdint.h +chilled.o: $(hdrdir)/ruby/internal/symbol.h +chilled.o: $(hdrdir)/ruby/internal/value.h +chilled.o: $(hdrdir)/ruby/internal/value_type.h +chilled.o: $(hdrdir)/ruby/internal/variable.h +chilled.o: $(hdrdir)/ruby/internal/warning_push.h +chilled.o: $(hdrdir)/ruby/internal/xmalloc.h +chilled.o: $(hdrdir)/ruby/missing.h +chilled.o: $(hdrdir)/ruby/ruby.h +chilled.o: $(hdrdir)/ruby/st.h +chilled.o: $(hdrdir)/ruby/subst.h +chilled.o: chilled.c coderange.o: $(RUBY_EXTCONF_H) coderange.o: $(arch_hdrdir)/ruby/config.h coderange.o: $(hdrdir)/ruby/assert.h @@ -227,6 +387,7 @@ coderange.o: $(hdrdir)/ruby/internal/attr/noexcept.h coderange.o: $(hdrdir)/ruby/internal/attr/noinline.h coderange.o: $(hdrdir)/ruby/internal/attr/nonnull.h coderange.o: $(hdrdir)/ruby/internal/attr/noreturn.h +coderange.o: $(hdrdir)/ruby/internal/attr/packed_struct.h coderange.o: $(hdrdir)/ruby/internal/attr/pure.h coderange.o: $(hdrdir)/ruby/internal/attr/restrict.h coderange.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -295,7 +456,6 @@ coderange.o: $(hdrdir)/ruby/internal/intern/enumerator.h coderange.o: $(hdrdir)/ruby/internal/intern/error.h coderange.o: $(hdrdir)/ruby/internal/intern/eval.h coderange.o: $(hdrdir)/ruby/internal/intern/file.h -coderange.o: $(hdrdir)/ruby/internal/intern/gc.h coderange.o: $(hdrdir)/ruby/internal/intern/hash.h coderange.o: $(hdrdir)/ruby/internal/intern/io.h coderange.o: $(hdrdir)/ruby/internal/intern/load.h @@ -326,12 +486,12 @@ coderange.o: $(hdrdir)/ruby/internal/memory.h coderange.o: $(hdrdir)/ruby/internal/method.h coderange.o: $(hdrdir)/ruby/internal/module.h coderange.o: $(hdrdir)/ruby/internal/newobj.h -coderange.o: $(hdrdir)/ruby/internal/rgengc.h coderange.o: $(hdrdir)/ruby/internal/scan_args.h coderange.o: $(hdrdir)/ruby/internal/special_consts.h coderange.o: $(hdrdir)/ruby/internal/static_assert.h coderange.o: $(hdrdir)/ruby/internal/stdalign.h coderange.o: $(hdrdir)/ruby/internal/stdbool.h +coderange.o: $(hdrdir)/ruby/internal/stdckdint.h coderange.o: $(hdrdir)/ruby/internal/symbol.h coderange.o: $(hdrdir)/ruby/internal/value.h coderange.o: $(hdrdir)/ruby/internal/value_type.h @@ -399,6 +559,7 @@ cstr.o: $(hdrdir)/ruby/internal/attr/noexcept.h cstr.o: $(hdrdir)/ruby/internal/attr/noinline.h cstr.o: $(hdrdir)/ruby/internal/attr/nonnull.h cstr.o: $(hdrdir)/ruby/internal/attr/noreturn.h +cstr.o: $(hdrdir)/ruby/internal/attr/packed_struct.h cstr.o: $(hdrdir)/ruby/internal/attr/pure.h cstr.o: $(hdrdir)/ruby/internal/attr/restrict.h cstr.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -467,7 +628,6 @@ cstr.o: $(hdrdir)/ruby/internal/intern/enumerator.h cstr.o: $(hdrdir)/ruby/internal/intern/error.h cstr.o: $(hdrdir)/ruby/internal/intern/eval.h cstr.o: $(hdrdir)/ruby/internal/intern/file.h -cstr.o: $(hdrdir)/ruby/internal/intern/gc.h cstr.o: $(hdrdir)/ruby/internal/intern/hash.h cstr.o: $(hdrdir)/ruby/internal/intern/io.h cstr.o: $(hdrdir)/ruby/internal/intern/load.h @@ -498,12 +658,12 @@ cstr.o: $(hdrdir)/ruby/internal/memory.h cstr.o: $(hdrdir)/ruby/internal/method.h cstr.o: $(hdrdir)/ruby/internal/module.h cstr.o: $(hdrdir)/ruby/internal/newobj.h -cstr.o: $(hdrdir)/ruby/internal/rgengc.h cstr.o: $(hdrdir)/ruby/internal/scan_args.h cstr.o: $(hdrdir)/ruby/internal/special_consts.h cstr.o: $(hdrdir)/ruby/internal/static_assert.h cstr.o: $(hdrdir)/ruby/internal/stdalign.h cstr.o: $(hdrdir)/ruby/internal/stdbool.h +cstr.o: $(hdrdir)/ruby/internal/stdckdint.h cstr.o: $(hdrdir)/ruby/internal/symbol.h cstr.o: $(hdrdir)/ruby/internal/value.h cstr.o: $(hdrdir)/ruby/internal/value_type.h @@ -573,6 +733,7 @@ ellipsize.o: $(hdrdir)/ruby/internal/attr/noexcept.h ellipsize.o: $(hdrdir)/ruby/internal/attr/noinline.h ellipsize.o: $(hdrdir)/ruby/internal/attr/nonnull.h ellipsize.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ellipsize.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ellipsize.o: $(hdrdir)/ruby/internal/attr/pure.h ellipsize.o: $(hdrdir)/ruby/internal/attr/restrict.h ellipsize.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -632,7 +793,6 @@ ellipsize.o: $(hdrdir)/ruby/internal/intern/enumerator.h ellipsize.o: $(hdrdir)/ruby/internal/intern/error.h ellipsize.o: $(hdrdir)/ruby/internal/intern/eval.h ellipsize.o: $(hdrdir)/ruby/internal/intern/file.h -ellipsize.o: $(hdrdir)/ruby/internal/intern/gc.h ellipsize.o: $(hdrdir)/ruby/internal/intern/hash.h ellipsize.o: $(hdrdir)/ruby/internal/intern/io.h ellipsize.o: $(hdrdir)/ruby/internal/intern/load.h @@ -663,12 +823,12 @@ ellipsize.o: $(hdrdir)/ruby/internal/memory.h ellipsize.o: $(hdrdir)/ruby/internal/method.h ellipsize.o: $(hdrdir)/ruby/internal/module.h ellipsize.o: $(hdrdir)/ruby/internal/newobj.h -ellipsize.o: $(hdrdir)/ruby/internal/rgengc.h ellipsize.o: $(hdrdir)/ruby/internal/scan_args.h ellipsize.o: $(hdrdir)/ruby/internal/special_consts.h ellipsize.o: $(hdrdir)/ruby/internal/static_assert.h ellipsize.o: $(hdrdir)/ruby/internal/stdalign.h ellipsize.o: $(hdrdir)/ruby/internal/stdbool.h +ellipsize.o: $(hdrdir)/ruby/internal/stdckdint.h ellipsize.o: $(hdrdir)/ruby/internal/symbol.h ellipsize.o: $(hdrdir)/ruby/internal/value.h ellipsize.o: $(hdrdir)/ruby/internal/value_type.h @@ -734,6 +894,7 @@ enc_associate.o: $(hdrdir)/ruby/internal/attr/noexcept.h enc_associate.o: $(hdrdir)/ruby/internal/attr/noinline.h enc_associate.o: $(hdrdir)/ruby/internal/attr/nonnull.h enc_associate.o: $(hdrdir)/ruby/internal/attr/noreturn.h +enc_associate.o: $(hdrdir)/ruby/internal/attr/packed_struct.h enc_associate.o: $(hdrdir)/ruby/internal/attr/pure.h enc_associate.o: $(hdrdir)/ruby/internal/attr/restrict.h enc_associate.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -802,7 +963,6 @@ enc_associate.o: $(hdrdir)/ruby/internal/intern/enumerator.h enc_associate.o: $(hdrdir)/ruby/internal/intern/error.h enc_associate.o: $(hdrdir)/ruby/internal/intern/eval.h enc_associate.o: $(hdrdir)/ruby/internal/intern/file.h -enc_associate.o: $(hdrdir)/ruby/internal/intern/gc.h enc_associate.o: $(hdrdir)/ruby/internal/intern/hash.h enc_associate.o: $(hdrdir)/ruby/internal/intern/io.h enc_associate.o: $(hdrdir)/ruby/internal/intern/load.h @@ -833,12 +993,12 @@ enc_associate.o: $(hdrdir)/ruby/internal/memory.h enc_associate.o: $(hdrdir)/ruby/internal/method.h enc_associate.o: $(hdrdir)/ruby/internal/module.h enc_associate.o: $(hdrdir)/ruby/internal/newobj.h -enc_associate.o: $(hdrdir)/ruby/internal/rgengc.h enc_associate.o: $(hdrdir)/ruby/internal/scan_args.h enc_associate.o: $(hdrdir)/ruby/internal/special_consts.h enc_associate.o: $(hdrdir)/ruby/internal/static_assert.h enc_associate.o: $(hdrdir)/ruby/internal/stdalign.h enc_associate.o: $(hdrdir)/ruby/internal/stdbool.h +enc_associate.o: $(hdrdir)/ruby/internal/stdckdint.h enc_associate.o: $(hdrdir)/ruby/internal/symbol.h enc_associate.o: $(hdrdir)/ruby/internal/value.h enc_associate.o: $(hdrdir)/ruby/internal/value_type.h @@ -852,6 +1012,178 @@ enc_associate.o: $(hdrdir)/ruby/ruby.h enc_associate.o: $(hdrdir)/ruby/st.h enc_associate.o: $(hdrdir)/ruby/subst.h enc_associate.o: enc_associate.c +enc_dummy.o: $(RUBY_EXTCONF_H) +enc_dummy.o: $(arch_hdrdir)/ruby/config.h +enc_dummy.o: $(hdrdir)/ruby.h +enc_dummy.o: $(hdrdir)/ruby/assert.h +enc_dummy.o: $(hdrdir)/ruby/backward.h +enc_dummy.o: $(hdrdir)/ruby/backward/2/assume.h +enc_dummy.o: $(hdrdir)/ruby/backward/2/attributes.h +enc_dummy.o: $(hdrdir)/ruby/backward/2/bool.h +enc_dummy.o: $(hdrdir)/ruby/backward/2/inttypes.h +enc_dummy.o: $(hdrdir)/ruby/backward/2/limits.h +enc_dummy.o: $(hdrdir)/ruby/backward/2/long_long.h +enc_dummy.o: $(hdrdir)/ruby/backward/2/stdalign.h +enc_dummy.o: $(hdrdir)/ruby/backward/2/stdarg.h +enc_dummy.o: $(hdrdir)/ruby/defines.h +enc_dummy.o: $(hdrdir)/ruby/encoding.h +enc_dummy.o: $(hdrdir)/ruby/intern.h +enc_dummy.o: $(hdrdir)/ruby/internal/abi.h +enc_dummy.o: $(hdrdir)/ruby/internal/anyargs.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/char.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/double.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/int.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/long.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/short.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +enc_dummy.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +enc_dummy.o: $(hdrdir)/ruby/internal/assume.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/artificial.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/cold.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/const.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/constexpr.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/deprecated.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/error.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/forceinline.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/format.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/noalias.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/noexcept.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/noinline.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/nonnull.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/noreturn.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/pure.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/restrict.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/warning.h +enc_dummy.o: $(hdrdir)/ruby/internal/attr/weakref.h +enc_dummy.o: $(hdrdir)/ruby/internal/cast.h +enc_dummy.o: $(hdrdir)/ruby/internal/compiler_is.h +enc_dummy.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +enc_dummy.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +enc_dummy.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +enc_dummy.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +enc_dummy.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +enc_dummy.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +enc_dummy.o: $(hdrdir)/ruby/internal/compiler_since.h +enc_dummy.o: $(hdrdir)/ruby/internal/config.h +enc_dummy.o: $(hdrdir)/ruby/internal/constant_p.h +enc_dummy.o: $(hdrdir)/ruby/internal/core.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rarray.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rbasic.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rbignum.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rclass.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rdata.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rfile.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rhash.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/robject.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rregexp.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rstring.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rstruct.h +enc_dummy.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +enc_dummy.o: $(hdrdir)/ruby/internal/ctype.h +enc_dummy.o: $(hdrdir)/ruby/internal/dllexport.h +enc_dummy.o: $(hdrdir)/ruby/internal/dosish.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/coderange.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/ctype.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/encoding.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/pathname.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/re.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/sprintf.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/string.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/symbol.h +enc_dummy.o: $(hdrdir)/ruby/internal/encoding/transcode.h +enc_dummy.o: $(hdrdir)/ruby/internal/error.h +enc_dummy.o: $(hdrdir)/ruby/internal/eval.h +enc_dummy.o: $(hdrdir)/ruby/internal/event.h +enc_dummy.o: $(hdrdir)/ruby/internal/fl_type.h +enc_dummy.o: $(hdrdir)/ruby/internal/gc.h +enc_dummy.o: $(hdrdir)/ruby/internal/glob.h +enc_dummy.o: $(hdrdir)/ruby/internal/globals.h +enc_dummy.o: $(hdrdir)/ruby/internal/has/attribute.h +enc_dummy.o: $(hdrdir)/ruby/internal/has/builtin.h +enc_dummy.o: $(hdrdir)/ruby/internal/has/c_attribute.h +enc_dummy.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +enc_dummy.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +enc_dummy.o: $(hdrdir)/ruby/internal/has/extension.h +enc_dummy.o: $(hdrdir)/ruby/internal/has/feature.h +enc_dummy.o: $(hdrdir)/ruby/internal/has/warning.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/array.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/bignum.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/class.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/compar.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/complex.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/cont.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/dir.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/enum.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/enumerator.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/error.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/eval.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/file.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/hash.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/io.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/load.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/marshal.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/numeric.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/object.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/parse.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/proc.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/process.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/random.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/range.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/rational.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/re.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/ruby.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/select.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/signal.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/sprintf.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/string.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/struct.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/thread.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/time.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/variable.h +enc_dummy.o: $(hdrdir)/ruby/internal/intern/vm.h +enc_dummy.o: $(hdrdir)/ruby/internal/interpreter.h +enc_dummy.o: $(hdrdir)/ruby/internal/iterator.h +enc_dummy.o: $(hdrdir)/ruby/internal/memory.h +enc_dummy.o: $(hdrdir)/ruby/internal/method.h +enc_dummy.o: $(hdrdir)/ruby/internal/module.h +enc_dummy.o: $(hdrdir)/ruby/internal/newobj.h +enc_dummy.o: $(hdrdir)/ruby/internal/scan_args.h +enc_dummy.o: $(hdrdir)/ruby/internal/special_consts.h +enc_dummy.o: $(hdrdir)/ruby/internal/static_assert.h +enc_dummy.o: $(hdrdir)/ruby/internal/stdalign.h +enc_dummy.o: $(hdrdir)/ruby/internal/stdbool.h +enc_dummy.o: $(hdrdir)/ruby/internal/stdckdint.h +enc_dummy.o: $(hdrdir)/ruby/internal/symbol.h +enc_dummy.o: $(hdrdir)/ruby/internal/value.h +enc_dummy.o: $(hdrdir)/ruby/internal/value_type.h +enc_dummy.o: $(hdrdir)/ruby/internal/variable.h +enc_dummy.o: $(hdrdir)/ruby/internal/warning_push.h +enc_dummy.o: $(hdrdir)/ruby/internal/xmalloc.h +enc_dummy.o: $(hdrdir)/ruby/missing.h +enc_dummy.o: $(hdrdir)/ruby/onigmo.h +enc_dummy.o: $(hdrdir)/ruby/oniguruma.h +enc_dummy.o: $(hdrdir)/ruby/ruby.h +enc_dummy.o: $(hdrdir)/ruby/st.h +enc_dummy.o: $(hdrdir)/ruby/subst.h +enc_dummy.o: enc_dummy.c enc_str_buf_cat.o: $(RUBY_EXTCONF_H) enc_str_buf_cat.o: $(arch_hdrdir)/ruby/config.h enc_str_buf_cat.o: $(hdrdir)/ruby/assert.h @@ -905,6 +1237,7 @@ enc_str_buf_cat.o: $(hdrdir)/ruby/internal/attr/noexcept.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/attr/noinline.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/attr/nonnull.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/attr/noreturn.h +enc_str_buf_cat.o: $(hdrdir)/ruby/internal/attr/packed_struct.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/attr/pure.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/attr/restrict.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -973,7 +1306,6 @@ enc_str_buf_cat.o: $(hdrdir)/ruby/internal/intern/enumerator.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/intern/error.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/intern/eval.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/intern/file.h -enc_str_buf_cat.o: $(hdrdir)/ruby/internal/intern/gc.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/intern/hash.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/intern/io.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1004,12 +1336,12 @@ enc_str_buf_cat.o: $(hdrdir)/ruby/internal/memory.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/method.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/module.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/newobj.h -enc_str_buf_cat.o: $(hdrdir)/ruby/internal/rgengc.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/scan_args.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/special_consts.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/static_assert.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/stdalign.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/stdbool.h +enc_str_buf_cat.o: $(hdrdir)/ruby/internal/stdckdint.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/symbol.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/value.h enc_str_buf_cat.o: $(hdrdir)/ruby/internal/value_type.h @@ -1031,6 +1363,7 @@ fstring.o: $(hdrdir)/ruby/backward.h fstring.o: $(hdrdir)/ruby/backward/2/assume.h fstring.o: $(hdrdir)/ruby/backward/2/attributes.h fstring.o: $(hdrdir)/ruby/backward/2/bool.h +fstring.o: $(hdrdir)/ruby/backward/2/gcc_version_since.h fstring.o: $(hdrdir)/ruby/backward/2/inttypes.h fstring.o: $(hdrdir)/ruby/backward/2/limits.h fstring.o: $(hdrdir)/ruby/backward/2/long_long.h @@ -1077,6 +1410,7 @@ fstring.o: $(hdrdir)/ruby/internal/attr/noexcept.h fstring.o: $(hdrdir)/ruby/internal/attr/noinline.h fstring.o: $(hdrdir)/ruby/internal/attr/nonnull.h fstring.o: $(hdrdir)/ruby/internal/attr/noreturn.h +fstring.o: $(hdrdir)/ruby/internal/attr/packed_struct.h fstring.o: $(hdrdir)/ruby/internal/attr/pure.h fstring.o: $(hdrdir)/ruby/internal/attr/restrict.h fstring.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1145,7 +1479,6 @@ fstring.o: $(hdrdir)/ruby/internal/intern/enumerator.h fstring.o: $(hdrdir)/ruby/internal/intern/error.h fstring.o: $(hdrdir)/ruby/internal/intern/eval.h fstring.o: $(hdrdir)/ruby/internal/intern/file.h -fstring.o: $(hdrdir)/ruby/internal/intern/gc.h fstring.o: $(hdrdir)/ruby/internal/intern/hash.h fstring.o: $(hdrdir)/ruby/internal/intern/io.h fstring.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1176,12 +1509,12 @@ fstring.o: $(hdrdir)/ruby/internal/memory.h fstring.o: $(hdrdir)/ruby/internal/method.h fstring.o: $(hdrdir)/ruby/internal/module.h fstring.o: $(hdrdir)/ruby/internal/newobj.h -fstring.o: $(hdrdir)/ruby/internal/rgengc.h fstring.o: $(hdrdir)/ruby/internal/scan_args.h fstring.o: $(hdrdir)/ruby/internal/special_consts.h fstring.o: $(hdrdir)/ruby/internal/static_assert.h fstring.o: $(hdrdir)/ruby/internal/stdalign.h fstring.o: $(hdrdir)/ruby/internal/stdbool.h +fstring.o: $(hdrdir)/ruby/internal/stdckdint.h fstring.o: $(hdrdir)/ruby/internal/symbol.h fstring.o: $(hdrdir)/ruby/internal/value.h fstring.o: $(hdrdir)/ruby/internal/value_type.h @@ -1194,6 +1527,8 @@ fstring.o: $(hdrdir)/ruby/oniguruma.h fstring.o: $(hdrdir)/ruby/ruby.h fstring.o: $(hdrdir)/ruby/st.h fstring.o: $(hdrdir)/ruby/subst.h +fstring.o: $(top_srcdir)/internal/compilers.h +fstring.o: $(top_srcdir)/internal/string.h fstring.o: fstring.c init.o: $(RUBY_EXTCONF_H) init.o: $(arch_hdrdir)/ruby/config.h @@ -1248,6 +1583,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1307,7 +1643,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1338,12 +1673,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -1408,6 +1743,7 @@ modify.o: $(hdrdir)/ruby/internal/attr/noexcept.h modify.o: $(hdrdir)/ruby/internal/attr/noinline.h modify.o: $(hdrdir)/ruby/internal/attr/nonnull.h modify.o: $(hdrdir)/ruby/internal/attr/noreturn.h +modify.o: $(hdrdir)/ruby/internal/attr/packed_struct.h modify.o: $(hdrdir)/ruby/internal/attr/pure.h modify.o: $(hdrdir)/ruby/internal/attr/restrict.h modify.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1467,7 +1803,6 @@ modify.o: $(hdrdir)/ruby/internal/intern/enumerator.h modify.o: $(hdrdir)/ruby/internal/intern/error.h modify.o: $(hdrdir)/ruby/internal/intern/eval.h modify.o: $(hdrdir)/ruby/internal/intern/file.h -modify.o: $(hdrdir)/ruby/internal/intern/gc.h modify.o: $(hdrdir)/ruby/internal/intern/hash.h modify.o: $(hdrdir)/ruby/internal/intern/io.h modify.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1498,12 +1833,12 @@ modify.o: $(hdrdir)/ruby/internal/memory.h modify.o: $(hdrdir)/ruby/internal/method.h modify.o: $(hdrdir)/ruby/internal/module.h modify.o: $(hdrdir)/ruby/internal/newobj.h -modify.o: $(hdrdir)/ruby/internal/rgengc.h modify.o: $(hdrdir)/ruby/internal/scan_args.h modify.o: $(hdrdir)/ruby/internal/special_consts.h modify.o: $(hdrdir)/ruby/internal/static_assert.h modify.o: $(hdrdir)/ruby/internal/stdalign.h modify.o: $(hdrdir)/ruby/internal/stdbool.h +modify.o: $(hdrdir)/ruby/internal/stdckdint.h modify.o: $(hdrdir)/ruby/internal/symbol.h modify.o: $(hdrdir)/ruby/internal/value.h modify.o: $(hdrdir)/ruby/internal/value_type.h @@ -1569,6 +1904,7 @@ new.o: $(hdrdir)/ruby/internal/attr/noexcept.h new.o: $(hdrdir)/ruby/internal/attr/noinline.h new.o: $(hdrdir)/ruby/internal/attr/nonnull.h new.o: $(hdrdir)/ruby/internal/attr/noreturn.h +new.o: $(hdrdir)/ruby/internal/attr/packed_struct.h new.o: $(hdrdir)/ruby/internal/attr/pure.h new.o: $(hdrdir)/ruby/internal/attr/restrict.h new.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1637,7 +1973,6 @@ new.o: $(hdrdir)/ruby/internal/intern/enumerator.h new.o: $(hdrdir)/ruby/internal/intern/error.h new.o: $(hdrdir)/ruby/internal/intern/eval.h new.o: $(hdrdir)/ruby/internal/intern/file.h -new.o: $(hdrdir)/ruby/internal/intern/gc.h new.o: $(hdrdir)/ruby/internal/intern/hash.h new.o: $(hdrdir)/ruby/internal/intern/io.h new.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1668,12 +2003,12 @@ new.o: $(hdrdir)/ruby/internal/memory.h new.o: $(hdrdir)/ruby/internal/method.h new.o: $(hdrdir)/ruby/internal/module.h new.o: $(hdrdir)/ruby/internal/newobj.h -new.o: $(hdrdir)/ruby/internal/rgengc.h new.o: $(hdrdir)/ruby/internal/scan_args.h new.o: $(hdrdir)/ruby/internal/special_consts.h new.o: $(hdrdir)/ruby/internal/static_assert.h new.o: $(hdrdir)/ruby/internal/stdalign.h new.o: $(hdrdir)/ruby/internal/stdbool.h +new.o: $(hdrdir)/ruby/internal/stdckdint.h new.o: $(hdrdir)/ruby/internal/symbol.h new.o: $(hdrdir)/ruby/internal/value.h new.o: $(hdrdir)/ruby/internal/value_type.h @@ -1740,6 +2075,7 @@ nofree.o: $(hdrdir)/ruby/internal/attr/noexcept.h nofree.o: $(hdrdir)/ruby/internal/attr/noinline.h nofree.o: $(hdrdir)/ruby/internal/attr/nonnull.h nofree.o: $(hdrdir)/ruby/internal/attr/noreturn.h +nofree.o: $(hdrdir)/ruby/internal/attr/packed_struct.h nofree.o: $(hdrdir)/ruby/internal/attr/pure.h nofree.o: $(hdrdir)/ruby/internal/attr/restrict.h nofree.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1799,7 +2135,6 @@ nofree.o: $(hdrdir)/ruby/internal/intern/enumerator.h nofree.o: $(hdrdir)/ruby/internal/intern/error.h nofree.o: $(hdrdir)/ruby/internal/intern/eval.h nofree.o: $(hdrdir)/ruby/internal/intern/file.h -nofree.o: $(hdrdir)/ruby/internal/intern/gc.h nofree.o: $(hdrdir)/ruby/internal/intern/hash.h nofree.o: $(hdrdir)/ruby/internal/intern/io.h nofree.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1830,12 +2165,12 @@ nofree.o: $(hdrdir)/ruby/internal/memory.h nofree.o: $(hdrdir)/ruby/internal/method.h nofree.o: $(hdrdir)/ruby/internal/module.h nofree.o: $(hdrdir)/ruby/internal/newobj.h -nofree.o: $(hdrdir)/ruby/internal/rgengc.h nofree.o: $(hdrdir)/ruby/internal/scan_args.h nofree.o: $(hdrdir)/ruby/internal/special_consts.h nofree.o: $(hdrdir)/ruby/internal/static_assert.h nofree.o: $(hdrdir)/ruby/internal/stdalign.h nofree.o: $(hdrdir)/ruby/internal/stdbool.h +nofree.o: $(hdrdir)/ruby/internal/stdckdint.h nofree.o: $(hdrdir)/ruby/internal/symbol.h nofree.o: $(hdrdir)/ruby/internal/value.h nofree.o: $(hdrdir)/ruby/internal/value_type.h @@ -1900,6 +2235,7 @@ normalize.o: $(hdrdir)/ruby/internal/attr/noexcept.h normalize.o: $(hdrdir)/ruby/internal/attr/noinline.h normalize.o: $(hdrdir)/ruby/internal/attr/nonnull.h normalize.o: $(hdrdir)/ruby/internal/attr/noreturn.h +normalize.o: $(hdrdir)/ruby/internal/attr/packed_struct.h normalize.o: $(hdrdir)/ruby/internal/attr/pure.h normalize.o: $(hdrdir)/ruby/internal/attr/restrict.h normalize.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1968,7 +2304,6 @@ normalize.o: $(hdrdir)/ruby/internal/intern/enumerator.h normalize.o: $(hdrdir)/ruby/internal/intern/error.h normalize.o: $(hdrdir)/ruby/internal/intern/eval.h normalize.o: $(hdrdir)/ruby/internal/intern/file.h -normalize.o: $(hdrdir)/ruby/internal/intern/gc.h normalize.o: $(hdrdir)/ruby/internal/intern/hash.h normalize.o: $(hdrdir)/ruby/internal/intern/io.h normalize.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1999,12 +2334,12 @@ normalize.o: $(hdrdir)/ruby/internal/memory.h normalize.o: $(hdrdir)/ruby/internal/method.h normalize.o: $(hdrdir)/ruby/internal/module.h normalize.o: $(hdrdir)/ruby/internal/newobj.h -normalize.o: $(hdrdir)/ruby/internal/rgengc.h normalize.o: $(hdrdir)/ruby/internal/scan_args.h normalize.o: $(hdrdir)/ruby/internal/special_consts.h normalize.o: $(hdrdir)/ruby/internal/static_assert.h normalize.o: $(hdrdir)/ruby/internal/stdalign.h normalize.o: $(hdrdir)/ruby/internal/stdbool.h +normalize.o: $(hdrdir)/ruby/internal/stdckdint.h normalize.o: $(hdrdir)/ruby/internal/symbol.h normalize.o: $(hdrdir)/ruby/internal/value.h normalize.o: $(hdrdir)/ruby/internal/value_type.h @@ -2073,6 +2408,7 @@ qsort.o: $(hdrdir)/ruby/internal/attr/noexcept.h qsort.o: $(hdrdir)/ruby/internal/attr/noinline.h qsort.o: $(hdrdir)/ruby/internal/attr/nonnull.h qsort.o: $(hdrdir)/ruby/internal/attr/noreturn.h +qsort.o: $(hdrdir)/ruby/internal/attr/packed_struct.h qsort.o: $(hdrdir)/ruby/internal/attr/pure.h qsort.o: $(hdrdir)/ruby/internal/attr/restrict.h qsort.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2141,7 +2477,6 @@ qsort.o: $(hdrdir)/ruby/internal/intern/enumerator.h qsort.o: $(hdrdir)/ruby/internal/intern/error.h qsort.o: $(hdrdir)/ruby/internal/intern/eval.h qsort.o: $(hdrdir)/ruby/internal/intern/file.h -qsort.o: $(hdrdir)/ruby/internal/intern/gc.h qsort.o: $(hdrdir)/ruby/internal/intern/hash.h qsort.o: $(hdrdir)/ruby/internal/intern/io.h qsort.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2172,12 +2507,12 @@ qsort.o: $(hdrdir)/ruby/internal/memory.h qsort.o: $(hdrdir)/ruby/internal/method.h qsort.o: $(hdrdir)/ruby/internal/module.h qsort.o: $(hdrdir)/ruby/internal/newobj.h -qsort.o: $(hdrdir)/ruby/internal/rgengc.h qsort.o: $(hdrdir)/ruby/internal/scan_args.h qsort.o: $(hdrdir)/ruby/internal/special_consts.h qsort.o: $(hdrdir)/ruby/internal/static_assert.h qsort.o: $(hdrdir)/ruby/internal/stdalign.h qsort.o: $(hdrdir)/ruby/internal/stdbool.h +qsort.o: $(hdrdir)/ruby/internal/stdckdint.h qsort.o: $(hdrdir)/ruby/internal/symbol.h qsort.o: $(hdrdir)/ruby/internal/value.h qsort.o: $(hdrdir)/ruby/internal/value_type.h @@ -2245,6 +2580,7 @@ rb_interned_str.o: $(hdrdir)/ruby/internal/attr/noexcept.h rb_interned_str.o: $(hdrdir)/ruby/internal/attr/noinline.h rb_interned_str.o: $(hdrdir)/ruby/internal/attr/nonnull.h rb_interned_str.o: $(hdrdir)/ruby/internal/attr/noreturn.h +rb_interned_str.o: $(hdrdir)/ruby/internal/attr/packed_struct.h rb_interned_str.o: $(hdrdir)/ruby/internal/attr/pure.h rb_interned_str.o: $(hdrdir)/ruby/internal/attr/restrict.h rb_interned_str.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2304,7 +2640,6 @@ rb_interned_str.o: $(hdrdir)/ruby/internal/intern/enumerator.h rb_interned_str.o: $(hdrdir)/ruby/internal/intern/error.h rb_interned_str.o: $(hdrdir)/ruby/internal/intern/eval.h rb_interned_str.o: $(hdrdir)/ruby/internal/intern/file.h -rb_interned_str.o: $(hdrdir)/ruby/internal/intern/gc.h rb_interned_str.o: $(hdrdir)/ruby/internal/intern/hash.h rb_interned_str.o: $(hdrdir)/ruby/internal/intern/io.h rb_interned_str.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2335,12 +2670,12 @@ rb_interned_str.o: $(hdrdir)/ruby/internal/memory.h rb_interned_str.o: $(hdrdir)/ruby/internal/method.h rb_interned_str.o: $(hdrdir)/ruby/internal/module.h rb_interned_str.o: $(hdrdir)/ruby/internal/newobj.h -rb_interned_str.o: $(hdrdir)/ruby/internal/rgengc.h rb_interned_str.o: $(hdrdir)/ruby/internal/scan_args.h rb_interned_str.o: $(hdrdir)/ruby/internal/special_consts.h rb_interned_str.o: $(hdrdir)/ruby/internal/static_assert.h rb_interned_str.o: $(hdrdir)/ruby/internal/stdalign.h rb_interned_str.o: $(hdrdir)/ruby/internal/stdbool.h +rb_interned_str.o: $(hdrdir)/ruby/internal/stdckdint.h rb_interned_str.o: $(hdrdir)/ruby/internal/symbol.h rb_interned_str.o: $(hdrdir)/ruby/internal/value.h rb_interned_str.o: $(hdrdir)/ruby/internal/value_type.h @@ -2405,6 +2740,7 @@ rb_str_dup.o: $(hdrdir)/ruby/internal/attr/noexcept.h rb_str_dup.o: $(hdrdir)/ruby/internal/attr/noinline.h rb_str_dup.o: $(hdrdir)/ruby/internal/attr/nonnull.h rb_str_dup.o: $(hdrdir)/ruby/internal/attr/noreturn.h +rb_str_dup.o: $(hdrdir)/ruby/internal/attr/packed_struct.h rb_str_dup.o: $(hdrdir)/ruby/internal/attr/pure.h rb_str_dup.o: $(hdrdir)/ruby/internal/attr/restrict.h rb_str_dup.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2464,7 +2800,6 @@ rb_str_dup.o: $(hdrdir)/ruby/internal/intern/enumerator.h rb_str_dup.o: $(hdrdir)/ruby/internal/intern/error.h rb_str_dup.o: $(hdrdir)/ruby/internal/intern/eval.h rb_str_dup.o: $(hdrdir)/ruby/internal/intern/file.h -rb_str_dup.o: $(hdrdir)/ruby/internal/intern/gc.h rb_str_dup.o: $(hdrdir)/ruby/internal/intern/hash.h rb_str_dup.o: $(hdrdir)/ruby/internal/intern/io.h rb_str_dup.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2495,12 +2830,12 @@ rb_str_dup.o: $(hdrdir)/ruby/internal/memory.h rb_str_dup.o: $(hdrdir)/ruby/internal/method.h rb_str_dup.o: $(hdrdir)/ruby/internal/module.h rb_str_dup.o: $(hdrdir)/ruby/internal/newobj.h -rb_str_dup.o: $(hdrdir)/ruby/internal/rgengc.h rb_str_dup.o: $(hdrdir)/ruby/internal/scan_args.h rb_str_dup.o: $(hdrdir)/ruby/internal/special_consts.h rb_str_dup.o: $(hdrdir)/ruby/internal/static_assert.h rb_str_dup.o: $(hdrdir)/ruby/internal/stdalign.h rb_str_dup.o: $(hdrdir)/ruby/internal/stdbool.h +rb_str_dup.o: $(hdrdir)/ruby/internal/stdckdint.h rb_str_dup.o: $(hdrdir)/ruby/internal/symbol.h rb_str_dup.o: $(hdrdir)/ruby/internal/value.h rb_str_dup.o: $(hdrdir)/ruby/internal/value_type.h @@ -2565,6 +2900,7 @@ set_len.o: $(hdrdir)/ruby/internal/attr/noexcept.h set_len.o: $(hdrdir)/ruby/internal/attr/noinline.h set_len.o: $(hdrdir)/ruby/internal/attr/nonnull.h set_len.o: $(hdrdir)/ruby/internal/attr/noreturn.h +set_len.o: $(hdrdir)/ruby/internal/attr/packed_struct.h set_len.o: $(hdrdir)/ruby/internal/attr/pure.h set_len.o: $(hdrdir)/ruby/internal/attr/restrict.h set_len.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2624,7 +2960,6 @@ set_len.o: $(hdrdir)/ruby/internal/intern/enumerator.h set_len.o: $(hdrdir)/ruby/internal/intern/error.h set_len.o: $(hdrdir)/ruby/internal/intern/eval.h set_len.o: $(hdrdir)/ruby/internal/intern/file.h -set_len.o: $(hdrdir)/ruby/internal/intern/gc.h set_len.o: $(hdrdir)/ruby/internal/intern/hash.h set_len.o: $(hdrdir)/ruby/internal/intern/io.h set_len.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2655,12 +2990,12 @@ set_len.o: $(hdrdir)/ruby/internal/memory.h set_len.o: $(hdrdir)/ruby/internal/method.h set_len.o: $(hdrdir)/ruby/internal/module.h set_len.o: $(hdrdir)/ruby/internal/newobj.h -set_len.o: $(hdrdir)/ruby/internal/rgengc.h set_len.o: $(hdrdir)/ruby/internal/scan_args.h set_len.o: $(hdrdir)/ruby/internal/special_consts.h set_len.o: $(hdrdir)/ruby/internal/static_assert.h set_len.o: $(hdrdir)/ruby/internal/stdalign.h set_len.o: $(hdrdir)/ruby/internal/stdbool.h +set_len.o: $(hdrdir)/ruby/internal/stdckdint.h set_len.o: $(hdrdir)/ruby/internal/symbol.h set_len.o: $(hdrdir)/ruby/internal/value.h set_len.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/string/enc_dummy.c b/ext/-test-/string/enc_dummy.c new file mode 100644 index 0000000000..4169552655 --- /dev/null +++ b/ext/-test-/string/enc_dummy.c @@ -0,0 +1,15 @@ +#include "ruby.h" +#include "ruby/encoding.h" + +VALUE +bug_rb_define_dummy_encoding(VALUE self, VALUE name) +{ + int idx = rb_define_dummy_encoding(RSTRING_PTR(name)); + return rb_enc_from_encoding(rb_enc_from_index(idx)); +} + +void +Init_string_enc_dummy(VALUE klass) +{ + rb_define_singleton_method(klass, "rb_define_dummy_encoding", bug_rb_define_dummy_encoding, 1); +} diff --git a/ext/-test-/string/fstring.c b/ext/-test-/string/fstring.c index 2374319fe3..71c4b7f97e 100644 --- a/ext/-test-/string/fstring.c +++ b/ext/-test-/string/fstring.c @@ -1,30 +1,38 @@ #include "ruby.h" #include "ruby/encoding.h" - -VALUE rb_fstring(VALUE str); +#include "internal/string.h" VALUE bug_s_fstring(VALUE self, VALUE str) { - return rb_fstring(str); + return rb_str_to_interned_str(str); +} + +VALUE +bug_s_fstring_fake_str(VALUE self) +{ + static const char literal[] = "abcdefghijklmnopqrstuvwxyz"; + struct RString fake_str; + return rb_str_to_interned_str(rb_setup_fake_str(&fake_str, literal, sizeof(literal) - 1, 0)); } VALUE bug_s_rb_enc_interned_str(VALUE self, VALUE encoding) { - return rb_enc_interned_str("foo", 3, RDATA(encoding)->data); + return rb_enc_interned_str("foo", 3, NIL_P(encoding) ? NULL : RDATA(encoding)->data); } VALUE bug_s_rb_enc_str_new(VALUE self, VALUE encoding) { - return rb_enc_str_new("foo", 3, RDATA(encoding)->data); + return rb_enc_str_new("foo", 3, NIL_P(encoding) ? NULL : RDATA(encoding)->data); } void Init_string_fstring(VALUE klass) { rb_define_singleton_method(klass, "fstring", bug_s_fstring, 1); + rb_define_singleton_method(klass, "fstring_fake_str", bug_s_fstring_fake_str, 0); rb_define_singleton_method(klass, "rb_enc_interned_str", bug_s_rb_enc_interned_str, 1); rb_define_singleton_method(klass, "rb_enc_str_new", bug_s_rb_enc_str_new, 1); } diff --git a/ext/-test-/string/set_len.c b/ext/-test-/string/set_len.c index 219cea404c..049da2cdb5 100644 --- a/ext/-test-/string/set_len.c +++ b/ext/-test-/string/set_len.c @@ -7,8 +7,18 @@ bug_str_set_len(VALUE str, VALUE len) return str; } +static VALUE +bug_str_append(VALUE str, VALUE addendum) +{ + StringValue(addendum); + rb_str_modify_expand(str, RSTRING_LEN(addendum)); + memcpy(RSTRING_END(str), RSTRING_PTR(addendum), RSTRING_LEN(addendum)); + return str; +} + void Init_string_set_len(VALUE klass) { rb_define_method(klass, "set_len", bug_str_set_len, 1); + rb_define_method(klass, "append", bug_str_append, 1); } diff --git a/ext/-test-/struct/data.c b/ext/-test-/struct/data.c new file mode 100644 index 0000000000..5841c342e7 --- /dev/null +++ b/ext/-test-/struct/data.c @@ -0,0 +1,13 @@ +#include "ruby.h" + +static VALUE +bug_data_new(VALUE self, VALUE super) +{ + return rb_data_define(super, "mem1", "mem2", NULL); +} + +void +Init_data(VALUE klass) +{ + rb_define_singleton_method(klass, "data_new", bug_data_new, 1); +} diff --git a/ext/-test-/struct/depend b/ext/-test-/struct/depend index 920a065216..951dddd5dd 100644 --- a/ext/-test-/struct/depend +++ b/ext/-test-/struct/depend @@ -1,4 +1,164 @@ # AUTOGENERATED DEPENDENCIES START +data.o: $(RUBY_EXTCONF_H) +data.o: $(arch_hdrdir)/ruby/config.h +data.o: $(hdrdir)/ruby.h +data.o: $(hdrdir)/ruby/assert.h +data.o: $(hdrdir)/ruby/backward.h +data.o: $(hdrdir)/ruby/backward/2/assume.h +data.o: $(hdrdir)/ruby/backward/2/attributes.h +data.o: $(hdrdir)/ruby/backward/2/bool.h +data.o: $(hdrdir)/ruby/backward/2/inttypes.h +data.o: $(hdrdir)/ruby/backward/2/limits.h +data.o: $(hdrdir)/ruby/backward/2/long_long.h +data.o: $(hdrdir)/ruby/backward/2/stdalign.h +data.o: $(hdrdir)/ruby/backward/2/stdarg.h +data.o: $(hdrdir)/ruby/defines.h +data.o: $(hdrdir)/ruby/intern.h +data.o: $(hdrdir)/ruby/internal/abi.h +data.o: $(hdrdir)/ruby/internal/anyargs.h +data.o: $(hdrdir)/ruby/internal/arithmetic.h +data.o: $(hdrdir)/ruby/internal/arithmetic/char.h +data.o: $(hdrdir)/ruby/internal/arithmetic/double.h +data.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +data.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +data.o: $(hdrdir)/ruby/internal/arithmetic/int.h +data.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +data.o: $(hdrdir)/ruby/internal/arithmetic/long.h +data.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +data.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +data.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +data.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +data.o: $(hdrdir)/ruby/internal/arithmetic/short.h +data.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +data.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +data.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +data.o: $(hdrdir)/ruby/internal/assume.h +data.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +data.o: $(hdrdir)/ruby/internal/attr/artificial.h +data.o: $(hdrdir)/ruby/internal/attr/cold.h +data.o: $(hdrdir)/ruby/internal/attr/const.h +data.o: $(hdrdir)/ruby/internal/attr/constexpr.h +data.o: $(hdrdir)/ruby/internal/attr/deprecated.h +data.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +data.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +data.o: $(hdrdir)/ruby/internal/attr/error.h +data.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +data.o: $(hdrdir)/ruby/internal/attr/forceinline.h +data.o: $(hdrdir)/ruby/internal/attr/format.h +data.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +data.o: $(hdrdir)/ruby/internal/attr/noalias.h +data.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +data.o: $(hdrdir)/ruby/internal/attr/noexcept.h +data.o: $(hdrdir)/ruby/internal/attr/noinline.h +data.o: $(hdrdir)/ruby/internal/attr/nonnull.h +data.o: $(hdrdir)/ruby/internal/attr/noreturn.h +data.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +data.o: $(hdrdir)/ruby/internal/attr/pure.h +data.o: $(hdrdir)/ruby/internal/attr/restrict.h +data.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +data.o: $(hdrdir)/ruby/internal/attr/warning.h +data.o: $(hdrdir)/ruby/internal/attr/weakref.h +data.o: $(hdrdir)/ruby/internal/cast.h +data.o: $(hdrdir)/ruby/internal/compiler_is.h +data.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +data.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +data.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +data.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +data.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +data.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +data.o: $(hdrdir)/ruby/internal/compiler_since.h +data.o: $(hdrdir)/ruby/internal/config.h +data.o: $(hdrdir)/ruby/internal/constant_p.h +data.o: $(hdrdir)/ruby/internal/core.h +data.o: $(hdrdir)/ruby/internal/core/rarray.h +data.o: $(hdrdir)/ruby/internal/core/rbasic.h +data.o: $(hdrdir)/ruby/internal/core/rbignum.h +data.o: $(hdrdir)/ruby/internal/core/rclass.h +data.o: $(hdrdir)/ruby/internal/core/rdata.h +data.o: $(hdrdir)/ruby/internal/core/rfile.h +data.o: $(hdrdir)/ruby/internal/core/rhash.h +data.o: $(hdrdir)/ruby/internal/core/robject.h +data.o: $(hdrdir)/ruby/internal/core/rregexp.h +data.o: $(hdrdir)/ruby/internal/core/rstring.h +data.o: $(hdrdir)/ruby/internal/core/rstruct.h +data.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +data.o: $(hdrdir)/ruby/internal/ctype.h +data.o: $(hdrdir)/ruby/internal/dllexport.h +data.o: $(hdrdir)/ruby/internal/dosish.h +data.o: $(hdrdir)/ruby/internal/error.h +data.o: $(hdrdir)/ruby/internal/eval.h +data.o: $(hdrdir)/ruby/internal/event.h +data.o: $(hdrdir)/ruby/internal/fl_type.h +data.o: $(hdrdir)/ruby/internal/gc.h +data.o: $(hdrdir)/ruby/internal/glob.h +data.o: $(hdrdir)/ruby/internal/globals.h +data.o: $(hdrdir)/ruby/internal/has/attribute.h +data.o: $(hdrdir)/ruby/internal/has/builtin.h +data.o: $(hdrdir)/ruby/internal/has/c_attribute.h +data.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +data.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +data.o: $(hdrdir)/ruby/internal/has/extension.h +data.o: $(hdrdir)/ruby/internal/has/feature.h +data.o: $(hdrdir)/ruby/internal/has/warning.h +data.o: $(hdrdir)/ruby/internal/intern/array.h +data.o: $(hdrdir)/ruby/internal/intern/bignum.h +data.o: $(hdrdir)/ruby/internal/intern/class.h +data.o: $(hdrdir)/ruby/internal/intern/compar.h +data.o: $(hdrdir)/ruby/internal/intern/complex.h +data.o: $(hdrdir)/ruby/internal/intern/cont.h +data.o: $(hdrdir)/ruby/internal/intern/dir.h +data.o: $(hdrdir)/ruby/internal/intern/enum.h +data.o: $(hdrdir)/ruby/internal/intern/enumerator.h +data.o: $(hdrdir)/ruby/internal/intern/error.h +data.o: $(hdrdir)/ruby/internal/intern/eval.h +data.o: $(hdrdir)/ruby/internal/intern/file.h +data.o: $(hdrdir)/ruby/internal/intern/hash.h +data.o: $(hdrdir)/ruby/internal/intern/io.h +data.o: $(hdrdir)/ruby/internal/intern/load.h +data.o: $(hdrdir)/ruby/internal/intern/marshal.h +data.o: $(hdrdir)/ruby/internal/intern/numeric.h +data.o: $(hdrdir)/ruby/internal/intern/object.h +data.o: $(hdrdir)/ruby/internal/intern/parse.h +data.o: $(hdrdir)/ruby/internal/intern/proc.h +data.o: $(hdrdir)/ruby/internal/intern/process.h +data.o: $(hdrdir)/ruby/internal/intern/random.h +data.o: $(hdrdir)/ruby/internal/intern/range.h +data.o: $(hdrdir)/ruby/internal/intern/rational.h +data.o: $(hdrdir)/ruby/internal/intern/re.h +data.o: $(hdrdir)/ruby/internal/intern/ruby.h +data.o: $(hdrdir)/ruby/internal/intern/select.h +data.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +data.o: $(hdrdir)/ruby/internal/intern/signal.h +data.o: $(hdrdir)/ruby/internal/intern/sprintf.h +data.o: $(hdrdir)/ruby/internal/intern/string.h +data.o: $(hdrdir)/ruby/internal/intern/struct.h +data.o: $(hdrdir)/ruby/internal/intern/thread.h +data.o: $(hdrdir)/ruby/internal/intern/time.h +data.o: $(hdrdir)/ruby/internal/intern/variable.h +data.o: $(hdrdir)/ruby/internal/intern/vm.h +data.o: $(hdrdir)/ruby/internal/interpreter.h +data.o: $(hdrdir)/ruby/internal/iterator.h +data.o: $(hdrdir)/ruby/internal/memory.h +data.o: $(hdrdir)/ruby/internal/method.h +data.o: $(hdrdir)/ruby/internal/module.h +data.o: $(hdrdir)/ruby/internal/newobj.h +data.o: $(hdrdir)/ruby/internal/scan_args.h +data.o: $(hdrdir)/ruby/internal/special_consts.h +data.o: $(hdrdir)/ruby/internal/static_assert.h +data.o: $(hdrdir)/ruby/internal/stdalign.h +data.o: $(hdrdir)/ruby/internal/stdbool.h +data.o: $(hdrdir)/ruby/internal/stdckdint.h +data.o: $(hdrdir)/ruby/internal/symbol.h +data.o: $(hdrdir)/ruby/internal/value.h +data.o: $(hdrdir)/ruby/internal/value_type.h +data.o: $(hdrdir)/ruby/internal/variable.h +data.o: $(hdrdir)/ruby/internal/warning_push.h +data.o: $(hdrdir)/ruby/internal/xmalloc.h +data.o: $(hdrdir)/ruby/missing.h +data.o: $(hdrdir)/ruby/ruby.h +data.o: $(hdrdir)/ruby/st.h +data.o: $(hdrdir)/ruby/subst.h +data.o: data.c duplicate.o: $(RUBY_EXTCONF_H) duplicate.o: $(arch_hdrdir)/ruby/config.h duplicate.o: $(hdrdir)/ruby.h @@ -52,6 +212,7 @@ duplicate.o: $(hdrdir)/ruby/internal/attr/noexcept.h duplicate.o: $(hdrdir)/ruby/internal/attr/noinline.h duplicate.o: $(hdrdir)/ruby/internal/attr/nonnull.h duplicate.o: $(hdrdir)/ruby/internal/attr/noreturn.h +duplicate.o: $(hdrdir)/ruby/internal/attr/packed_struct.h duplicate.o: $(hdrdir)/ruby/internal/attr/pure.h duplicate.o: $(hdrdir)/ruby/internal/attr/restrict.h duplicate.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +272,6 @@ duplicate.o: $(hdrdir)/ruby/internal/intern/enumerator.h duplicate.o: $(hdrdir)/ruby/internal/intern/error.h duplicate.o: $(hdrdir)/ruby/internal/intern/eval.h duplicate.o: $(hdrdir)/ruby/internal/intern/file.h -duplicate.o: $(hdrdir)/ruby/internal/intern/gc.h duplicate.o: $(hdrdir)/ruby/internal/intern/hash.h duplicate.o: $(hdrdir)/ruby/internal/intern/io.h duplicate.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +302,12 @@ duplicate.o: $(hdrdir)/ruby/internal/memory.h duplicate.o: $(hdrdir)/ruby/internal/method.h duplicate.o: $(hdrdir)/ruby/internal/module.h duplicate.o: $(hdrdir)/ruby/internal/newobj.h -duplicate.o: $(hdrdir)/ruby/internal/rgengc.h duplicate.o: $(hdrdir)/ruby/internal/scan_args.h duplicate.o: $(hdrdir)/ruby/internal/special_consts.h duplicate.o: $(hdrdir)/ruby/internal/static_assert.h duplicate.o: $(hdrdir)/ruby/internal/stdalign.h duplicate.o: $(hdrdir)/ruby/internal/stdbool.h +duplicate.o: $(hdrdir)/ruby/internal/stdckdint.h duplicate.o: $(hdrdir)/ruby/internal/symbol.h duplicate.o: $(hdrdir)/ruby/internal/value.h duplicate.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +372,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +432,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +462,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -372,6 +532,7 @@ len.o: $(hdrdir)/ruby/internal/attr/noexcept.h len.o: $(hdrdir)/ruby/internal/attr/noinline.h len.o: $(hdrdir)/ruby/internal/attr/nonnull.h len.o: $(hdrdir)/ruby/internal/attr/noreturn.h +len.o: $(hdrdir)/ruby/internal/attr/packed_struct.h len.o: $(hdrdir)/ruby/internal/attr/pure.h len.o: $(hdrdir)/ruby/internal/attr/restrict.h len.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -431,7 +592,6 @@ len.o: $(hdrdir)/ruby/internal/intern/enumerator.h len.o: $(hdrdir)/ruby/internal/intern/error.h len.o: $(hdrdir)/ruby/internal/intern/eval.h len.o: $(hdrdir)/ruby/internal/intern/file.h -len.o: $(hdrdir)/ruby/internal/intern/gc.h len.o: $(hdrdir)/ruby/internal/intern/hash.h len.o: $(hdrdir)/ruby/internal/intern/io.h len.o: $(hdrdir)/ruby/internal/intern/load.h @@ -462,12 +622,12 @@ len.o: $(hdrdir)/ruby/internal/memory.h len.o: $(hdrdir)/ruby/internal/method.h len.o: $(hdrdir)/ruby/internal/module.h len.o: $(hdrdir)/ruby/internal/newobj.h -len.o: $(hdrdir)/ruby/internal/rgengc.h len.o: $(hdrdir)/ruby/internal/scan_args.h len.o: $(hdrdir)/ruby/internal/special_consts.h len.o: $(hdrdir)/ruby/internal/static_assert.h len.o: $(hdrdir)/ruby/internal/stdalign.h len.o: $(hdrdir)/ruby/internal/stdbool.h +len.o: $(hdrdir)/ruby/internal/stdckdint.h len.o: $(hdrdir)/ruby/internal/symbol.h len.o: $(hdrdir)/ruby/internal/value.h len.o: $(hdrdir)/ruby/internal/value_type.h @@ -532,6 +692,7 @@ member.o: $(hdrdir)/ruby/internal/attr/noexcept.h member.o: $(hdrdir)/ruby/internal/attr/noinline.h member.o: $(hdrdir)/ruby/internal/attr/nonnull.h member.o: $(hdrdir)/ruby/internal/attr/noreturn.h +member.o: $(hdrdir)/ruby/internal/attr/packed_struct.h member.o: $(hdrdir)/ruby/internal/attr/pure.h member.o: $(hdrdir)/ruby/internal/attr/restrict.h member.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -591,7 +752,6 @@ member.o: $(hdrdir)/ruby/internal/intern/enumerator.h member.o: $(hdrdir)/ruby/internal/intern/error.h member.o: $(hdrdir)/ruby/internal/intern/eval.h member.o: $(hdrdir)/ruby/internal/intern/file.h -member.o: $(hdrdir)/ruby/internal/intern/gc.h member.o: $(hdrdir)/ruby/internal/intern/hash.h member.o: $(hdrdir)/ruby/internal/intern/io.h member.o: $(hdrdir)/ruby/internal/intern/load.h @@ -622,12 +782,12 @@ member.o: $(hdrdir)/ruby/internal/memory.h member.o: $(hdrdir)/ruby/internal/method.h member.o: $(hdrdir)/ruby/internal/module.h member.o: $(hdrdir)/ruby/internal/newobj.h -member.o: $(hdrdir)/ruby/internal/rgengc.h member.o: $(hdrdir)/ruby/internal/scan_args.h member.o: $(hdrdir)/ruby/internal/special_consts.h member.o: $(hdrdir)/ruby/internal/static_assert.h member.o: $(hdrdir)/ruby/internal/stdalign.h member.o: $(hdrdir)/ruby/internal/stdbool.h +member.o: $(hdrdir)/ruby/internal/stdckdint.h member.o: $(hdrdir)/ruby/internal/symbol.h member.o: $(hdrdir)/ruby/internal/value.h member.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/struct/member.c b/ext/-test-/struct/member.c index f5400fe477..29ddff93e8 100644 --- a/ext/-test-/struct/member.c +++ b/ext/-test-/struct/member.c @@ -6,7 +6,7 @@ bug_struct_get(VALUE obj, VALUE name) ID id = rb_check_id(&name); if (!id) { - rb_name_error_str(name, "`%"PRIsVALUE"' is not a struct member", name); + rb_name_error_str(name, "'%"PRIsVALUE"' is not a struct member", name); } return rb_struct_getmember(obj, id); } diff --git a/ext/-test-/symbol/depend b/ext/-test-/symbol/depend index b94e4ce821..7c76596fdf 100644 --- a/ext/-test-/symbol/depend +++ b/ext/-test-/symbol/depend @@ -52,6 +52,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ type.o: $(hdrdir)/ruby/internal/attr/noexcept.h type.o: $(hdrdir)/ruby/internal/attr/noinline.h type.o: $(hdrdir)/ruby/internal/attr/nonnull.h type.o: $(hdrdir)/ruby/internal/attr/noreturn.h +type.o: $(hdrdir)/ruby/internal/attr/packed_struct.h type.o: $(hdrdir)/ruby/internal/attr/pure.h type.o: $(hdrdir)/ruby/internal/attr/restrict.h type.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ type.o: $(hdrdir)/ruby/internal/intern/enumerator.h type.o: $(hdrdir)/ruby/internal/intern/error.h type.o: $(hdrdir)/ruby/internal/intern/eval.h type.o: $(hdrdir)/ruby/internal/intern/file.h -type.o: $(hdrdir)/ruby/internal/intern/gc.h type.o: $(hdrdir)/ruby/internal/intern/hash.h type.o: $(hdrdir)/ruby/internal/intern/io.h type.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ type.o: $(hdrdir)/ruby/internal/memory.h type.o: $(hdrdir)/ruby/internal/method.h type.o: $(hdrdir)/ruby/internal/module.h type.o: $(hdrdir)/ruby/internal/newobj.h -type.o: $(hdrdir)/ruby/internal/rgengc.h type.o: $(hdrdir)/ruby/internal/scan_args.h type.o: $(hdrdir)/ruby/internal/special_consts.h type.o: $(hdrdir)/ruby/internal/static_assert.h type.o: $(hdrdir)/ruby/internal/stdalign.h type.o: $(hdrdir)/ruby/internal/stdbool.h +type.o: $(hdrdir)/ruby/internal/stdckdint.h type.o: $(hdrdir)/ruby/internal/symbol.h type.o: $(hdrdir)/ruby/internal/value.h type.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/thread/instrumentation/depend b/ext/-test-/thread/instrumentation/depend index e2fcd060d8..a37e4d5675 100644 --- a/ext/-test-/thread/instrumentation/depend +++ b/ext/-test-/thread/instrumentation/depend @@ -52,6 +52,7 @@ instrumentation.o: $(hdrdir)/ruby/internal/attr/noexcept.h instrumentation.o: $(hdrdir)/ruby/internal/attr/noinline.h instrumentation.o: $(hdrdir)/ruby/internal/attr/nonnull.h instrumentation.o: $(hdrdir)/ruby/internal/attr/noreturn.h +instrumentation.o: $(hdrdir)/ruby/internal/attr/packed_struct.h instrumentation.o: $(hdrdir)/ruby/internal/attr/pure.h instrumentation.o: $(hdrdir)/ruby/internal/attr/restrict.h instrumentation.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ instrumentation.o: $(hdrdir)/ruby/internal/intern/enumerator.h instrumentation.o: $(hdrdir)/ruby/internal/intern/error.h instrumentation.o: $(hdrdir)/ruby/internal/intern/eval.h instrumentation.o: $(hdrdir)/ruby/internal/intern/file.h -instrumentation.o: $(hdrdir)/ruby/internal/intern/gc.h instrumentation.o: $(hdrdir)/ruby/internal/intern/hash.h instrumentation.o: $(hdrdir)/ruby/internal/intern/io.h instrumentation.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ instrumentation.o: $(hdrdir)/ruby/internal/memory.h instrumentation.o: $(hdrdir)/ruby/internal/method.h instrumentation.o: $(hdrdir)/ruby/internal/module.h instrumentation.o: $(hdrdir)/ruby/internal/newobj.h -instrumentation.o: $(hdrdir)/ruby/internal/rgengc.h instrumentation.o: $(hdrdir)/ruby/internal/scan_args.h instrumentation.o: $(hdrdir)/ruby/internal/special_consts.h instrumentation.o: $(hdrdir)/ruby/internal/static_assert.h instrumentation.o: $(hdrdir)/ruby/internal/stdalign.h instrumentation.o: $(hdrdir)/ruby/internal/stdbool.h +instrumentation.o: $(hdrdir)/ruby/internal/stdckdint.h instrumentation.o: $(hdrdir)/ruby/internal/symbol.h instrumentation.o: $(hdrdir)/ruby/internal/value.h instrumentation.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/thread/instrumentation/instrumentation.c b/ext/-test-/thread/instrumentation/instrumentation.c index d2a2c2740b..d81bc0f2a7 100644 --- a/ext/-test-/thread/instrumentation/instrumentation.c +++ b/ext/-test-/thread/instrumentation/instrumentation.c @@ -2,90 +2,137 @@ #include "ruby/atomic.h" #include "ruby/thread.h" -static rb_atomic_t started_count = 0; -static rb_atomic_t ready_count = 0; -static rb_atomic_t resumed_count = 0; -static rb_atomic_t suspended_count = 0; -static rb_atomic_t exited_count = 0; - -#if __STDC_VERSION__ >= 201112 - #define RB_THREAD_LOCAL_SPECIFIER _Thread_local -#elif defined(__GNUC__) && !defined(RB_THREAD_LOCAL_SPECIFIER_IS_UNSUPPORTED) - /* note that ICC (linux) and Clang are covered by __GNUC__ */ - #define RB_THREAD_LOCAL_SPECIFIER __thread -#else - #define RB_THREAD_LOCAL_SPECIFIER +#ifndef RB_THREAD_LOCAL_SPECIFIER +# define RB_THREAD_LOCAL_SPECIFIER #endif -static RB_THREAD_LOCAL_SPECIFIER unsigned int local_ready_count = 0; -static RB_THREAD_LOCAL_SPECIFIER unsigned int local_resumed_count = 0; -static RB_THREAD_LOCAL_SPECIFIER unsigned int local_suspended_count = 0; +static VALUE last_thread = Qnil; +static VALUE timeline_value = Qnil; + +struct thread_event { + VALUE thread; + rb_event_flag_t event; +}; + +#define MAX_EVENTS 1024 +static struct thread_event event_timeline[MAX_EVENTS]; +static rb_atomic_t timeline_cursor; static void -ex_callback(rb_event_flag_t event, const rb_internal_thread_event_data_t *event_data, void *user_data) +event_timeline_gc_mark(void *ptr) { + rb_atomic_t cursor; + for (cursor = 0; cursor < timeline_cursor; cursor++) { + rb_gc_mark(event_timeline[cursor].thread); + } +} + +static const rb_data_type_t event_timeline_type = { + "TestThreadInstrumentation/event_timeline", + {event_timeline_gc_mark, NULL, NULL,}, + 0, 0, + RUBY_TYPED_FREE_IMMEDIATELY, +}; + +static void +reset_timeline(void) +{ + timeline_cursor = 0; + memset(event_timeline, 0, sizeof(struct thread_event) * MAX_EVENTS); +} + +static rb_event_flag_t +find_last_event(VALUE thread) +{ + rb_atomic_t cursor = timeline_cursor; + if (cursor) { + do { + if (event_timeline[cursor].thread == thread){ + return event_timeline[cursor].event; + } + cursor--; + } while (cursor > 0); + } + return 0; +} + +static const char * +event_name(rb_event_flag_t event) { switch (event) { case RUBY_INTERNAL_THREAD_EVENT_STARTED: - RUBY_ATOMIC_INC(started_count); - break; + return "started"; case RUBY_INTERNAL_THREAD_EVENT_READY: - RUBY_ATOMIC_INC(ready_count); - local_ready_count++; - break; + return "ready"; case RUBY_INTERNAL_THREAD_EVENT_RESUMED: - RUBY_ATOMIC_INC(resumed_count); - local_resumed_count++; - break; + return "resumed"; case RUBY_INTERNAL_THREAD_EVENT_SUSPENDED: - RUBY_ATOMIC_INC(suspended_count); - local_suspended_count++; - break; + return "suspended"; case RUBY_INTERNAL_THREAD_EVENT_EXITED: - RUBY_ATOMIC_INC(exited_count); - break; + return "exited"; } + return "no-event"; } -static rb_internal_thread_event_hook_t * single_hook = NULL; - -static VALUE -thread_counters(VALUE thread) +static void +unexpected(bool strict, const char *format, VALUE thread, rb_event_flag_t last_event) { - VALUE array = rb_ary_new2(5); - rb_ary_push(array, UINT2NUM(started_count)); - rb_ary_push(array, UINT2NUM(ready_count)); - rb_ary_push(array, UINT2NUM(resumed_count)); - rb_ary_push(array, UINT2NUM(suspended_count)); - rb_ary_push(array, UINT2NUM(exited_count)); - return array; + const char *last_event_name = event_name(last_event); + if (strict) { + rb_bug(format, thread, last_event_name); + } + else { + fprintf(stderr, format, thread, last_event_name); + fprintf(stderr, "\n"); + } } -static VALUE -thread_local_counters(VALUE thread) +static void +ex_callback(rb_event_flag_t event, const rb_internal_thread_event_data_t *event_data, void *user_data) { - VALUE array = rb_ary_new2(3); - rb_ary_push(array, UINT2NUM(local_ready_count)); - rb_ary_push(array, UINT2NUM(local_resumed_count)); - rb_ary_push(array, UINT2NUM(local_suspended_count)); - return array; -} + rb_event_flag_t last_event = find_last_event(event_data->thread); + bool strict = (bool)user_data; -static VALUE -thread_reset_counters(VALUE thread) -{ - RUBY_ATOMIC_SET(started_count, 0); - RUBY_ATOMIC_SET(ready_count, 0); - RUBY_ATOMIC_SET(resumed_count, 0); - RUBY_ATOMIC_SET(suspended_count, 0); - RUBY_ATOMIC_SET(exited_count, 0); - local_ready_count = 0; - local_resumed_count = 0; - local_suspended_count = 0; - return Qtrue; + if (last_event != 0) { + switch (event) { + case RUBY_INTERNAL_THREAD_EVENT_STARTED: + unexpected(strict, "[thread=%"PRIxVALUE"] `started` event can't be preceded by `%s`", event_data->thread, last_event); + break; + case RUBY_INTERNAL_THREAD_EVENT_READY: + if (last_event != RUBY_INTERNAL_THREAD_EVENT_STARTED && last_event != RUBY_INTERNAL_THREAD_EVENT_SUSPENDED) { + unexpected(strict, "[thread=%"PRIxVALUE"] `ready` must be preceded by `started` or `suspended`, got: `%s`", event_data->thread, last_event); + } + break; + case RUBY_INTERNAL_THREAD_EVENT_RESUMED: + if (last_event != RUBY_INTERNAL_THREAD_EVENT_READY) { + unexpected(strict, "[thread=%"PRIxVALUE"] `resumed` must be preceded by `ready`, got: `%s`", event_data->thread, last_event); + } + break; + case RUBY_INTERNAL_THREAD_EVENT_SUSPENDED: + if (last_event != RUBY_INTERNAL_THREAD_EVENT_RESUMED) { + unexpected(strict, "[thread=%"PRIxVALUE"] `suspended` must be preceded by `resumed`, got: `%s`", event_data->thread, last_event); + } + break; + case RUBY_INTERNAL_THREAD_EVENT_EXITED: + if (last_event != RUBY_INTERNAL_THREAD_EVENT_RESUMED && last_event != RUBY_INTERNAL_THREAD_EVENT_SUSPENDED) { + unexpected(strict, "[thread=%"PRIxVALUE"] `exited` must be preceded by `resumed` or `suspended`, got: `%s`", event_data->thread, last_event); + } + break; + } + } + + rb_atomic_t cursor = RUBY_ATOMIC_FETCH_ADD(timeline_cursor, 1); + if (cursor >= MAX_EVENTS) { + rb_bug("TestThreadInstrumentation: ran out of event_timeline space"); + } + + event_timeline[cursor].thread = event_data->thread; + event_timeline[cursor].event = event; } +static rb_internal_thread_event_hook_t * single_hook = NULL; + static VALUE -thread_register_callback(VALUE thread) +thread_register_callback(VALUE thread, VALUE strict) { single_hook = rb_internal_thread_add_event_hook( ex_callback, @@ -94,13 +141,33 @@ thread_register_callback(VALUE thread) RUBY_INTERNAL_THREAD_EVENT_RESUMED | RUBY_INTERNAL_THREAD_EVENT_SUSPENDED | RUBY_INTERNAL_THREAD_EVENT_EXITED, - NULL + (void *)RTEST(strict) ); return Qnil; } static VALUE +event_symbol(rb_event_flag_t event) +{ + switch (event) { + case RUBY_INTERNAL_THREAD_EVENT_STARTED: + return rb_id2sym(rb_intern("started")); + case RUBY_INTERNAL_THREAD_EVENT_READY: + return rb_id2sym(rb_intern("ready")); + case RUBY_INTERNAL_THREAD_EVENT_RESUMED: + return rb_id2sym(rb_intern("resumed")); + case RUBY_INTERNAL_THREAD_EVENT_SUSPENDED: + return rb_id2sym(rb_intern("suspended")); + case RUBY_INTERNAL_THREAD_EVENT_EXITED: + return rb_id2sym(rb_intern("exited")); + default: + rb_bug("TestThreadInstrumentation: Unexpected event"); + break; + } +} + +static VALUE thread_unregister_callback(VALUE thread) { if (single_hook) { @@ -108,7 +175,18 @@ thread_unregister_callback(VALUE thread) single_hook = NULL; } - return Qnil; + VALUE events = rb_ary_new_capa(timeline_cursor); + rb_atomic_t cursor; + for (cursor = 0; cursor < timeline_cursor; cursor++) { + VALUE pair = rb_ary_new_capa(2); + rb_ary_push(pair, event_timeline[cursor].thread); + rb_ary_push(pair, event_symbol(event_timeline[cursor].event)); + rb_ary_push(events, pair); + } + + reset_timeline(); + + return events; } static VALUE @@ -132,10 +210,11 @@ Init_instrumentation(void) { VALUE mBug = rb_define_module("Bug"); VALUE klass = rb_define_module_under(mBug, "ThreadInstrumentation"); - rb_define_singleton_method(klass, "counters", thread_counters, 0); - rb_define_singleton_method(klass, "local_counters", thread_local_counters, 0); - rb_define_singleton_method(klass, "reset_counters", thread_reset_counters, 0); - rb_define_singleton_method(klass, "register_callback", thread_register_callback, 0); + rb_global_variable(&timeline_value); + timeline_value = TypedData_Wrap_Struct(0, &event_timeline_type, 0); + + rb_global_variable(&last_thread); + rb_define_singleton_method(klass, "register_callback", thread_register_callback, 1); rb_define_singleton_method(klass, "unregister_callback", thread_unregister_callback, 0); rb_define_singleton_method(klass, "register_and_unregister_callbacks", thread_register_and_unregister_callback, 0); } diff --git a/ext/-test-/thread/lock_native_thread/extconf.rb b/ext/-test-/thread/lock_native_thread/extconf.rb new file mode 100644 index 0000000000..832bfde01a --- /dev/null +++ b/ext/-test-/thread/lock_native_thread/extconf.rb @@ -0,0 +1,2 @@ +# frozen_string_literal: false +create_makefile("-test-/thread/lock_native_thread") diff --git a/ext/-test-/thread/lock_native_thread/lock_native_thread.c b/ext/-test-/thread/lock_native_thread/lock_native_thread.c new file mode 100644 index 0000000000..2eb75809a9 --- /dev/null +++ b/ext/-test-/thread/lock_native_thread/lock_native_thread.c @@ -0,0 +1,50 @@ + +#include "ruby/ruby.h" +#include "ruby/thread.h" + +#ifdef HAVE_PTHREAD_H +#include <pthread.h> + +static pthread_key_t tls_key; + +static VALUE +get_tls(VALUE self) +{ + return (VALUE)pthread_getspecific(tls_key); +} + +static VALUE +set_tls(VALUE self, VALUE vn) +{ + pthread_setspecific(tls_key, (void *)vn); + return Qnil; +} + +static VALUE +lock_native_thread(VALUE self) +{ + return rb_thread_lock_native_thread() ? Qtrue : Qfalse; +} + +void +Init_lock_native_thread(void) +{ + int r; + + if ((r = pthread_key_create(&tls_key, NULL)) != 0) { + rb_bug("pthread_key_create() returns %d", r); + } + pthread_setspecific(tls_key, NULL); + + rb_define_method(rb_cThread, "lock_native_thread", lock_native_thread, 0); + rb_define_method(rb_cThread, "get_tls", get_tls, 0); + rb_define_method(rb_cThread, "set_tls", set_tls, 1); +} + +#else // HAVE_PTHREAD_H +void +Init_lock_native_thread(void) +{ + // do nothing +} +#endif // HAVE_PTHREAD_H diff --git a/ext/-test-/thread_fd/depend b/ext/-test-/thread_fd/depend index ecf738108a..0fda9f6dbf 100644 --- a/ext/-test-/thread_fd/depend +++ b/ext/-test-/thread_fd/depend @@ -51,6 +51,7 @@ thread_fd.o: $(hdrdir)/ruby/internal/attr/noexcept.h thread_fd.o: $(hdrdir)/ruby/internal/attr/noinline.h thread_fd.o: $(hdrdir)/ruby/internal/attr/nonnull.h thread_fd.o: $(hdrdir)/ruby/internal/attr/noreturn.h +thread_fd.o: $(hdrdir)/ruby/internal/attr/packed_struct.h thread_fd.o: $(hdrdir)/ruby/internal/attr/pure.h thread_fd.o: $(hdrdir)/ruby/internal/attr/restrict.h thread_fd.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ thread_fd.o: $(hdrdir)/ruby/internal/intern/enumerator.h thread_fd.o: $(hdrdir)/ruby/internal/intern/error.h thread_fd.o: $(hdrdir)/ruby/internal/intern/eval.h thread_fd.o: $(hdrdir)/ruby/internal/intern/file.h -thread_fd.o: $(hdrdir)/ruby/internal/intern/gc.h thread_fd.o: $(hdrdir)/ruby/internal/intern/hash.h thread_fd.o: $(hdrdir)/ruby/internal/intern/io.h thread_fd.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ thread_fd.o: $(hdrdir)/ruby/internal/memory.h thread_fd.o: $(hdrdir)/ruby/internal/method.h thread_fd.o: $(hdrdir)/ruby/internal/module.h thread_fd.o: $(hdrdir)/ruby/internal/newobj.h -thread_fd.o: $(hdrdir)/ruby/internal/rgengc.h thread_fd.o: $(hdrdir)/ruby/internal/scan_args.h thread_fd.o: $(hdrdir)/ruby/internal/special_consts.h thread_fd.o: $(hdrdir)/ruby/internal/static_assert.h thread_fd.o: $(hdrdir)/ruby/internal/stdalign.h thread_fd.o: $(hdrdir)/ruby/internal/stdbool.h +thread_fd.o: $(hdrdir)/ruby/internal/stdckdint.h thread_fd.o: $(hdrdir)/ruby/internal/symbol.h thread_fd.o: $(hdrdir)/ruby/internal/value.h thread_fd.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/time/depend b/ext/-test-/time/depend index b7d1a2b114..5ed791bcc5 100644 --- a/ext/-test-/time/depend +++ b/ext/-test-/time/depend @@ -52,6 +52,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -213,6 +213,7 @@ leap_second.o: $(hdrdir)/ruby/internal/attr/noexcept.h leap_second.o: $(hdrdir)/ruby/internal/attr/noinline.h leap_second.o: $(hdrdir)/ruby/internal/attr/nonnull.h leap_second.o: $(hdrdir)/ruby/internal/attr/noreturn.h +leap_second.o: $(hdrdir)/ruby/internal/attr/packed_struct.h leap_second.o: $(hdrdir)/ruby/internal/attr/pure.h leap_second.o: $(hdrdir)/ruby/internal/attr/restrict.h leap_second.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -272,7 +273,6 @@ leap_second.o: $(hdrdir)/ruby/internal/intern/enumerator.h leap_second.o: $(hdrdir)/ruby/internal/intern/error.h leap_second.o: $(hdrdir)/ruby/internal/intern/eval.h leap_second.o: $(hdrdir)/ruby/internal/intern/file.h -leap_second.o: $(hdrdir)/ruby/internal/intern/gc.h leap_second.o: $(hdrdir)/ruby/internal/intern/hash.h leap_second.o: $(hdrdir)/ruby/internal/intern/io.h leap_second.o: $(hdrdir)/ruby/internal/intern/load.h @@ -303,12 +303,12 @@ leap_second.o: $(hdrdir)/ruby/internal/memory.h leap_second.o: $(hdrdir)/ruby/internal/method.h leap_second.o: $(hdrdir)/ruby/internal/module.h leap_second.o: $(hdrdir)/ruby/internal/newobj.h -leap_second.o: $(hdrdir)/ruby/internal/rgengc.h leap_second.o: $(hdrdir)/ruby/internal/scan_args.h leap_second.o: $(hdrdir)/ruby/internal/special_consts.h leap_second.o: $(hdrdir)/ruby/internal/static_assert.h leap_second.o: $(hdrdir)/ruby/internal/stdalign.h leap_second.o: $(hdrdir)/ruby/internal/stdbool.h +leap_second.o: $(hdrdir)/ruby/internal/stdckdint.h leap_second.o: $(hdrdir)/ruby/internal/symbol.h leap_second.o: $(hdrdir)/ruby/internal/value.h leap_second.o: $(hdrdir)/ruby/internal/value_type.h @@ -377,6 +377,7 @@ new.o: $(hdrdir)/ruby/internal/attr/noexcept.h new.o: $(hdrdir)/ruby/internal/attr/noinline.h new.o: $(hdrdir)/ruby/internal/attr/nonnull.h new.o: $(hdrdir)/ruby/internal/attr/noreturn.h +new.o: $(hdrdir)/ruby/internal/attr/packed_struct.h new.o: $(hdrdir)/ruby/internal/attr/pure.h new.o: $(hdrdir)/ruby/internal/attr/restrict.h new.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -436,7 +437,6 @@ new.o: $(hdrdir)/ruby/internal/intern/enumerator.h new.o: $(hdrdir)/ruby/internal/intern/error.h new.o: $(hdrdir)/ruby/internal/intern/eval.h new.o: $(hdrdir)/ruby/internal/intern/file.h -new.o: $(hdrdir)/ruby/internal/intern/gc.h new.o: $(hdrdir)/ruby/internal/intern/hash.h new.o: $(hdrdir)/ruby/internal/intern/io.h new.o: $(hdrdir)/ruby/internal/intern/load.h @@ -467,12 +467,12 @@ new.o: $(hdrdir)/ruby/internal/memory.h new.o: $(hdrdir)/ruby/internal/method.h new.o: $(hdrdir)/ruby/internal/module.h new.o: $(hdrdir)/ruby/internal/newobj.h -new.o: $(hdrdir)/ruby/internal/rgengc.h new.o: $(hdrdir)/ruby/internal/scan_args.h new.o: $(hdrdir)/ruby/internal/special_consts.h new.o: $(hdrdir)/ruby/internal/static_assert.h new.o: $(hdrdir)/ruby/internal/stdalign.h new.o: $(hdrdir)/ruby/internal/stdbool.h +new.o: $(hdrdir)/ruby/internal/stdckdint.h new.o: $(hdrdir)/ruby/internal/symbol.h new.o: $(hdrdir)/ruby/internal/value.h new.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/tracepoint/depend b/ext/-test-/tracepoint/depend index 8e2aa7eab6..133663b3bd 100644 --- a/ext/-test-/tracepoint/depend +++ b/ext/-test-/tracepoint/depend @@ -52,6 +52,7 @@ gc_hook.o: $(hdrdir)/ruby/internal/attr/noexcept.h gc_hook.o: $(hdrdir)/ruby/internal/attr/noinline.h gc_hook.o: $(hdrdir)/ruby/internal/attr/nonnull.h gc_hook.o: $(hdrdir)/ruby/internal/attr/noreturn.h +gc_hook.o: $(hdrdir)/ruby/internal/attr/packed_struct.h gc_hook.o: $(hdrdir)/ruby/internal/attr/pure.h gc_hook.o: $(hdrdir)/ruby/internal/attr/restrict.h gc_hook.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ gc_hook.o: $(hdrdir)/ruby/internal/intern/enumerator.h gc_hook.o: $(hdrdir)/ruby/internal/intern/error.h gc_hook.o: $(hdrdir)/ruby/internal/intern/eval.h gc_hook.o: $(hdrdir)/ruby/internal/intern/file.h -gc_hook.o: $(hdrdir)/ruby/internal/intern/gc.h gc_hook.o: $(hdrdir)/ruby/internal/intern/hash.h gc_hook.o: $(hdrdir)/ruby/internal/intern/io.h gc_hook.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ gc_hook.o: $(hdrdir)/ruby/internal/memory.h gc_hook.o: $(hdrdir)/ruby/internal/method.h gc_hook.o: $(hdrdir)/ruby/internal/module.h gc_hook.o: $(hdrdir)/ruby/internal/newobj.h -gc_hook.o: $(hdrdir)/ruby/internal/rgengc.h gc_hook.o: $(hdrdir)/ruby/internal/scan_args.h gc_hook.o: $(hdrdir)/ruby/internal/special_consts.h gc_hook.o: $(hdrdir)/ruby/internal/static_assert.h gc_hook.o: $(hdrdir)/ruby/internal/stdalign.h gc_hook.o: $(hdrdir)/ruby/internal/stdbool.h +gc_hook.o: $(hdrdir)/ruby/internal/stdckdint.h gc_hook.o: $(hdrdir)/ruby/internal/symbol.h gc_hook.o: $(hdrdir)/ruby/internal/value.h gc_hook.o: $(hdrdir)/ruby/internal/value_type.h @@ -212,6 +212,7 @@ tracepoint.o: $(hdrdir)/ruby/internal/attr/noexcept.h tracepoint.o: $(hdrdir)/ruby/internal/attr/noinline.h tracepoint.o: $(hdrdir)/ruby/internal/attr/nonnull.h tracepoint.o: $(hdrdir)/ruby/internal/attr/noreturn.h +tracepoint.o: $(hdrdir)/ruby/internal/attr/packed_struct.h tracepoint.o: $(hdrdir)/ruby/internal/attr/pure.h tracepoint.o: $(hdrdir)/ruby/internal/attr/restrict.h tracepoint.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -271,7 +272,6 @@ tracepoint.o: $(hdrdir)/ruby/internal/intern/enumerator.h tracepoint.o: $(hdrdir)/ruby/internal/intern/error.h tracepoint.o: $(hdrdir)/ruby/internal/intern/eval.h tracepoint.o: $(hdrdir)/ruby/internal/intern/file.h -tracepoint.o: $(hdrdir)/ruby/internal/intern/gc.h tracepoint.o: $(hdrdir)/ruby/internal/intern/hash.h tracepoint.o: $(hdrdir)/ruby/internal/intern/io.h tracepoint.o: $(hdrdir)/ruby/internal/intern/load.h @@ -302,12 +302,12 @@ tracepoint.o: $(hdrdir)/ruby/internal/memory.h tracepoint.o: $(hdrdir)/ruby/internal/method.h tracepoint.o: $(hdrdir)/ruby/internal/module.h tracepoint.o: $(hdrdir)/ruby/internal/newobj.h -tracepoint.o: $(hdrdir)/ruby/internal/rgengc.h tracepoint.o: $(hdrdir)/ruby/internal/scan_args.h tracepoint.o: $(hdrdir)/ruby/internal/special_consts.h tracepoint.o: $(hdrdir)/ruby/internal/static_assert.h tracepoint.o: $(hdrdir)/ruby/internal/stdalign.h tracepoint.o: $(hdrdir)/ruby/internal/stdbool.h +tracepoint.o: $(hdrdir)/ruby/internal/stdckdint.h tracepoint.o: $(hdrdir)/ruby/internal/symbol.h tracepoint.o: $(hdrdir)/ruby/internal/value.h tracepoint.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/tracepoint/gc_hook.c b/ext/-test-/tracepoint/gc_hook.c index a3f4e7f68a..54c06c54a5 100644 --- a/ext/-test-/tracepoint/gc_hook.c +++ b/ext/-test-/tracepoint/gc_hook.c @@ -33,7 +33,9 @@ gc_start_end_i(VALUE tpval, void *data) } if (invoking == 0) { - rb_postponed_job_register(0, invoke_proc, data); + /* will overwrite the existing handle with new data on the second and subsequent call */ + rb_postponed_job_handle_t h = rb_postponed_job_preregister(0, invoke_proc, data); + rb_postponed_job_trigger(h); } } diff --git a/ext/-test-/typeddata/depend b/ext/-test-/typeddata/depend index 02f6de6e20..6c0847c82d 100644 --- a/ext/-test-/typeddata/depend +++ b/ext/-test-/typeddata/depend @@ -52,6 +52,7 @@ typeddata.o: $(hdrdir)/ruby/internal/attr/noexcept.h typeddata.o: $(hdrdir)/ruby/internal/attr/noinline.h typeddata.o: $(hdrdir)/ruby/internal/attr/nonnull.h typeddata.o: $(hdrdir)/ruby/internal/attr/noreturn.h +typeddata.o: $(hdrdir)/ruby/internal/attr/packed_struct.h typeddata.o: $(hdrdir)/ruby/internal/attr/pure.h typeddata.o: $(hdrdir)/ruby/internal/attr/restrict.h typeddata.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ typeddata.o: $(hdrdir)/ruby/internal/intern/enumerator.h typeddata.o: $(hdrdir)/ruby/internal/intern/error.h typeddata.o: $(hdrdir)/ruby/internal/intern/eval.h typeddata.o: $(hdrdir)/ruby/internal/intern/file.h -typeddata.o: $(hdrdir)/ruby/internal/intern/gc.h typeddata.o: $(hdrdir)/ruby/internal/intern/hash.h typeddata.o: $(hdrdir)/ruby/internal/intern/io.h typeddata.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ typeddata.o: $(hdrdir)/ruby/internal/memory.h typeddata.o: $(hdrdir)/ruby/internal/method.h typeddata.o: $(hdrdir)/ruby/internal/module.h typeddata.o: $(hdrdir)/ruby/internal/newobj.h -typeddata.o: $(hdrdir)/ruby/internal/rgengc.h typeddata.o: $(hdrdir)/ruby/internal/scan_args.h typeddata.o: $(hdrdir)/ruby/internal/special_consts.h typeddata.o: $(hdrdir)/ruby/internal/static_assert.h typeddata.o: $(hdrdir)/ruby/internal/stdalign.h typeddata.o: $(hdrdir)/ruby/internal/stdbool.h +typeddata.o: $(hdrdir)/ruby/internal/stdckdint.h typeddata.o: $(hdrdir)/ruby/internal/symbol.h typeddata.o: $(hdrdir)/ruby/internal/value.h typeddata.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/vm/depend b/ext/-test-/vm/depend index 7f110d48eb..422b40a32d 100644 --- a/ext/-test-/vm/depend +++ b/ext/-test-/vm/depend @@ -51,6 +51,7 @@ at_exit.o: $(hdrdir)/ruby/internal/attr/noexcept.h at_exit.o: $(hdrdir)/ruby/internal/attr/noinline.h at_exit.o: $(hdrdir)/ruby/internal/attr/nonnull.h at_exit.o: $(hdrdir)/ruby/internal/attr/noreturn.h +at_exit.o: $(hdrdir)/ruby/internal/attr/packed_struct.h at_exit.o: $(hdrdir)/ruby/internal/attr/pure.h at_exit.o: $(hdrdir)/ruby/internal/attr/restrict.h at_exit.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ at_exit.o: $(hdrdir)/ruby/internal/intern/enumerator.h at_exit.o: $(hdrdir)/ruby/internal/intern/error.h at_exit.o: $(hdrdir)/ruby/internal/intern/eval.h at_exit.o: $(hdrdir)/ruby/internal/intern/file.h -at_exit.o: $(hdrdir)/ruby/internal/intern/gc.h at_exit.o: $(hdrdir)/ruby/internal/intern/hash.h at_exit.o: $(hdrdir)/ruby/internal/intern/io.h at_exit.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ at_exit.o: $(hdrdir)/ruby/internal/memory.h at_exit.o: $(hdrdir)/ruby/internal/method.h at_exit.o: $(hdrdir)/ruby/internal/module.h at_exit.o: $(hdrdir)/ruby/internal/newobj.h -at_exit.o: $(hdrdir)/ruby/internal/rgengc.h at_exit.o: $(hdrdir)/ruby/internal/scan_args.h at_exit.o: $(hdrdir)/ruby/internal/special_consts.h at_exit.o: $(hdrdir)/ruby/internal/static_assert.h at_exit.o: $(hdrdir)/ruby/internal/stdalign.h at_exit.o: $(hdrdir)/ruby/internal/stdbool.h +at_exit.o: $(hdrdir)/ruby/internal/stdckdint.h at_exit.o: $(hdrdir)/ruby/internal/symbol.h at_exit.o: $(hdrdir)/ruby/internal/value.h at_exit.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/-test-/wait/depend b/ext/-test-/wait/depend index e71bda9968..7997a16709 100644 --- a/ext/-test-/wait/depend +++ b/ext/-test-/wait/depend @@ -52,6 +52,7 @@ wait.o: $(hdrdir)/ruby/internal/attr/noexcept.h wait.o: $(hdrdir)/ruby/internal/attr/noinline.h wait.o: $(hdrdir)/ruby/internal/attr/nonnull.h wait.o: $(hdrdir)/ruby/internal/attr/noreturn.h +wait.o: $(hdrdir)/ruby/internal/attr/packed_struct.h wait.o: $(hdrdir)/ruby/internal/attr/pure.h wait.o: $(hdrdir)/ruby/internal/attr/restrict.h wait.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -120,7 +121,6 @@ wait.o: $(hdrdir)/ruby/internal/intern/enumerator.h wait.o: $(hdrdir)/ruby/internal/intern/error.h wait.o: $(hdrdir)/ruby/internal/intern/eval.h wait.o: $(hdrdir)/ruby/internal/intern/file.h -wait.o: $(hdrdir)/ruby/internal/intern/gc.h wait.o: $(hdrdir)/ruby/internal/intern/hash.h wait.o: $(hdrdir)/ruby/internal/intern/io.h wait.o: $(hdrdir)/ruby/internal/intern/load.h @@ -151,12 +151,12 @@ wait.o: $(hdrdir)/ruby/internal/memory.h wait.o: $(hdrdir)/ruby/internal/method.h wait.o: $(hdrdir)/ruby/internal/module.h wait.o: $(hdrdir)/ruby/internal/newobj.h -wait.o: $(hdrdir)/ruby/internal/rgengc.h wait.o: $(hdrdir)/ruby/internal/scan_args.h wait.o: $(hdrdir)/ruby/internal/special_consts.h wait.o: $(hdrdir)/ruby/internal/static_assert.h wait.o: $(hdrdir)/ruby/internal/stdalign.h wait.o: $(hdrdir)/ruby/internal/stdbool.h +wait.o: $(hdrdir)/ruby/internal/stdckdint.h wait.o: $(hdrdir)/ruby/internal/symbol.h wait.o: $(hdrdir)/ruby/internal/value.h wait.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/.document b/ext/.document index aeb40c60fb..0efd511a61 100644 --- a/ext/.document +++ b/ext/.document @@ -11,7 +11,6 @@ date/date_parse.c date/date_strftime.c date/date_strptime.c date/lib -dbm/dbm.c digest/bubblebabble/bubblebabble.c digest/digest.c digest/lib @@ -22,7 +21,6 @@ digest/sha2/sha2init.c digest/sha2/lib etc/etc.c fcntl/fcntl.c -fiber/fiber.c fiddle/closure.c fiddle/conversions.c fiddle/fiddle.c @@ -31,9 +29,7 @@ fiddle/pinned.c fiddle/pointer.c fiddle/handle.c fiddle/lib -gdbm/gdbm.c -io/console/console.c -io/console/lib +io/console/ io/nonblock/nonblock.c io/wait/wait.c json/generator/generator.c @@ -5,7 +5,6 @@ #continuation #coverage #date -#dbm #digest/bubblebabble #digest #digest/md5 @@ -14,9 +13,7 @@ #digest/sha2 #etc #fcntl -#fiber #fiddle -#gdbm #io/console #io/nonblock #io/wait diff --git a/ext/Setup.atheos b/ext/Setup.atheos index 3f6263b1e2..91f73f32f9 100644 --- a/ext/Setup.atheos +++ b/ext/Setup.atheos @@ -1,23 +1,19 @@ option nodynamic -#Win32API bigdecimal cgi/escape -dbm digest digest/md5 digest/rmd160 digest/sha1 digest/sha2 -enumerator etc fcntl -gdbm io/wait nkf #openssl pty -racc/parse +#racc/cparse readline ripper socket diff --git a/ext/Setup.nt b/ext/Setup.nt index dc36aa8688..1278f183e4 100644 --- a/ext/Setup.nt +++ b/ext/Setup.nt @@ -1,24 +1,20 @@ #option platform cygwin|mingw|mswin #option nodynamic -Win32API bigdecimal cgi/escape -#dbm digest digest/md5 digest/rmd160 digest/sha1 digest/sha2 -enumerator etc fcntl -#gdbm #io/wait nkf #openssl #pty -racc/cparse +#racc/cparse #readline #ripper socket diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c deleted file mode 100644 index d6ea35c615..0000000000 --- a/ext/bigdecimal/bigdecimal.c +++ /dev/null @@ -1,7724 +0,0 @@ -/* - * - * Ruby BigDecimal(Variable decimal precision) extension library. - * - * Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp) - * - */ - -/* #define BIGDECIMAL_DEBUG 1 */ - -#include "bigdecimal.h" -#include "ruby/util.h" - -#ifndef BIGDECIMAL_DEBUG -# undef NDEBUG -# define NDEBUG -#endif -#include <assert.h> - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <math.h> - -#ifdef HAVE_IEEEFP_H -#include <ieeefp.h> -#endif - -#include "bits.h" -#include "static_assert.h" - -/* #define ENABLE_NUMERIC_STRING */ - -#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; - -static ID id_BigDecimal_exception_mode; -static ID id_BigDecimal_rounding_mode; -static ID id_BigDecimal_precision_limit; - -static ID id_up; -static ID id_down; -static ID id_truncate; -static ID id_half_up; -static ID id_default; -static ID id_half_down; -static ID id_half_even; -static ID id_banker; -static ID id_ceiling; -static ID id_ceil; -static ID id_floor; -static ID id_to_r; -static ID id_eq; -static ID id_half; - -#define RBD_NUM_ROUNDING_MODES 11 - -static struct { - ID id; - uint8_t mode; -} rbd_rounding_modes[RBD_NUM_ROUNDING_MODES]; - -/* MACRO's to guard objects from GC by keeping them in stack */ -#ifdef RBIMPL_ATTR_MAYBE_UNUSED -#define ENTER(n) RBIMPL_ATTR_MAYBE_UNUSED() volatile VALUE vStack[n];int iStack=0 -#else -#define ENTER(n) volatile VALUE RB_UNUSED_VAR(vStack[n]);int iStack=0 -#endif -#define PUSH(x) (vStack[iStack++] = (VALUE)(x)) -#define SAVE(p) PUSH((p)->obj) -#define GUARD_OBJ(p,y) ((p)=(y), SAVE(p)) - -#define BASE_FIG BIGDECIMAL_COMPONENT_FIGURES -#define BASE BIGDECIMAL_BASE - -#define HALF_BASE (BASE/2) -#define BASE1 (BASE/10) - -#define LOG10_2 0.3010299956639812 - -#ifndef RRATIONAL_ZERO_P -# define RRATIONAL_ZERO_P(x) (FIXNUM_P(rb_rational_num(x)) && \ - FIX2LONG(rb_rational_num(x)) == 0) -#endif - -#ifndef RRATIONAL_NEGATIVE_P -# define RRATIONAL_NEGATIVE_P(x) RTEST(rb_funcall((x), '<', 1, INT2FIX(0))) -#endif - -#ifndef DECIMAL_SIZE_OF_BITS -#define DECIMAL_SIZE_OF_BITS(n) (((n) * 3010 + 9998) / 9999) -/* an approximation of ceil(n * log10(2)), upto 65536 at least */ -#endif - -#ifdef PRIsVALUE -# define RB_OBJ_CLASSNAME(obj) rb_obj_class(obj) -# define RB_OBJ_STRING(obj) (obj) -#else -# define PRIsVALUE "s" -# define RB_OBJ_CLASSNAME(obj) rb_obj_classname(obj) -# define RB_OBJ_STRING(obj) StringValueCStr(obj) -#endif - -#ifndef MAYBE_UNUSED -# define MAYBE_UNUSED(x) x -#endif - -#define BIGDECIMAL_POSITIVE_P(bd) ((bd)->sign > 0) -#define BIGDECIMAL_NEGATIVE_P(bd) ((bd)->sign < 0) - -/* - * ================== Memory allocation ============================ - */ - -#ifdef BIGDECIMAL_DEBUG -static size_t rbd_allocation_count = 0; /* Memory allocation counter */ -static inline void -atomic_allocation_count_inc(void) -{ - RUBY_ATOMIC_SIZE_INC(rbd_allocation_count); -} -static inline void -atomic_allocation_count_dec_nounderflow(void) -{ - if (rbd_allocation_count == 0) return; - RUBY_ATOMIC_SIZE_DEC(rbd_allocation_count); -} -static void -check_allocation_count_nonzero(void) -{ - if (rbd_allocation_count != 0) return; - rb_bug("[bigdecimal][rbd_free_struct] Too many memory free calls"); -} -#else -# define atomic_allocation_count_inc() /* nothing */ -# define atomic_allocation_count_dec_nounderflow() /* nothing */ -# define check_allocation_count_nonzero() /* nothing */ -#endif /* BIGDECIMAL_DEBUG */ - -PUREFUNC(static inline size_t rbd_struct_size(size_t const)); - -static inline size_t -rbd_struct_size(size_t const internal_digits) -{ - size_t const frac_len = (internal_digits == 0) ? 1 : internal_digits; - return offsetof(Real, frac) + frac_len * sizeof(DECDIG); -} - -static inline Real * -rbd_allocate_struct(size_t const internal_digits) -{ - size_t const size = rbd_struct_size(internal_digits); - Real *real = ruby_xcalloc(1, size); - atomic_allocation_count_inc(); - real->MaxPrec = internal_digits; - return real; -} - -static size_t -rbd_calculate_internal_digits(size_t const digits, bool limit_precision) -{ - size_t const len = roomof(digits, BASE_FIG); - if (limit_precision) { - size_t const prec_limit = VpGetPrecLimit(); - if (prec_limit > 0) { - /* NOTE: 2 more digits for rounding and division */ - size_t const max_len = roomof(prec_limit, BASE_FIG) + 2; - if (len > max_len) - return max_len; - } - } - - return len; -} - -static inline Real * -rbd_allocate_struct_decimal_digits(size_t const decimal_digits, bool limit_precision) -{ - size_t const internal_digits = rbd_calculate_internal_digits(decimal_digits, limit_precision); - return rbd_allocate_struct(internal_digits); -} - -static VALUE BigDecimal_wrap_struct(VALUE obj, Real *vp); - -static Real * -rbd_reallocate_struct(Real *real, size_t const internal_digits) -{ - size_t const size = rbd_struct_size(internal_digits); - VALUE obj = real ? real->obj : 0; - Real *new_real = (Real *)ruby_xrealloc(real, size); - new_real->MaxPrec = internal_digits; - if (obj) { - new_real->obj = 0; - BigDecimal_wrap_struct(obj, new_real); - } - return new_real; -} - -static void -rbd_free_struct(Real *real) -{ - if (real != NULL) { - check_allocation_count_nonzero(); - ruby_xfree(real); - atomic_allocation_count_dec_nounderflow(); - } -} - -#define NewZero rbd_allocate_struct_zero -static Real * -rbd_allocate_struct_zero(int sign, size_t const digits, bool limit_precision) -{ - Real *real = rbd_allocate_struct_decimal_digits(digits, limit_precision); - VpSetZero(real, sign); - return real; -} - -MAYBE_UNUSED(static inline Real * rbd_allocate_struct_zero_limited(int sign, size_t const digits)); -#define NewZeroLimited rbd_allocate_struct_zero_limited -static inline Real * -rbd_allocate_struct_zero_limited(int sign, size_t const digits) -{ - return rbd_allocate_struct_zero(sign, digits, true); -} - -MAYBE_UNUSED(static inline Real * rbd_allocate_struct_zero_nolimit(int sign, size_t const digits)); -#define NewZeroNolimit rbd_allocate_struct_zero_nolimit -static inline Real * -rbd_allocate_struct_zero_nolimit(int sign, size_t const digits) -{ - return rbd_allocate_struct_zero(sign, digits, false); -} - -#define NewOne rbd_allocate_struct_one -static Real * -rbd_allocate_struct_one(int sign, size_t const digits, bool limit_precision) -{ - Real *real = rbd_allocate_struct_decimal_digits(digits, limit_precision); - VpSetOne(real); - if (sign < 0) - VpSetSign(real, VP_SIGN_NEGATIVE_FINITE); - return real; -} - -MAYBE_UNUSED(static inline Real * rbd_allocate_struct_one_limited(int sign, size_t const digits)); -#define NewOneLimited rbd_allocate_struct_one_limited -static inline Real * -rbd_allocate_struct_one_limited(int sign, size_t const digits) -{ - return rbd_allocate_struct_one(sign, digits, true); -} - -MAYBE_UNUSED(static inline Real * rbd_allocate_struct_one_nolimit(int sign, size_t const digits)); -#define NewOneNolimit rbd_allocate_struct_one_nolimit -static inline Real * -rbd_allocate_struct_one_nolimit(int sign, size_t const digits) -{ - return rbd_allocate_struct_one(sign, digits, false); -} - -/* - * ================== Ruby Interface part ========================== - */ -#define DoSomeOne(x,y,f) rb_num_coerce_bin(x,y,f) - -/* - * VP routines used in BigDecimal part - */ -static unsigned short VpGetException(void); -static void VpSetException(unsigned short f); -static void VpCheckException(Real *p, bool always); -static VALUE VpCheckGetValue(Real *p); -static void VpInternalRound(Real *c, size_t ixDigit, DECDIG vPrev, DECDIG v); -static int VpLimitRound(Real *c, size_t ixDigit); -static Real *VpCopy(Real *pv, Real const* const x); -static int VPrint(FILE *fp,const char *cntl_chr,Real *a); - -/* - * **** BigDecimal part **** - */ - -static VALUE BigDecimal_nan(void); -static VALUE BigDecimal_positive_infinity(void); -static VALUE BigDecimal_negative_infinity(void); -static VALUE BigDecimal_positive_zero(void); -static VALUE BigDecimal_negative_zero(void); - -static void -BigDecimal_delete(void *pv) -{ - rbd_free_struct(pv); -} - -static size_t -BigDecimal_memsize(const void *ptr) -{ - const Real *pv = ptr; - return (sizeof(*pv) + pv->MaxPrec * sizeof(DECDIG)); -} - -#ifndef HAVE_RB_EXT_RACTOR_SAFE -# undef RUBY_TYPED_FROZEN_SHAREABLE -# define RUBY_TYPED_FROZEN_SHAREABLE 0 -#endif - -static const rb_data_type_t BigDecimal_data_type = { - "BigDecimal", - { 0, BigDecimal_delete, BigDecimal_memsize, }, -#ifdef RUBY_TYPED_FREE_IMMEDIATELY - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_FROZEN_SHAREABLE -#endif -}; - -static Real * -rbd_allocate_struct_zero_wrap_klass(VALUE klass, int sign, size_t const digits, bool limit_precision) -{ - Real *real = rbd_allocate_struct_zero(sign, digits, limit_precision); - if (real != NULL) { - VALUE obj = TypedData_Wrap_Struct(klass, &BigDecimal_data_type, 0); - BigDecimal_wrap_struct(obj, real); - } - return real; -} - -MAYBE_UNUSED(static inline Real * rbd_allocate_struct_zero_limited_wrap(int sign, size_t const digits)); -#define NewZeroWrapLimited rbd_allocate_struct_zero_limited_wrap -static inline Real * -rbd_allocate_struct_zero_limited_wrap(int sign, size_t const digits) -{ - return rbd_allocate_struct_zero_wrap_klass(rb_cBigDecimal, sign, digits, true); -} - -MAYBE_UNUSED(static inline Real * rbd_allocate_struct_zero_nolimit_wrap(int sign, size_t const digits)); -#define NewZeroWrapNolimit rbd_allocate_struct_zero_nolimit_wrap -static inline Real * -rbd_allocate_struct_zero_nolimit_wrap(int sign, size_t const digits) -{ - return rbd_allocate_struct_zero_wrap_klass(rb_cBigDecimal, sign, digits, false); -} - -static Real * -rbd_allocate_struct_one_wrap_klass(VALUE klass, int sign, size_t const digits, bool limit_precision) -{ - Real *real = rbd_allocate_struct_one(sign, digits, limit_precision); - if (real != NULL) { - VALUE obj = TypedData_Wrap_Struct(klass, &BigDecimal_data_type, 0); - BigDecimal_wrap_struct(obj, real); - } - return real; -} - -MAYBE_UNUSED(static inline Real * rbd_allocate_struct_one_limited_wrap(int sign, size_t const digits)); -#define NewOneWrapLimited rbd_allocate_struct_one_limited_wrap -static inline Real * -rbd_allocate_struct_one_limited_wrap(int sign, size_t const digits) -{ - return rbd_allocate_struct_one_wrap_klass(rb_cBigDecimal, sign, digits, true); -} - -MAYBE_UNUSED(static inline Real * rbd_allocate_struct_one_nolimit_wrap(int sign, size_t const digits)); -#define NewOneWrapNolimit rbd_allocate_struct_one_nolimit_wrap -static inline Real * -rbd_allocate_struct_one_nolimit_wrap(int sign, size_t const digits) -{ - return rbd_allocate_struct_one_wrap_klass(rb_cBigDecimal, sign, digits, false); -} - -static inline int -is_kind_of_BigDecimal(VALUE const v) -{ - return rb_typeddata_is_kind_of(v, &BigDecimal_data_type); -} - -NORETURN(static void cannot_be_coerced_into_BigDecimal(VALUE, VALUE)); - -static void -cannot_be_coerced_into_BigDecimal(VALUE exc_class, VALUE v) -{ - VALUE str; - - if (rb_special_const_p(v)) { - str = rb_inspect(v); - } - else { - 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)); -} - -static inline VALUE BigDecimal_div2(VALUE, VALUE, VALUE); -static VALUE rb_inum_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception); -static VALUE rb_float_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception); -static VALUE rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception); -static VALUE rb_cstr_convert_to_BigDecimal(const char *c_str, size_t digs, int raise_exception); -static VALUE rb_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception); - -static Real* -GetVpValueWithPrec(VALUE v, long prec, int must) -{ - const size_t digs = prec < 0 ? SIZE_MAX : (size_t)prec; - - switch(TYPE(v)) { - case T_FLOAT: - v = rb_float_convert_to_BigDecimal(v, digs, must); - break; - - case T_RATIONAL: - v = rb_rational_convert_to_BigDecimal(v, digs, must); - break; - - case T_DATA: - if (!is_kind_of_BigDecimal(v)) { - goto SomeOneMayDoIt; - } - break; - - case T_FIXNUM: { - char szD[128]; - snprintf(szD, 128, "%ld", FIX2LONG(v)); - v = rb_cstr_convert_to_BigDecimal(szD, VpBaseFig() * 2 + 1, must); - break; - } - -#ifdef ENABLE_NUMERIC_STRING - case T_STRING: { - const char *c_str = StringValueCStr(v); - v = rb_cstr_convert_to_BigDecimal(c_str, RSTRING_LEN(v) + VpBaseFig() + 1, must); - break; - } -#endif /* ENABLE_NUMERIC_STRING */ - - case T_BIGNUM: { - VALUE bg = rb_big2str(v, 10); - v = rb_cstr_convert_to_BigDecimal(RSTRING_PTR(bg), RSTRING_LEN(bg) + VpBaseFig() + 1, must); - RB_GC_GUARD(bg); - break; - } - - default: - goto SomeOneMayDoIt; - } - - Real *vp; - TypedData_Get_Struct(v, Real, &BigDecimal_data_type, vp); - return vp; - -SomeOneMayDoIt: - if (must) { - cannot_be_coerced_into_BigDecimal(rb_eTypeError, v); - } - return NULL; /* NULL means to coerce */ -} - -static inline Real* -GetVpValue(VALUE v, int must) -{ - return GetVpValueWithPrec(v, -1, must); -} - -/* call-seq: - * BigDecimal.double_fig -> integer - * - * Returns the number of digits a Float object is allowed to have; - * the result is system-dependent: - * - * BigDecimal.double_fig # => 16 - * - */ -static inline VALUE -BigDecimal_double_fig(VALUE self) -{ - return INT2FIX(VpDblFig()); -} - -/* call-seq: - * precs -> array - * - * Returns an Array of two Integer values that represent platform-dependent - * internal storage properties. - * - * This method is deprecated and will be removed in the future. - * Instead, use BigDecimal#n_significant_digits for obtaining the number of - * significant digits in scientific notation, and BigDecimal#precision for - * obtaining the number of digits in decimal notation. - * - */ - -static VALUE -BigDecimal_prec(VALUE self) -{ - ENTER(1); - Real *p; - VALUE obj; - - rb_category_warn(RB_WARN_CATEGORY_DEPRECATED, - "BigDecimal#precs is deprecated and will be removed in the future; " - "use BigDecimal#precision instead."); - - GUARD_OBJ(p, GetVpValue(self, 1)); - obj = rb_assoc_new(SIZET2NUM(p->Prec*VpBaseFig()), - SIZET2NUM(p->MaxPrec*VpBaseFig())); - return obj; -} - -static void -BigDecimal_count_precision_and_scale(VALUE self, ssize_t *out_precision, ssize_t *out_scale) -{ - ENTER(1); - - if (out_precision == NULL && out_scale == NULL) - return; - - Real *p; - GUARD_OBJ(p, GetVpValue(self, 1)); - if (VpIsZero(p) || !VpIsDef(p)) { - zero: - if (out_precision) *out_precision = 0; - if (out_scale) *out_scale = 0; - return; - } - - DECDIG x; - - ssize_t n = p->Prec; /* The length of frac without zeros. */ - while (n > 0 && p->frac[n-1] == 0) --n; - if (n == 0) goto zero; - - int nlz = BASE_FIG; - for (x = p->frac[0]; x > 0; x /= 10) --nlz; - - int ntz = 0; - for (x = p->frac[n-1]; x > 0 && x % 10 == 0; x /= 10) ++ntz; - - /* - * Calculate the precision and the scale - * ------------------------------------- - * - * The most significant digit is frac[0], and the least significant digit - * is frac[Prec-1]. When the exponent is zero, the decimal point is - * located just before frac[0]. - * - * When the exponent is negative, the decimal point moves to leftward. - * In this case, the precision can be calculated by - * - * precision = BASE_FIG * (-exponent + n) - ntz, - * - * and the scale is the same as precision. - * - * 0 . 0000 0000 | frac[0] ... frac[n-1] | - * |<----------| exponent == -2 | - * |---------------------------------->| precision - * |---------------------------------->| scale - * - * - * Conversely, when the exponent is positive, the decimal point moves to - * rightward. In this case, the scale equals to - * - * BASE_FIG * (n - exponent) - ntz. - * - * the precision equals to - * - * scale + BASE_FIG * exponent - nlz. - * - * | frac[0] frac[1] . frac[2] ... frac[n-1] | - * |---------------->| exponent == 2 | - * | |---------------------->| scale - * |---------------------------------------->| precision - */ - - ssize_t ex = p->exponent; - - /* Count the number of decimal digits before frac[1]. */ - ssize_t n_digits_head = BASE_FIG; - if (ex < 0) { - n_digits_head += (-ex) * BASE_FIG; /* The number of leading zeros before frac[0]. */ - ex = 0; - } - else if (ex > 0) { - /* Count the number of decimal digits without the leading zeros in - * the most significant digit in the integral part. - */ - n_digits_head -= nlz; /* Make the number of digits */ - } - - if (out_precision) { - ssize_t precision = n_digits_head; - - /* Count the number of decimal digits after frac[0]. */ - if (ex > (ssize_t)n) { - /* In this case the number is an integer with some trailing zeros. */ - precision += (ex - 1) * BASE_FIG; - } - else if (n > 0) { - precision += (n - 1) * BASE_FIG; - - if (ex < (ssize_t)n) { - precision -= ntz; - } - } - - *out_precision = precision; - } - - if (out_scale) { - ssize_t scale = 0; - - if (p->exponent < 0) { - scale = n_digits_head + (n - 1) * BASE_FIG - ntz; - } - else if (n > p->exponent) { - scale = (n - p->exponent) * BASE_FIG - ntz; - } - - *out_scale = scale; - } -} - -/* - * call-seq: - * precision -> integer - * - * Returns the number of decimal digits in +self+: - * - * BigDecimal("0").precision # => 0 - * BigDecimal("1").precision # => 1 - * BigDecimal("1.1").precision # => 2 - * BigDecimal("3.1415").precision # => 5 - * BigDecimal("-1e20").precision # => 21 - * BigDecimal("1e-20").precision # => 20 - * BigDecimal("Infinity").precision # => 0 - * BigDecimal("-Infinity").precision # => 0 - * BigDecimal("NaN").precision # => 0 - * - */ -static VALUE -BigDecimal_precision(VALUE self) -{ - ssize_t precision; - BigDecimal_count_precision_and_scale(self, &precision, NULL); - return SSIZET2NUM(precision); -} - -/* - * call-seq: - * scale -> integer - * - * Returns the number of decimal digits following the decimal digits in +self+. - * - * BigDecimal("0").scale # => 0 - * BigDecimal("1").scale # => 1 - * BigDecimal("1.1").scale # => 1 - * BigDecimal("3.1415").scale # => 4 - * BigDecimal("-1e20").precision # => 0 - * BigDecimal("1e-20").precision # => 20 - * BigDecimal("Infinity").scale # => 0 - * BigDecimal("-Infinity").scale # => 0 - * BigDecimal("NaN").scale # => 0 - */ -static VALUE -BigDecimal_scale(VALUE self) -{ - ssize_t scale; - BigDecimal_count_precision_and_scale(self, NULL, &scale); - return SSIZET2NUM(scale); -} - -/* - * call-seq: - * precision_scale -> [integer, integer] - * - * Returns a 2-length array; the first item is the result of - * BigDecimal#precision and the second one is of BigDecimal#scale. - * - * See BigDecimal#precision. - * See BigDecimal#scale. - */ -static VALUE -BigDecimal_precision_scale(VALUE self) -{ - ssize_t precision, scale; - BigDecimal_count_precision_and_scale(self, &precision, &scale); - return rb_assoc_new(SSIZET2NUM(precision), SSIZET2NUM(scale)); -} - -/* - * call-seq: - * n_significant_digits -> integer - * - * Returns the number of decimal significant digits in +self+. - * - * BigDecimal("0").n_significant_digits # => 0 - * BigDecimal("1").n_significant_digits # => 1 - * BigDecimal("1.1").n_significant_digits # => 2 - * BigDecimal("3.1415").n_significant_digits # => 5 - * BigDecimal("-1e20").n_significant_digits # => 1 - * BigDecimal("1e-20").n_significant_digits # => 1 - * BigDecimal("Infinity").n_significant_digits # => 0 - * BigDecimal("-Infinity").n_significant_digits # => 0 - * BigDecimal("NaN").n_significant_digits # => 0 - */ -static VALUE -BigDecimal_n_significant_digits(VALUE self) -{ - ENTER(1); - - Real *p; - GUARD_OBJ(p, GetVpValue(self, 1)); - if (VpIsZero(p) || !VpIsDef(p)) { - return INT2FIX(0); - } - - ssize_t n = p->Prec; /* The length of frac without trailing zeros. */ - for (n = p->Prec; n > 0 && p->frac[n-1] == 0; --n); - if (n == 0) return INT2FIX(0); - - DECDIG x; - int nlz = BASE_FIG; - for (x = p->frac[0]; x > 0; x /= 10) --nlz; - - int ntz = 0; - for (x = p->frac[n-1]; x > 0 && x % 10 == 0; x /= 10) ++ntz; - - ssize_t n_significant_digits = BASE_FIG*n - nlz - ntz; - return SSIZET2NUM(n_significant_digits); -} - -/* - * call-seq: - * hash -> integer - * - * Returns the integer hash value for +self+. - * - * Two instances of \BigDecimal have the same hash value if and only if - * they have equal: - * - * - Sign. - * - Fractional part. - * - Exponent. - * - */ -static VALUE -BigDecimal_hash(VALUE self) -{ - ENTER(1); - Real *p; - st_index_t hash; - - 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) { - hash ^= rb_memhash(p->frac, sizeof(DECDIG)*p->Prec); - hash += p->exponent; - } - return ST2FIX(hash); -} - -/* - * call-seq: - * _dump -> string - * - * Returns a string representing the marshalling of +self+. - * See module Marshal. - * - * inf = BigDecimal('Infinity') # => Infinity - * dumped = inf._dump # => "9:Infinity" - * BigDecimal._load(dumped) # => Infinity - * - */ -static VALUE -BigDecimal_dump(int argc, VALUE *argv, VALUE self) -{ - ENTER(5); - Real *vp; - char *psz; - VALUE dummy; - volatile VALUE dump; - size_t len; - - rb_scan_args(argc, argv, "01", &dummy); - GUARD_OBJ(vp,GetVpValue(self, 1)); - dump = rb_str_new(0, VpNumOfChars(vp, "E")+50); - psz = RSTRING_PTR(dump); - snprintf(psz, RSTRING_LEN(dump), "%"PRIuSIZE":", VpMaxPrec(vp)*VpBaseFig()); - len = strlen(psz); - VpToString(vp, psz+len, RSTRING_LEN(dump)-len, 0, 0); - rb_str_resize(dump, strlen(psz)); - return dump; -} - -/* - * Internal method used to provide marshalling support. See the Marshal module. - */ -static VALUE -BigDecimal_load(VALUE self, VALUE str) -{ - ENTER(2); - Real *pv; - unsigned char *pch; - unsigned char ch; - unsigned long m=0; - - pch = (unsigned char *)StringValueCStr(str); - /* First get max prec */ - 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, true, true)); - m /= VpBaseFig(); - if (m && pv->MaxPrec > m) { - pv->MaxPrec = m+1; - } - return VpCheckGetValue(pv); -} - -static unsigned short -check_rounding_mode_option(VALUE const opts) -{ - VALUE mode; - char const *s; - long l; - - assert(RB_TYPE_P(opts, T_HASH)); - - if (NIL_P(opts)) - goto no_opt; - - mode = rb_hash_lookup2(opts, ID2SYM(id_half), Qundef); - if (mode == Qundef || NIL_P(mode)) - goto no_opt; - - if (SYMBOL_P(mode)) - mode = rb_sym2str(mode); - else if (!RB_TYPE_P(mode, T_STRING)) { - VALUE str_mode = rb_check_string_type(mode); - if (NIL_P(str_mode)) - goto invalid; - mode = str_mode; - } - s = RSTRING_PTR(mode); - l = RSTRING_LEN(mode); - switch (l) { - case 2: - if (strncasecmp(s, "up", 2) == 0) - return VP_ROUND_HALF_UP; - break; - case 4: - if (strncasecmp(s, "even", 4) == 0) - return VP_ROUND_HALF_EVEN; - else if (strncasecmp(s, "down", 4) == 0) - return VP_ROUND_HALF_DOWN; - break; - default: - break; - } - - invalid: - rb_raise(rb_eArgError, "invalid rounding mode (%"PRIsVALUE")", mode); - - no_opt: - return VpGetRoundMode(); -} - -static unsigned short -check_rounding_mode(VALUE const v) -{ - unsigned short sw; - ID id; - if (RB_TYPE_P(v, T_SYMBOL)) { - int i; - id = SYM2ID(v); - for (i = 0; i < RBD_NUM_ROUNDING_MODES; ++i) { - if (rbd_rounding_modes[i].id == id) { - return rbd_rounding_modes[i].mode; - } - } - rb_raise(rb_eArgError, "invalid rounding mode (%"PRIsVALUE")", v); - } - else { - sw = NUM2USHORT(v); - if (!VpIsRoundMode(sw)) { - rb_raise(rb_eArgError, "invalid rounding mode (%"PRIsVALUE")", v); - } - return sw; - } -} - -/* call-seq: - * BigDecimal.mode(mode, setting = nil) -> integer - * - * Returns an integer representing the mode settings - * for exception handling and rounding. - * - * These modes control exception handling: - * - * - \BigDecimal::EXCEPTION_NaN. - * - \BigDecimal::EXCEPTION_INFINITY. - * - \BigDecimal::EXCEPTION_UNDERFLOW. - * - \BigDecimal::EXCEPTION_OVERFLOW. - * - \BigDecimal::EXCEPTION_ZERODIVIDE. - * - \BigDecimal::EXCEPTION_ALL. - * - * Values for +setting+ for exception handling: - * - * - +true+: sets the given +mode+ to +true+. - * - +false+: sets the given +mode+ to +false+. - * - +nil+: does not modify the mode settings. - * - * You can use method BigDecimal.save_exception_mode - * to temporarily change, and then automatically restore, exception modes. - * - * For clarity, some examples below begin by setting all - * exception modes to +false+. - * - * This mode controls the way rounding is to be performed: - * - * - \BigDecimal::ROUND_MODE - * - * You can use method BigDecimal.save_rounding_mode - * to temporarily change, and then automatically restore, the rounding mode. - * - * <b>NaNs</b> - * - * Mode \BigDecimal::EXCEPTION_NaN controls behavior - * when a \BigDecimal NaN is created. - * - * Settings: - * - * - +false+ (default): Returns <tt>BigDecimal('NaN')</tt>. - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * BigDecimal('NaN') # => NaN - * BigDecimal.mode(BigDecimal::EXCEPTION_NaN, true) # => 2 - * BigDecimal('NaN') # Raises FloatDomainError - * - * <b>Infinities</b> - * - * Mode \BigDecimal::EXCEPTION_INFINITY controls behavior - * when a \BigDecimal Infinity or -Infinity is created. - * Settings: - * - * - +false+ (default): Returns <tt>BigDecimal('Infinity')</tt> - * or <tt>BigDecimal('-Infinity')</tt>. - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * BigDecimal('Infinity') # => Infinity - * BigDecimal('-Infinity') # => -Infinity - * BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, true) # => 1 - * BigDecimal('Infinity') # Raises FloatDomainError - * BigDecimal('-Infinity') # Raises FloatDomainError - * - * <b>Underflow</b> - * - * Mode \BigDecimal::EXCEPTION_UNDERFLOW controls behavior - * when a \BigDecimal underflow occurs. - * Settings: - * - * - +false+ (default): Returns <tt>BigDecimal('0')</tt> - * or <tt>BigDecimal('-Infinity')</tt>. - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * def flow_under - * x = BigDecimal('0.1') - * 100.times { x *= x } - * end - * flow_under # => 100 - * BigDecimal.mode(BigDecimal::EXCEPTION_UNDERFLOW, true) # => 4 - * flow_under # Raises FloatDomainError - * - * <b>Overflow</b> - * - * Mode \BigDecimal::EXCEPTION_OVERFLOW controls behavior - * when a \BigDecimal overflow occurs. - * Settings: - * - * - +false+ (default): Returns <tt>BigDecimal('Infinity')</tt> - * or <tt>BigDecimal('-Infinity')</tt>. - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * def flow_over - * x = BigDecimal('10') - * 100.times { x *= x } - * end - * flow_over # => 100 - * BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, true) # => 1 - * flow_over # Raises FloatDomainError - * - * <b>Zero Division</b> - * - * Mode \BigDecimal::EXCEPTION_ZERODIVIDE controls behavior - * when a zero-division occurs. - * Settings: - * - * - +false+ (default): Returns <tt>BigDecimal('Infinity')</tt> - * or <tt>BigDecimal('-Infinity')</tt>. - * - +true+: Raises FloatDomainError. - * - * Examples: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * one = BigDecimal('1') - * zero = BigDecimal('0') - * one / zero # => Infinity - * BigDecimal.mode(BigDecimal::EXCEPTION_ZERODIVIDE, true) # => 16 - * one / zero # Raises FloatDomainError - * - * <b>All Exceptions</b> - * - * Mode \BigDecimal::EXCEPTION_ALL controls all of the above: - * - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, false) # => 0 - * BigDecimal.mode(BigDecimal::EXCEPTION_ALL, true) # => 23 - * - * <b>Rounding</b> - * - * Mode \BigDecimal::ROUND_MODE controls the way rounding is to be performed; - * its +setting+ values are: - * - * - +ROUND_UP+: Round away from zero. - * Aliased as +:up+. - * - +ROUND_DOWN+: Round toward zero. - * Aliased as +:down+ and +:truncate+. - * - +ROUND_HALF_UP+: Round toward the nearest neighbor; - * if the neighbors are equidistant, round away from zero. - * Aliased as +:half_up+ and +:default+. - * - +ROUND_HALF_DOWN+: Round toward the nearest neighbor; - * if the neighbors are equidistant, round toward zero. - * Aliased as +:half_down+. - * - +ROUND_HALF_EVEN+ (Banker's rounding): Round toward the nearest neighbor; - * if the neighbors are equidistant, round toward the even neighbor. - * Aliased as +:half_even+ and +:banker+. - * - +ROUND_CEILING+: Round toward positive infinity. - * Aliased as +:ceiling+ and +:ceil+. - * - +ROUND_FLOOR+: Round toward negative infinity. - * Aliased as +:floor:+. - * - */ -static VALUE -BigDecimal_mode(int argc, VALUE *argv, VALUE self) -{ - VALUE which; - VALUE val; - unsigned long f,fo; - - rb_scan_args(argc, argv, "11", &which, &val); - f = (unsigned long)NUM2INT(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 (VP_ROUND_MODE == f) { - /* Rounding mode setting */ - unsigned short sw; - fo = VpGetRoundMode(); - if (NIL_P(val)) return INT2FIX(fo); - sw = check_rounding_mode(val); - fo = VpSetRoundMode(sw); - return INT2FIX(fo); - } - rb_raise(rb_eTypeError, "first argument for BigDecimal.mode invalid"); - return Qnil; -} - -static size_t -GetAddSubPrec(Real *a, Real *b) -{ - size_t mxs; - 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); - } - } - return mx; -} - -static inline SIGNED_VALUE -check_int_precision(VALUE v) -{ - SIGNED_VALUE n; -#if SIZEOF_VALUE <= SIZEOF_LONG - n = (SIGNED_VALUE)NUM2LONG(v); -#elif SIZEOF_VALUE <= SIZEOF_LONG_LONG - n = (SIGNED_VALUE)NUM2LL(v); -#else -# error SIZEOF_VALUE is too large -#endif - if (n < 0) { - rb_raise(rb_eArgError, "negative precision"); - } - return n; -} - -static VALUE -BigDecimal_wrap_struct(VALUE obj, Real *vp) -{ - assert(is_kind_of_BigDecimal(obj)); - assert(vp != NULL); - - if (vp->obj == obj && RTYPEDDATA_DATA(obj) == vp) - return obj; - - assert(RTYPEDDATA_DATA(obj) == NULL); - assert(vp->obj == 0); - - RTYPEDDATA_DATA(obj) = vp; - vp->obj = obj; - RB_OBJ_FREEZE(obj); - return obj; -} - -VP_EXPORT Real * -VpNewRbClass(size_t mx, const char *str, VALUE klass, bool strict_p, bool raise_exception) -{ - VALUE obj = TypedData_Wrap_Struct(klass, &BigDecimal_data_type, 0); - Real *pv = VpAlloc(mx, str, strict_p, raise_exception); - if (!pv) - return NULL; - BigDecimal_wrap_struct(obj, pv); - return pv; -} - -VP_EXPORT Real * -VpCreateRbObject(size_t mx, const char *str, bool raise_exception) -{ - return VpNewRbClass(mx, str, rb_cBigDecimal, true, raise_exception); -} - -static Real * -VpCopy(Real *pv, Real const* const x) -{ - assert(x != NULL); - - pv = rbd_reallocate_struct(pv, x->MaxPrec); - pv->MaxPrec = x->MaxPrec; - pv->Prec = x->Prec; - pv->exponent = x->exponent; - pv->sign = x->sign; - pv->flag = x->flag; - MEMCPY(pv->frac, x->frac, DECDIG, pv->MaxPrec); - - return pv; -} - -/* Returns True if the value is Not a Number. */ -static VALUE -BigDecimal_IsNaN(VALUE self) -{ - 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. - */ -static VALUE -BigDecimal_IsInfinite(VALUE self) -{ - Real *p = GetVpValue(self, 1); - if (VpIsPosInf(p)) return INT2FIX(1); - if (VpIsNegInf(p)) return INT2FIX(-1); - return Qnil; -} - -/* Returns True if the value is finite (not NaN or infinite). */ -static VALUE -BigDecimal_IsFinite(VALUE self) -{ - Real *p = GetVpValue(self, 1); - if (VpIsNaN(p)) return Qfalse; - if (VpIsInf(p)) return Qfalse; - return Qtrue; -} - -static void -BigDecimal_check_num(Real *p) -{ - VpCheckException(p, true); -} - -static VALUE BigDecimal_split(VALUE self); - -/* Returns the value as an Integer. - * - * If the BigDecimal is infinity or NaN, raises FloatDomainError. - */ -static VALUE -BigDecimal_to_i(VALUE self) -{ - ENTER(5); - ssize_t e, nf; - Real *p; - - GUARD_OBJ(p, GetVpValue(self, 1)); - BigDecimal_check_num(p); - - e = VpExponent10(p); - if (e <= 0) return INT2FIX(0); - nf = VpBaseFig(); - if (e <= nf) { - return LONG2NUM((long)(VpGetSign(p) * (DECDIG_DBL_SIGNED)p->frac[0])); - } - else { - VALUE a = BigDecimal_split(self); - VALUE digits = RARRAY_AREF(a, 1); - VALUE numerator = rb_funcall(digits, rb_intern("to_i"), 0); - VALUE ret; - ssize_t dpower = e - (ssize_t)RSTRING_LEN(digits); - - if (BIGDECIMAL_NEGATIVE_P(p)) { - numerator = rb_funcall(numerator, '*', 1, INT2FIX(-1)); - } - if (dpower < 0) { - ret = rb_funcall(numerator, rb_intern("div"), 1, - rb_funcall(INT2FIX(10), rb_intern("**"), 1, - INT2FIX(-dpower))); - } - else { - ret = rb_funcall(numerator, '*', 1, - rb_funcall(INT2FIX(10), rb_intern("**"), 1, - INT2FIX(dpower))); - } - if (RB_TYPE_P(ret, T_FLOAT)) { - rb_raise(rb_eFloatDomainError, "Infinity"); - } - return ret; - } -} - -/* Returns a new Float object having approximately the same value as the - * BigDecimal number. Normal accuracy limits and built-in errors of binary - * Float arithmetic apply. - */ -static VALUE -BigDecimal_to_f(VALUE self) -{ - ENTER(1); - Real *p; - double d; - SIGNED_VALUE e; - char *buf; - volatile VALUE str; - - GUARD_OBJ(p, GetVpValue(self, 1)); - if (VpVtoD(&d, &e, p) != 1) - return rb_float_new(d); - if (e > (SIGNED_VALUE)(DBL_MAX_10_EXP+BASE_FIG)) - goto overflow; - if (e < (SIGNED_VALUE)(DBL_MIN_10_EXP-BASE_FIG)) - goto underflow; - - str = rb_str_new(0, VpNumOfChars(p, "E")); - buf = RSTRING_PTR(str); - VpToString(p, buf, RSTRING_LEN(str), 0, 0); - errno = 0; - d = strtod(buf, 0); - 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 (BIGDECIMAL_NEGATIVE_P(p)) - return rb_float_new(VpGetDoubleNegInf()); - else - return rb_float_new(VpGetDoublePosInf()); - -underflow: - VpException(VP_EXCEPTION_UNDERFLOW, "BigDecimal to Float conversion", 0); - if (BIGDECIMAL_NEGATIVE_P(p)) - return rb_float_new(-0.0); - else - return rb_float_new(0.0); -} - - -/* Converts a BigDecimal to a Rational. - */ -static VALUE -BigDecimal_to_r(VALUE self) -{ - Real *p; - ssize_t sign, power, denomi_power; - VALUE a, digits, numerator; - - p = GetVpValue(self, 1); - BigDecimal_check_num(p); - - sign = VpGetSign(p); - power = VpExponent10(p); - a = BigDecimal_split(self); - digits = RARRAY_AREF(a, 1); - denomi_power = power - RSTRING_LEN(digits); - numerator = rb_funcall(digits, rb_intern("to_i"), 0); - - if (sign < 0) { - numerator = rb_funcall(numerator, '*', 1, INT2FIX(-1)); - } - if (denomi_power < 0) { - return rb_Rational(numerator, - rb_funcall(INT2FIX(10), rb_intern("**"), 1, - INT2FIX(-denomi_power))); - } - else { - return rb_Rational1(rb_funcall(numerator, '*', 1, - rb_funcall(INT2FIX(10), rb_intern("**"), 1, - INT2FIX(denomi_power)))); - } -} - -/* The coerce method provides support for Ruby type coercion. It is not - * enabled by default. - * - * This means that binary operations like + * / or - can often be performed - * on a BigDecimal and an object of another type, if the other object can - * be coerced into a BigDecimal value. - * - * e.g. - * a = BigDecimal("1.0") - * b = a / 2.0 #=> 0.5 - * - * Note that coercing a String to a BigDecimal is not supported by default; - * it requires a special compile-time option when building Ruby. - */ -static VALUE -BigDecimal_coerce(VALUE self, VALUE other) -{ - ENTER(2); - VALUE obj; - Real *b; - - if (RB_TYPE_P(other, T_FLOAT)) { - GUARD_OBJ(b, GetVpValueWithPrec(other, 0, 1)); - obj = rb_assoc_new(VpCheckGetValue(b), self); - } - else { - if (RB_TYPE_P(other, T_RATIONAL)) { - Real* pv = DATA_PTR(self); - GUARD_OBJ(b, GetVpValueWithPrec(other, pv->Prec*VpBaseFig(), 1)); - } - else { - GUARD_OBJ(b, GetVpValue(other, 1)); - } - obj = rb_assoc_new(b->obj, self); - } - - return obj; -} - -/* - * call-seq: - * +big_decimal -> self - * - * Returns +self+: - * - * +BigDecimal(5) # => 0.5e1 - * +BigDecimal(-5) # => -0.5e1 - * - */ - -static VALUE -BigDecimal_uplus(VALUE self) -{ - return self; -} - - /* - * call-seq: - * self + value -> bigdecimal - * - * Returns the \BigDecimal sum of +self+ and +value+: - * - * b = BigDecimal('111111.111') # => 0.111111111e6 - * b + 2 # => 0.111113111e6 - * b + 2.0 # => 0.111113111e6 - * b + Rational(2, 1) # => 0.111113111e6 - * b + Complex(2, 0) # => (0.111113111e6+0i) - * - * See the {Note About Precision}[BigDecimal.html#class-BigDecimal-label-A+Note+About+Precision]. - * - */ - -static VALUE -BigDecimal_add(VALUE self, VALUE r) -{ - ENTER(5); - Real *c, *a, *b; - size_t mx; - - GUARD_OBJ(a, GetVpValue(self, 1)); - if (RB_TYPE_P(r, T_FLOAT)) { - b = GetVpValueWithPrec(r, 0, 1); - } - else if (RB_TYPE_P(r, T_RATIONAL)) { - b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); - } - else { - b = GetVpValue(r, 0); - } - - if (!b) return DoSomeOne(self,r,'+'); - SAVE(b); - - if (VpIsNaN(b)) return b->obj; - if (VpIsNaN(a)) return a->obj; - - mx = GetAddSubPrec(a, b); - if (mx == (size_t)-1L) { - GUARD_OBJ(c, NewZeroWrapLimited(1, VpBaseFig() + 1)); - VpAddSub(c, a, b, 1); - } - else { - GUARD_OBJ(c, NewZeroWrapLimited(1, mx * (VpBaseFig() + 1))); - if (!mx) { - VpSetInf(c, VpGetSign(a)); - } - else { - VpAddSub(c, a, b, 1); - } - } - return VpCheckGetValue(c); -} - - /* call-seq: - * self - value -> bigdecimal - * - * Returns the \BigDecimal difference of +self+ and +value+: - * - * b = BigDecimal('333333.333') # => 0.333333333e6 - * b - 2 # => 0.333331333e6 - * b - 2.0 # => 0.333331333e6 - * b - Rational(2, 1) # => 0.333331333e6 - * b - Complex(2, 0) # => (0.333331333e6+0i) - * - * See the {Note About Precision}[BigDecimal.html#class-BigDecimal-label-A+Note+About+Precision]. - * - */ -static VALUE -BigDecimal_sub(VALUE self, VALUE r) -{ - ENTER(5); - Real *c, *a, *b; - size_t mx; - - GUARD_OBJ(a, GetVpValue(self,1)); - if (RB_TYPE_P(r, T_FLOAT)) { - b = GetVpValueWithPrec(r, 0, 1); - } - else if (RB_TYPE_P(r, T_RATIONAL)) { - b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); - } - else { - b = GetVpValue(r,0); - } - - if (!b) return DoSomeOne(self,r,'-'); - SAVE(b); - - if (VpIsNaN(b)) return b->obj; - if (VpIsNaN(a)) return a->obj; - - mx = GetAddSubPrec(a,b); - if (mx == (size_t)-1L) { - GUARD_OBJ(c, NewZeroWrapLimited(1, VpBaseFig() + 1)); - VpAddSub(c, a, b, -1); - } - else { - GUARD_OBJ(c, NewZeroWrapLimited(1, mx *(VpBaseFig() + 1))); - if (!mx) { - VpSetInf(c,VpGetSign(a)); - } - else { - VpAddSub(c, a, b, -1); - } - } - return VpCheckGetValue(c); -} - -static VALUE -BigDecimalCmp(VALUE self, VALUE r,char op) -{ - ENTER(5); - SIGNED_VALUE e; - Real *a, *b=0; - GUARD_OBJ(a, GetVpValue(self, 1)); - switch (TYPE(r)) { - case T_DATA: - if (!is_kind_of_BigDecimal(r)) break; - /* fall through */ - case T_FIXNUM: - /* fall through */ - case T_BIGNUM: - GUARD_OBJ(b, GetVpValue(r, 0)); - break; - - case T_FLOAT: - GUARD_OBJ(b, GetVpValueWithPrec(r, 0, 0)); - break; - - case T_RATIONAL: - GUARD_OBJ(b, GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 0)); - break; - - default: - break; - } - if (b == NULL) { - ID f = 0; - - switch (op) { - case '*': - return rb_num_coerce_cmp(self, r, rb_intern("<=>")); - - case '=': - return RTEST(rb_num_coerce_cmp(self, r, rb_intern("=="))) ? Qtrue : Qfalse; - - case 'G': - f = rb_intern(">="); - break; - - case 'L': - f = rb_intern("<="); - break; - - case '>': - /* fall through */ - case '<': - f = (ID)op; - break; - - default: - break; - } - return rb_num_coerce_relop(self, r, f); - } - SAVE(b); - e = VpComp(a, b); - if (e == 999) - return (op == '*') ? Qnil : Qfalse; - switch (op) { - case '*': - return INT2FIX(e); /* any op */ - - case '=': - if (e == 0) return Qtrue; - return Qfalse; - - case 'G': - if (e >= 0) return Qtrue; - return Qfalse; - - case '>': - if (e > 0) return Qtrue; - return Qfalse; - - case 'L': - if (e <= 0) return Qtrue; - return Qfalse; - - case '<': - if (e < 0) return Qtrue; - return Qfalse; - - default: - break; - } - - 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); - return VpIsZero(a) ? Qtrue : Qfalse; -} - -/* Returns self if the value is non-zero, nil otherwise. */ -static VALUE -BigDecimal_nonzero(VALUE self) -{ - Real *a = GetVpValue(self, 1); - return VpIsZero(a) ? Qnil : self; -} - -/* The comparison operator. - * a <=> b is 0 if a == b, 1 if a > b, -1 if a < b. - */ -static VALUE -BigDecimal_comp(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, '*'); -} - -/* - * Tests for value equality; returns true if the values are equal. - * - * The == and === operators and the eql? method have the same implementation - * for BigDecimal. - * - * Values may be coerced to perform the comparison: - * - * BigDecimal('1.0') == 1.0 #=> true - */ -static VALUE -BigDecimal_eq(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, '='); -} - -/* call-seq: - * self < other -> true or false - * - * Returns +true+ if +self+ is less than +other+, +false+ otherwise: - * - * b = BigDecimal('1.5') # => 0.15e1 - * b < 2 # => true - * b < 2.0 # => true - * b < Rational(2, 1) # => true - * b < 1.5 # => false - * - * Raises an exception if the comparison cannot be made. - * - */ -static VALUE -BigDecimal_lt(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, '<'); -} - -/* call-seq: - * self <= other -> true or false - * - * Returns +true+ if +self+ is less or equal to than +other+, +false+ otherwise: - * - * b = BigDecimal('1.5') # => 0.15e1 - * b <= 2 # => true - * b <= 2.0 # => true - * b <= Rational(2, 1) # => true - * b <= 1.5 # => true - * b < 1 # => false - * - * Raises an exception if the comparison cannot be made. - * - */ -static VALUE -BigDecimal_le(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, 'L'); -} - -/* call-seq: - * self > other -> true or false - * - * Returns +true+ if +self+ is greater than +other+, +false+ otherwise: - * - * b = BigDecimal('1.5') - * b > 1 # => true - * b > 1.0 # => true - * b > Rational(1, 1) # => true - * b > 2 # => false - * - * Raises an exception if the comparison cannot be made. - * - */ -static VALUE -BigDecimal_gt(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, '>'); -} - -/* call-seq: - * self >= other -> true or false - * - * Returns +true+ if +self+ is greater than or equal to +other+, +false+ otherwise: - * - * b = BigDecimal('1.5') - * b >= 1 # => true - * b >= 1.0 # => true - * b >= Rational(1, 1) # => true - * b >= 1.5 # => true - * b > 2 # => false - * - * Raises an exception if the comparison cannot be made. - * - */ -static VALUE -BigDecimal_ge(VALUE self, VALUE r) -{ - return BigDecimalCmp(self, r, 'G'); -} - -/* - * call-seq: - * -self -> bigdecimal - * - * Returns the \BigDecimal negation of self: - * - * b0 = BigDecimal('1.5') - * b1 = -b0 # => -0.15e1 - * b2 = -b1 # => 0.15e1 - * - */ - -static VALUE -BigDecimal_neg(VALUE self) -{ - ENTER(5); - Real *c, *a; - GUARD_OBJ(a, GetVpValue(self, 1)); - GUARD_OBJ(c, NewZeroWrapLimited(1, a->Prec *(VpBaseFig() + 1))); - VpAsgn(c, a, -1); - return VpCheckGetValue(c); -} - -static VALUE -BigDecimal_mult(VALUE self, VALUE r) -{ - ENTER(5); - Real *c, *a, *b; - size_t mx; - - GUARD_OBJ(a, GetVpValue(self, 1)); - if (RB_TYPE_P(r, T_FLOAT)) { - b = GetVpValueWithPrec(r, 0, 1); - } - else if (RB_TYPE_P(r, T_RATIONAL)) { - b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); - } - else { - b = GetVpValue(r,0); - } - - if (!b) return DoSomeOne(self, r, '*'); - SAVE(b); - - mx = a->Prec + b->Prec; - GUARD_OBJ(c, NewZeroWrapLimited(1, mx * (VpBaseFig() + 1))); - VpMult(c, a, b); - return VpCheckGetValue(c); -} - -static VALUE -BigDecimal_divide(VALUE self, VALUE r, Real **c, Real **res, Real **div) -/* For c = self.div(r): with round operation */ -{ - ENTER(5); - Real *a, *b; - ssize_t a_prec, b_prec; - size_t mx; - - TypedData_Get_Struct(self, Real, &BigDecimal_data_type, a); - SAVE(a); - - VALUE rr = r; - if (is_kind_of_BigDecimal(rr)) { - /* do nothing */ - } - else if (RB_INTEGER_TYPE_P(r)) { - rr = rb_inum_convert_to_BigDecimal(r, 0, true); - } - else if (RB_TYPE_P(r, T_FLOAT)) { - rr = rb_float_convert_to_BigDecimal(r, 0, true); - } - else if (RB_TYPE_P(r, T_RATIONAL)) { - rr = rb_rational_convert_to_BigDecimal(r, a->Prec*BASE_FIG, true); - } - - if (!is_kind_of_BigDecimal(rr)) { - return DoSomeOne(self, r, '/'); - } - - TypedData_Get_Struct(rr, Real, &BigDecimal_data_type, b); - SAVE(b); - *div = b; - - BigDecimal_count_precision_and_scale(self, &a_prec, NULL); - BigDecimal_count_precision_and_scale(rr, &b_prec, NULL); - mx = (a_prec > b_prec) ? a_prec : b_prec; - mx *= 2; - - if (2*BIGDECIMAL_DOUBLE_FIGURES > mx) - mx = 2*BIGDECIMAL_DOUBLE_FIGURES; - - GUARD_OBJ((*c), NewZeroWrapNolimit(1, mx + 2*BASE_FIG)); - GUARD_OBJ((*res), NewZeroWrapNolimit(1, (mx + 1)*2 + 2*BASE_FIG)); - VpDivd(*c, *res, a, b); - - return Qnil; -} - -static VALUE BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod); - -/* call-seq: - * a / b -> bigdecimal - * - * Divide by the specified value. - * - * The result precision will be the precision of the larger operand, - * but its minimum is 2*Float::DIG. - * - * See BigDecimal#div. - * See BigDecimal#quo. - */ -static VALUE -BigDecimal_div(VALUE self, VALUE r) -/* For c = self/r: with round operation */ -{ - ENTER(5); - Real *c=NULL, *res=NULL, *div = NULL; - r = BigDecimal_divide(self, r, &c, &res, &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], (DECDIG)(VpBaseVal() * (DECDIG_DBL)res->frac[0] / div->frac[0])); - } - return VpCheckGetValue(c); -} - -static VALUE BigDecimal_round(int argc, VALUE *argv, VALUE self); - -/* call-seq: - * quo(value) -> bigdecimal - * quo(value, digits) -> bigdecimal - * - * Divide by the specified value. - * - * digits:: If specified and less than the number of significant digits of - * the result, the result is rounded to the given number of digits, - * according to the rounding mode indicated by BigDecimal.mode. - * - * If digits is 0 or omitted, the result is the same as for the - * / operator. - * - * See BigDecimal#/. - * See BigDecimal#div. - */ -static VALUE -BigDecimal_quo(int argc, VALUE *argv, VALUE self) -{ - VALUE value, digits, result; - SIGNED_VALUE n = -1; - - argc = rb_scan_args(argc, argv, "11", &value, &digits); - if (argc > 1) { - n = check_int_precision(digits); - } - - if (n > 0) { - result = BigDecimal_div2(self, value, digits); - } - else { - result = BigDecimal_div(self, value); - } - - return result; -} - -/* - * %: mod = a%b = a - (a.to_f/b).floor * b - * div = (a.to_f/b).floor - */ -static VALUE -BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod) -{ - ENTER(8); - Real *c=NULL, *d=NULL, *res=NULL; - Real *a, *b; - ssize_t a_prec, b_prec; - size_t mx; - - TypedData_Get_Struct(self, Real, &BigDecimal_data_type, a); - SAVE(a); - - VALUE rr = r; - if (is_kind_of_BigDecimal(rr)) { - /* do nothing */ - } - else if (RB_INTEGER_TYPE_P(r)) { - rr = rb_inum_convert_to_BigDecimal(r, 0, true); - } - else if (RB_TYPE_P(r, T_FLOAT)) { - rr = rb_float_convert_to_BigDecimal(r, 0, true); - } - else if (RB_TYPE_P(r, T_RATIONAL)) { - rr = rb_rational_convert_to_BigDecimal(r, a->Prec*BASE_FIG, true); - } - - if (!is_kind_of_BigDecimal(rr)) { - return Qfalse; - } - - TypedData_Get_Struct(rr, Real, &BigDecimal_data_type, b); - SAVE(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)) { - if (VpGetSign(a) == VpGetSign(b)) { - VALUE inf = BigDecimal_positive_infinity(); - TypedData_Get_Struct(inf, Real, &BigDecimal_data_type, *div); - } - else { - VALUE inf = BigDecimal_negative_infinity(); - TypedData_Get_Struct(inf, Real, &BigDecimal_data_type, *div); - } - VALUE nan = BigDecimal_nan(); - TypedData_Get_Struct(nan, Real, &BigDecimal_data_type, *mod); - return Qtrue; - } - if (VpIsInf(b)) { - VALUE zero = BigDecimal_positive_zero(); - TypedData_Get_Struct(zero, Real, &BigDecimal_data_type, *div); - *mod = a; - return Qtrue; - } - if (VpIsZero(a)) { - VALUE zero = BigDecimal_positive_zero(); - TypedData_Get_Struct(zero, Real, &BigDecimal_data_type, *div); - TypedData_Get_Struct(zero, Real, &BigDecimal_data_type, *mod); - return Qtrue; - } - - BigDecimal_count_precision_and_scale(self, &a_prec, NULL); - BigDecimal_count_precision_and_scale(rr, &b_prec, NULL); - - mx = (a_prec > b_prec) ? a_prec : b_prec; - mx *= 2; - - if (2*BIGDECIMAL_DOUBLE_FIGURES > mx) - mx = 2*BIGDECIMAL_DOUBLE_FIGURES; - - GUARD_OBJ(c, NewZeroWrapLimited(1, mx + 2*BASE_FIG)); - GUARD_OBJ(res, NewZeroWrapNolimit(1, mx*2 + 2*BASE_FIG)); - VpDivd(c, res, a, b); - - mx = c->Prec * BASE_FIG; - GUARD_OBJ(d, NewZeroWrapLimited(1, mx)); - VpActiveRound(d, c, VP_ROUND_DOWN, 0); - - VpMult(res, d, b); - VpAddSub(c, a, res, -1); - - if (!VpIsZero(c) && (VpGetSign(a) * VpGetSign(b) < 0)) { - /* result adjustment for negative case */ - res = rbd_reallocate_struct(res, d->MaxPrec); - res->MaxPrec = d->MaxPrec; - VpAddSub(res, d, VpOne(), -1); - GUARD_OBJ(d, NewZeroWrapLimited(1, GetAddSubPrec(c, b) * 2*BASE_FIG)); - VpAddSub(d, c, b, 1); - *div = res; - *mod = d; - } - else { - *div = d; - *mod = c; - } - return Qtrue; - - NaN: - { - VALUE nan = BigDecimal_nan(); - TypedData_Get_Struct(nan, Real, &BigDecimal_data_type, *div); - TypedData_Get_Struct(nan, Real, &BigDecimal_data_type, *mod); - } - return Qtrue; -} - -/* call-seq: - * a % b - * a.modulo(b) - * - * 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; - - if (BigDecimal_DoDivmod(self, r, &div, &mod)) { - SAVE(div); SAVE(mod); - return VpCheckGetValue(mod); - } - return DoSomeOne(self, r, '%'); -} - -static VALUE -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; - - GUARD_OBJ(a, GetVpValue(self, 1)); - if (RB_TYPE_P(r, T_FLOAT)) { - b = GetVpValueWithPrec(r, 0, 1); - } - else if (RB_TYPE_P(r, T_RATIONAL)) { - b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1); - } - else { - b = GetVpValue(r, 0); - } - - if (!b) return DoSomeOne(self, r, rb_intern("remainder")); - SAVE(b); - - mx = (a->MaxPrec + b->MaxPrec) *VpBaseFig(); - GUARD_OBJ(c, NewZeroWrapLimited(1, mx)); - GUARD_OBJ(res, NewZeroWrapNolimit(1, (mx+1) * 2 + (VpBaseFig() + 1))); - GUARD_OBJ(rr, NewZeroWrapNolimit(1, (mx+1) * 2 + (VpBaseFig() + 1))); - GUARD_OBJ(ff, NewZeroWrapNolimit(1, (mx+1) * 2 + (VpBaseFig() + 1))); - - VpDivd(c, res, a, b); - - mx = c->Prec *(VpBaseFig() + 1); - - GUARD_OBJ(d, NewZeroWrapLimited(1, mx)); - GUARD_OBJ(f, NewZeroWrapLimited(1, mx)); - - VpActiveRound(d, c, VP_ROUND_DOWN, 0); /* 0: round off */ - - VpFrac(f, c); - VpMult(rr, f, b); - VpAddSub(ff, res, rr, 1); - - *dv = d; - *rv = ff; - return Qnil; -} - -/* call-seq: - * remainder(value) - * - * Returns the remainder from dividing by the value. - * - * x.remainder(y) means x-y*(x/y).truncate - */ -static VALUE -BigDecimal_remainder(VALUE self, VALUE r) /* remainder */ -{ - VALUE f; - Real *d, *rv = 0; - f = BigDecimal_divremain(self, r, &d, &rv); - if (!NIL_P(f)) return f; - return VpCheckGetValue(rv); -} - -/* call-seq: - * divmod(value) - * - * Divides by the specified value, and returns the quotient and modulus - * as BigDecimal numbers. The quotient is rounded towards negative infinity. - * - * For example: - * - * require 'bigdecimal' - * - * a = BigDecimal("42") - * b = BigDecimal("9") - * - * q, m = a.divmod(b) - * - * c = q * b + m - * - * a == c #=> true - * - * The quotient q is (a/b).floor, and the modulus is the amount that must be - * added to q * b to get a. - */ -static VALUE -BigDecimal_divmod(VALUE self, VALUE r) -{ - ENTER(5); - Real *div = NULL, *mod = NULL; - - if (BigDecimal_DoDivmod(self, r, &div, &mod)) { - SAVE(div); SAVE(mod); - return rb_assoc_new(VpCheckGetValue(div), VpCheckGetValue(mod)); - } - return DoSomeOne(self,r,rb_intern("divmod")); -} - -/* - * Do the same manner as Float#div when n is nil. - * Do the same manner as BigDecimal#quo when n is 0. - */ -static inline VALUE -BigDecimal_div2(VALUE self, VALUE b, VALUE n) -{ - ENTER(5); - SIGNED_VALUE ix; - - if (NIL_P(n)) { /* div in Float sense */ - Real *div = NULL; - Real *mod; - if (BigDecimal_DoDivmod(self, b, &div, &mod)) { - return BigDecimal_to_i(VpCheckGetValue(div)); - } - return DoSomeOne(self, b, rb_intern("div")); - } - - /* div in BigDecimal sense */ - ix = check_int_precision(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 b_prec = ix; - size_t pl = VpSetPrecLimit(0); - - GUARD_OBJ(cv, NewZeroWrapLimited(1, mx + VpBaseFig())); - GUARD_OBJ(av, GetVpValue(self, 1)); - /* TODO: I want to refactor this precision control for a float value later - * by introducing an implicit conversion function instead of - * GetVpValueWithPrec. */ - if (RB_FLOAT_TYPE_P(b) && b_prec > BIGDECIMAL_DOUBLE_FIGURES) { - b_prec = BIGDECIMAL_DOUBLE_FIGURES; - } - GUARD_OBJ(bv, GetVpValueWithPrec(b, b_prec, 1)); - mx = av->Prec + bv->Prec + 2; - if (mx <= cv->MaxPrec) mx = cv->MaxPrec + 1; - GUARD_OBJ(res, NewZeroWrapNolimit(1, (mx * 2 + 2)*VpBaseFig())); - VpDivd(cv, res, av, bv); - VpSetPrecLimit(pl); - VpLeftRound(cv, VpGetRoundMode(), ix); - return VpCheckGetValue(cv); - } -} - - /* - * Document-method: BigDecimal#div - * - * call-seq: - * div(value) -> integer - * div(value, digits) -> bigdecimal or integer - * - * Divide by the specified value. - * - * 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 for the / operator - * or #quo. - * - * If digits is not specified, the result is an integer, - * by analogy with Float#div; see also BigDecimal#divmod. - * - * See BigDecimal#/. - * See BigDecimal#quo. - * - * Examples: - * - * a = BigDecimal("4") - * b = BigDecimal("3") - * - * a.div(b, 3) # => 0.133e1 - * - * a.div(b, 0) # => 0.1333333333333333333e1 - * a / b # => 0.1333333333333333333e1 - * a.quo(b) # => 0.1333333333333333333e1 - * - * a.div(b) # => 1 - */ -static VALUE -BigDecimal_div3(int argc, VALUE *argv, VALUE self) -{ - VALUE b,n; - - rb_scan_args(argc, argv, "11", &b, &n); - - return BigDecimal_div2(self, b, n); -} - - /* - * call-seq: - * add(value, ndigits) -> new_bigdecimal - * - * Returns the \BigDecimal sum of +self+ and +value+ - * with a precision of +ndigits+ decimal digits. - * - * When +ndigits+ is less than the number of significant digits - * in the sum, the sum is rounded to that number of digits, - * according to the current rounding mode; see BigDecimal.mode. - * - * Examples: - * - * # Set the rounding mode. - * BigDecimal.mode(BigDecimal::ROUND_MODE, :half_up) - * b = BigDecimal('111111.111') - * b.add(1, 0) # => 0.111112111e6 - * b.add(1, 3) # => 0.111e6 - * b.add(1, 6) # => 0.111112e6 - * b.add(1, 15) # => 0.111112111e6 - * b.add(1.0, 15) # => 0.111112111e6 - * b.add(Rational(1, 1), 15) # => 0.111112111e6 - * - */ - -static VALUE -BigDecimal_add2(VALUE self, VALUE b, VALUE n) -{ - ENTER(2); - Real *cv; - SIGNED_VALUE mx = check_int_precision(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 VpCheckGetValue(cv); - } -} - -/* call-seq: - * 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) -{ - ENTER(2); - Real *cv; - SIGNED_VALUE mx = check_int_precision(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 VpCheckGetValue(cv); - } -} - - /* - * call-seq: - * mult(other, ndigits) -> bigdecimal - * - * Returns the \BigDecimal product of +self+ and +value+ - * with a precision of +ndigits+ decimal digits. - * - * When +ndigits+ is less than the number of significant digits - * in the sum, the sum is rounded to that number of digits, - * according to the current rounding mode; see BigDecimal.mode. - * - * Examples: - * - * # Set the rounding mode. - * BigDecimal.mode(BigDecimal::ROUND_MODE, :half_up) - * b = BigDecimal('555555.555') - * b.mult(3, 0) # => 0.1666666665e7 - * b.mult(3, 3) # => 0.167e7 - * b.mult(3, 6) # => 0.166667e7 - * b.mult(3, 15) # => 0.1666666665e7 - * b.mult(3.0, 0) # => 0.1666666665e7 - * b.mult(Rational(3, 1), 0) # => 0.1666666665e7 - * b.mult(Complex(3, 0), 0) # => (0.1666666665e7+0.0i) - * - */ - -static VALUE -BigDecimal_mult2(VALUE self, VALUE b, VALUE n) -{ - ENTER(2); - Real *cv; - SIGNED_VALUE mx = check_int_precision(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 VpCheckGetValue(cv); - } -} - -/* - * call-seq: - * abs -> bigdecimal - * - * Returns the \BigDecimal absolute value of +self+: - * - * BigDecimal('5').abs # => 0.5e1 - * BigDecimal('-3').abs # => 0.3e1 - * - */ - -static VALUE -BigDecimal_abs(VALUE self) -{ - ENTER(5); - Real *c, *a; - size_t mx; - - GUARD_OBJ(a, GetVpValue(self, 1)); - mx = a->Prec *(VpBaseFig() + 1); - GUARD_OBJ(c, NewZeroWrapLimited(1, mx)); - VpAsgn(c, a, 1); - VpChangeSign(c, 1); - return VpCheckGetValue(c); -} - -/* call-seq: - * sqrt(n) - * - * Returns the square root of the value. - * - * Result has at least n significant digits. - */ -static VALUE -BigDecimal_sqrt(VALUE self, VALUE nFig) -{ - ENTER(5); - Real *c, *a; - size_t mx, n; - - GUARD_OBJ(a, GetVpValue(self, 1)); - mx = a->Prec * (VpBaseFig() + 1); - - n = check_int_precision(nFig); - n += VpDblFig() + VpBaseFig(); - if (mx <= n) mx = n; - GUARD_OBJ(c, NewZeroWrapLimited(1, mx)); - VpSqrt(c, a); - return VpCheckGetValue(c); -} - -/* Return the integer part of the number, as a BigDecimal. - */ -static VALUE -BigDecimal_fix(VALUE self) -{ - ENTER(5); - Real *c, *a; - size_t mx; - - GUARD_OBJ(a, GetVpValue(self, 1)); - mx = a->Prec *(VpBaseFig() + 1); - GUARD_OBJ(c, NewZeroWrapLimited(1, mx)); - VpActiveRound(c, a, VP_ROUND_DOWN, 0); /* 0: round off */ - return VpCheckGetValue(c); -} - -/* call-seq: - * round(n, mode) - * - * Round to the nearest integer (by default), returning the result as a - * BigDecimal if n is specified, or as an Integer if it isn't. - * - * BigDecimal('3.14159').round #=> 3 - * BigDecimal('8.7').round #=> 9 - * BigDecimal('-9.9').round #=> -10 - * - * BigDecimal('3.14159').round(2).class.name #=> "BigDecimal" - * BigDecimal('3.14159').round.class.name #=> "Integer" - * - * If n is specified and positive, the fractional part of the result has no - * more than that many digits. - * - * If n is specified and negative, at least that many digits to the left of the - * decimal point will be 0 in the result, and return value will be an Integer. - * - * BigDecimal('3.14159').round(3) #=> 3.142 - * BigDecimal('13345.234').round(-2) #=> 13300 - * - * The value of the optional mode argument can be used to determine how - * rounding is performed; see BigDecimal.mode. - */ -static VALUE -BigDecimal_round(int argc, VALUE *argv, VALUE self) -{ - ENTER(5); - Real *c, *a; - int iLoc = 0; - VALUE vLoc; - VALUE vRound; - int round_to_int = 0; - size_t mx, pl; - - unsigned short sw = VpGetRoundMode(); - - switch (rb_scan_args(argc, argv, "02", &vLoc, &vRound)) { - case 0: - iLoc = 0; - round_to_int = 1; - break; - case 1: - if (RB_TYPE_P(vLoc, T_HASH)) { - sw = check_rounding_mode_option(vLoc); - } - else { - iLoc = NUM2INT(vLoc); - if (iLoc < 1) round_to_int = 1; - } - break; - case 2: - iLoc = NUM2INT(vLoc); - if (RB_TYPE_P(vRound, T_HASH)) { - sw = check_rounding_mode_option(vRound); - } - else { - 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, NewZeroWrapLimited(1, mx)); - VpSetPrecLimit(pl); - VpActiveRound(c, a, sw, iLoc); - if (round_to_int) { - return BigDecimal_to_i(VpCheckGetValue(c)); - } - return VpCheckGetValue(c); -} - -/* call-seq: - * truncate(n) - * - * Truncate to the nearest integer (by default), returning the result as a - * BigDecimal. - * - * BigDecimal('3.14159').truncate #=> 3 - * BigDecimal('8.7').truncate #=> 8 - * BigDecimal('-9.9').truncate #=> -9 - * - * If n is specified and positive, the fractional part of the result has no - * more than that many digits. - * - * 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 - */ -static VALUE -BigDecimal_truncate(int argc, VALUE *argv, VALUE self) -{ - ENTER(5); - Real *c, *a; - int iLoc; - VALUE vLoc; - size_t mx, pl = VpSetPrecLimit(0); - - if (rb_scan_args(argc, argv, "01", &vLoc) == 0) { - iLoc = 0; - } - else { - iLoc = NUM2INT(vLoc); - } - - GUARD_OBJ(a, GetVpValue(self, 1)); - mx = a->Prec * (VpBaseFig() + 1); - GUARD_OBJ(c, NewZeroWrapLimited(1, mx)); - VpSetPrecLimit(pl); - VpActiveRound(c, a, VP_ROUND_DOWN, iLoc); /* 0: truncate */ - if (argc == 0) { - return BigDecimal_to_i(VpCheckGetValue(c)); - } - return VpCheckGetValue(c); -} - -/* Return the fractional part of the number, as a BigDecimal. - */ -static VALUE -BigDecimal_frac(VALUE self) -{ - ENTER(5); - Real *c, *a; - size_t mx; - - GUARD_OBJ(a, GetVpValue(self, 1)); - mx = a->Prec * (VpBaseFig() + 1); - GUARD_OBJ(c, NewZeroWrapLimited(1, mx)); - VpFrac(c, a); - return VpCheckGetValue(c); -} - -/* call-seq: - * floor(n) - * - * Return the largest integer less than or equal to the value, as a BigDecimal. - * - * 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. - * - * 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 - */ -static VALUE -BigDecimal_floor(int argc, VALUE *argv, VALUE self) -{ - ENTER(5); - Real *c, *a; - int iLoc; - VALUE vLoc; - size_t mx, pl = VpSetPrecLimit(0); - - if (rb_scan_args(argc, argv, "01", &vLoc)==0) { - iLoc = 0; - } - else { - iLoc = NUM2INT(vLoc); - } - - GUARD_OBJ(a, GetVpValue(self, 1)); - mx = a->Prec * (VpBaseFig() + 1); - GUARD_OBJ(c, NewZeroWrapLimited(1, mx)); - VpSetPrecLimit(pl); - VpActiveRound(c, a, VP_ROUND_FLOOR, iLoc); -#ifdef BIGDECIMAL_DEBUG - VPrint(stderr, "floor: c=%\n", c); -#endif - if (argc == 0) { - return BigDecimal_to_i(VpCheckGetValue(c)); - } - return VpCheckGetValue(c); -} - -/* call-seq: - * ceil(n) - * - * Return the smallest integer greater than or equal to the value, as a BigDecimal. - * - * 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. - * - * 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 - */ -static VALUE -BigDecimal_ceil(int argc, VALUE *argv, VALUE self) -{ - ENTER(5); - Real *c, *a; - int iLoc; - VALUE vLoc; - size_t mx, pl = VpSetPrecLimit(0); - - if (rb_scan_args(argc, argv, "01", &vLoc) == 0) { - iLoc = 0; - } else { - iLoc = NUM2INT(vLoc); - } - - GUARD_OBJ(a, GetVpValue(self, 1)); - mx = a->Prec * (VpBaseFig() + 1); - GUARD_OBJ(c, NewZeroWrapLimited(1, mx)); - VpSetPrecLimit(pl); - VpActiveRound(c, a, VP_ROUND_CEIL, iLoc); - if (argc == 0) { - return BigDecimal_to_i(VpCheckGetValue(c)); - } - return VpCheckGetValue(c); -} - -/* call-seq: - * to_s(s) - * - * Converts the value to a string. - * - * The default format looks like 0.xxxxEnn. - * - * The optional parameter s consists of either an integer; or an optional '+' - * or ' ', followed by an optional number, followed by an optional 'E' or 'F'. - * - * If there is a '+' at the start of s, positive values are returned with - * a leading '+'. - * - * A space at the start of s returns positive values with a leading space. - * - * If s contains a number, a space is inserted after each group of that many - * fractional digits. - * - * If s ends with an 'E', engineering notation (0.xxxxEnn) is used. - * - * If s ends with an 'F', conventional floating point notation is used. - * - * Examples: - * - * BigDecimal('-123.45678901234567890').to_s('5F') - * #=> '-123.45678 90123 45678 9' - * - * BigDecimal('123.45678901234567890').to_s('+8F') - * #=> '+123.45678901 23456789' - * - * BigDecimal('123.45678901234567890').to_s(' F') - * #=> ' 123.4567890123456789' - */ -static VALUE -BigDecimal_to_s(int argc, VALUE *argv, VALUE self) -{ - ENTER(5); - int fmt = 0; /* 0: E format, 1: F format */ - int fPlus = 0; /* 0: default, 1: set ' ' before digits, 2: set '+' before digits. */ - Real *vp; - volatile VALUE str; - char *psz; - char ch; - size_t nc, mc = 0; - SIGNED_VALUE m; - VALUE f; - - GUARD_OBJ(vp, GetVpValue(self, 1)); - - if (rb_scan_args(argc, argv, "01", &f) == 1) { - if (RB_TYPE_P(f, T_STRING)) { - psz = StringValueCStr(f); - if (*psz == ' ') { - fPlus = 1; - psz++; - } - else if (*psz == '+') { - fPlus = 2; - psz++; - } - while ((ch = *psz++) != 0) { - if (ISSPACE(ch)) { - continue; - } - if (!ISDIGIT(ch)) { - if (ch == 'F' || ch == 'f') { - fmt = 1; /* F format */ - } - break; - } - mc = mc*10 + ch - '0'; - } - } - else { - m = NUM2INT(f); - if (m <= 0) { - rb_raise(rb_eArgError, "argument must be positive"); - } - mc = (size_t)m; - } - } - if (fmt) { - nc = VpNumOfChars(vp, "F"); - } - else { - nc = VpNumOfChars(vp, "E"); - } - if (mc > 0) { - nc += (nc + mc - 1) / mc + 1; - } - - str = rb_usascii_str_new(0, nc); - psz = RSTRING_PTR(str); - - if (fmt) { - VpToFString(vp, psz, RSTRING_LEN(str), mc, fPlus); - } - else { - VpToString (vp, psz, RSTRING_LEN(str), mc, fPlus); - } - rb_str_resize(str, strlen(psz)); - return str; -} - -/* Splits a BigDecimal number into four parts, returned as an array of values. - * - * The first value represents the sign of the BigDecimal, and is -1 or 1, or 0 - * if the BigDecimal is Not a Number. - * - * The second value is a string representing the significant digits of the - * BigDecimal, with no leading zeros. - * - * The third value is the base used for arithmetic (currently always 10) as an - * Integer. - * - * The fourth value is an Integer exponent. - * - * If the BigDecimal can be represented as 0.xxxxxx*10**n, then xxxxxx is the - * string of significant digits with no leading zeros, and n is the exponent. - * - * From these values, you can translate a BigDecimal to a float as follows: - * - * sign, significant_digits, base, exponent = a.split - * f = sign * "0.#{significant_digits}".to_f * (base ** exponent) - * - * (Note that the to_f method is provided as a more convenient way to translate - * a BigDecimal to a Float.) - */ -static VALUE -BigDecimal_split(VALUE self) -{ - ENTER(5); - Real *vp; - VALUE obj,str; - ssize_t e, s; - char *psz1; - - GUARD_OBJ(vp, GetVpValue(self, 1)); - str = rb_str_new(0, VpNumOfChars(vp, "E")); - psz1 = RSTRING_PTR(str); - VpSzMantissa(vp, psz1, RSTRING_LEN(str)); - s = 1; - if(psz1[0] == '-') { - size_t len = strlen(psz1 + 1); - - memmove(psz1, psz1 + 1, len); - psz1[len] = '\0'; - s = -1; - } - if (psz1[0] == 'N') s = 0; /* NaN */ - e = VpExponent10(vp); - obj = rb_ary_new2(4); - rb_ary_push(obj, INT2FIX(s)); - rb_ary_push(obj, str); - rb_str_resize(str, strlen(psz1)); - rb_ary_push(obj, INT2FIX(10)); - rb_ary_push(obj, SSIZET2NUM(e)); - return obj; -} - -/* Returns the exponent of the BigDecimal number, as an Integer. - * - * If the number can be represented as 0.xxxxxx*10**n where xxxxxx is a string - * of digits with no leading zeros, then n is the exponent. - */ -static VALUE -BigDecimal_exponent(VALUE self) -{ - ssize_t e = VpExponent10(GetVpValue(self, 1)); - return SSIZET2NUM(e); -} - -/* Returns a string representation of self. - * - * BigDecimal("1234.5678").inspect - * #=> "0.12345678e4" - */ -static VALUE -BigDecimal_inspect(VALUE self) -{ - ENTER(5); - Real *vp; - volatile VALUE str; - size_t nc; - - GUARD_OBJ(vp, GetVpValue(self, 1)); - nc = VpNumOfChars(vp, "E"); - - str = rb_str_new(0, nc); - VpToString(vp, RSTRING_PTR(str), RSTRING_LEN(str), 0, 0); - rb_str_resize(str, strlen(RSTRING_PTR(str))); - return str; -} - -static VALUE BigMath_s_exp(VALUE, VALUE, VALUE); -static VALUE BigMath_s_log(VALUE, VALUE, VALUE); - -#define BigMath_exp(x, n) BigMath_s_exp(rb_mBigMath, (x), (n)) -#define BigMath_log(x, n) BigMath_s_log(rb_mBigMath, (x), (n)) - -inline static int -is_integer(VALUE x) -{ - return (RB_TYPE_P(x, T_FIXNUM) || RB_TYPE_P(x, T_BIGNUM)); -} - -inline static int -is_negative(VALUE x) -{ - if (FIXNUM_P(x)) { - return FIX2LONG(x) < 0; - } - else if (RB_TYPE_P(x, T_BIGNUM)) { - return FIX2INT(rb_big_cmp(x, INT2FIX(0))) < 0; - } - else if (RB_TYPE_P(x, T_FLOAT)) { - return RFLOAT_VALUE(x) < 0.0; - } - return RTEST(rb_funcall(x, '<', 1, INT2FIX(0))); -} - -#define is_positive(x) (!is_negative(x)) - -inline static int -is_zero(VALUE x) -{ - VALUE num; - - switch (TYPE(x)) { - case T_FIXNUM: - return FIX2LONG(x) == 0; - - case T_BIGNUM: - return Qfalse; - - case T_RATIONAL: - num = rb_rational_num(x); - return FIXNUM_P(num) && FIX2LONG(num) == 0; - - default: - break; - } - - return RTEST(rb_funcall(x, id_eq, 1, INT2FIX(0))); -} - -inline static int -is_one(VALUE x) -{ - VALUE num, den; - - switch (TYPE(x)) { - case T_FIXNUM: - return FIX2LONG(x) == 1; - - case T_BIGNUM: - return Qfalse; - - case T_RATIONAL: - num = rb_rational_num(x); - den = rb_rational_den(x); - return FIXNUM_P(den) && FIX2LONG(den) == 1 && - FIXNUM_P(num) && FIX2LONG(num) == 1; - - default: - break; - } - - return RTEST(rb_funcall(x, id_eq, 1, INT2FIX(1))); -} - -inline static int -is_even(VALUE x) -{ - switch (TYPE(x)) { - case T_FIXNUM: - return (FIX2LONG(x) % 2) == 0; - - case T_BIGNUM: - { - unsigned long l; - rb_big_pack(x, &l, 1); - return l % 2 == 0; - } - - default: - break; - } - - return 0; -} - -static VALUE -bigdecimal_power_by_bigdecimal(Real const* x, Real const* exp, ssize_t const n) -{ - VALUE log_x, multiplied, y; - volatile VALUE obj = exp->obj; - - if (VpIsZero(exp)) { - return VpCheckGetValue(NewOneWrapLimited(1, 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; -} - -/* call-seq: - * power(n) - * power(n, prec) - * - * Returns the value raised to the power of n. - * - * Note that n must be an Integer. - * - * Also available as the operator **. - */ -static VALUE -BigDecimal_power(int argc, VALUE*argv, VALUE self) -{ - ENTER(5); - VALUE vexp, prec; - Real* exp = NULL; - Real *x, *y; - ssize_t mp, ma, n; - SIGNED_VALUE int_exp; - double d; - - rb_scan_args(argc, argv, "11", &vexp, &prec); - - GUARD_OBJ(x, GetVpValue(self, 1)); - n = NIL_P(prec) ? (ssize_t)(x->Prec*VpBaseFig()) : NUM2SSIZET(prec); - - if (VpIsNaN(x)) { - y = NewZeroWrapLimited(1, n); - VpSetNaN(y); - RB_GC_GUARD(y->obj); - return VpCheckGetValue(y); - } - - retry: - switch (TYPE(vexp)) { - case T_FIXNUM: - break; - - case T_BIGNUM: - break; - - case T_FLOAT: - d = RFLOAT_VALUE(vexp); - if (d == round(d)) { - if (FIXABLE(d)) { - vexp = LONG2FIX((long)d); - } - else { - vexp = rb_dbl2big(d); - } - goto retry; - } - if (NIL_P(prec)) { - n += BIGDECIMAL_DOUBLE_FIGURES; - } - exp = GetVpValueWithPrec(vexp, 0, 1); - break; - - case T_RATIONAL: - if (is_zero(rb_rational_num(vexp))) { - if (is_positive(vexp)) { - vexp = INT2FIX(0); - goto retry; - } - } - else if (is_one(rb_rational_den(vexp))) { - vexp = rb_rational_num(vexp); - goto retry; - } - exp = GetVpValueWithPrec(vexp, n, 1); - if (NIL_P(prec)) { - n += n; - } - break; - - case T_DATA: - if (is_kind_of_BigDecimal(vexp)) { - VALUE zero = INT2FIX(0); - VALUE rounded = BigDecimal_round(1, &zero, vexp); - if (RTEST(BigDecimal_eq(vexp, rounded))) { - vexp = BigDecimal_to_i(vexp); - goto retry; - } - if (NIL_P(prec)) { - GUARD_OBJ(y, GetVpValue(vexp, 1)); - n += y->Prec*VpBaseFig(); - } - exp = DATA_PTR(vexp); - break; - } - /* fall through */ - default: - rb_raise(rb_eTypeError, - "wrong argument type %"PRIsVALUE" (expected scalar Numeric)", - RB_OBJ_CLASSNAME(vexp)); - } - - if (VpIsZero(x)) { - if (is_negative(vexp)) { - y = NewZeroWrapNolimit(1, n); - if (BIGDECIMAL_NEGATIVE_P(x)) { - if (is_integer(vexp)) { - if (is_even(vexp)) { - /* (-0) ** (-even_integer) -> Infinity */ - VpSetPosInf(y); - } - else { - /* (-0) ** (-odd_integer) -> -Infinity */ - VpSetNegInf(y); - } - } - else { - /* (-0) ** (-non_integer) -> Infinity */ - VpSetPosInf(y); - } - } - else { - /* (+0) ** (-num) -> Infinity */ - VpSetPosInf(y); - } - RB_GC_GUARD(y->obj); - return VpCheckGetValue(y); - } - else if (is_zero(vexp)) { - return VpCheckGetValue(NewOneWrapLimited(1, n)); - } - else { - return VpCheckGetValue(NewZeroWrapLimited(1, n)); - } - } - - if (is_zero(vexp)) { - return VpCheckGetValue(NewOneWrapLimited(1, n)); - } - else if (is_one(vexp)) { - return self; - } - - if (VpIsInf(x)) { - if (is_negative(vexp)) { - if (BIGDECIMAL_NEGATIVE_P(x)) { - if (is_integer(vexp)) { - if (is_even(vexp)) { - /* (-Infinity) ** (-even_integer) -> +0 */ - return VpCheckGetValue(NewZeroWrapLimited(1, n)); - } - else { - /* (-Infinity) ** (-odd_integer) -> -0 */ - return VpCheckGetValue(NewZeroWrapLimited(-1, n)); - } - } - else { - /* (-Infinity) ** (-non_integer) -> -0 */ - return VpCheckGetValue(NewZeroWrapLimited(-1, n)); - } - } - else { - return VpCheckGetValue(NewZeroWrapLimited(1, n)); - } - } - else { - y = NewZeroWrapLimited(1, n); - if (BIGDECIMAL_NEGATIVE_P(x)) { - if (is_integer(vexp)) { - if (is_even(vexp)) { - VpSetPosInf(y); - } - else { - VpSetNegInf(y); - } - } - else { - /* TODO: support complex */ - rb_raise(rb_eMathDomainError, - "a non-integral exponent for a negative base"); - } - } - else { - VpSetPosInf(y); - } - return VpCheckGetValue(y); - } - } - - if (exp != NULL) { - return bigdecimal_power_by_bigdecimal(x, exp, n); - } - else if (RB_TYPE_P(vexp, T_BIGNUM)) { - VALUE abs_value = BigDecimal_abs(self); - if (is_one(abs_value)) { - return VpCheckGetValue(NewOneWrapLimited(1, n)); - } - else if (RTEST(rb_funcall(abs_value, '<', 1, INT2FIX(1)))) { - if (is_negative(vexp)) { - y = NewZeroWrapLimited(1, n); - VpSetInf(y, (is_even(vexp) ? 1 : -1) * VpGetSign(x)); - return VpCheckGetValue(y); - } - else if (BIGDECIMAL_NEGATIVE_P(x) && is_even(vexp)) { - return VpCheckGetValue(NewZeroWrapLimited(-1, n)); - } - else { - return VpCheckGetValue(NewZeroWrapLimited(1, n)); - } - } - else { - if (is_positive(vexp)) { - y = NewZeroWrapLimited(1, n); - VpSetInf(y, (is_even(vexp) ? 1 : -1) * VpGetSign(x)); - return VpCheckGetValue(y); - } - else if (BIGDECIMAL_NEGATIVE_P(x) && is_even(vexp)) { - return VpCheckGetValue(NewZeroWrapLimited(-1, n)); - } - else { - return VpCheckGetValue(NewZeroWrapLimited(1, n)); - } - } - } - - int_exp = FIX2LONG(vexp); - ma = int_exp; - if (ma < 0) ma = -ma; - if (ma == 0) ma = 1; - - if (VpIsDef(x)) { - mp = x->Prec * (VpBaseFig() + 1); - GUARD_OBJ(y, NewZeroWrapLimited(1, mp * (ma + 1))); - } - else { - GUARD_OBJ(y, NewZeroWrapLimited(1, 1)); - } - VpPowerByInt(y, x, int_exp); - if (!NIL_P(prec) && VpIsDef(y)) { - VpMidRound(y, VpGetRoundMode(), n); - } - return VpCheckGetValue(y); -} - -/* call-seq: - * self ** other -> bigdecimal - * - * Returns the \BigDecimal value of +self+ raised to power +other+: - * - * b = BigDecimal('3.14') - * b ** 2 # => 0.98596e1 - * b ** 2.0 # => 0.98596e1 - * b ** Rational(2, 1) # => 0.98596e1 - * - * Related: BigDecimal#power. - * - */ -static VALUE -BigDecimal_power_op(VALUE self, VALUE exp) -{ - return BigDecimal_power(1, &exp, self); -} - -/* :nodoc: - * - * private method for 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); - - if (self != other) { - DATA_PTR(self) = VpCopy(pv, x); - } - return self; -} - -static VALUE -BigDecimal_clone(VALUE self) -{ - return self; -} - -#ifdef HAVE_RB_OPTS_EXCEPTION_P -int rb_opts_exception_p(VALUE opts, int default_value); -#define opts_exception_p(opts) rb_opts_exception_p((opts), 1) -#else -static int -opts_exception_p(VALUE opts) -{ - static ID kwds[1]; - VALUE exception; - if (!kwds[0]) { - kwds[0] = rb_intern_const("exception"); - } - if (!rb_get_kwargs(opts, kwds, 0, 1, &exception)) return 1; - switch (exception) { - case Qtrue: case Qfalse: - break; - default: - rb_raise(rb_eArgError, "true or false is expected as exception: %+"PRIsVALUE, - exception); - } - return exception != Qfalse; -} -#endif - -static VALUE -check_exception(VALUE bd) -{ - assert(is_kind_of_BigDecimal(bd)); - - Real *vp; - TypedData_Get_Struct(bd, Real, &BigDecimal_data_type, vp); - VpCheckGetValue(vp); /* VpCheckGetValue performs exception check */ - - return bd; -} - -static VALUE -rb_uint64_convert_to_BigDecimal(uint64_t uval, RB_UNUSED_VAR(size_t digs), int raise_exception) -{ - VALUE obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, 0); - - Real *vp; - if (uval == 0) { - vp = rbd_allocate_struct(1); - vp->MaxPrec = 1; - vp->Prec = 1; - vp->exponent = 1; - VpSetZero(vp, 1); - vp->frac[0] = 0; - } - else if (uval < BASE) { - vp = rbd_allocate_struct(1); - vp->MaxPrec = 1; - vp->Prec = 1; - vp->exponent = 1; - VpSetSign(vp, 1); - vp->frac[0] = (DECDIG)uval; - } - else { - DECDIG buf[BIGDECIMAL_INT64_MAX_LENGTH] = {0,}; - DECDIG r = uval % BASE; - size_t len = 0, ntz = 0; - if (r == 0) { - // Count and skip trailing zeros - for (; r == 0 && uval > 0; ++ntz) { - uval /= BASE; - r = uval % BASE; - } - } - for (; uval > 0; ++len) { - // Store digits - buf[BIGDECIMAL_INT64_MAX_LENGTH - len - 1] = r; - uval /= BASE; - r = uval % BASE; - } - - const size_t exp = len + ntz; - vp = rbd_allocate_struct(len); - vp->MaxPrec = len; - vp->Prec = len; - vp->exponent = exp; - VpSetSign(vp, 1); - MEMCPY(vp->frac, buf + BIGDECIMAL_INT64_MAX_LENGTH - len, DECDIG, len); - } - - return BigDecimal_wrap_struct(obj, vp); -} - -static VALUE -rb_int64_convert_to_BigDecimal(int64_t ival, size_t digs, int raise_exception) -{ - const uint64_t uval = (ival < 0) ? (((uint64_t)-(ival+1))+1) : (uint64_t)ival; - VALUE bd = rb_uint64_convert_to_BigDecimal(uval, digs, raise_exception); - if (ival < 0) { - Real *vp; - TypedData_Get_Struct(bd, Real, &BigDecimal_data_type, vp); - VpSetSign(vp, -1); - } - return bd; -} - -static VALUE -rb_big_convert_to_BigDecimal(VALUE val, RB_UNUSED_VAR(size_t digs), int raise_exception) -{ - assert(RB_TYPE_P(val, T_BIGNUM)); - - int leading_zeros; - size_t size = rb_absint_size(val, &leading_zeros); - int sign = FIX2INT(rb_big_cmp(val, INT2FIX(0))); - if (sign < 0 && leading_zeros == 0) { - size += 1; - } - if (size <= sizeof(long)) { - if (sign < 0) { - return rb_int64_convert_to_BigDecimal(NUM2LONG(val), digs, raise_exception); - } - else { - return rb_uint64_convert_to_BigDecimal(NUM2ULONG(val), digs, raise_exception); - } - } -#if defined(SIZEOF_LONG_LONG) && SIZEOF_LONG < SIZEOF_LONG_LONG - else if (size <= sizeof(LONG_LONG)) { - if (sign < 0) { - return rb_int64_convert_to_BigDecimal(NUM2LL(val), digs, raise_exception); - } - else { - return rb_uint64_convert_to_BigDecimal(NUM2ULL(val), digs, raise_exception); - } - } -#endif - else { - VALUE str = rb_big2str(val, 10); - Real *vp = VpCreateRbObject(RSTRING_LEN(str) + BASE_FIG + 1, - RSTRING_PTR(str), true); - RB_GC_GUARD(str); - return check_exception(vp->obj); - } -} - -static VALUE -rb_inum_convert_to_BigDecimal(VALUE val, RB_UNUSED_VAR(size_t digs), int raise_exception) -{ - assert(RB_INTEGER_TYPE_P(val)); - if (FIXNUM_P(val)) { - return rb_int64_convert_to_BigDecimal(FIX2LONG(val), digs, raise_exception); - } - else { - return rb_big_convert_to_BigDecimal(val, digs, raise_exception); - } -} - -static VALUE -rb_float_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) -{ - assert(RB_FLOAT_TYPE_P(val)); - - double d = RFLOAT_VALUE(val); - - if (isnan(d)) { - VALUE obj = BigDecimal_nan(); - return check_exception(obj); - } - else if (isinf(d)) { - VALUE obj; - if (d > 0) { - obj = BigDecimal_positive_infinity(); - } - else { - obj = BigDecimal_negative_infinity(); - } - return check_exception(obj); - } - else if (d == 0.0) { - if (1/d < 0.0) { - return BigDecimal_negative_zero(); - } - else { - return BigDecimal_positive_zero(); - } - } - - if (digs == SIZE_MAX) { - if (!raise_exception) - return Qnil; - rb_raise(rb_eArgError, - "can't omit precision for a %"PRIsVALUE".", - CLASS_OF(val)); - } - else if (digs > BIGDECIMAL_DOUBLE_FIGURES) { - if (!raise_exception) - return Qnil; - rb_raise(rb_eArgError, "precision too large."); - } - - /* Use the same logic in flo_to_s to convert a float to a decimal string */ - char buf[BIGDECIMAL_DOUBLE_FIGURES + BASE_FIG + 2 + 1]; /* sizeof(buf) == 28 in the typical case */ - int decpt, negative_p; - char *e; - const int mode = digs == 0 ? 0 : 2; - char *p = BigDecimal_dtoa(d, mode, (int)digs, &decpt, &negative_p, &e); - int len10 = (int)(e - p); - if (len10 > BIGDECIMAL_DOUBLE_FIGURES) { - /* TODO: Presumably, rounding should be done here. */ - len10 = BIGDECIMAL_DOUBLE_FIGURES; - } - memcpy(buf, p, len10); - xfree(p); - - VALUE inum; - size_t RB_UNUSED_VAR(prec) = 0; - SIGNED_VALUE exp = 0; - if (decpt > 0) { - if (decpt < len10) { - /* - * len10 |---------------| - * : |-------| frac_len10 = len10 - decpt - * decpt |-------| |--| ntz10 = BASE_FIG - frac_len10 % BASE_FIG - * : : : - * 00 dd dddd.dddd dd 00 - * prec |-----.----.----.-----| prec = exp + roomof(frac_len, BASE_FIG) - * exp |-----.----| exp = roomof(decpt, BASE_FIG) - */ - const size_t frac_len10 = len10 - decpt; - const size_t ntz10 = BASE_FIG - frac_len10 % BASE_FIG; - memset(buf + len10, '0', ntz10); - buf[len10 + ntz10] = '\0'; - inum = rb_cstr_to_inum(buf, 10, false); - - exp = roomof(decpt, BASE_FIG); - prec = exp + roomof(frac_len10, BASE_FIG); - } - else { - /* - * decpt |-----------------------| - * len10 |----------| : - * : |------------| exp10 - * : : : - * 00 dd dddd dd 00 0000 0000.0 - * : : : : - * : |--| ntz10 = exp10 % BASE_FIG - * prec |-----.----.-----| : - * : |----.----| exp10 / BASE_FIG - * exp |-----.----.-----.----.----| - */ - const size_t exp10 = decpt - len10; - const size_t ntz10 = exp10 % BASE_FIG; - - memset(buf + len10, '0', ntz10); - buf[len10 + ntz10] = '\0'; - inum = rb_cstr_to_inum(buf, 10, false); - - prec = roomof(len10 + ntz10, BASE_FIG); - exp = prec + exp10 / BASE_FIG; - } - } - else if (decpt == 0) { - /* - * len10 |------------| - * : : - * 0.dddd dddd dd 00 - * : : : - * : |--| ntz10 = prec * BASE_FIG - len10 - * prec |----.----.-----| roomof(len10, BASE_FIG) - */ - prec = roomof(len10, BASE_FIG); - const size_t ntz10 = prec * BASE_FIG - len10; - - memset(buf + len10, '0', ntz10); - buf[len10 + ntz10] = '\0'; - inum = rb_cstr_to_inum(buf, 10, false); - } - else { - /* - * len10 |---------------| - * : : - * decpt |-------| |--| ntz10 = prec * BASE_FIG - nlz10 - len10 - * : : : - * 0.0000 00 dd dddd dddd dd 00 - * : : : - * nlz10 |--| : decpt % BASE_FIG - * prec |-----.----.----.-----| roomof(decpt + len10, BASE_FIG) - exp - * exp |----| decpt / BASE_FIG - */ - decpt = -decpt; - - const size_t nlz10 = decpt % BASE_FIG; - exp = decpt / BASE_FIG; - prec = roomof(decpt + len10, BASE_FIG) - exp; - const size_t ntz10 = prec * BASE_FIG - nlz10 - len10; - - if (nlz10 > 0) { - memmove(buf + nlz10, buf, len10); - memset(buf, '0', nlz10); - } - memset(buf + nlz10 + len10, '0', ntz10); - buf[nlz10 + len10 + ntz10] = '\0'; - inum = rb_cstr_to_inum(buf, 10, false); - - exp = -exp; - } - - VALUE bd = rb_inum_convert_to_BigDecimal(inum, SIZE_MAX, raise_exception); - Real *vp; - TypedData_Get_Struct(bd, Real, &BigDecimal_data_type, vp); - assert(vp->Prec == prec); - vp->exponent = exp; - - if (negative_p) VpSetSign(vp, -1); - return bd; -} - -static VALUE -rb_rational_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) -{ - assert(RB_TYPE_P(val, T_RATIONAL)); - - if (digs == SIZE_MAX) { - if (!raise_exception) - return Qnil; - rb_raise(rb_eArgError, - "can't omit precision for a %"PRIsVALUE".", - CLASS_OF(val)); - } - - VALUE num = rb_inum_convert_to_BigDecimal(rb_rational_num(val), 0, raise_exception); - VALUE d = BigDecimal_div2(num, rb_rational_den(val), SIZET2NUM(digs)); - return d; -} - -static VALUE -rb_cstr_convert_to_BigDecimal(const char *c_str, size_t digs, int raise_exception) -{ - if (digs == SIZE_MAX) - digs = 0; - - Real *vp = VpCreateRbObject(digs, c_str, raise_exception); - if (!vp) - return Qnil; - return VpCheckGetValue(vp); -} - -static inline VALUE -rb_str_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) -{ - const char *c_str = StringValueCStr(val); - return rb_cstr_convert_to_BigDecimal(c_str, digs, raise_exception); -} - -static VALUE -rb_convert_to_BigDecimal(VALUE val, size_t digs, int raise_exception) -{ - switch (val) { - case Qnil: - case Qtrue: - case Qfalse: - if (raise_exception) { - const char *cname = NIL_P(val) ? "nil" : - val == Qtrue ? "true" : - val == Qfalse ? "false" : - NULL; - rb_raise(rb_eTypeError, - "can't convert %s into BigDecimal", cname); - } - return Qnil; - - default: - break; - } - - if (is_kind_of_BigDecimal(val)) { - if (digs == SIZE_MAX) - return check_exception(val); - - Real *vp; - TypedData_Get_Struct(val, Real, &BigDecimal_data_type, vp); - - VALUE copy = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, 0); - vp = VpCopy(NULL, vp); - /* TODO: rounding */ - BigDecimal_wrap_struct(copy, vp); - return VpCheckGetValue(vp); - } - else if (RB_INTEGER_TYPE_P(val)) { - return rb_inum_convert_to_BigDecimal(val, digs, raise_exception); - } - else if (RB_FLOAT_TYPE_P(val)) { - return rb_float_convert_to_BigDecimal(val, digs, raise_exception); - } - else if (RB_TYPE_P(val, T_RATIONAL)) { - return rb_rational_convert_to_BigDecimal(val, digs, raise_exception); - } - else if (RB_TYPE_P(val, T_COMPLEX)) { - VALUE im = rb_complex_imag(val); - if (!is_zero(im)) { - /* TODO: handle raise_exception */ - rb_raise(rb_eArgError, - "Unable to make a BigDecimal from non-zero imaginary number"); - } - return rb_convert_to_BigDecimal(rb_complex_real(val), digs, raise_exception); - } - else if (RB_TYPE_P(val, T_STRING)) { - return rb_str_convert_to_BigDecimal(val, digs, raise_exception); - } - - /* TODO: chheck to_d */ - /* TODO: chheck to_int */ - - VALUE str = rb_check_convert_type(val, T_STRING, "String", "to_str"); - if (!RB_TYPE_P(str, T_STRING)) { - if (raise_exception) { - rb_raise(rb_eTypeError, - "can't convert %"PRIsVALUE" into BigDecimal", rb_obj_class(val)); - } - return Qnil; - } - return rb_str_convert_to_BigDecimal(str, digs, raise_exception); -} - -/* call-seq: - * BigDecimal(value, exception: true) -> bigdecimal - * BigDecimal(value, ndigits, exception: true) -> bigdecimal - * - * Returns the \BigDecimal converted from +value+ - * with a precision of +ndigits+ decimal digits. - * - * When +ndigits+ is less than the number of significant digits - * in the value, the result is rounded to that number of digits, - * according to the current rounding mode; see BigDecimal.mode. - * - * When +ndigits+ is 0, the number of digits to correctly represent a float number - * is determined automatically. - * - * Returns +value+ converted to a \BigDecimal, depending on the type of +value+: - * - * - Integer, Float, Rational, Complex, or BigDecimal: converted directly: - * - * # Integer, Complex, or BigDecimal value does not require ndigits; ignored if given. - * BigDecimal(2) # => 0.2e1 - * BigDecimal(Complex(2, 0)) # => 0.2e1 - * BigDecimal(BigDecimal(2)) # => 0.2e1 - * # Float or Rational value requires ndigits. - * BigDecimal(2.0, 0) # => 0.2e1 - * BigDecimal(Rational(2, 1), 0) # => 0.2e1 - * - * - String: converted by parsing if it contains an integer or floating-point literal; - * leading and trailing whitespace is ignored: - * - * # String does not require ndigits; ignored if given. - * BigDecimal('2') # => 0.2e1 - * BigDecimal('2.0') # => 0.2e1 - * BigDecimal('0.2e1') # => 0.2e1 - * BigDecimal(' 2.0 ') # => 0.2e1 - * - * - Other type that responds to method <tt>:to_str</tt>: - * first converted to a string, then converted to a \BigDecimal, as above. - * - * - Other type: - * - * - Raises an exception if keyword argument +exception+ is +true+. - * - Returns +nil+ if keyword argument +exception+ is +true+. - * - * Raises an exception if +value+ evaluates to a Float - * and +digits+ is larger than Float::DIG + 1. - * - */ -static VALUE -f_BigDecimal(int argc, VALUE *argv, VALUE self) -{ - VALUE val, digs_v, opts = Qnil; - argc = rb_scan_args(argc, argv, "11:", &val, &digs_v, &opts); - int exception = opts_exception_p(opts); - - size_t digs = SIZE_MAX; /* this means digs is omitted */ - if (argc > 1) { - digs_v = rb_to_int(digs_v); - if (FIXNUM_P(digs_v)) { - long n = FIX2LONG(digs_v); - if (n < 0) - goto negative_digs; - digs = (size_t)n; - } - else { - if (RBIGNUM_NEGATIVE_P(digs_v)) { - negative_digs: - if (!exception) - return Qnil; - rb_raise(rb_eArgError, "negative precision"); - } - digs = NUM2SIZET(digs_v); - } - } - - return rb_convert_to_BigDecimal(val, digs, exception); -} - -static VALUE -BigDecimal_s_interpret_loosely(VALUE klass, VALUE str) -{ - char const *c_str = StringValueCStr(str); - Real *vp = VpNewRbClass(0, c_str, klass, false, true); - if (!vp) - return Qnil; - else - return VpCheckGetValue(vp); -} - - /* call-seq: - * BigDecimal.limit(digits) - * - * Limit the number of significant digits in newly created BigDecimal - * numbers to the specified value. Rounding is performed as necessary, - * as specified by BigDecimal.mode. - * - * A limit of 0, the default, means no upper limit. - * - * The limit specified by this method takes less priority over any limit - * specified to instance methods such as ceil, floor, truncate, or round. - */ -static VALUE -BigDecimal_limit(int argc, VALUE *argv, VALUE self) -{ - VALUE nFig; - VALUE nCur = SIZET2NUM(VpGetPrecLimit()); - - if (rb_scan_args(argc, argv, "01", &nFig) == 1) { - int nf; - if (NIL_P(nFig)) return nCur; - nf = NUM2INT(nFig); - if (nf < 0) { - rb_raise(rb_eArgError, "argument must be positive"); - } - VpSetPrecLimit(nf); - } - return nCur; -} - -/* Returns the sign of the value. - * - * Returns a positive value if > 0, a negative value if < 0. - * It behaves the same with zeros - - * it returns a positive value for a positive zero (BigDecimal('0')) and - * a negative value for a negative zero (BigDecimal('-0')). - * - * The specific value returned indicates the type and sign of the BigDecimal, - * as follows: - * - * 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_FINITE:: value is positive - * BigDecimal::SIGN_NEGATIVE_FINITE:: value is negative - */ -static VALUE -BigDecimal_sign(VALUE self) -{ /* sign */ - int s = GetVpValue(self, 1)->sign; - return INT2FIX(s); -} - -/* - * 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(BigDecimal('Infinity')) - * BigDecimal(BigDecimal('-Infinity')) - * BigDecimal(BigDecimal('NaN')) - * end - * - * For use with the BigDecimal::EXCEPTION_* - * - * See BigDecimal.mode - */ -static VALUE -BigDecimal_save_exception_mode(VALUE self) -{ - unsigned short const exception_mode = VpGetException(); - int state; - VALUE ret = rb_protect(rb_yield, Qnil, &state); - VpSetException(exception_mode); - if (state) rb_jump_tag(state); - return ret; -} - -/* - * 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) -{ - unsigned short const round_mode = VpGetRoundMode(); - int state; - VALUE ret = rb_protect(rb_yield, Qnil, &state); - VpSetRoundMode(round_mode); - if (state) rb_jump_tag(state); - return ret; -} - -/* - * 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) -{ - size_t const limit = VpGetPrecLimit(); - int state; - VALUE ret = rb_protect(rb_yield, Qnil, &state); - VpSetPrecLimit(limit); - if (state) rb_jump_tag(state); - return ret; -} - -/* call-seq: - * BigMath.exp(decimal, numeric) -> BigDecimal - * - * Computes the value of e (the base of natural logarithms) raised to the - * power of +decimal+, to the specified number of digits of precision. - * - * If +decimal+ is infinity, returns Infinity. - * - * If +decimal+ is NaN, returns NaN. - */ -static VALUE -BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec) -{ - ssize_t prec, n, i; - Real* vx = NULL; - VALUE one, d, y; - int negative = 0; - int infinite = 0; - int nan = 0; - double flo; - - prec = NUM2SSIZET(vprec); - if (prec <= 0) { - rb_raise(rb_eArgError, "Zero or negative precision for exp"); - } - - /* TODO: the following switch statement is almost same as one in the - * BigDecimalCmp function. */ - switch (TYPE(x)) { - case T_DATA: - if (!is_kind_of_BigDecimal(x)) break; - vx = DATA_PTR(x); - negative = BIGDECIMAL_NEGATIVE_P(vx); - infinite = VpIsPosInf(vx) || VpIsNegInf(vx); - nan = VpIsNaN(vx); - break; - - case T_FIXNUM: - /* fall through */ - case T_BIGNUM: - vx = GetVpValue(x, 0); - break; - - case T_FLOAT: - flo = RFLOAT_VALUE(x); - negative = flo < 0; - infinite = isinf(flo); - nan = isnan(flo); - if (!infinite && !nan) { - vx = GetVpValueWithPrec(x, 0, 0); - } - break; - - case T_RATIONAL: - vx = GetVpValueWithPrec(x, prec, 0); - break; - - default: - break; - } - if (infinite) { - if (negative) { - return VpCheckGetValue(GetVpValueWithPrec(INT2FIX(0), prec, 1)); - } - else { - Real* vy = NewZeroWrapNolimit(1, prec); - VpSetInf(vy, VP_SIGN_POSITIVE_INFINITE); - RB_GC_GUARD(vy->obj); - return VpCheckGetValue(vy); - } - } - else if (nan) { - Real* vy = NewZeroWrapNolimit(1, prec); - VpSetNaN(vy); - RB_GC_GUARD(vy->obj); - return VpCheckGetValue(vy); - } - else if (vx == NULL) { - cannot_be_coerced_into_BigDecimal(rb_eArgError, x); - } - x = vx->obj; - - n = prec + BIGDECIMAL_DOUBLE_FIGURES; - negative = BIGDECIMAL_NEGATIVE_P(vx); - if (negative) { - VALUE x_zero = INT2NUM(1); - VALUE x_copy = f_BigDecimal(1, &x_zero, klass); - x = BigDecimal_initialize_copy(x_copy, x); - vx = DATA_PTR(x); - VpSetSign(vx, 1); - } - - one = VpCheckGetValue(NewOneWrapLimited(1, 1)); - y = one; - d = y; - i = 1; - - while (!VpIsZero((Real*)DATA_PTR(d))) { - 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; - } - else if ((size_t)m < BIGDECIMAL_DOUBLE_FIGURES) { - m = BIGDECIMAL_DOUBLE_FIGURES; - } - - d = BigDecimal_mult(d, x); /* d <- d * x */ - d = BigDecimal_div2(d, SSIZET2NUM(i), SSIZET2NUM(m)); /* d <- d / i */ - y = BigDecimal_add(y, d); /* y <- y + d */ - ++i; /* i <- i + 1 */ - } - - if (negative) { - return BigDecimal_div2(one, y, vprec); - } - else { - vprec = SSIZET2NUM(prec - VpExponent10(DATA_PTR(y))); - return BigDecimal_round(1, &vprec, y); - } - - RB_GC_GUARD(one); - RB_GC_GUARD(x); - RB_GC_GUARD(y); - RB_GC_GUARD(d); -} - -/* call-seq: - * BigMath.log(decimal, numeric) -> BigDecimal - * - * Computes the natural logarithm of +decimal+ to the specified number of - * digits of precision, +numeric+. - * - * If +decimal+ is zero or negative, raises Math::DomainError. - * - * If +decimal+ is positive infinity, returns Infinity. - * - * If +decimal+ is NaN, returns NaN. - */ -static VALUE -BigMath_s_log(VALUE klass, VALUE x, VALUE vprec) -{ - ssize_t prec, n, i; - SIGNED_VALUE expo; - Real* vx = NULL; - VALUE vn, one, two, w, x2, y, d; - int zero = 0; - int negative = 0; - int infinite = 0; - int nan = 0; - double flo; - long fix; - - if (!is_integer(vprec)) { - rb_raise(rb_eArgError, "precision must be an Integer"); - } - - prec = NUM2SSIZET(vprec); - if (prec <= 0) { - rb_raise(rb_eArgError, "Zero or negative precision for exp"); - } - - /* TODO: the following switch statement is almost same as one in the - * BigDecimalCmp function. */ - switch (TYPE(x)) { - case T_DATA: - if (!is_kind_of_BigDecimal(x)) break; - vx = DATA_PTR(x); - zero = VpIsZero(vx); - negative = BIGDECIMAL_NEGATIVE_P(vx); - infinite = VpIsPosInf(vx) || VpIsNegInf(vx); - nan = VpIsNaN(vx); - break; - - case T_FIXNUM: - fix = FIX2LONG(x); - zero = fix == 0; - negative = fix < 0; - goto get_vp_value; - - case T_BIGNUM: - i = FIX2INT(rb_big_cmp(x, INT2FIX(0))); - zero = i == 0; - negative = i < 0; -get_vp_value: - if (zero || negative) break; - vx = GetVpValue(x, 0); - break; - - case T_FLOAT: - flo = RFLOAT_VALUE(x); - zero = flo == 0; - negative = flo < 0; - infinite = isinf(flo); - nan = isnan(flo); - if (!zero && !negative && !infinite && !nan) { - vx = GetVpValueWithPrec(x, 0, 1); - } - break; - - case T_RATIONAL: - zero = RRATIONAL_ZERO_P(x); - negative = RRATIONAL_NEGATIVE_P(x); - if (zero || negative) break; - vx = GetVpValueWithPrec(x, prec, 1); - break; - - case T_COMPLEX: - rb_raise(rb_eMathDomainError, - "Complex argument for BigMath.log"); - - default: - break; - } - if (infinite && !negative) { - Real *vy = NewZeroWrapNolimit(1, prec); - RB_GC_GUARD(vy->obj); - VpSetInf(vy, VP_SIGN_POSITIVE_INFINITE); - return VpCheckGetValue(vy); - } - else if (nan) { - Real* vy = NewZeroWrapNolimit(1, prec); - RB_GC_GUARD(vy->obj); - VpSetNaN(vy); - return VpCheckGetValue(vy); - } - else if (zero || negative) { - rb_raise(rb_eMathDomainError, - "Zero or negative argument for log"); - } - else if (vx == NULL) { - cannot_be_coerced_into_BigDecimal(rb_eArgError, x); - } - x = VpCheckGetValue(vx); - - RB_GC_GUARD(one) = VpCheckGetValue(NewOneWrapLimited(1, 1)); - RB_GC_GUARD(two) = VpCheckGetValue(VpCreateRbObject(1, "2", true)); - - n = prec + BIGDECIMAL_DOUBLE_FIGURES; - RB_GC_GUARD(vn) = SSIZET2NUM(n); - expo = VpExponent10(vx); - if (expo < 0 || expo >= 3) { - char buf[DECIMAL_SIZE_OF_BITS(SIZEOF_VALUE * CHAR_BIT) + 4]; - snprintf(buf, sizeof(buf), "1E%"PRIdVALUE, -expo); - x = BigDecimal_mult2(x, VpCheckGetValue(VpCreateRbObject(1, buf, true)), vn); - } - else { - expo = 0; - } - w = BigDecimal_sub(x, one); - x = BigDecimal_div2(w, BigDecimal_add(x, one), vn); - RB_GC_GUARD(x2) = BigDecimal_mult2(x, x, vn); - RB_GC_GUARD(y) = x; - RB_GC_GUARD(d) = y; - i = 1; - while (!VpIsZero((Real*)DATA_PTR(d))) { - SIGNED_VALUE const ey = VpExponent10(DATA_PTR(y)); - SIGNED_VALUE const ed = VpExponent10(DATA_PTR(d)); - ssize_t m = n - vabs(ey - ed); - if (m <= 0) { - break; - } - else if ((size_t)m < BIGDECIMAL_DOUBLE_FIGURES) { - m = BIGDECIMAL_DOUBLE_FIGURES; - } - - x = BigDecimal_mult2(x2, x, vn); - i += 2; - d = BigDecimal_div2(x, SSIZET2NUM(i), SSIZET2NUM(m)); - y = BigDecimal_add(y, d); - } - - y = BigDecimal_mult(y, two); - if (expo != 0) { - VALUE log10, vexpo, dy; - log10 = BigMath_s_log(klass, INT2FIX(10), vprec); - vexpo = VpCheckGetValue(GetVpValue(SSIZET2NUM(expo), 1)); - dy = BigDecimal_mult(log10, vexpo); - y = BigDecimal_add(y, dy); - } - - return y; -} - -static VALUE BIGDECIMAL_NAN = Qnil; - -static VALUE -BigDecimal_nan(void) -{ - return BIGDECIMAL_NAN; -} - -static VALUE BIGDECIMAL_POSITIVE_INFINITY = Qnil; - -static VALUE -BigDecimal_positive_infinity(void) -{ - return BIGDECIMAL_POSITIVE_INFINITY; -} - -static VALUE BIGDECIMAL_NEGATIVE_INFINITY = Qnil; - -static VALUE -BigDecimal_negative_infinity(void) -{ - return BIGDECIMAL_NEGATIVE_INFINITY; -} - -static VALUE BIGDECIMAL_POSITIVE_ZERO = Qnil; - -static VALUE -BigDecimal_positive_zero(void) -{ - return BIGDECIMAL_POSITIVE_ZERO; -} - -static VALUE BIGDECIMAL_NEGATIVE_ZERO = Qnil; - -static VALUE -BigDecimal_negative_zero(void) -{ - return BIGDECIMAL_NEGATIVE_ZERO; -} - -/* Document-class: BigDecimal - * BigDecimal provides arbitrary-precision floating point decimal arithmetic. - * - * == Introduction - * - * Ruby provides built-in support for arbitrary precision integer arithmetic. - * - * For example: - * - * 42**13 #=> 1265437718438866624512 - * - * BigDecimal provides similar support for very large or very accurate floating - * point numbers. - * - * 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: - * - * sum = 0 - * 10_000.times do - * sum = sum + 0.0001 - * end - * print sum #=> 0.9999999999999062 - * - * and contrast with the output from: - * - * require 'bigdecimal' - * - * sum = BigDecimal("0") - * 10_000.times do - * sum = sum + BigDecimal("0.0001") - * end - * print sum #=> 0.1E1 - * - * Similarly: - * - * (BigDecimal("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") #=> true - * - * (1.2 - 1.0) == 0.2 #=> false - * - * == A Note About Precision - * - * For a calculation using a \BigDecimal and another +value+, - * the precision of the result depends on the type of +value+: - * - * - If +value+ is a \Float, - * the precision is Float::DIG + 1. - * - If +value+ is a \Rational, the precision is larger than Float::DIG + 1. - * - If +value+ is a \BigDecimal, the precision is +value+'s precision in the - * internal representation, which is platform-dependent. - * - If +value+ is other object, the precision is determined by the result of +BigDecimal(value)+. - * - * == Special features of accurate decimal arithmetic - * - * Because BigDecimal is more accurate than normal binary floating point - * arithmetic, it requires some special values. - * - * === Infinity - * - * BigDecimal sometimes needs to return infinity, for example if you divide - * a value by zero. - * - * BigDecimal("1.0") / BigDecimal("0.0") #=> Infinity - * BigDecimal("-1.0") / BigDecimal("0.0") #=> -Infinity - * - * You can represent infinite numbers to BigDecimal using the strings - * <code>'Infinity'</code>, <code>'+Infinity'</code> and - * <code>'-Infinity'</code> (case-sensitive) - * - * === Not a Number - * - * When a computation results in an undefined value, the special value +NaN+ - * (for 'not a number') is returned. - * - * Example: - * - * BigDecimal("0.0") / BigDecimal("0.0") #=> NaN - * - * You can also create undefined values. - * - * NaN is never considered to be the same as any other value, even NaN itself: - * - * n = BigDecimal('NaN') - * n == 0.0 #=> false - * n == n #=> false - * - * === 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. - * - * BigDecimal("1.0") / BigDecimal("-Infinity") #=> -0.0 - * - * If the value is positive, a value of positive zero is returned. - * - * BigDecimal("1.0") / BigDecimal("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 - * comparison. - * - * Note also that in mathematics, there is no particular concept of negative - * or positive zero; true mathematical zero has no sign. - * - * == bigdecimal/util - * - * When you require +bigdecimal/util+, the #to_d method will be - * available on BigDecimal and the native Integer, Float, Rational, - * and String classes: - * - * require 'bigdecimal/util' - * - * 42.to_d # => 0.42e2 - * 0.5.to_d # => 0.5e0 - * (2/3r).to_d(3) # => 0.667e0 - * "0.5".to_d # => 0.5e0 - * - * == License - * - * Copyright (C) 2002 by Shigeo Kobayashi <shigeo@tinyforest.gr.jp>. - * - * BigDecimal is released under the Ruby and 2-clause BSD licenses. - * See LICENSE.txt for details. - * - * 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) -{ -#ifdef HAVE_RB_EXT_RACTOR_SAFE - rb_ext_ractor_safe(true); -#endif - VALUE arg; - - id_BigDecimal_exception_mode = rb_intern_const("BigDecimal.exception_mode"); - id_BigDecimal_rounding_mode = rb_intern_const("BigDecimal.rounding_mode"); - id_BigDecimal_precision_limit = rb_intern_const("BigDecimal.precision_limit"); - - /* Initialize VP routines */ - VpInit(0UL); - - /* Class and method registration */ - rb_cBigDecimal = rb_define_class("BigDecimal", rb_cNumeric); - - /* Global function */ - rb_define_global_function("BigDecimal", f_BigDecimal, -1); - - /* Class methods */ - rb_undef_alloc_func(rb_cBigDecimal); - rb_undef_method(CLASS_OF(rb_cBigDecimal), "new"); - rb_define_singleton_method(rb_cBigDecimal, "interpret_loosely", BigDecimal_s_interpret_loosely, 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); - rb_define_singleton_method(rb_cBigDecimal, "_load", BigDecimal_load, 1); - - rb_define_singleton_method(rb_cBigDecimal, "save_exception_mode", BigDecimal_save_exception_mode, 0); - rb_define_singleton_method(rb_cBigDecimal, "save_rounding_mode", BigDecimal_save_rounding_mode, 0); - rb_define_singleton_method(rb_cBigDecimal, "save_limit", BigDecimal_save_limit, 0); - - /* Constants definition */ - -#ifndef RUBY_BIGDECIMAL_VERSION -# error RUBY_BIGDECIMAL_VERSION is not defined -#endif - /* - * The version of bigdecimal library - */ - rb_define_const(rb_cBigDecimal, "VERSION", rb_str_new2(RUBY_BIGDECIMAL_VERSION)); - - /* - * Base value used in internal calculations. On a 32 bit system, BASE - * is 10000, indicating that calculation is done in groups of 4 digits. - * (If it were larger, BASE**2 wouldn't fit in 32 bits, so you couldn't - * guarantee that two groups could always be multiplied together without - * overflow.) - */ - rb_define_const(rb_cBigDecimal, "BASE", INT2FIX((SIGNED_VALUE)VpBaseVal())); - - /* Exceptions */ - - /* - * 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)); - - /* - * 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)); - - /* - * 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)); - - /* - * 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)); - - /* - * 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)); - - /* - * 0x10: Determines what happens when a division by zero is performed. - * See BigDecimal.mode. - */ - 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)); - - /* 1: Indicates that values should be rounded away from zero. See - * BigDecimal.mode. - */ - 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)); - - /* 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)); - - /* 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)); - - /* 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)); - - /* 0: Indicates that a value is not a number. See BigDecimal.sign. */ - 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)); - - /* -1: Indicates that a value is -0. See BigDecimal.sign. */ - 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)); - - /* -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)); - - /* 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)); - - /* -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)); - - /* Positive zero value. */ - arg = rb_str_new2("+0"); - BIGDECIMAL_POSITIVE_ZERO = f_BigDecimal(1, &arg, rb_cBigDecimal); - rb_gc_register_mark_object(BIGDECIMAL_POSITIVE_ZERO); - - /* Negative zero value. */ - arg = rb_str_new2("-0"); - BIGDECIMAL_NEGATIVE_ZERO = f_BigDecimal(1, &arg, rb_cBigDecimal); - rb_gc_register_mark_object(BIGDECIMAL_NEGATIVE_ZERO); - - /* Positive infinity value. */ - arg = rb_str_new2("+Infinity"); - BIGDECIMAL_POSITIVE_INFINITY = f_BigDecimal(1, &arg, rb_cBigDecimal); - rb_gc_register_mark_object(BIGDECIMAL_POSITIVE_INFINITY); - - /* Negative infinity value. */ - arg = rb_str_new2("-Infinity"); - BIGDECIMAL_NEGATIVE_INFINITY = f_BigDecimal(1, &arg, rb_cBigDecimal); - rb_gc_register_mark_object(BIGDECIMAL_NEGATIVE_INFINITY); - - /* 'Not a Number' value. */ - arg = rb_str_new2("NaN"); - BIGDECIMAL_NAN = f_BigDecimal(1, &arg, rb_cBigDecimal); - rb_gc_register_mark_object(BIGDECIMAL_NAN); - - /* Special value constants */ - rb_define_const(rb_cBigDecimal, "INFINITY", BIGDECIMAL_POSITIVE_INFINITY); - rb_define_const(rb_cBigDecimal, "NAN", BIGDECIMAL_NAN); - - /* instance methods */ - rb_define_method(rb_cBigDecimal, "precs", BigDecimal_prec, 0); - rb_define_method(rb_cBigDecimal, "precision", BigDecimal_precision, 0); - rb_define_method(rb_cBigDecimal, "scale", BigDecimal_scale, 0); - rb_define_method(rb_cBigDecimal, "precision_scale", BigDecimal_precision_scale, 0); - rb_define_method(rb_cBigDecimal, "n_significant_digits", BigDecimal_n_significant_digits, 0); - - rb_define_method(rb_cBigDecimal, "add", BigDecimal_add2, 2); - rb_define_method(rb_cBigDecimal, "sub", BigDecimal_sub2, 2); - rb_define_method(rb_cBigDecimal, "mult", BigDecimal_mult2, 2); - rb_define_method(rb_cBigDecimal, "div", BigDecimal_div3, -1); - rb_define_method(rb_cBigDecimal, "hash", BigDecimal_hash, 0); - rb_define_method(rb_cBigDecimal, "to_s", BigDecimal_to_s, -1); - rb_define_method(rb_cBigDecimal, "to_i", BigDecimal_to_i, 0); - rb_define_method(rb_cBigDecimal, "to_int", BigDecimal_to_i, 0); - rb_define_method(rb_cBigDecimal, "to_r", BigDecimal_to_r, 0); - rb_define_method(rb_cBigDecimal, "split", BigDecimal_split, 0); - rb_define_method(rb_cBigDecimal, "+", BigDecimal_add, 1); - rb_define_method(rb_cBigDecimal, "-", BigDecimal_sub, 1); - rb_define_method(rb_cBigDecimal, "+@", BigDecimal_uplus, 0); - rb_define_method(rb_cBigDecimal, "-@", BigDecimal_neg, 0); - rb_define_method(rb_cBigDecimal, "*", BigDecimal_mult, 1); - rb_define_method(rb_cBigDecimal, "/", BigDecimal_div, 1); - rb_define_method(rb_cBigDecimal, "quo", BigDecimal_quo, -1); - rb_define_method(rb_cBigDecimal, "%", BigDecimal_mod, 1); - rb_define_method(rb_cBigDecimal, "modulo", BigDecimal_mod, 1); - rb_define_method(rb_cBigDecimal, "remainder", BigDecimal_remainder, 1); - rb_define_method(rb_cBigDecimal, "divmod", BigDecimal_divmod, 1); - rb_define_method(rb_cBigDecimal, "clone", BigDecimal_clone, 0); - rb_define_method(rb_cBigDecimal, "dup", BigDecimal_clone, 0); - rb_define_method(rb_cBigDecimal, "to_f", BigDecimal_to_f, 0); - rb_define_method(rb_cBigDecimal, "abs", BigDecimal_abs, 0); - rb_define_method(rb_cBigDecimal, "sqrt", BigDecimal_sqrt, 1); - rb_define_method(rb_cBigDecimal, "fix", BigDecimal_fix, 0); - rb_define_method(rb_cBigDecimal, "round", BigDecimal_round, -1); - rb_define_method(rb_cBigDecimal, "frac", BigDecimal_frac, 0); - rb_define_method(rb_cBigDecimal, "floor", BigDecimal_floor, -1); - rb_define_method(rb_cBigDecimal, "ceil", BigDecimal_ceil, -1); - rb_define_method(rb_cBigDecimal, "power", BigDecimal_power, -1); - rb_define_method(rb_cBigDecimal, "**", BigDecimal_power_op, 1); - rb_define_method(rb_cBigDecimal, "<=>", BigDecimal_comp, 1); - rb_define_method(rb_cBigDecimal, "==", BigDecimal_eq, 1); - rb_define_method(rb_cBigDecimal, "===", BigDecimal_eq, 1); - rb_define_method(rb_cBigDecimal, "eql?", BigDecimal_eq, 1); - rb_define_method(rb_cBigDecimal, "<", BigDecimal_lt, 1); - rb_define_method(rb_cBigDecimal, "<=", BigDecimal_le, 1); - rb_define_method(rb_cBigDecimal, ">", BigDecimal_gt, 1); - rb_define_method(rb_cBigDecimal, ">=", BigDecimal_ge, 1); - rb_define_method(rb_cBigDecimal, "zero?", BigDecimal_zero, 0); - rb_define_method(rb_cBigDecimal, "nonzero?", BigDecimal_nonzero, 0); - rb_define_method(rb_cBigDecimal, "coerce", BigDecimal_coerce, 1); - rb_define_method(rb_cBigDecimal, "inspect", BigDecimal_inspect, 0); - rb_define_method(rb_cBigDecimal, "exponent", BigDecimal_exponent, 0); - rb_define_method(rb_cBigDecimal, "sign", BigDecimal_sign, 0); - rb_define_method(rb_cBigDecimal, "nan?", BigDecimal_IsNaN, 0); - rb_define_method(rb_cBigDecimal, "infinite?", BigDecimal_IsInfinite, 0); - rb_define_method(rb_cBigDecimal, "finite?", BigDecimal_IsFinite, 0); - rb_define_method(rb_cBigDecimal, "truncate", BigDecimal_truncate, -1); - rb_define_method(rb_cBigDecimal, "_dump", BigDecimal_dump, -1); - - 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); - -#define ROUNDING_MODE(i, name, value) \ - id_##name = rb_intern_const(#name); \ - rbd_rounding_modes[i].id = id_##name; \ - rbd_rounding_modes[i].mode = value; - - ROUNDING_MODE(0, up, RBD_ROUND_UP); - ROUNDING_MODE(1, down, RBD_ROUND_DOWN); - ROUNDING_MODE(2, half_up, RBD_ROUND_HALF_UP); - ROUNDING_MODE(3, half_down, RBD_ROUND_HALF_DOWN); - ROUNDING_MODE(4, ceil, RBD_ROUND_CEIL); - ROUNDING_MODE(5, floor, RBD_ROUND_FLOOR); - ROUNDING_MODE(6, half_even, RBD_ROUND_HALF_EVEN); - - ROUNDING_MODE(7, default, RBD_ROUND_DEFAULT); - ROUNDING_MODE(8, truncate, RBD_ROUND_TRUNCATE); - ROUNDING_MODE(9, banker, RBD_ROUND_BANKER); - ROUNDING_MODE(10, ceiling, RBD_ROUND_CEILING); - -#undef ROUNDING_MODE - - id_to_r = rb_intern_const("to_r"); - id_eq = rb_intern_const("=="); - id_half = rb_intern_const("half"); - - (void)VPrint; /* suppress unused warning */ -} - -/* - * - * ============================================================================ - * - * vp_ routines begin from here. - * - * ============================================================================ - * - */ -#ifdef BIGDECIMAL_DEBUG -static int gfDebug = 1; /* Debug switch */ -#if 0 -static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */ -#endif -#endif /* BIGDECIMAL_DEBUG */ - -static Real *VpConstOne; /* constant 1.0 */ -static Real *VpConstPt5; /* constant 0.5 */ -#define maxnr 100UL /* Maximum iterations for calculating sqrt. */ - /* used in VpSqrt() */ - -/* ETC */ -#define MemCmp(x,y,z) memcmp(x,y,z) -#define StrCmp(x,y) strcmp(x,y) - -enum op_sw { - OP_SW_ADD = 1, /* + */ - OP_SW_SUB, /* - */ - OP_SW_MULT, /* * */ - OP_SW_DIV /* / */ -}; - -static int VpIsDefOP(Real *c, Real *a, Real *b, enum op_sw sw); -static int AddExponent(Real *a, SIGNED_VALUE n); -static DECDIG VpAddAbs(Real *a,Real *b,Real *c); -static DECDIG VpSubAbs(Real *a,Real *b,Real *c); -static size_t VpSetPTR(Real *a, Real *b, Real *c, size_t *a_pos, size_t *b_pos, size_t *c_pos, DECDIG *av, DECDIG *bv); -static int VpNmlz(Real *a); -static void VpFormatSt(char *psz, size_t fFmt); -static int VpRdup(Real *m, size_t ind_m); - -#ifdef BIGDECIMAL_DEBUG -# ifdef HAVE_RB_EXT_RACTOR_SAFE -# error Need to make rewiting gnAlloc atomic -# endif -static int gnAlloc = 0; /* Memory allocation counter */ -#endif /* BIGDECIMAL_DEBUG */ - -/* - * EXCEPTION Handling. - */ - -#define bigdecimal_set_thread_local_exception_mode(mode) \ - rb_thread_local_aset( \ - rb_thread_current(), \ - id_BigDecimal_exception_mode, \ - INT2FIX((int)(mode)) \ - ) - -static unsigned short -VpGetException (void) -{ - VALUE const vmode = rb_thread_local_aref( - rb_thread_current(), - id_BigDecimal_exception_mode - ); - - if (NIL_P(vmode)) { - bigdecimal_set_thread_local_exception_mode(BIGDECIMAL_EXCEPTION_MODE_DEFAULT); - return BIGDECIMAL_EXCEPTION_MODE_DEFAULT; - } - - return NUM2USHORT(vmode); -} - -static void -VpSetException(unsigned short f) -{ - bigdecimal_set_thread_local_exception_mode(f); -} - -static void -VpCheckException(Real *p, bool always) -{ - if (VpIsNaN(p)) { - VpException(VP_EXCEPTION_NaN, "Computation results in 'NaN' (Not a Number)", always); - } - else if (VpIsPosInf(p)) { - VpException(VP_EXCEPTION_INFINITY, "Computation results in 'Infinity'", always); - } - else if (VpIsNegInf(p)) { - VpException(VP_EXCEPTION_INFINITY, "Computation results in '-Infinity'", always); - } -} - -static VALUE -VpCheckGetValue(Real *p) -{ - VpCheckException(p, false); - return p->obj; -} - -/* - * Precision limit. - */ - -#define bigdecimal_set_thread_local_precision_limit(limit) \ - rb_thread_local_aset( \ - rb_thread_current(), \ - id_BigDecimal_precision_limit, \ - SIZET2NUM(limit) \ - ) -#define BIGDECIMAL_PRECISION_LIMIT_DEFAULT ((size_t)0) - -/* These 2 functions added at v1.1.7 */ -VP_EXPORT size_t -VpGetPrecLimit(void) -{ - VALUE const vlimit = rb_thread_local_aref( - rb_thread_current(), - id_BigDecimal_precision_limit - ); - - if (NIL_P(vlimit)) { - bigdecimal_set_thread_local_precision_limit(BIGDECIMAL_PRECISION_LIMIT_DEFAULT); - return BIGDECIMAL_PRECISION_LIMIT_DEFAULT; - } - - return NUM2SIZET(vlimit); -} - -VP_EXPORT size_t -VpSetPrecLimit(size_t n) -{ - size_t const s = VpGetPrecLimit(); - bigdecimal_set_thread_local_precision_limit(n); - return s; -} - -/* - * Rounding mode. - */ - -#define bigdecimal_set_thread_local_rounding_mode(mode) \ - rb_thread_local_aset( \ - rb_thread_current(), \ - id_BigDecimal_rounding_mode, \ - INT2FIX((int)(mode)) \ - ) - -VP_EXPORT unsigned short -VpGetRoundMode(void) -{ - VALUE const vmode = rb_thread_local_aref( - rb_thread_current(), - id_BigDecimal_rounding_mode - ); - - if (NIL_P(vmode)) { - bigdecimal_set_thread_local_rounding_mode(BIGDECIMAL_ROUNDING_MODE_DEFAULT); - return BIGDECIMAL_ROUNDING_MODE_DEFAULT; - } - - return NUM2USHORT(vmode); -} - -VP_EXPORT int -VpIsRoundMode(unsigned short n) -{ - switch (n) { - case VP_ROUND_UP: - case VP_ROUND_DOWN: - case VP_ROUND_HALF_UP: - case VP_ROUND_HALF_DOWN: - case VP_ROUND_CEIL: - case VP_ROUND_FLOOR: - case VP_ROUND_HALF_EVEN: - return 1; - - default: - return 0; - } -} - -VP_EXPORT unsigned short -VpSetRoundMode(unsigned short n) -{ - if (VpIsRoundMode(n)) { - bigdecimal_set_thread_local_rounding_mode(n); - return n; - } - - return VpGetRoundMode(); -} - -/* - * 0.0 & 1.0 generator - * These gZero_..... and gOne_..... can be any name - * referenced from nowhere except Zero() and One(). - * gZero_..... and gOne_..... must have global scope - * (to let the compiler know they may be changed in outside - * (... but not actually..)). - */ -volatile const double gOne_ABCED9B4_CE73__00400511F31D = 1.0; - -static double -One(void) -{ - return gOne_ABCED9B4_CE73__00400511F31D; -} - -/* - ---------------------------------------------------------------- - Value of sign in Real structure is reserved for future use. - short sign; - ==0 : NaN - 1 : Positive zero - -1 : Negative zero - 2 : Positive number - -2 : Negative number - 3 : Positive infinite number - -3 : Negative infinite number - ---------------------------------------------------------------- -*/ - -VP_EXPORT double -VpGetDoubleNaN(void) /* Returns the value of NaN */ -{ - return nan(""); -} - -VP_EXPORT double -VpGetDoublePosInf(void) /* Returns the value of +Infinity */ -{ - return HUGE_VAL; -} - -VP_EXPORT double -VpGetDoubleNegInf(void) /* Returns the value of -Infinity */ -{ - return -HUGE_VAL; -} - -VP_EXPORT double -VpGetDoubleNegZero(void) /* Returns the value of -0 */ -{ - static double nzero = 1000.0; - if (nzero != 0.0) nzero = (One()/VpGetDoubleNegInf()); - return nzero; -} - -#if 0 /* unused */ -VP_EXPORT int -VpIsNegDoubleZero(double v) -{ - double z = VpGetDoubleNegZero(); - return MemCmp(&v,&z,sizeof(v))==0; -} -#endif - -VP_EXPORT int -VpException(unsigned short f, const char *str,int always) -{ - unsigned short const exception_mode = VpGetException(); - - if (f == VP_EXCEPTION_OP) 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: - rb_raise(rb_eFloatDomainError, "%s", str); - break; - default: - rb_fatal("%s", str); - } - } - return 0; /* 0 Means VpException() raised no exception */ -} - -/* Throw exception or returns 0,when resulting c is Inf or NaN */ -/* sw=1:+ 2:- 3:* 4:/ */ -static int -VpIsDefOP(Real *c, Real *a, Real *b, enum op_sw 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 OP_SW_ADD: /* + */ - if (VpGetSign(a) == VpGetSign(b)) { - VpSetInf(c, VpGetSign(a)); - goto Inf; - } - else { - VpSetNaN(c); - goto NaN; - } - case OP_SW_SUB: /* - */ - if (VpGetSign(a) != VpGetSign(b)) { - VpSetInf(c, VpGetSign(a)); - goto Inf; - } - else { - VpSetNaN(c); - goto NaN; - } - case OP_SW_MULT: /* * */ - VpSetInf(c, VpGetSign(a)*VpGetSign(b)); - goto Inf; - case OP_SW_DIV: /* / */ - VpSetNaN(c); - goto NaN; - } - VpSetNaN(c); - goto NaN; - } - /* Inf op Finite */ - switch(sw) { - case OP_SW_ADD: /* + */ - case OP_SW_SUB: /* - */ - VpSetInf(c, VpGetSign(a)); - break; - case OP_SW_MULT: /* * */ - if (VpIsZero(b)) { - VpSetNaN(c); - goto NaN; - } - VpSetInf(c, VpGetSign(a)*VpGetSign(b)); - break; - case OP_SW_DIV: /* / */ - VpSetInf(c, VpGetSign(a)*VpGetSign(b)); - } - goto Inf; - } - - if (VpIsInf(b)) { - switch(sw) { - case OP_SW_ADD: /* + */ - VpSetInf(c, VpGetSign(b)); - break; - case OP_SW_SUB: /* - */ - VpSetInf(c, -VpGetSign(b)); - break; - case OP_SW_MULT: /* * */ - if (VpIsZero(a)) { - VpSetNaN(c); - goto NaN; - } - VpSetInf(c, VpGetSign(a)*VpGetSign(b)); - break; - case OP_SW_DIV: /* / */ - VpSetZero(c, VpGetSign(a)*VpGetSign(b)); - } - goto Inf; - } - return 1; /* Results OK */ - -Inf: - if (VpIsPosInf(c)) { - return VpException(VP_EXCEPTION_INFINITY, "Computation results to 'Infinity'", 0); - } - else { - return VpException(VP_EXCEPTION_INFINITY, "Computation results to '-Infinity'", 0); - } - -NaN: - return VpException(VP_EXCEPTION_NaN, "Computation results to 'NaN'", 0); -} - -/* - ---------------------------------------------------------------- -*/ - -/* - * returns number of chars needed to represent vp in specified format. - */ -VP_EXPORT size_t -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': - /* fall through */ - default: - nc = BASE_FIG*(vp->Prec + 2)+6; /* 3: sign + exponent chars */ - } - return nc; -} - -/* - * Initializer for Vp routines and constants used. - * [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 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 - * by one DECDIG word in the computer used. - * - * [Returns] - * BIGDECIMAL_DOUBLE_FIGURES ... OK - */ -VP_EXPORT size_t -VpInit(DECDIG BaseVal) -{ - /* Setup +/- Inf NaN -0 */ - VpGetDoubleNegZero(); - - /* Const 1.0 */ - VpConstOne = NewOneNolimit(1, 1); - - /* Const 0.5 */ - VpConstPt5 = NewOneNolimit(1, 1); - VpConstPt5->exponent = 0; - VpConstPt5->frac[0] = 5*BASE1; - -#ifdef BIGDECIMAL_DEBUG - gnAlloc = 0; -#endif /* BIGDECIMAL_DEBUG */ - -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - printf("VpInit: BaseVal = %"PRIuDECDIG"\n", BaseVal); - printf("\tBASE = %"PRIuDECDIG"\n", BASE); - printf("\tHALF_BASE = %"PRIuDECDIG"\n", HALF_BASE); - printf("\tBASE1 = %"PRIuDECDIG"\n", BASE1); - printf("\tBASE_FIG = %u\n", BASE_FIG); - printf("\tBIGDECIMAL_DOUBLE_FIGURES = %d\n", BIGDECIMAL_DOUBLE_FIGURES); - } -#endif /* BIGDECIMAL_DEBUG */ - - return BIGDECIMAL_DOUBLE_FIGURES; -} - -VP_EXPORT Real * -VpOne(void) -{ - return VpConstOne; -} - -/* If exponent overflows,then raise exception or returns 0 */ -static int -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) { - 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 (eb - mb > 0) 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 > 0) 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); - -overflow: - VpSetInf(a, VpGetSign(a)); - return VpException(VP_EXCEPTION_OVERFLOW, "Exponent overflow", 0); -} - -Real * -bigdecimal_parse_special_string(const char *str) -{ - static const struct { - const char *str; - size_t len; - int sign; - } table[] = { - { SZ_INF, sizeof(SZ_INF) - 1, VP_SIGN_POSITIVE_INFINITE }, - { SZ_PINF, sizeof(SZ_PINF) - 1, VP_SIGN_POSITIVE_INFINITE }, - { SZ_NINF, sizeof(SZ_NINF) - 1, VP_SIGN_NEGATIVE_INFINITE }, - { SZ_NaN, sizeof(SZ_NaN) - 1, VP_SIGN_NaN } - }; - static const size_t table_length = sizeof(table) / sizeof(table[0]); - size_t i; - - for (i = 0; i < table_length; ++i) { - const char *p; - if (strncmp(str, table[i].str, table[i].len) != 0) { - continue; - } - - p = str + table[i].len; - while (*p && ISSPACE(*p)) ++p; - if (*p == '\0') { - Real *vp = rbd_allocate_struct(1); - vp->MaxPrec = 1; - switch (table[i].sign) { - default: - UNREACHABLE; break; - case VP_SIGN_POSITIVE_INFINITE: - VpSetPosInf(vp); - return vp; - case VP_SIGN_NEGATIVE_INFINITE: - VpSetNegInf(vp); - return vp; - case VP_SIGN_NaN: - VpSetNaN(vp); - return vp; - } - } - } - - return NULL; -} - -/* - * Allocates variable. - * [Input] - * mx ... The number of decimal digits to be allocated, if zero then mx is determined by szVal. - * The mx will be the number of significant digits can to be stored. - * szVal ... The value assigned(char). If szVal==NULL, then zero is assumed. - * If szVal[0]=='#' then MaxPrec is not affected by the precision limit - * so that the full precision specified by szVal is allocated. - * - * [Returns] - * Pointer to the newly allocated variable, or - * NULL be returned if memory allocation is failed,or any error. - */ -VP_EXPORT Real * -VpAlloc(size_t mx, const char *szVal, int strict_p, int exc) -{ - const char *orig_szVal = szVal; - size_t i, j, ni, ipf, nf, ipe, ne, dot_seen, exp_seen, nalloc; - size_t len; - char v, *psz; - int sign=1; - Real *vp = NULL; - VALUE buf; - - if (szVal == NULL) { - return_zero: - /* necessary to be able to store */ - /* at least mx digits. */ - /* szVal==NULL ==> allocate zero value. */ - vp = rbd_allocate_struct(mx); - vp->MaxPrec = rbd_calculate_internal_digits(mx, false); /* Must false */ - VpSetZero(vp, 1); /* initialize vp to zero. */ - return vp; - } - - /* Skipping leading spaces */ - while (ISSPACE(*szVal)) szVal++; - - /* Check on Inf & NaN */ - if ((vp = bigdecimal_parse_special_string(szVal)) != NULL) { - return vp; - } - - /* Processing the leading one `#` */ - if (*szVal != '#') { - len = rbd_calculate_internal_digits(mx, true); - } - else { - len = rbd_calculate_internal_digits(mx, false); - ++szVal; - } - - /* Scanning digits */ - - /* A buffer for keeping scanned digits */ - buf = rb_str_tmp_new(strlen(szVal) + 1); - psz = RSTRING_PTR(buf); - - /* cursor: i for psz, and j for szVal */ - i = j = 0; - - /* Scanning: sign part */ - v = psz[i] = szVal[j]; - if ((v == '-') || (v == '+')) { - sign = -(v == '-'); - ++i; - ++j; - } - - /* Scanning: integer part */ - ni = 0; /* number of digits in the integer part */ - while ((v = psz[i] = szVal[j]) != '\0') { - if (!strict_p && ISSPACE(v)) { - v = psz[i] = '\0'; - break; - } - if (v == '_') { - if (ni > 0) { - v = szVal[j+1]; - if (v == '\0' || ISSPACE(v) || ISDIGIT(v)) { - ++j; - continue; - } - if (!strict_p) { - v = psz[i] = '\0'; - break; - } - } - goto invalid_value; - } - if (!ISDIGIT(v)) { - break; - } - ++ni; - ++i; - ++j; - } - - /* Scanning: fractional part */ - nf = 0; /* number of digits in the fractional part */ - ne = 0; /* number of digits in the exponential part */ - ipf = 0; /* index of the beginning of the fractional part */ - ipe = 0; /* index of the beginning of the exponential part */ - dot_seen = 0; - exp_seen = 0; - - if (v != '\0') { - /* Scanning fractional part */ - if ((psz[i] = szVal[j]) == '.') { - dot_seen = 1; - ++i; - ++j; - ipf = i; - while ((v = psz[i] = szVal[j]) != '\0') { - if (!strict_p && ISSPACE(v)) { - v = psz[i] = '\0'; - break; - } - if (v == '_') { - if (nf > 0 && ISDIGIT(szVal[j+1])) { - ++j; - continue; - } - if (!strict_p) { - v = psz[i] = '\0'; - if (nf == 0) { - dot_seen = 0; - } - break; - } - goto invalid_value; - } - if (!ISDIGIT(v)) break; - ++i; - ++j; - ++nf; - } - } - - /* Scanning exponential part */ - if (v != '\0') { - switch ((psz[i] = szVal[j])) { - case '\0': - break; - case 'e': case 'E': - case 'd': case 'D': - exp_seen = 1; - ++i; - ++j; - ipe = i; - v = psz[i] = szVal[j]; - if ((v == '-') || (v == '+')) { - ++i; - ++j; - } - while ((v = psz[i] = szVal[j]) != '\0') { - if (!strict_p && ISSPACE(v)) { - v = psz[i] = '\0'; - break; - } - if (v == '_') { - if (ne > 0 && ISDIGIT(szVal[j+1])) { - ++j; - continue; - } - if (!strict_p) { - v = psz[i] = '\0'; - if (ne == 0) { - exp_seen = 0; - } - break; - } - goto invalid_value; - } - if (!ISDIGIT(v)) break; - ++i; - ++j; - ++ne; - } - break; - default: - break; - } - } - - if (v != '\0') { - /* Scanning trailing spaces */ - while (ISSPACE(szVal[j])) ++j; - - /* Invalid character */ - if (szVal[j] && strict_p) { - goto invalid_value; - } - } - } - - psz[i] = '\0'; - - if (strict_p && (((ni == 0 || dot_seen) && nf == 0) || (exp_seen && ne == 0))) { - VALUE str; - invalid_value: - if (!strict_p) { - goto return_zero; - } - if (!exc) { - return NULL; - } - str = rb_str_new2(orig_szVal); - rb_raise(rb_eArgError, "invalid value for BigDecimal(): \"%"PRIsVALUE"\"", str); - } - - nalloc = (ni + nf + BASE_FIG - 1) / BASE_FIG + 1; /* set effective allocation */ - /* units for szVal[] */ - if (len == 0) len = 1; - nalloc = Max(nalloc, len); - len = nalloc; - vp = rbd_allocate_struct(len); - vp->MaxPrec = len; /* set max precision */ - VpSetZero(vp, sign); - VpCtoV(vp, psz, ni, psz + ipf, nf, psz + ipe, ne); - rb_str_resize(buf, 0); - return vp; -} - -/* - * Assignment(c=a). - * [Input] - * a ... RHSV - * isw ... switch for assignment. - * c = a when isw > 0 - * c = -a when isw < 0 - * if c->MaxPrec < a->Prec,then round operation - * will be performed. - * [Output] - * c ... LHSV - */ -VP_EXPORT size_t -VpAsgn(Real *c, Real *a, int isw) -{ - size_t n; - if (VpIsNaN(a)) { - VpSetNaN(c); - 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(DECDIG)); - /* 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; -} - -/* - * c = a + b when operation = 1 or 2 - * c = a - b when operation = -1 or -2. - * Returns number of significant digits of c - */ -VP_EXPORT size_t -VpAddSub(Real *c, Real *a, Real *b, int operation) -{ - short sw, isw; - Real *a_ptr, *b_ptr; - size_t n, na, nb, i; - DECDIG mrv; - -#ifdef BIGDECIMAL_DEBUG - 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) ? OP_SW_ADD : OP_SW_SUB)) 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(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; - - /* compare absolute value. As a result,|a_ptr|>=|b_ptr| */ - 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; - } /* |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; - } - -end_if: - isw = VpGetSign(a) + sw *VpGetSign(b); - /* - * isw = 0 ...( 1)+(-1),( 1)-( 1),(-1)+(1),(-1)-(-1) - * = 2 ...( 1)+( 1),( 1)-(-1) - * =-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); - } - } - 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); - } -#endif /* BIGDECIMAL_DEBUG */ - return c->Prec * BASE_FIG; -} - -/* - * Addition of two values with variable precision - * a and b assuming abs(a)>abs(b). - * c = abs(a) + abs(b) ; where |a|>=|b| - */ -static DECDIG -VpAddAbs(Real *a, Real *b, Real *c) -{ - size_t word_shift; - size_t ap; - size_t bp; - size_t cp; - size_t a_pos; - size_t b_pos, b_pos_with_word_shift; - size_t c_pos; - DECDIG av, bv, carry, mrv; - -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - VPrint(stdout, "VpAddAbs called: a = %\n", a); - VPrint(stdout, " b = %\n", b); - } -#endif /* BIGDECIMAL_DEBUG */ - - word_shift = VpSetPTR(a, b, c, &ap, &bp, &cp, &av, &bv); - 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; - - 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. */ - if (b_pos > 0) { - while (b_pos > 0 && b_pos + word_shift > a_pos) { - c->frac[--c_pos] = b->frac[--b_pos]; - } - } - if (b_pos == 0 && word_shift > a_pos) { - while (word_shift-- > a_pos) { - c->frac[--c_pos] = 0; - } - } - - /* Just assign the last few digits of a to c because b has no */ - /* corresponding digits to be added. */ - b_pos_with_word_shift = b_pos + word_shift; - while (a_pos > b_pos_with_word_shift) { - c->frac[--c_pos] = a->frac[--a_pos]; - } - 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; - } - } - - /* 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; - } - } - if (c_pos) c->frac[c_pos - 1] += carry; - goto Exit; - -Assign_a: - VpAsgn(c, a, 1); - mrv = 0; - -Exit: - -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - VPrint(stdout, "VpAddAbs exit: c=% \n", c); - } -#endif /* BIGDECIMAL_DEBUG */ - return mrv; -} - -/* - * c = abs(a) - abs(b) - */ -static DECDIG -VpSubAbs(Real *a, Real *b, Real *c) -{ - size_t word_shift; - size_t ap; - size_t bp; - size_t cp; - size_t a_pos; - size_t b_pos, b_pos_with_word_shift; - size_t c_pos; - DECDIG av, bv, borrow, mrv; - -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - VPrint(stdout, "VpSubAbs called: a = %\n", a); - VPrint(stdout, " b = %\n", b); - } -#endif /* BIGDECIMAL_DEBUG */ - - word_shift = VpSetPTR(a, b, c, &ap, &bp, &cp, &av, &bv); - 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 (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 > 0 && b_pos + word_shift > a_pos) { - c->frac[--c_pos] = BASE - b->frac[--b_pos] - borrow; - borrow = 1; - } - if (b_pos == 0) { - while (word_shift > a_pos) { - --word_shift; - c->frac[--c_pos] = BASE - borrow; - borrow = 1; - } - } - } - /* Just assign the last few digits of a to c because b has no */ - /* corresponding digits to subtract. */ - - b_pos_with_word_shift = b_pos + word_shift; - while (a_pos > b_pos_with_word_shift) { - c->frac[--c_pos] = a->frac[--a_pos]; - } - - /* 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; - } - } - - /* 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; - } - } - if (c_pos) c->frac[c_pos - 1] -= borrow; - goto Exit; - -Assign_a: - VpAsgn(c, a, 1); - mrv = 0; - -Exit: -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - VPrint(stdout, "VpSubAbs exit: c=% \n", c); - } -#endif /* BIGDECIMAL_DEBUG */ - return mrv; -} - -/* - * Note: If(av+bv)>= HALF_BASE,then 1 will be added to the least significant - * digit of c(In case of addition). - * ------------------------- figure of output ----------------------------------- - * a = xxxxxxxxxxx - * b = xxxxxxxxxx - * c =xxxxxxxxxxxxxxx - * word_shift = | | - * right_word = | | (Total digits in RHSV) - * left_word = | | (Total digits in LHSV) - * a_pos = | - * b_pos = | - * c_pos = | - */ -static size_t -VpSetPTR(Real *a, Real *b, Real *c, size_t *a_pos, size_t *b_pos, size_t *c_pos, DECDIG *av, DECDIG *bv) -{ - size_t left_word, right_word, word_shift; - - size_t const round_limit = (VpGetPrecLimit() + BASE_FIG - 1) / BASE_FIG; - - assert(a->exponent >= b->exponent); - - c->frac[0] = 0; - *av = *bv = 0; - - word_shift = (a->exponent - b->exponent); - left_word = b->Prec + word_shift; - right_word = Max(a->Prec, left_word); - left_word = c->MaxPrec - 1; /* -1 ... prepare for round up */ - - /* - * check if 'round' is needed. - */ - if (right_word > left_word) { /* round ? */ - /*--------------------------------- - * Actual size of a = xxxxxxAxx - * Actual size of b = xxxBxxxxx - * Max. size of c = xxxxxx - * Round off = |-----| - * c_pos = | - * right_word = | - * a_pos = | - */ - *c_pos = right_word = left_word + 1; /* Set resulting precision */ - /* be equal to that of c */ - if (a->Prec >= c->MaxPrec) { - /* - * a = xxxxxxAxxx - * c = xxxxxx - * a_pos = | - */ - *a_pos = left_word; - if (*a_pos <= round_limit) { - *av = a->frac[*a_pos]; /* av is 'A' shown in above. */ - } - } - else { - /* - * a = xxxxxxx - * c = xxxxxxxxxx - * a_pos = | - */ - *a_pos = a->Prec; - } - if (b->Prec + word_shift >= c->MaxPrec) { - /* - * a = xxxxxxxxx - * b = xxxxxxxBxxx - * c = xxxxxxxxxxx - * b_pos = | - */ - if (c->MaxPrec >= word_shift + 1) { - *b_pos = c->MaxPrec - word_shift - 1; - if (*b_pos + word_shift <= round_limit) { - *bv = b->frac[*b_pos]; - } - } - else { - *b_pos = -1L; - } - } - else { - /* - * a = xxxxxxxxxxxxxxxx - * b = xxxxxx - * c = xxxxxxxxxxxxx - * b_pos = | - */ - *b_pos = b->Prec; - } - } - else { /* The MaxPrec of c - 1 > The Prec of a + b */ - /* - * a = xxxxxxx - * b = xxxxxx - * c = xxxxxxxxxxx - * c_pos = | - */ - *b_pos = b->Prec; - *a_pos = a->Prec; - *c_pos = right_word + 1; - } - c->Prec = *c_pos; - c->exponent = a->exponent; - if (!AddExponent(c, 1)) return (size_t)-1L; - return word_shift; -} - -/* - * Return number of significant digits - * c = a * b , Where a = a0a1a2 ... an - * b = b0b1b2 ... bm - * c = c0c1c2 ... cl - * a0 a1 ... an * bm - * a0 a1 ... an * bm-1 - * . . . - * . . . - * a0 a1 .... an * b0 - * +_____________________________ - * c0 c1 c2 ...... cl - * nc <---| - * MaxAB |--------------------| - */ -VP_EXPORT size_t -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; - DECDIG carry; - DECDIG_DBL s; - Real *w; - -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - VPrint(stdout, "VpMult(Enter): a=% \n", a); - VPrint(stdout, " b=% \n", b); - } -#endif /* BIGDECIMAL_DEBUG */ - - if (!VpIsDefOP(c, a, b, OP_SW_MULT)) 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 (VpIsOne(a)) { - VpAsgn(c, b, VpGetSign(a)); - 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; - } - w = NULL; - MxIndA = a->Prec - 1; - MxIndB = b->Prec - 1; - 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 = NewZeroNolimit(1, (size_t)((MxIndAB + 1) * BASE_FIG)); - MxIndC = MxIndAB; - } - - /* set LHSV c info */ - - c->exponent = a->exponent; /* set exponent */ - if (!AddExponent(c, b->exponent)) { - if (w) rbd_free_struct(c); - return 0; - } - VpSetSign(c, VpGetSign(a) * VpGetSign(b)); /* set sign */ - carry = 0; - nc = ind_c = MxIndAB; - memset(c->frac, 0, (nc + 1) * sizeof(DECDIG)); /* Initialize c */ - c->Prec = nc + 1; /* set precision */ - for (nc = 0; nc < MxIndAB; ++nc, --ind_c) { - if (nc < MxIndB) { /* The left triangle of the Fig. */ - ind_as = MxIndA - nc; - ind_ae = MxIndA; - ind_bs = MxIndB; - } - else if (nc <= MxIndA) { /* The middle rectangular of the Fig. */ - ind_as = MxIndA - nc; - ind_ae = MxIndA - (nc - MxIndB); - ind_bs = MxIndB; - } - else /* if (nc > MxIndA) */ { /* The right triangle of the Fig. */ - ind_as = 0; - ind_ae = MxIndAB - nc - 1; - ind_bs = MxIndB - (nc - MxIndA); - } - - for (i = ind_as; i <= ind_ae; ++i) { - s = (DECDIG_DBL)a->frac[i] * b->frac[ind_bs--]; - carry = (DECDIG)(s / BASE); - s -= (DECDIG_DBL)carry * BASE; - c->frac[ind_c] += (DECDIG)s; - if (c->frac[ind_c] >= BASE) { - s = c->frac[ind_c] / BASE; - carry += (DECDIG)s; - c->frac[ind_c] -= (DECDIG)(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); - rbd_free_struct(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); - } -#endif /*BIGDECIMAL_DEBUG */ - return c->Prec*BASE_FIG; -} - -/* - * c = a / b, remainder = r - */ -VP_EXPORT size_t -VpDivd(Real *c, Real *r, Real *a, Real *b) -{ - size_t word_a, word_b, word_c, word_r; - size_t i, n, ind_a, ind_b, ind_c, ind_r; - size_t nLoop; - DECDIG_DBL q, b1, b1p1, b1b2, b1b2p1, r1r2; - DECDIG borrow, borrow1, borrow2; - DECDIG_DBL qb; - -#ifdef BIGDECIMAL_DEBUG - 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, OP_SW_DIV)) goto Exit; - if (VpIsZero(a) && VpIsZero(b)) { - VpSetNaN(c); - return VpException(VP_EXCEPTION_NaN, "Computation results to 'NaN'", 0); - } - if (VpIsZero(b)) { - VpSetInf(c, VpGetSign(a) * VpGetSign(b)); - return VpException(VP_EXCEPTION_ZERODIVIDE, "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 (VpIsOne(b)) { - /* divide by one */ - VpAsgn(c, a, VpGetSign(b)); - VpSetZero(r, VpGetSign(a)); - goto Exit; - } - - word_a = a->Prec; - word_b = b->Prec; - word_c = c->MaxPrec; - word_r = r->MaxPrec; - - if (word_a >= word_r) goto space_error; - - ind_r = 1; - r->frac[0] = 0; - 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; - - ind_c = 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; - } - - /* */ - /* loop start */ - 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 = (DECDIG_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 == (DECDIG)q */ - c->frac[ind_c] += (DECDIG)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 == (DECDIG)q */ - c->frac[ind_c + 1] += (DECDIG)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 = (DECDIG)(qb / BASE); - qb -= (DECDIG_DBL)borrow1 * BASE; /* get qb < BASE */ - } - if(r->frac[ind_r] < qb) { - r->frac[ind_r] += (DECDIG)(BASE - qb); - borrow2 = borrow2 + borrow1 + 1; - } - else { - r->frac[ind_r] -= (DECDIG)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; -carry: - 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; - - 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)); - VpNmlz(r); /* normalize r(remainder) */ - goto Exit; - -space_error: -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - printf(" word_a=%"PRIuSIZE"\n", word_a); - printf(" word_b=%"PRIuSIZE"\n", word_b); - printf(" word_c=%"PRIuSIZE"\n", word_c); - printf(" word_r=%"PRIuSIZE"\n", word_r); - printf(" ind_r =%"PRIuSIZE"\n", ind_r); - } -#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); - } -#endif /* BIGDECIMAL_DEBUG */ - return c->Prec * BASE_FIG; -} - -/* - * Input a = 00000xxxxxxxx En(5 preceding zeros) - * Output a = xxxxxxxx En-5 - */ -static int -VpNmlz(Real *a) -{ - size_t ind_a, i; - - if (!VpIsDef(a)) goto NoVal; - if (VpIsZero(a)) goto NoVal; - - 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(DECDIG)); - } - return 1; - } - } - /* a is zero(no non-zero digit) */ - VpSetZero(a, VpGetSign(a)); - return 0; - -NoVal: - a->frac[0] = 0; - a->Prec = 1; - return 0; -} - -/* - * VpComp = 0 ... if a=b, - * Pos ... a>b, - * Neg ... a<b. - * 999 ... result undefined(NaN) - */ -VP_EXPORT int -VpComp(Real *a, Real *b) -{ - int val; - 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; - } - /* Zero check */ - if (VpIsZero(a)) { - if (VpIsZero(b)) return 0; /* both zero */ - val = -VpGetSign(b); - 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; - } - - /* 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; - } - - /* a and b have same exponent, then compare their significand. */ - 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; - } - if (a->Prec > b->Prec) { - val = VpGetSign(a); - } - else if (a->Prec < b->Prec) { - val = -VpGetSign(b); - } - -Exit: - 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); - } -#endif /* BIGDECIMAL_DEBUG */ - return (int)val; -} - -/* - * cntl_chr ... ASCIIZ Character, print control characters - * Available control codes: - * % ... VP variable. To print '%', use '%%'. - * \n ... new line - * \b ... backspace - * \t ... tab - * Note: % must not appear more than once - * a ... VP variable to be printed - */ -static int -VPrint(FILE *fp, const char *cntl_chr, Real *a) -{ - size_t i, j, nc, nd, ZeroSup, sep = 10; - DECDIG m, e, nn; - - j = 0; - nd = nc = 0; /* nd : number of digits in fraction part(every 10 digits, */ - /* nd<=10). */ - /* 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 (VpIsNaN(a)) { - fprintf(fp, SZ_NaN); - nc += 8; - } - else if (VpIsPosInf(a)) { - fprintf(fp, SZ_INF); - nc += 8; - } - else if (VpIsNegInf(a)) { - fprintf(fp, SZ_NINF); - nc += 9; - } - else if (!VpIsZero(a)) { - if (BIGDECIMAL_NEGATIVE_P(a)) { - fprintf(fp, "-"); - ++nc; - } - nc += fprintf(fp, "0."); - switch (*(cntl_chr + j + 1)) { - default: - break; - - case '0': case 'z': - ZeroSup = 0; - ++j; - sep = cntl_chr[j] == 'z' ? BIGDECIMAL_COMPONENT_FIGURES : 10; - break; - } - for (i = 0; i < a->Prec; ++i) { - m = BASE1; - e = a->frac[i]; - while (m) { - nn = e / m; - if (!ZeroSup || nn) { - nc += fprintf(fp, "%lu", (unsigned long)nn); /* The leading zero(s) */ - /* as 0.00xx will not */ - /* be printed. */ - ++nd; - ZeroSup = 0; /* Set to print succeeding zeros */ - } - if (nd >= sep) { /* print ' ' after every 10 digits */ - nd = 0; - nc += fprintf(fp, " "); - } - e = e - nn * m; - m /= 10; - } - } - nc += fprintf(fp, "E%"PRIdSIZE, VpExponent10(a)); - nc += fprintf(fp, " (%"PRIdVALUE", %lu, %lu)", a->exponent, a->Prec, a->MaxPrec); - } - else { - nc += fprintf(fp, "0.0"); - } - } - else { - ++nc; - if (*(cntl_chr + j) == '\\') { - switch (*(cntl_chr + j + 1)) { - case 'n': - fprintf(fp, "\n"); - ++j; - break; - case 't': - fprintf(fp, "\t"); - ++j; - break; - case 'b': - fprintf(fp, "\n"); - ++j; - break; - default: - fprintf(fp, "%c", *(cntl_chr + j)); - break; - } - } - else { - fprintf(fp, "%c", *(cntl_chr + j)); - if (*(cntl_chr + j) == '%') ++j; - } - } - j++; - } - - return (int)nc; -} - -static void -VpFormatSt(char *psz, size_t fFmt) -{ - size_t ie, i, nf = 0; - char ch; - - 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' || ch == 'e') break; - - if (++nf > fFmt) { - memmove(psz + i + 1, psz + i, ie - i + 1); - ++ie; - nf = 0; - psz[i] = ' '; - } - } -} - -VP_EXPORT ssize_t -VpExponent10(Real *a) -{ - ssize_t ex; - size_t n; - - if (!VpHasVal(a)) return 0; - - ex = a->exponent * (ssize_t)BASE_FIG; - n = BASE1; - while ((a->frac[0] / n) == 0) { - --ex; - n /= 10; - } - return ex; -} - -VP_EXPORT void -VpSzMantissa(Real *a, char *buf, size_t buflen) -{ - size_t i, n, ZeroSup; - DECDIG_DBL m, e, nn; - - if (VpIsNaN(a)) { - snprintf(buf, buflen, SZ_NaN); - return; - } - if (VpIsPosInf(a)) { - snprintf(buf, buflen, SZ_INF); - return; - } - if (VpIsNegInf(a)) { - snprintf(buf, buflen, SZ_NINF); - return; - } - - ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */ - if (!VpIsZero(a)) { - if (BIGDECIMAL_NEGATIVE_P(a)) *buf++ = '-'; - n = a->Prec; - for (i = 0; i < n; ++i) { - m = BASE1; - e = a->frac[i]; - while (m) { - nn = e / m; - if (!ZeroSup || nn) { - snprintf(buf, buflen, "%lu", (unsigned long)nn); /* The leading zero(s) */ - buf += strlen(buf); - /* as 0.00xx will be ignored. */ - ZeroSup = 0; /* Set to print succeeding zeros */ - } - e = e - nn * m; - m /= 10; - } - } - *buf = 0; - while (buf[-1] == '0') *(--buf) = 0; - } - else { - if (VpIsPosZero(a)) snprintf(buf, buflen, "0"); - else snprintf(buf, buflen, "-0"); - } -} - -VP_EXPORT int -VpToSpecialString(Real *a, char *buf, size_t buflen, int fPlus) -/* fPlus = 0: default, 1: set ' ' before digits, 2: set '+' before digits. */ -{ - if (VpIsNaN(a)) { - snprintf(buf, buflen, SZ_NaN); - return 1; - } - - if (VpIsPosInf(a)) { - if (fPlus == 1) { - *buf++ = ' '; - } - else if (fPlus == 2) { - *buf++ = '+'; - } - snprintf(buf, buflen, SZ_INF); - return 1; - } - if (VpIsNegInf(a)) { - snprintf(buf, buflen, SZ_NINF); - return 1; - } - if (VpIsZero(a)) { - if (VpIsPosZero(a)) { - if (fPlus == 1) snprintf(buf, buflen, " 0.0"); - else if (fPlus == 2) snprintf(buf, buflen, "+0.0"); - else snprintf(buf, buflen, "0.0"); - } - else snprintf(buf, buflen, "-0.0"); - return 1; - } - return 0; -} - -VP_EXPORT void -VpToString(Real *a, char *buf, size_t buflen, size_t fFmt, int fPlus) -/* fPlus = 0: default, 1: set ' ' before digits, 2: set '+' before digits. */ -{ - size_t i, n, ZeroSup; - DECDIG shift, m, e, nn; - char *p = buf; - size_t plen = buflen; - ssize_t ex; - - if (VpToSpecialString(a, buf, buflen, fPlus)) return; - - ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */ - -#define ADVANCE(n) do { \ - if (plen < n) goto overflow; \ - p += n; \ - plen -= n; \ -} while (0) - - if (BIGDECIMAL_NEGATIVE_P(a)) { - *p = '-'; - ADVANCE(1); - } - else if (fPlus == 1) { - *p = ' '; - ADVANCE(1); - } - else if (fPlus == 2) { - *p = '+'; - ADVANCE(1); - } - - *p = '0'; ADVANCE(1); - *p = '.'; ADVANCE(1); - - n = a->Prec; - for (i = 0; i < n; ++i) { - m = BASE1; - e = a->frac[i]; - while (m) { - nn = e / m; - if (!ZeroSup || nn) { - /* The reading zero(s) */ - size_t n = (size_t)snprintf(p, plen, "%lu", (unsigned long)nn); - if (n > plen) goto overflow; - ADVANCE(n); - /* 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 (p - 1 > buf && p[-1] == '0') { - *(--p) = '\0'; - ++plen; - } - snprintf(p, plen, "e%"PRIdSIZE, ex); - if (fFmt) VpFormatSt(buf, fFmt); - - overflow: - return; -#undef ADVANCE -} - -VP_EXPORT void -VpToFString(Real *a, char *buf, size_t buflen, size_t fFmt, int fPlus) -/* fPlus = 0: default, 1: set ' ' before digits, 2: set '+' before digits. */ -{ - size_t i, n; - DECDIG m, e, nn; - char *p = buf; - size_t plen = buflen; - ssize_t ex; - - if (VpToSpecialString(a, buf, buflen, fPlus)) return; - -#define ADVANCE(n) do { \ - if (plen < n) goto overflow; \ - p += n; \ - plen -= n; \ -} while (0) - - - if (BIGDECIMAL_NEGATIVE_P(a)) { - *p = '-'; - ADVANCE(1); - } - else if (fPlus == 1) { - *p = ' '; - ADVANCE(1); - } - else if (fPlus == 2) { - *p = '+'; - ADVANCE(1); - } - - n = a->Prec; - ex = a->exponent; - if (ex <= 0) { - *p = '0'; ADVANCE(1); - *p = '.'; ADVANCE(1); - while (ex < 0) { - for (i=0; i < BASE_FIG; ++i) { - *p = '0'; ADVANCE(1); - } - ++ex; - } - ex = -1; - } - - for (i = 0; i < n; ++i) { - --ex; - if (i == 0 && ex >= 0) { - size_t n = snprintf(p, plen, "%lu", (unsigned long)a->frac[i]); - if (n > plen) goto overflow; - ADVANCE(n); - } - else { - m = BASE1; - e = a->frac[i]; - while (m) { - nn = e / m; - *p = (char)(nn + '0'); - ADVANCE(1); - e = e - nn * m; - m /= 10; - } - } - if (ex == 0) { - *p = '.'; - ADVANCE(1); - } - } - while (--ex>=0) { - m = BASE; - while (m /= 10) { - *p = '0'; - ADVANCE(1); - } - if (ex == 0) { - *p = '.'; - ADVANCE(1); - } - } - - *p = '\0'; - while (p - 1 > buf && p[-1] == '0') { - *(--p) = '\0'; - ++plen; - } - if (p - 1 > buf && p[-1] == '.') { - snprintf(p, plen, "0"); - } - if (fFmt) VpFormatSt(buf, fFmt); - - overflow: - return; -#undef ADVANCE -} - -/* - * [Output] - * a[] ... variable to be assigned the value. - * [Input] - * int_chr[] ... integer part(may include '+/-'). - * ni ... number of characters in int_chr[],not including '+/-'. - * frac[] ... fraction part. - * nf ... number of characters in frac[]. - * exp_chr[] ... exponent part(including '+/-'). - * ne ... number of characters in exp_chr[],not including '+/-'. - */ -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; - SIGNED_VALUE e, es, eb, ef; - int sign, signe, exponent_overflow; - - /* get exponent part */ - e = 0; - ma = a->MaxPrec; - mi = ni; - me = ne; - signe = 1; - exponent_overflow = 0; - memset(a->frac, 0, ma * sizeof(DECDIG)); - if (ne > 0) { - i = 0; - if (exp_chr[0] == '-') { - signe = -1; - ++i; - ++me; - } - else if (exp_chr[0] == '+') { - ++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; - } - } - - /* 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; - } - } - - e = signe * e; /* e: The value of exponent part. */ - e = e + ni; /* set actual exponent size. */ - - if (e > 0) signe = 1; - else signe = -1; - - /* Adjust the exponent so that it is the multiple of BASE_FIG. */ - 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 preceding zero */ - ++e; - } - } - - eb = e / (SIGNED_VALUE)BASE_FIG; - - if (exponent_overflow) { - int zero = 1; - for ( ; i < mi && zero; i++) zero = int_chr[i] == '0'; - for (i = 0; i < nf && zero; i++) zero = frac[i] == '0'; - if (!zero && signe > 0) { - VpSetInf(a, sign); - VpException(VP_EXCEPTION_INFINITY, "exponent overflow",0); - } - else VpSetZero(a, sign); - return 1; - } - - 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; - } - } - - /* 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; - } - } - goto Final; - -over_flow: - rb_warn("Conversion from String to BigDecimal overflow (last few digits discarded)."); - -Final: - if (ind_a >= ma) ind_a = ma - 1; - while (j < BASE_FIG) { - a->frac[ind_a] = a->frac[ind_a] * 10; - ++j; - } - a->Prec = ind_a + 1; - a->exponent = eb; - VpSetSign(a, sign); - VpNmlz(a); - return 1; -} - -/* - * [Input] - * *m ... Real - * [Output] - * *d ... fraction part of m(d = 0.xxxxxxx). where # of 'x's is fig. - * *e ... exponent of m. - * BIGDECIMAL_DOUBLE_FIGURES ... Number of digits in a double variable. - * - * m -> d*10**e, 0<d<BASE - * [Returns] - * 0 ... Zero - * 1 ... Normal - * 2 ... Infinity - * -1 ... NaN - */ -VP_EXPORT int -VpVtoD(double *d, SIGNED_VALUE *e, Real *m) -{ - size_t ind_m, mm, fig; - 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; - } - /* Normal number */ - fig = roomof(BIGDECIMAL_DOUBLE_FIGURES, BASE_FIG); - ind_m = 0; - 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; - } - *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(" BIGDECIMAL_DOUBLE_FIGURES = %d\n", BIGDECIMAL_DOUBLE_FIGURES); - } -#endif /*BIGDECIMAL_DEBUG */ - return f; -} - -/* - * m <- d - */ -VP_EXPORT void -VpDtoV(Real *m, double d) -{ - size_t ind_m, mm; - SIGNED_VALUE ne; - DECDIG i; - double val, val2; - - if (isnan(d)) { - VpSetNaN(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; - } - 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; - } - } - /* Now val = 0.xxxxx*BASE**ne */ - - mm = m->MaxPrec; - memset(m->frac, 0, mm * sizeof(DECDIG)); - for (ind_m = 0; val > 0.0 && ind_m < mm; ind_m++) { - val *= (double)BASE; - i = (DECDIG)val; - val -= (double)i; - m->frac[ind_m] = i; - } - 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, - (DECDIG)(val*(double)BASE)); - -Exit: -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - printf("VpDtoV d=%30.30e\n", d); - VPrint(stdout, " m=%\n", m); - } -#endif /* BIGDECIMAL_DEBUG */ - return; -} - -/* - * m <- ival - */ -#if 0 /* unused */ -VP_EXPORT void -VpItoV(Real *m, SIGNED_VALUE ival) -{ - size_t mm, ind_m; - size_t val, v1, v2, v; - int isign; - SIGNED_VALUE ne; - - if (ival == 0) { - VpSetZero(m, 1); - goto Exit; - } - isign = 1; - val = 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; - } - 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; - } - m->Prec = ind_m - 1; - m->exponent = ne; - VpSetSign(m, isign); - VpNmlz(m); - -Exit: -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - printf(" VpItoV i=%d\n", ival); - VPrint(stdout, " m=%\n", m); - } -#endif /* BIGDECIMAL_DEBUG */ - return; -} -#endif - -/* - * y = SQRT(x), y*y - x =>0 - */ -VP_EXPORT int -VpSqrt(Real *y, Real *x) -{ - Real *f = NULL; - Real *r = NULL; - size_t y_prec; - SIGNED_VALUE n, e; - SIGNED_VALUE prec; - ssize_t nr; - double val; - - /* Zero or +Infinity ? */ - if (VpIsZero(x) || VpIsPosInf(x)) { - VpAsgn(y,x,1); - goto Exit; - } - - /* Negative ? */ - if (BIGDECIMAL_NEGATIVE_P(x)) { - VpSetNaN(y); - return VpException(VP_EXCEPTION_OP, "sqrt of negative value", 0); - } - - /* NaN ? */ - if (VpIsNaN(x)) { - VpSetNaN(y); - return VpException(VP_EXCEPTION_OP, "sqrt of 'NaN'(Not a Number)", 0); - } - - /* One ? */ - 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 */ - /* TODO: reconsider MaxPrec of f and r */ - f = NewOneNolimit(1, y->MaxPrec * (BASE_FIG + 2)); - r = NewOneNolimit(1, (n + n) * (BASE_FIG + 2)); - - nr = 0; - y_prec = y->MaxPrec; - - prec = x->exponent - (ssize_t)y_prec; - if (x->exponent > 0) - ++prec; - else - --prec; - - VpVtoD(&val, &e, x); /* val <- x */ - e /= (SIGNED_VALUE)BASE_FIG; - n = e / 2; - if (e - n * 2 != 0) { - val /= BASE; - n = (e + 1) / 2; - } - VpDtoV(y, sqrt(val)); /* y <- sqrt(val) */ - y->exponent += n; - n = (SIGNED_VALUE)roomof(BIGDECIMAL_DOUBLE_FIGURES, BASE_FIG); - y->MaxPrec = Min((size_t)n , y_prec); - f->MaxPrec = y->MaxPrec + 1; - n = (SIGNED_VALUE)(y_prec * BASE_FIG); - if (n < (SIGNED_VALUE)maxnr) n = (SIGNED_VALUE)maxnr; - - /* - * Perform: y_{n+1} = (y_n - x/y_n) / 2 - */ - 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, VpConstPt5, 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); - } -#endif /* BIGDECIMAL_DEBUG */ - y->MaxPrec = y_prec; - -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); - } -#endif /* BIGDECIMAL_DEBUG */ - y->MaxPrec = y_prec; - -Exit: - rbd_free_struct(f); - rbd_free_struct(r); - return 1; -} - -/* - * Round relatively from the decimal point. - * f: rounding mode - * nf: digit location to round from the decimal point. - */ -VP_EXPORT int -VpMidRound(Real *y, unsigned short f, ssize_t nf) -{ - /* fracf: any positive digit under rounding position? */ - /* fracf_1further: any positive digits under one further than the rounding position? */ - /* exptoadd: number of digits needed to compensate negative nf */ - int fracf, fracf_1further; - ssize_t n,i,ix,ioffset, exptoadd; - DECDIG v, shifter; - DECDIG div; - - nf += y->exponent * (ssize_t)BASE_FIG; - 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 */ - return 0; - } - exptoadd = -nf; - nf = 0; - } - - ix = nf / (ssize_t)BASE_FIG; - if ((size_t)ix >= y->Prec) return 0; /* rounding position too right(small). */ - v = y->frac[ix]; - - ioffset = nf - ix*(ssize_t)BASE_FIG; - n = (ssize_t)BASE_FIG - ioffset - 1; - for (shifter = 1, i = 0; i < n; ++i) shifter *= 10; - - /* so the representation used (in y->frac) is an array of DECDIG, where - each DECDIG contains a value between 0 and BASE-1, consisting of BASE_FIG - decimal places. - - (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. - - ix is the position (in DECDIGs) of the DECDIG containing the decimal digit, - from the start of the array. - - v is the value of this DECDIG - - ioffset is the number of extra decimal places along of this decimal digit - 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); - - v /= shifter; - div = v / 10; - v = v - div*10; - /* 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 DECDIGs for zero-ness a whole DECDIG at a time. - 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++) { - if (y->frac[i] % BASE) { - fracf = fracf_1further = 1; - break; - } - } - - /* now fracf = does any positive digit exist under the rounding position? - now fracf_1further = does any positive digit exist under one further than the - rounding position? - 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(DECDIG)); - - 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: - if (v > 5 || (v == 5 && fracf_1further)) ++div; - break; - case VP_ROUND_CEIL: - if (fracf && BIGDECIMAL_POSITIVE_P(y)) ++div; - break; - case VP_ROUND_FLOOR: - if (fracf && BIGDECIMAL_NEGATIVE_P(y)) ++div; - break; - case VP_ROUND_HALF_EVEN: /* Banker's rounding */ - if (v > 5) ++div; - else if (v == 5) { - if (fracf_1further) { - ++div; - } - else { - if (ioffset == 0) { - /* v is the first decimal digit of its DECDIG; - need to grab the previous DECDIG if present - to check for evenness of the previous decimal - digit (which is same as that of the DECDIG since - base 10 has a factor of 2) */ - if (ix && (y->frac[ix-1] % 2)) ++div; - } - else { - if (div % 2) ++div; - } - } - } - 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); - } - 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++; - } - } - } - return 1; -} - -VP_EXPORT int -VpLeftRound(Real *y, unsigned short f, ssize_t nf) -/* - * Round from the left hand side of the digits. - */ -{ - DECDIG v; - if (!VpHasVal(y)) return 0; /* Unable to round */ - v = y->frac[0]; - nf -= VpExponent(y) * (ssize_t)BASE_FIG; - while ((v /= 10) != 0) nf--; - nf += (ssize_t)BASE_FIG-1; - return VpMidRound(y, f, nf); -} - -VP_EXPORT int -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); -} - -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; - return VpLeftRound(c, VpGetRoundMode(), (ssize_t)ix); -} - -/* If I understand correctly, this is only ever used to round off the final decimal - digit of precision */ -static void -VpInternalRound(Real *c, size_t ixDigit, DECDIG vPrev, DECDIG v) -{ - int f = 0; - - unsigned short const rounding_mode = VpGetRoundMode(); - - if (VpLimitRound(c, ixDigit)) return; - if (!v) return; - - v /= BASE1; - switch (rounding_mode) { - case VP_ROUND_DOWN: - break; - case VP_ROUND_UP: - if (v) f = 1; - break; - case VP_ROUND_HALF_UP: - if (v >= 5) f = 1; - break; - 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: - if (v && BIGDECIMAL_POSITIVE_P(c)) f = 1; - break; - case VP_ROUND_FLOOR: - if (v && BIGDECIMAL_NEGATIVE_P(c)) f = 1; - break; - 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; - else if (v == 5 && vPrev % 2) f = 1; - break; - } - if (f) { - VpRdup(c, ixDigit); - VpNmlz(c); - } -} - -/* - * Rounds up m(plus one to final digit of m). - */ -static int -VpRdup(Real *m, size_t ind_m) -{ - DECDIG carry; - - 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); - } - return 1; -} - -/* - * y = x - fix(x) - */ -VP_EXPORT void -VpFrac(Real *y, Real *x) -{ - size_t my, ind_y, ind_x; - - 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; - } - else if (x->exponent <= 0) { - VpAsgn(y, x, 1); - goto Exit; - } - - /* satisfy: x->exponent > 0 */ - - y->Prec = x->Prec - (size_t)x->exponent; - y->Prec = Min(y->Prec, y->MaxPrec); - y->exponent = 0; - 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; - } - VpNmlz(y); - -Exit: -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - VPrint(stdout, "VpFrac y=%\n", y); - VPrint(stdout, " x=%\n", x); - } -#endif /* BIGDECIMAL_DEBUG */ - return; -} - -/* - * y = x ** n - */ -VP_EXPORT int -VpPowerByInt(Real *y, Real *x, SIGNED_VALUE n) -{ - size_t s, ss; - ssize_t sign; - 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 (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 (x->exponent == 1 && x->Prec == 1 && x->frac[0] == 1) { - /* abs(x) = 1 */ - VpSetOne(y); - if (BIGDECIMAL_POSITIVE_P(x)) 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; - } - - /* Allocate working variables */ - /* TODO: reconsider MaxPrec of w1 and w2 */ - w1 = NewZeroNolimit(1, (y->MaxPrec + 2) * BASE_FIG); - w2 = NewZeroNolimit(1, (w1->MaxPrec * 2 + 1) * BASE_FIG); - - /* calculation start */ - - VpAsgn(y, x, 1); - --n; - 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); - } - if (sign < 0) { - VpDivd(w1, w2, VpConstOne, y); - VpAsgn(y, w1, 1); - } - -Exit: -#ifdef BIGDECIMAL_DEBUG - if (gfDebug) { - VPrint(stdout, "VpPowerByInt y=%\n", y); - VPrint(stdout, "VpPowerByInt x=%\n", x); - printf(" n=%"PRIdVALUE"\n", n); - } -#endif /* BIGDECIMAL_DEBUG */ - rbd_free_struct(w2); - rbd_free_struct(w1); - return 1; -} - -#ifdef BIGDECIMAL_DEBUG -int -VpVarCheck(Real * v) -/* - * Checks the validity of the Real variable v. - * [Input] - * v ... Real *, variable to be checked. - * [Returns] - * 0 ... correct v. - * other ... error - */ -{ - 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"]=%"PRIuDECDIG"\n", i, v->frac[i]); - printf(" Prec. =%"PRIuSIZE"\n", v->Prec); - printf(" Exp. =%"PRIdVALUE"\n", v->exponent); - printf(" BASE =%"PRIuDECDIG"\n", BASE); - return 3; - } - } - return 0; -} -#endif /* BIGDECIMAL_DEBUG */ diff --git a/ext/bigdecimal/bigdecimal.gemspec b/ext/bigdecimal/bigdecimal.gemspec deleted file mode 100644 index 1feed332f6..0000000000 --- a/ext/bigdecimal/bigdecimal.gemspec +++ /dev/null @@ -1,38 +0,0 @@ -# coding: utf-8 - -Gem::Specification.new do |s| - s.name = "bigdecimal" - s.version = "3.1.2" - s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"] - s.email = ["mrkn@mrkn.jp"] - - s.summary = "Arbitrary-precision decimal floating-point number library." - s.description = "This library provides arbitrary-precision decimal floating-point number class." - s.homepage = "https://github.com/ruby/bigdecimal" - s.licenses = ["Ruby", "bsd-2-clause"] - - s.require_paths = %w[lib] - s.extensions = %w[ext/bigdecimal/extconf.rb] - s.files = %w[ - bigdecimal.gemspec - ext/bigdecimal/bigdecimal.c - ext/bigdecimal/bigdecimal.h - ext/bigdecimal/bits.h - ext/bigdecimal/feature.h - ext/bigdecimal/missing.c - ext/bigdecimal/missing.h - ext/bigdecimal/missing/dtoa.c - ext/bigdecimal/static_assert.h - lib/bigdecimal.rb - lib/bigdecimal/jacobian.rb - lib/bigdecimal/ludcmp.rb - lib/bigdecimal/math.rb - lib/bigdecimal/newton.rb - lib/bigdecimal/util.rb - sample/linear.rb - sample/nlsolve.rb - sample/pi.rb - ] - - s.required_ruby_version = Gem::Requirement.new(">= 2.5.0") -end diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h deleted file mode 100644 index 54fed811fb..0000000000 --- a/ext/bigdecimal/bigdecimal.h +++ /dev/null @@ -1,313 +0,0 @@ -/* - * - * Ruby BigDecimal(Variable decimal precision) extension library. - * - * Copyright(C) 2002 by Shigeo Kobayashi(shigeo@tinyforest.gr.jp) - * - */ - -#ifndef RUBY_BIG_DECIMAL_H -#define RUBY_BIG_DECIMAL_H 1 - -#define RUBY_NO_OLD_COMPATIBILITY -#include "ruby/ruby.h" -#include "missing.h" - -#ifdef HAVE_FLOAT_H -# include <float.h> -#endif - -#ifdef HAVE_INT64_T -# define DECDIG uint32_t -# define DECDIG_DBL uint64_t -# define DECDIG_DBL_SIGNED int64_t -# define SIZEOF_DECDIG 4 -# define PRI_DECDIG_PREFIX "" -# ifdef PRI_LL_PREFIX -# define PRI_DECDIG_DBL_PREFIX PRI_LL_PREFIX -# else -# define PRI_DECDIG_DBL_PREFIX "l" -# endif -#else -# define DECDIG uint16_t -# define DECDIG_DBL uint32_t -# define DECDIG_DBL_SIGNED int32_t -# define SIZEOF_DECDIG 2 -# define PRI_DECDIG_PREFIX "h" -# define PRI_DECDIG_DBL_PREFIX "" -#endif - -#define PRIdDECDIG PRI_DECDIG_PREFIX"d" -#define PRIiDECDIG PRI_DECDIG_PREFIX"i" -#define PRIoDECDIG PRI_DECDIG_PREFIX"o" -#define PRIuDECDIG PRI_DECDIG_PREFIX"u" -#define PRIxDECDIG PRI_DECDIG_PREFIX"x" -#define PRIXDECDIG PRI_DECDIG_PREFIX"X" - -#define PRIdDECDIG_DBL PRI_DECDIG_DBL_PREFIX"d" -#define PRIiDECDIG_DBL PRI_DECDIG_DBL_PREFIX"i" -#define PRIoDECDIG_DBL PRI_DECDIG_DBL_PREFIX"o" -#define PRIuDECDIG_DBL PRI_DECDIG_DBL_PREFIX"u" -#define PRIxDECDIG_DBL PRI_DECDIG_DBL_PREFIX"x" -#define PRIXDECDIG_DBL PRI_DECDIG_DBL_PREFIX"X" - -#if SIZEOF_DECDIG == 4 -# define BIGDECIMAL_BASE ((DECDIG)1000000000U) -# define BIGDECIMAL_COMPONENT_FIGURES 9 -/* - * The number of components required for a 64-bit integer. - * - * INT64_MAX: 9_223372036_854775807 - * UINT64_MAX: 18_446744073_709551615 - */ -# define BIGDECIMAL_INT64_MAX_LENGTH 3 - -#elif SIZEOF_DECDIG == 2 -# define BIGDECIMAL_BASE ((DECDIG)10000U) -# define BIGDECIMAL_COMPONENT_FIGURES 4 -/* - * The number of components required for a 64-bit integer. - * - * INT64_MAX: 922_3372_0368_5477_5807 - * UINT64_MAX: 1844_6744_0737_0955_1615 - */ -# define BIGDECIMAL_INT64_MAX_LENGTH 5 - -#else -# error Unknown size of DECDIG -#endif - -#define BIGDECIMAL_DOUBLE_FIGURES (1+DBL_DIG) - -#if defined(__cplusplus) -extern "C" { -#if 0 -} /* satisfy cc-mode */ -#endif -#endif - -extern VALUE rb_cBigDecimal; - -/* - * NaN & Infinity - */ -#define SZ_NaN "NaN" -#define SZ_INF "Infinity" -#define SZ_PINF "+Infinity" -#define SZ_NINF "-Infinity" - -/* - * #define VP_EXPORT other than static to let VP_ routines - * be called from outside of this module. - */ -#define VP_EXPORT static - -/* Exception mode */ -#define VP_EXCEPTION_ALL ((unsigned short)0x00FF) -#define VP_EXCEPTION_INFINITY ((unsigned short)0x0001) -#define VP_EXCEPTION_NaN ((unsigned short)0x0002) -#define VP_EXCEPTION_UNDERFLOW ((unsigned short)0x0004) -#define VP_EXCEPTION_OVERFLOW ((unsigned short)0x0001) /* 0x0008) */ -#define VP_EXCEPTION_ZERODIVIDE ((unsigned short)0x0010) - -/* Following 2 exceptions can't controlled by user */ -#define VP_EXCEPTION_OP ((unsigned short)0x0020) - -#define BIGDECIMAL_EXCEPTION_MODE_DEFAULT 0U - -/* This is used in BigDecimal#mode */ -#define VP_ROUND_MODE ((unsigned short)0x0100) - -/* Rounding mode */ -#define VP_ROUND_UP RBD_ROUND_UP -#define VP_ROUND_DOWN RBD_ROUND_DOWN -#define VP_ROUND_HALF_UP RBD_ROUND_HALF_UP -#define VP_ROUND_HALF_DOWN RBD_ROUND_HALF_DOWN -#define VP_ROUND_CEIL RBD_ROUND_CEIL -#define VP_ROUND_FLOOR RBD_ROUND_FLOOR -#define VP_ROUND_HALF_EVEN RBD_ROUND_HALF_EVEN - -enum rbd_rounding_mode { - RBD_ROUND_UP = 1, - RBD_ROUND_DOWN = 2, - RBD_ROUND_HALF_UP = 3, - RBD_ROUND_HALF_DOWN = 4, - RBD_ROUND_CEIL = 5, - RBD_ROUND_FLOOR = 6, - RBD_ROUND_HALF_EVEN = 7, - - RBD_ROUND_DEFAULT = RBD_ROUND_HALF_UP, - RBD_ROUND_TRUNCATE = RBD_ROUND_DOWN, - RBD_ROUND_BANKER = RBD_ROUND_HALF_EVEN, - RBD_ROUND_CEILING = RBD_ROUND_CEIL -}; - -#define BIGDECIMAL_ROUNDING_MODE_DEFAULT VP_ROUND_HALF_UP - -/* Sign flag */ -#define VP_SIGN_NaN 0 /* NaN */ -#define VP_SIGN_POSITIVE_ZERO 1 /* Positive zero */ -#define VP_SIGN_NEGATIVE_ZERO -1 /* Negative zero */ -#define VP_SIGN_POSITIVE_FINITE 2 /* Positive finite number */ -#define VP_SIGN_NEGATIVE_FINITE -2 /* Negative finite number */ -#define VP_SIGN_POSITIVE_INFINITE 3 /* Positive infinite number */ -#define VP_SIGN_NEGATIVE_INFINITE -3 /* Negative infinite number */ - -/* The size of fraction part array */ -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) -#define FLEXIBLE_ARRAY_SIZE /* */ -#elif defined(__GNUC__) && !defined(__STRICT_ANSI__) -#define FLEXIBLE_ARRAY_SIZE 0 -#else -#define FLEXIBLE_ARRAY_SIZE 1 -#endif - -/* - * VP representation - * r = 0.xxxxxxxxx *BASE**exponent - */ -typedef struct { - VALUE obj; /* Back pointer(VALUE) for Ruby object. */ - size_t MaxPrec; /* Maximum precision size */ - /* This is the actual size of frac[] */ - /*(frac[0] to frac[MaxPrec] are available). */ - size_t Prec; /* Current precision size. */ - /* This indicates how much the */ - /* array frac[] is actually used. */ - SIGNED_VALUE exponent; /* Exponent part. */ - short sign; /* Attributes of the value. */ - /* - * ==0 : NaN - * 1 : Positive zero - * -1 : Negative zero - * 2 : Positive number - * -2 : Negative number - * 3 : Positive infinite number - * -3 : Negative infinite number - */ - short flag; /* Not used in vp_routines,space for user. */ - DECDIG frac[FLEXIBLE_ARRAY_SIZE]; /* Array of fraction part. */ -} Real; - -/* - * ------------------ - * EXPORTables. - * ------------------ - */ - -VP_EXPORT Real *VpNewRbClass(size_t mx, char const *str, VALUE klass, bool strict_p, bool raise_exception); - -VP_EXPORT Real *VpCreateRbObject(size_t mx, const char *str, bool raise_exception); - -#define VpBaseFig() BIGDECIMAL_COMPONENT_FIGURES -#define VpDblFig() BIGDECIMAL_DOUBLE_FIGURES -#define VpBaseVal() BIGDECIMAL_BASE - -/* Zero,Inf,NaN (isinf(),isnan() used to check) */ -VP_EXPORT double VpGetDoubleNaN(void); -VP_EXPORT double VpGetDoublePosInf(void); -VP_EXPORT double VpGetDoubleNegInf(void); -VP_EXPORT double VpGetDoubleNegZero(void); - -/* These 2 functions added at v1.1.7 */ -VP_EXPORT size_t VpGetPrecLimit(void); -VP_EXPORT size_t VpSetPrecLimit(size_t n); - -/* Round mode */ -VP_EXPORT int VpIsRoundMode(unsigned short n); -VP_EXPORT unsigned short VpGetRoundMode(void); -VP_EXPORT unsigned short VpSetRoundMode(unsigned short n); - -VP_EXPORT int VpException(unsigned short f,const char *str,int always); -#if 0 /* unused */ -VP_EXPORT int VpIsNegDoubleZero(double v); -#endif -VP_EXPORT size_t VpNumOfChars(Real *vp,const char *pszFmt); -VP_EXPORT size_t VpInit(DECDIG BaseVal); -VP_EXPORT Real *VpAlloc(size_t mx, const char *szVal, int strict_p, int exc); -VP_EXPORT size_t VpAsgn(Real *c, Real *a, int isw); -VP_EXPORT size_t VpAddSub(Real *c,Real *a,Real *b,int operation); -VP_EXPORT size_t VpMult(Real *c,Real *a,Real *b); -VP_EXPORT size_t VpDivd(Real *c,Real *r,Real *a,Real *b); -VP_EXPORT int VpComp(Real *a,Real *b); -VP_EXPORT ssize_t VpExponent10(Real *a); -VP_EXPORT void VpSzMantissa(Real *a, char *buf, size_t bufsize); -VP_EXPORT int VpToSpecialString(Real *a, char *buf, size_t bufsize, int fPlus); -VP_EXPORT void VpToString(Real *a, char *buf, size_t bufsize, size_t fFmt, int fPlus); -VP_EXPORT void VpToFString(Real *a, char *buf, size_t bufsize, size_t fFmt, int fPlus); -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); -VP_EXPORT int VpVtoD(double *d, SIGNED_VALUE *e, Real *m); -VP_EXPORT void VpDtoV(Real *m,double d); -#if 0 /* unused */ -VP_EXPORT void VpItoV(Real *m,S_INT ival); -#endif -VP_EXPORT int VpSqrt(Real *y,Real *x); -VP_EXPORT int VpActiveRound(Real *y, Real *x, unsigned short f, ssize_t il); -VP_EXPORT int VpMidRound(Real *y, unsigned short f, ssize_t nf); -VP_EXPORT int VpLeftRound(Real *y, unsigned short f, ssize_t nf); -VP_EXPORT void VpFrac(Real *y, Real *x); -VP_EXPORT int VpPowerByInt(Real *y, Real *x, SIGNED_VALUE n); -#define VpPower VpPowerByInt - -/* VP constants */ -VP_EXPORT Real *VpOne(void); - -/* - * ------------------ - * MACRO definitions. - * ------------------ - */ -#define Abs(a) (((a)>= 0)?(a):(-(a))) -#define Max(a, b) (((a)>(b))?(a):(b)) -#define Min(a, b) (((a)>(b))?(b):(a)) - -#define VpMaxPrec(a) ((a)->MaxPrec) -#define VpPrec(a) ((a)->Prec) -#define VpGetFlag(a) ((a)->flag) - -/* Sign */ - -/* VpGetSign(a) returns 1,-1 if a>0,a<0 respectively */ -#define VpGetSign(a) (((a)->sign>0)?1:(-1)) -/* Change sign of a to a>0,a<0 if s = 1,-1 respectively */ -#define VpChangeSign(a,s) {if((s)>0) (a)->sign=(short)Abs((ssize_t)(a)->sign);else (a)->sign=-(short)Abs((ssize_t)(a)->sign);} -/* Sets sign of a to a>0,a<0 if s = 1,-1 respectively */ -#define VpSetSign(a,s) {if((s)>0) (a)->sign=(short)VP_SIGN_POSITIVE_FINITE;else (a)->sign=(short)VP_SIGN_NEGATIVE_FINITE;} - -/* 1 */ -#define VpSetOne(a) {(a)->Prec=(a)->exponent=(a)->frac[0]=1;(a)->sign=VP_SIGN_POSITIVE_FINITE;} - -/* ZEROs */ -#define VpIsPosZero(a) ((a)->sign==VP_SIGN_POSITIVE_ZERO) -#define VpIsNegZero(a) ((a)->sign==VP_SIGN_NEGATIVE_ZERO) -#define VpIsZero(a) (VpIsPosZero(a) || VpIsNegZero(a)) -#define VpSetPosZero(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_ZERO) -#define VpSetNegZero(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_ZERO) -#define VpSetZero(a,s) (void)(((s)>0)?VpSetPosZero(a):VpSetNegZero(a)) - -/* NaN */ -#define VpIsNaN(a) ((a)->sign==VP_SIGN_NaN) -#define VpSetNaN(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NaN) - -/* Infinity */ -#define VpIsPosInf(a) ((a)->sign==VP_SIGN_POSITIVE_INFINITE) -#define VpIsNegInf(a) ((a)->sign==VP_SIGN_NEGATIVE_INFINITE) -#define VpIsInf(a) (VpIsPosInf(a) || VpIsNegInf(a)) -#define VpIsDef(a) ( !(VpIsNaN(a)||VpIsInf(a)) ) -#define VpSetPosInf(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_POSITIVE_INFINITE) -#define VpSetNegInf(a) ((a)->frac[0]=0,(a)->Prec=1,(a)->sign=VP_SIGN_NEGATIVE_INFINITE) -#define VpSetInf(a,s) (void)(((s)>0)?VpSetPosInf(a):VpSetNegInf(a)) -#define VpHasVal(a) (a->frac[0]) -#define VpIsOne(a) ((a->Prec==1)&&(a->frac[0]==1)&&(a->exponent==1)) -#define VpExponent(a) (a->exponent) -#ifdef BIGDECIMAL_DEBUG -int VpVarCheck(Real * v); -#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/bits.h b/ext/bigdecimal/bits.h deleted file mode 100644 index 6e1e4776e3..0000000000 --- a/ext/bigdecimal/bits.h +++ /dev/null @@ -1,141 +0,0 @@ -#ifndef BIGDECIMAL_BITS_H -#define BIGDECIMAL_BITS_H - -#include "feature.h" -#include "static_assert.h" - -#if defined(__x86_64__) && defined(HAVE_X86INTRIN_H) -# include <x86intrin.h> /* for _lzcnt_u64, etc. */ -#elif defined(_MSC_VER) && defined(HAVE_INTRIN_H) -# include <intrin.h> /* for the following intrinsics */ -#endif - -#if defined(_MSC_VER) && defined(__AVX2__) -# pragma intrinsic(__lzcnt) -# pragma intrinsic(__lzcnt64) -#endif - -#define numberof(array) ((int)(sizeof(array) / sizeof((array)[0]))) -#define roomof(x, y) (((x) + (y) - 1) / (y)) -#define type_roomof(x, y) roomof(sizeof(x), sizeof(y)) - -#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))) - -#ifdef HAVE_UINT128_T -# define bit_length(x) \ - (unsigned int) \ - (sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \ - sizeof(x) <= sizeof(int64_t) ? 64 - nlz_int64((uint64_t)(x)) : \ - 128 - nlz_int128((uint128_t)(x))) -#else -# define bit_length(x) \ - (unsigned int) \ - (sizeof(x) <= sizeof(int32_t) ? 32 - nlz_int32((uint32_t)(x)) : \ - 64 - nlz_int64((uint64_t)(x))) -#endif - -static inline unsigned nlz_int32(uint32_t x); -static inline unsigned nlz_int64(uint64_t x); -#ifdef HAVE_UINT128_T -static inline unsigned nlz_int128(uint128_t x); -#endif - -static inline unsigned int -nlz_int32(uint32_t x) -{ -#if defined(_MSC_VER) && defined(__AVX2__) && defined(HAVE___LZCNT) - /* Note: It seems there is no such thing like __LZCNT__ predefined in MSVC. - * AMD CPUs have had this instruction for decades (since K10) but for - * Intel, Haswell is the oldest one. We need to use __AVX2__ for maximum - * safety. */ - return (unsigned int)__lzcnt(x); - -#elif defined(__x86_64__) && defined(__LZCNT__) && defined(HAVE__LZCNT_U32) - return (unsigned int)_lzcnt_u32(x); - -#elif defined(_MSC_VER) && defined(HAVE__BITSCANREVERSE) - unsigned long r; - return _BitScanReverse(&r, x) ? (31 - (int)r) : 32; - -#elif __has_builtin(__builtin_clz) - STATIC_ASSERT(sizeof_int, sizeof(int) * CHAR_BIT == 32); - return x ? (unsigned int)__builtin_clz(x) : 32; - -#else - uint32_t y; - unsigned n = 32; - 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 (unsigned int)(n - x); -#endif -} - -static inline unsigned int -nlz_int64(uint64_t x) -{ -#if defined(_MSC_VER) && defined(__AVX2__) && defined(HAVE___LZCNT64) - return (unsigned int)__lzcnt64(x); - -#elif defined(__x86_64__) && defined(__LZCNT__) && defined(HAVE__LZCNT_U64) - return (unsigned int)_lzcnt_u64(x); - -#elif defined(_WIN64) && defined(_MSC_VER) && defined(HAVE__BITSCANREVERSE64) - unsigned long r; - return _BitScanReverse64(&r, x) ? (63u - (unsigned int)r) : 64; - -#elif __has_builtin(__builtin_clzl) && __has_builtin(__builtin_clzll) && !(defined(__sun) && defined(__sparc)) - if (x == 0) { - return 64; - } - else if (sizeof(long) * CHAR_BIT == 64) { - return (unsigned int)__builtin_clzl((unsigned long)x); - } - else if (sizeof(long long) * CHAR_BIT == 64) { - return (unsigned int)__builtin_clzll((unsigned long long)x); - } - else { - /* :FIXME: Is there a way to make this branch a compile-time error? */ - __builtin_unreachable(); - } - -#else - uint64_t y; - unsigned int n = 64; - 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 (unsigned int)(n - x); - -#endif -} - -#ifdef HAVE_UINT128_T -static inline unsigned int -nlz_int128(uint128_t x) -{ - uint64_t y = (uint64_t)(x >> 64); - - if (x == 0) { - return 128; - } - else if (y == 0) { - return (unsigned int)nlz_int64(x) + 64; - } - else { - return (unsigned int)nlz_int64(y); - } -} -#endif - -#endif /* BIGDECIMAL_BITS_H */ diff --git a/ext/bigdecimal/depend b/ext/bigdecimal/depend deleted file mode 100644 index ee892162f2..0000000000 --- a/ext/bigdecimal/depend +++ /dev/null @@ -1,330 +0,0 @@ -extconf.h: $(srcdir)/$(GEMSPEC) -Makefile: $(BIGDECIMAL_RB) - -# AUTOGENERATED DEPENDENCIES START -bigdecimal.o: $(RUBY_EXTCONF_H) -bigdecimal.o: $(arch_hdrdir)/ruby/config.h -bigdecimal.o: $(hdrdir)/ruby/assert.h -bigdecimal.o: $(hdrdir)/ruby/backward/2/assume.h -bigdecimal.o: $(hdrdir)/ruby/backward/2/attributes.h -bigdecimal.o: $(hdrdir)/ruby/backward/2/bool.h -bigdecimal.o: $(hdrdir)/ruby/backward/2/inttypes.h -bigdecimal.o: $(hdrdir)/ruby/backward/2/limits.h -bigdecimal.o: $(hdrdir)/ruby/backward/2/long_long.h -bigdecimal.o: $(hdrdir)/ruby/backward/2/stdalign.h -bigdecimal.o: $(hdrdir)/ruby/backward/2/stdarg.h -bigdecimal.o: $(hdrdir)/ruby/defines.h -bigdecimal.o: $(hdrdir)/ruby/intern.h -bigdecimal.o: $(hdrdir)/ruby/internal/abi.h -bigdecimal.o: $(hdrdir)/ruby/internal/anyargs.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/char.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/double.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/int.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/long.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/short.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h -bigdecimal.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h -bigdecimal.o: $(hdrdir)/ruby/internal/assume.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/alloc_size.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/artificial.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/cold.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/const.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/constexpr.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/deprecated.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/error.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/flag_enum.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/forceinline.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/format.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/noalias.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/nodiscard.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/noexcept.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/noinline.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/nonnull.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/noreturn.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/pure.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/restrict.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/warning.h -bigdecimal.o: $(hdrdir)/ruby/internal/attr/weakref.h -bigdecimal.o: $(hdrdir)/ruby/internal/cast.h -bigdecimal.o: $(hdrdir)/ruby/internal/compiler_is.h -bigdecimal.o: $(hdrdir)/ruby/internal/compiler_is/apple.h -bigdecimal.o: $(hdrdir)/ruby/internal/compiler_is/clang.h -bigdecimal.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h -bigdecimal.o: $(hdrdir)/ruby/internal/compiler_is/intel.h -bigdecimal.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h -bigdecimal.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h -bigdecimal.o: $(hdrdir)/ruby/internal/compiler_since.h -bigdecimal.o: $(hdrdir)/ruby/internal/config.h -bigdecimal.o: $(hdrdir)/ruby/internal/constant_p.h -bigdecimal.o: $(hdrdir)/ruby/internal/core.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rarray.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rbasic.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rbignum.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rclass.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rdata.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rfile.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rhash.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/robject.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rregexp.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rstring.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rstruct.h -bigdecimal.o: $(hdrdir)/ruby/internal/core/rtypeddata.h -bigdecimal.o: $(hdrdir)/ruby/internal/ctype.h -bigdecimal.o: $(hdrdir)/ruby/internal/dllexport.h -bigdecimal.o: $(hdrdir)/ruby/internal/dosish.h -bigdecimal.o: $(hdrdir)/ruby/internal/error.h -bigdecimal.o: $(hdrdir)/ruby/internal/eval.h -bigdecimal.o: $(hdrdir)/ruby/internal/event.h -bigdecimal.o: $(hdrdir)/ruby/internal/fl_type.h -bigdecimal.o: $(hdrdir)/ruby/internal/gc.h -bigdecimal.o: $(hdrdir)/ruby/internal/glob.h -bigdecimal.o: $(hdrdir)/ruby/internal/globals.h -bigdecimal.o: $(hdrdir)/ruby/internal/has/attribute.h -bigdecimal.o: $(hdrdir)/ruby/internal/has/builtin.h -bigdecimal.o: $(hdrdir)/ruby/internal/has/c_attribute.h -bigdecimal.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h -bigdecimal.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h -bigdecimal.o: $(hdrdir)/ruby/internal/has/extension.h -bigdecimal.o: $(hdrdir)/ruby/internal/has/feature.h -bigdecimal.o: $(hdrdir)/ruby/internal/has/warning.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/array.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/bignum.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/class.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/compar.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/complex.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/cont.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/dir.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/enum.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/enumerator.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/error.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/eval.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/file.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/gc.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/hash.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/io.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/load.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/marshal.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/numeric.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/object.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/parse.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/proc.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/process.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/random.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/range.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/rational.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/re.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/ruby.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/select.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/select/largesize.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/signal.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/sprintf.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/string.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/struct.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/thread.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/time.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/variable.h -bigdecimal.o: $(hdrdir)/ruby/internal/intern/vm.h -bigdecimal.o: $(hdrdir)/ruby/internal/interpreter.h -bigdecimal.o: $(hdrdir)/ruby/internal/iterator.h -bigdecimal.o: $(hdrdir)/ruby/internal/memory.h -bigdecimal.o: $(hdrdir)/ruby/internal/method.h -bigdecimal.o: $(hdrdir)/ruby/internal/module.h -bigdecimal.o: $(hdrdir)/ruby/internal/newobj.h -bigdecimal.o: $(hdrdir)/ruby/internal/rgengc.h -bigdecimal.o: $(hdrdir)/ruby/internal/scan_args.h -bigdecimal.o: $(hdrdir)/ruby/internal/special_consts.h -bigdecimal.o: $(hdrdir)/ruby/internal/static_assert.h -bigdecimal.o: $(hdrdir)/ruby/internal/stdalign.h -bigdecimal.o: $(hdrdir)/ruby/internal/stdbool.h -bigdecimal.o: $(hdrdir)/ruby/internal/symbol.h -bigdecimal.o: $(hdrdir)/ruby/internal/value.h -bigdecimal.o: $(hdrdir)/ruby/internal/value_type.h -bigdecimal.o: $(hdrdir)/ruby/internal/variable.h -bigdecimal.o: $(hdrdir)/ruby/internal/warning_push.h -bigdecimal.o: $(hdrdir)/ruby/internal/xmalloc.h -bigdecimal.o: $(hdrdir)/ruby/missing.h -bigdecimal.o: $(hdrdir)/ruby/ruby.h -bigdecimal.o: $(hdrdir)/ruby/st.h -bigdecimal.o: $(hdrdir)/ruby/subst.h -bigdecimal.o: $(hdrdir)/ruby/util.h -bigdecimal.o: bigdecimal.c -bigdecimal.o: bigdecimal.h -bigdecimal.o: bits.h -bigdecimal.o: feature.h -bigdecimal.o: missing.h -bigdecimal.o: static_assert.h -missing.o: $(RUBY_EXTCONF_H) -missing.o: $(arch_hdrdir)/ruby/config.h -missing.o: $(hdrdir)/ruby/assert.h -missing.o: $(hdrdir)/ruby/atomic.h -missing.o: $(hdrdir)/ruby/backward.h -missing.o: $(hdrdir)/ruby/backward/2/assume.h -missing.o: $(hdrdir)/ruby/backward/2/attributes.h -missing.o: $(hdrdir)/ruby/backward/2/bool.h -missing.o: $(hdrdir)/ruby/backward/2/inttypes.h -missing.o: $(hdrdir)/ruby/backward/2/limits.h -missing.o: $(hdrdir)/ruby/backward/2/long_long.h -missing.o: $(hdrdir)/ruby/backward/2/stdalign.h -missing.o: $(hdrdir)/ruby/backward/2/stdarg.h -missing.o: $(hdrdir)/ruby/defines.h -missing.o: $(hdrdir)/ruby/intern.h -missing.o: $(hdrdir)/ruby/internal/abi.h -missing.o: $(hdrdir)/ruby/internal/anyargs.h -missing.o: $(hdrdir)/ruby/internal/arithmetic.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/char.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/double.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/int.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/long.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/short.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h -missing.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h -missing.o: $(hdrdir)/ruby/internal/assume.h -missing.o: $(hdrdir)/ruby/internal/attr/alloc_size.h -missing.o: $(hdrdir)/ruby/internal/attr/artificial.h -missing.o: $(hdrdir)/ruby/internal/attr/cold.h -missing.o: $(hdrdir)/ruby/internal/attr/const.h -missing.o: $(hdrdir)/ruby/internal/attr/constexpr.h -missing.o: $(hdrdir)/ruby/internal/attr/deprecated.h -missing.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h -missing.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h -missing.o: $(hdrdir)/ruby/internal/attr/error.h -missing.o: $(hdrdir)/ruby/internal/attr/flag_enum.h -missing.o: $(hdrdir)/ruby/internal/attr/forceinline.h -missing.o: $(hdrdir)/ruby/internal/attr/format.h -missing.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h -missing.o: $(hdrdir)/ruby/internal/attr/noalias.h -missing.o: $(hdrdir)/ruby/internal/attr/nodiscard.h -missing.o: $(hdrdir)/ruby/internal/attr/noexcept.h -missing.o: $(hdrdir)/ruby/internal/attr/noinline.h -missing.o: $(hdrdir)/ruby/internal/attr/nonnull.h -missing.o: $(hdrdir)/ruby/internal/attr/noreturn.h -missing.o: $(hdrdir)/ruby/internal/attr/pure.h -missing.o: $(hdrdir)/ruby/internal/attr/restrict.h -missing.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h -missing.o: $(hdrdir)/ruby/internal/attr/warning.h -missing.o: $(hdrdir)/ruby/internal/attr/weakref.h -missing.o: $(hdrdir)/ruby/internal/cast.h -missing.o: $(hdrdir)/ruby/internal/compiler_is.h -missing.o: $(hdrdir)/ruby/internal/compiler_is/apple.h -missing.o: $(hdrdir)/ruby/internal/compiler_is/clang.h -missing.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h -missing.o: $(hdrdir)/ruby/internal/compiler_is/intel.h -missing.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h -missing.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h -missing.o: $(hdrdir)/ruby/internal/compiler_since.h -missing.o: $(hdrdir)/ruby/internal/config.h -missing.o: $(hdrdir)/ruby/internal/constant_p.h -missing.o: $(hdrdir)/ruby/internal/core.h -missing.o: $(hdrdir)/ruby/internal/core/rarray.h -missing.o: $(hdrdir)/ruby/internal/core/rbasic.h -missing.o: $(hdrdir)/ruby/internal/core/rbignum.h -missing.o: $(hdrdir)/ruby/internal/core/rclass.h -missing.o: $(hdrdir)/ruby/internal/core/rdata.h -missing.o: $(hdrdir)/ruby/internal/core/rfile.h -missing.o: $(hdrdir)/ruby/internal/core/rhash.h -missing.o: $(hdrdir)/ruby/internal/core/robject.h -missing.o: $(hdrdir)/ruby/internal/core/rregexp.h -missing.o: $(hdrdir)/ruby/internal/core/rstring.h -missing.o: $(hdrdir)/ruby/internal/core/rstruct.h -missing.o: $(hdrdir)/ruby/internal/core/rtypeddata.h -missing.o: $(hdrdir)/ruby/internal/ctype.h -missing.o: $(hdrdir)/ruby/internal/dllexport.h -missing.o: $(hdrdir)/ruby/internal/dosish.h -missing.o: $(hdrdir)/ruby/internal/error.h -missing.o: $(hdrdir)/ruby/internal/eval.h -missing.o: $(hdrdir)/ruby/internal/event.h -missing.o: $(hdrdir)/ruby/internal/fl_type.h -missing.o: $(hdrdir)/ruby/internal/gc.h -missing.o: $(hdrdir)/ruby/internal/glob.h -missing.o: $(hdrdir)/ruby/internal/globals.h -missing.o: $(hdrdir)/ruby/internal/has/attribute.h -missing.o: $(hdrdir)/ruby/internal/has/builtin.h -missing.o: $(hdrdir)/ruby/internal/has/c_attribute.h -missing.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h -missing.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h -missing.o: $(hdrdir)/ruby/internal/has/extension.h -missing.o: $(hdrdir)/ruby/internal/has/feature.h -missing.o: $(hdrdir)/ruby/internal/has/warning.h -missing.o: $(hdrdir)/ruby/internal/intern/array.h -missing.o: $(hdrdir)/ruby/internal/intern/bignum.h -missing.o: $(hdrdir)/ruby/internal/intern/class.h -missing.o: $(hdrdir)/ruby/internal/intern/compar.h -missing.o: $(hdrdir)/ruby/internal/intern/complex.h -missing.o: $(hdrdir)/ruby/internal/intern/cont.h -missing.o: $(hdrdir)/ruby/internal/intern/dir.h -missing.o: $(hdrdir)/ruby/internal/intern/enum.h -missing.o: $(hdrdir)/ruby/internal/intern/enumerator.h -missing.o: $(hdrdir)/ruby/internal/intern/error.h -missing.o: $(hdrdir)/ruby/internal/intern/eval.h -missing.o: $(hdrdir)/ruby/internal/intern/file.h -missing.o: $(hdrdir)/ruby/internal/intern/gc.h -missing.o: $(hdrdir)/ruby/internal/intern/hash.h -missing.o: $(hdrdir)/ruby/internal/intern/io.h -missing.o: $(hdrdir)/ruby/internal/intern/load.h -missing.o: $(hdrdir)/ruby/internal/intern/marshal.h -missing.o: $(hdrdir)/ruby/internal/intern/numeric.h -missing.o: $(hdrdir)/ruby/internal/intern/object.h -missing.o: $(hdrdir)/ruby/internal/intern/parse.h -missing.o: $(hdrdir)/ruby/internal/intern/proc.h -missing.o: $(hdrdir)/ruby/internal/intern/process.h -missing.o: $(hdrdir)/ruby/internal/intern/random.h -missing.o: $(hdrdir)/ruby/internal/intern/range.h -missing.o: $(hdrdir)/ruby/internal/intern/rational.h -missing.o: $(hdrdir)/ruby/internal/intern/re.h -missing.o: $(hdrdir)/ruby/internal/intern/ruby.h -missing.o: $(hdrdir)/ruby/internal/intern/select.h -missing.o: $(hdrdir)/ruby/internal/intern/select/largesize.h -missing.o: $(hdrdir)/ruby/internal/intern/signal.h -missing.o: $(hdrdir)/ruby/internal/intern/sprintf.h -missing.o: $(hdrdir)/ruby/internal/intern/string.h -missing.o: $(hdrdir)/ruby/internal/intern/struct.h -missing.o: $(hdrdir)/ruby/internal/intern/thread.h -missing.o: $(hdrdir)/ruby/internal/intern/time.h -missing.o: $(hdrdir)/ruby/internal/intern/variable.h -missing.o: $(hdrdir)/ruby/internal/intern/vm.h -missing.o: $(hdrdir)/ruby/internal/interpreter.h -missing.o: $(hdrdir)/ruby/internal/iterator.h -missing.o: $(hdrdir)/ruby/internal/memory.h -missing.o: $(hdrdir)/ruby/internal/method.h -missing.o: $(hdrdir)/ruby/internal/module.h -missing.o: $(hdrdir)/ruby/internal/newobj.h -missing.o: $(hdrdir)/ruby/internal/rgengc.h -missing.o: $(hdrdir)/ruby/internal/scan_args.h -missing.o: $(hdrdir)/ruby/internal/special_consts.h -missing.o: $(hdrdir)/ruby/internal/static_assert.h -missing.o: $(hdrdir)/ruby/internal/stdalign.h -missing.o: $(hdrdir)/ruby/internal/stdbool.h -missing.o: $(hdrdir)/ruby/internal/symbol.h -missing.o: $(hdrdir)/ruby/internal/value.h -missing.o: $(hdrdir)/ruby/internal/value_type.h -missing.o: $(hdrdir)/ruby/internal/variable.h -missing.o: $(hdrdir)/ruby/internal/warning_push.h -missing.o: $(hdrdir)/ruby/internal/xmalloc.h -missing.o: $(hdrdir)/ruby/missing.h -missing.o: $(hdrdir)/ruby/ruby.h -missing.o: $(hdrdir)/ruby/st.h -missing.o: $(hdrdir)/ruby/subst.h -missing.o: missing.c -missing.o: missing/dtoa.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ext/bigdecimal/extconf.rb b/ext/bigdecimal/extconf.rb deleted file mode 100644 index 17e7905dd6..0000000000 --- a/ext/bigdecimal/extconf.rb +++ /dev/null @@ -1,87 +0,0 @@ -# frozen_string_literal: false -require 'mkmf' - -def check_bigdecimal_version(gemspec_path) - message "checking RUBY_BIGDECIMAL_VERSION... " - bigdecimal_version = File.read(gemspec_path).match(/^\s*s\.version\s+=\s+['"]([^'"]+)['"]\s*$/)[1] - - version_components = bigdecimal_version.split('.') - bigdecimal_version = version_components[0, 3].join('.') - bigdecimal_version << "-#{version_components[3]}" if version_components[3] - $defs << %Q[-DRUBY_BIGDECIMAL_VERSION=\\"#{bigdecimal_version}\\"] - - message "#{bigdecimal_version}\n" -end - -def have_builtin_func(name, check_expr, opt = "", &b) - checking_for checking_message(name.funcall_style, nil, opt) do - if try_compile(<<SRC, opt, &b) -int foo; -int main() { #{check_expr}; return 0; } -SRC - $defs.push(format("-DHAVE_BUILTIN_%s", name.tr_cpp)) - true - else - false - end - end -end - -gemspec_name = gemspec_path = nil -unless ['', '../../'].any? {|dir| - gemspec_name = "#{dir}bigdecimal.gemspec" - gemspec_path = File.expand_path("../#{gemspec_name}", __FILE__) - File.file?(gemspec_path) - } - $stderr.puts "Unable to find bigdecimal.gemspec" - abort -end - -check_bigdecimal_version(gemspec_path) - -have_builtin_func("__builtin_clz", "__builtin_clz(0)") -have_builtin_func("__builtin_clzl", "__builtin_clzl(0)") -have_builtin_func("__builtin_clzll", "__builtin_clzll(0)") - -have_header("float.h") -have_header("math.h") -have_header("stdbool.h") -have_header("stdlib.h") - -have_header("x86intrin.h") -have_func("_lzcnt_u32", "x86intrin.h") -have_func("_lzcnt_u64", "x86intrin.h") - -have_header("intrin.h") -have_func("__lzcnt", "intrin.h") -have_func("__lzcnt64", "intrin.h") -have_func("_BitScanReverse", "intrin.h") -have_func("_BitScanReverse64", "intrin.h") - -have_func("labs", "stdlib.h") -have_func("llabs", "stdlib.h") -have_func("finite", "math.h") -have_func("isfinite", "math.h") - -have_header("ruby/atomic.h") -have_header("ruby/internal/has/builtin.h") -have_header("ruby/internal/static_assert.h") - -have_func("rb_rational_num", "ruby.h") -have_func("rb_rational_den", "ruby.h") -have_func("rb_complex_real", "ruby.h") -have_func("rb_complex_imag", "ruby.h") -have_func("rb_opts_exception_p", "ruby.h") -have_func("rb_category_warn", "ruby.h") -have_const("RB_WARN_CATEGORY_DEPRECATED", "ruby.h") - -if File.file?(File.expand_path('../lib/bigdecimal.rb', __FILE__)) - bigdecimal_rb = "$(srcdir)/lib/bigdecimal.rb" -else - bigdecimal_rb = "$(srcdir)/../../lib/bigdecimal.rb" -end - -create_makefile('bigdecimal') {|mf| - mf << "GEMSPEC = #{gemspec_name}\n" - mf << "BIGDECIMAL_RB = #{bigdecimal_rb}\n" -} diff --git a/ext/bigdecimal/feature.h b/ext/bigdecimal/feature.h deleted file mode 100644 index f628514500..0000000000 --- a/ext/bigdecimal/feature.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef BIGDECIMAL_HAS_FEATURE_H -#define BIGDECIMAL_HAS_FEATURE_H - -/* ======== __has_feature ======== */ - -#ifndef __has_feature -# define __has_feature(_) 0 -#endif - -/* ======== __has_extension ======== */ - -#ifndef __has_extension -# define __has_extension __has_feature -#endif - -/* ======== __has_builtin ======== */ - -#ifdef HAVE_RUBY_INTERNAL_HAS_BUILTIN_H -# include <ruby/internal/has/builtin.h> -#endif - -#ifdef RBIMPL_HAS_BUILTIN -# define BIGDECIMAL_HAS_BUILTIN(...) RBIMPL_HAS_BUILTIN(__VA_ARGS__) - -#else -# /* The following section is copied from CRuby's builtin.h */ -# -# ifdef __has_builtin -# if defined(__INTEL_COMPILER) -# /* :TODO: Intel C Compiler has __has_builtin (since 19.1 maybe?), and is -# * reportedly broken. We have to skip them. However the situation can -# * change. They might improve someday. We need to revisit here later. */ -# elif defined(__GNUC__) && ! __has_builtin(__builtin_alloca) -# /* FreeBSD's <sys/cdefs.h> defines its own *broken* version of -# * __has_builtin. Cygwin copied that content to be a victim of the -# * broken-ness. We don't take them into account. */ -# else -# define HAVE___HAS_BUILTIN 1 -# endif -# endif -# -# if defined(HAVE___HAS_BUILTIN) -# define BIGDECIMAL_HAS_BUILTIN(_) __has_builtin(_) -# -# elif defined(__GNUC__) -# define BIGDECIMAL_HAS_BUILTIN(_) BIGDECIMAL_HAS_BUILTIN_ ## _ -# if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 6)) -# define BIGDECIMAL_HAS_BUILTIN___builtin_clz 1 -# define BIGDECIMAL_HAS_BUILTIN___builtin_clzl 1 -# else -# define BIGDECIMAL_HAS_BUILTIN___builtin_clz 0 -# define BIGDECIMAL_HAS_BUILTIN___builtin_clzl 0 -# endif -# elif defined(_MSC_VER) -# define BIGDECIMAL_HAS_BUILTIN(_) 0 -# -# else -# define BIGDECIMAL_HAS_BUILTIN(_) BIGDECIMAL_HAS_BUILTIN_ ## _ -# define BIGDECIMAL_HAS_BUILTIN___builtin_clz HAVE_BUILTIN___BUILTIN_CLZ -# define BIGDECIMAL_HAS_BUILTIN___builtin_clzl HAVE_BUILTIN___BUILTIN_CLZL -# endif -#endif /* RBIMPL_HAS_BUILTIN */ - -#ifndef __has_builtin -# define __has_builtin(...) BIGDECIMAL_HAS_BUILTIN(__VA_ARGS__) -#endif - -#endif /* BIGDECIMAL_HAS_FEATURE_H */ diff --git a/ext/bigdecimal/lib/bigdecimal.rb b/ext/bigdecimal/lib/bigdecimal.rb deleted file mode 100644 index 8fd2587c84..0000000000 --- a/ext/bigdecimal/lib/bigdecimal.rb +++ /dev/null @@ -1 +0,0 @@ -require 'bigdecimal.so' diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb deleted file mode 100644 index 4448024c74..0000000000 --- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb +++ /dev/null @@ -1,90 +0,0 @@ -# frozen_string_literal: false - -require 'bigdecimal' - -# require 'bigdecimal/jacobian' -# -# Provides methods to compute the Jacobian matrix of a set of equations at a -# point x. In the methods below: -# -# f is an Object which is used to compute the Jacobian matrix of the equations. -# It must provide the following methods: -# -# f.values(x):: returns the values of all functions at x -# -# f.zero:: returns 0.0 -# f.one:: 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. -# -# x is the point at which to compute the Jacobian. -# -# fx is f.values(x). -# -module Jacobian - module_function - - # Determines the equality of two numbers by comparing to zero, or using the epsilon value - def isEqual(a,b,zero=0.0,e=1.0e-8) - aa = a.abs - bb = b.abs - if aa == zero && bb == zero then - true - else - if ((a-b)/(aa+bb)).abs < e then - true - else - false - end - end - end - - - # Computes the derivative of +f[i]+ at +x[i]+. - # +fx+ is the value of +f+ at +x+. - def dfdxi(f,fx,x,i) - nRetry = 0 - n = x.size - xSave = x[i] - ok = 0 - ratio = f.ten*f.ten*f.ten - dx = x[i].abs/ratio - 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 - deriv = [] - nRetry += 1 - if nRetry > 100 - raise "Singular Jacobian matrix. No change at x[" + i.to_s + "]" - end - dx = dx*f.two - x[i] += dx - fxNew = f.values(x) - for j in 0...n do - if !isEqual(fxNew[j],fx[j],f.zero,f.eps) then - ok += 1 - deriv <<= (fxNew[j]-fx[j])/dx - else - deriv <<= f.zero - end - end - x[i] = xSave - end - deriv - end - - # Computes the Jacobian of +f+ at +x+. +fx+ is the value of +f+ at +x+. - def jacobian(f,fx,x) - n = x.size - dfdx = Array.new(n*n) - for i in 0...n do - df = dfdxi(f,fx,x,i) - for j in 0...n do - dfdx[j*n+i] = df[j] - end - end - dfdx - end -end diff --git a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb b/ext/bigdecimal/lib/bigdecimal/ludcmp.rb deleted file mode 100644 index dd265e482a..0000000000 --- a/ext/bigdecimal/lib/bigdecimal/ludcmp.rb +++ /dev/null @@ -1,89 +0,0 @@ -# frozen_string_literal: false -require 'bigdecimal' - -# -# Solves a*x = b for x, using LU decomposition. -# -module LUSolve - module_function - - # Performs LU decomposition of the n by n matrix a. - def ludecomp(a,n,zero=0,one=1) - prec = BigDecimal.limit(nil) - ps = [] - scales = [] - for i in 0...n do # pick up largest(abs. val.) element in each row. - ps <<= i - nrmrow = zero - ixn = i*n - for j in 0...n do - biggst = a[ixn+j].abs - nrmrow = biggst if biggst>nrmrow - end - if nrmrow>zero then - scales <<= one.div(nrmrow,prec) - else - raise "Singular matrix" - end - end - n1 = n - 1 - for k in 0...n1 do # Gaussian elimination with partial pivoting. - biggst = zero; - for i in k...n do - size = a[ps[i]*n+k].abs*scales[ps[i]] - if size>biggst then - biggst = size - pividx = i - end - end - raise "Singular matrix" if biggst<=zero - if pividx!=k then - j = ps[k] - ps[k] = ps[pividx] - ps[pividx] = j - end - pivot = a[ps[k]*n+k] - for i in (k+1)...n do - psin = ps[i]*n - a[psin+k] = mult = a[psin+k].div(pivot,prec) - if mult!=zero then - pskn = ps[k]*n - for j in (k+1)...n do - a[psin+j] -= mult.mult(a[pskn+j],prec) - end - end - end - end - raise "Singular matrix" if a[ps[n1]*n+n1] == zero - ps - end - - # Solves a*x = b for x, using LU decomposition. - # - # a is a matrix, b is a constant vector, x is the solution vector. - # - # ps is the pivot, a vector which indicates the permutation of rows performed - # during LU decomposition. - def lusolve(a,b,ps,zero=0.0) - prec = BigDecimal.limit(nil) - n = ps.size - x = [] - for i in 0...n do - dot = zero - psin = ps[i]*n - for j in 0...i do - dot = a[psin+j].mult(x[j],prec) + dot - end - x <<= b[ps[i]] - dot - end - (n-1).downto(0) do |i| - dot = zero - psin = ps[i]*n - for j in (i+1)...n do - dot = a[psin+j].mult(x[j],prec) + dot - end - x[i] = (x[i]-dot).div(a[psin+i],prec) - end - x - end -end diff --git a/ext/bigdecimal/lib/bigdecimal/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rb deleted file mode 100644 index 0b9d0648bb..0000000000 --- a/ext/bigdecimal/lib/bigdecimal/math.rb +++ /dev/null @@ -1,232 +0,0 @@ -# frozen_string_literal: false -require 'bigdecimal' - -# -#-- -# Contents: -# sqrt(x, prec) -# sin (x, prec) -# cos (x, prec) -# atan(x, prec) Note: |x|<1, x=0.9999 may not converge. -# PI (prec) -# E (prec) == exp(1.0,prec) -# -# where: -# x ... BigDecimal number to be computed. -# |x| must be small enough to get convergence. -# prec ... Number of digits to be obtained. -#++ -# -# Provides mathematical functions. -# -# Example: -# -# require "bigdecimal/math" -# -# include BigMath -# -# a = BigDecimal((PI(100)/2).to_s) -# puts sin(a,100) # => 0.99999999999999999999......e0 -# -module BigMath - module_function - - # call-seq: - # sqrt(decimal, numeric) -> BigDecimal - # - # Computes the square root of +decimal+ to the specified number of digits of - # precision, +numeric+. - # - # BigMath.sqrt(BigDecimal('2'), 16).to_s - # #=> "0.1414213562373095048801688724e1" - # - def sqrt(x, prec) - x.sqrt(prec) - end - - # 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" - # - def sin(x, prec) - raise ArgumentError, "Zero or negative precision for sin" if prec <= 0 - return BigDecimal("NaN") if x.infinite? || x.nan? - n = prec + BigDecimal.double_fig - one = BigDecimal("1") - two = BigDecimal("2") - x = -x if neg = x < 0 - if x > (twopi = two * BigMath.PI(prec)) - if x > 30 - x %= twopi - else - x -= twopi while x > twopi - end - end - x1 = x - x2 = x.mult(x,n) - sign = 1 - y = x - d = y - i = one - z = one - while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0) - m = BigDecimal.double_fig if m < BigDecimal.double_fig - sign = -sign - x1 = x2.mult(x1,n) - i += two - z *= (i-one) * i - d = sign * x1.div(z,m) - y += d - end - neg ? -y : y - end - - # 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" - # - def cos(x, prec) - raise ArgumentError, "Zero or negative precision for cos" if prec <= 0 - return BigDecimal("NaN") if x.infinite? || x.nan? - n = prec + BigDecimal.double_fig - one = BigDecimal("1") - two = BigDecimal("2") - x = -x if x < 0 - if x > (twopi = two * BigMath.PI(prec)) - if x > 30 - x %= twopi - else - x -= twopi while x > twopi - end - end - x1 = one - x2 = x.mult(x,n) - sign = 1 - y = one - d = y - i = BigDecimal("0") - z = one - while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0) - m = BigDecimal.double_fig if m < BigDecimal.double_fig - sign = -sign - x1 = x2.mult(x1,n) - i += two - z *= (i-one) * i - d = sign * x1.div(z,m) - y += d - end - y - end - - # 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('-1'), 16).to_s - # #=> "-0.785398163397448309615660845819878471907514682065e0" - # - def atan(x, prec) - raise ArgumentError, "Zero or negative precision for atan" if prec <= 0 - return BigDecimal("NaN") if x.nan? - pi = PI(prec) - x = -x if neg = x < 0 - return pi.div(neg ? -2 : 2, prec) if x.infinite? - return pi / (neg ? -4 : 4) if x.round(prec) == 1 - x = BigDecimal("1").div(x, prec) if inv = x > 1 - x = (-1 + sqrt(1 + x**2, prec))/x if dbl = x > 0.5 - n = prec + BigDecimal.double_fig - y = x - d = y - t = x - r = BigDecimal("3") - x2 = x.mult(x,n) - while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0) - m = BigDecimal.double_fig if m < BigDecimal.double_fig - t = -t.mult(x2,n) - d = t.div(r,m) - y += d - r += 2 - end - y *= 2 if dbl - y = pi / 2 - y if inv - y = -y if neg - y - end - - # 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 precision for PI" if prec <= 0 - n = prec + BigDecimal.double_fig - zero = BigDecimal("0") - one = BigDecimal("1") - two = BigDecimal("2") - - m25 = BigDecimal("-0.04") - m57121 = BigDecimal("-57121") - - pi = zero - - d = one - k = one - t = BigDecimal("-80") - while d.nonzero? && ((m = n - (pi.exponent - d.exponent).abs) > 0) - m = BigDecimal.double_fig if m < BigDecimal.double_fig - t = t*m25 - d = t.div(k,m) - k = k+two - pi = pi + d - end - - d = one - k = one - t = BigDecimal("956") - while d.nonzero? && ((m = n - (pi.exponent - d.exponent).abs) > 0) - m = BigDecimal.double_fig if m < BigDecimal.double_fig - t = t.div(m57121,n) - d = t.div(k,m) - pi = pi + d - k = k+two - end - pi - end - - # call-seq: - # E(numeric) -> BigDecimal - # - # Computes e (the base of natural logarithms) to the specified number of - # 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 - BigMath.exp(1, prec) - end -end diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb deleted file mode 100644 index 85bacb7f2e..0000000000 --- a/ext/bigdecimal/lib/bigdecimal/newton.rb +++ /dev/null @@ -1,80 +0,0 @@ -# frozen_string_literal: false -require "bigdecimal/ludcmp" -require "bigdecimal/jacobian" - -# -# newton.rb -# -# Solves the nonlinear algebraic equation system f = 0 by Newton's method. -# This program is not dependent on BigDecimal. -# -# To call: -# n = nlsolve(f,x) -# where n is the number of iterations required, -# x is the initial value vector -# f is an Object which is used to compute the values of the equations to be solved. -# It must provide the following methods: -# -# f.values(x):: returns the values of all functions at x -# -# f.zero:: returns 0.0 -# f.one:: 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. -# -# On exit, x is the solution vector. -# -module Newton - include LUSolve - include Jacobian - module_function - - def norm(fv,zero=0.0) # :nodoc: - s = zero - n = fv.size - for i in 0...n do - s += fv[i]*fv[i] - end - s - end - - # See also Newton - def nlsolve(f,x) - nRetry = 0 - n = x.size - - f0 = f.values(x) - zero = f.zero - one = f.one - two = f.two - p5 = one/two - d = norm(f0,zero) - minfact = f.ten*f.ten*f.ten - minfact = one/minfact - e = f.eps - while d >= e do - nRetry += 1 - # Not yet converged. => Compute Jacobian matrix - dfdx = jacobian(f,f0,x) - # Solve dfdx*dx = -f0 to estimate dx - dx = lusolve(dfdx,f0,ludecomp(dfdx,n,zero,one),zero) - fact = two - xs = x.dup - begin - fact *= p5 - if fact < minfact then - raise "Failed to reduce function values." - end - for i in 0...n do - x[i] = xs[i] - dx[i]*fact - end - f0 = f.values(x) - dn = norm(f0,zero) - end while(dn>=d) - d = dn - end - nRetry - end -end diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb deleted file mode 100644 index ad92f7cfe6..0000000000 --- a/ext/bigdecimal/lib/bigdecimal/util.rb +++ /dev/null @@ -1,185 +0,0 @@ -# frozen_string_literal: false -# -#-- -# bigdecimal/util extends various native classes to provide the #to_d method, -# and provides BigDecimal#to_d and BigDecimal#to_digits. -#++ - -require 'bigdecimal' - -class Integer < Numeric - # call-seq: - # int.to_d -> bigdecimal - # - # Returns the value of +int+ as a BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # 42.to_d # => 0.42e2 - # - # See also BigDecimal::new. - # - def to_d - BigDecimal(self) - end -end - - -class Float < Numeric - # call-seq: - # float.to_d -> bigdecimal - # float.to_d(precision) -> bigdecimal - # - # Returns the value of +float+ as a BigDecimal. - # The +precision+ parameter is used to determine the number of - # significant digits for the result. When +precision+ is set to +0+, - # the number of digits to represent the float being converted is determined - # automatically. - # The default +precision+ is +0+. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # 0.5.to_d # => 0.5e0 - # 1.234.to_d # => 0.1234e1 - # 1.234.to_d(2) # => 0.12e1 - # - # See also BigDecimal::new. - # - def to_d(precision=0) - BigDecimal(self, precision) - end -end - - -class String - # call-seq: - # str.to_d -> bigdecimal - # - # Returns the result of interpreting leading characters in +str+ - # as a BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # "0.5".to_d # => 0.5e0 - # "123.45e1".to_d # => 0.12345e4 - # "45.67 degrees".to_d # => 0.4567e2 - # - # See also BigDecimal::new. - # - def to_d - BigDecimal.interpret_loosely(self) - end -end - - -class BigDecimal < Numeric - # call-seq: - # a.to_digits -> string - # - # Converts a BigDecimal to a String of the form "nnnnnn.mmm". - # This method is deprecated; use BigDecimal#to_s("F") instead. - # - # require 'bigdecimal/util' - # - # d = BigDecimal("3.14") - # d.to_digits # => "3.14" - # - def to_digits - if self.nan? || self.infinite? || self.zero? - self.to_s - else - i = self.to_i.to_s - _,f,_,z = self.frac.split - i + "." + ("0"*(-z)) + f - end - end - - # call-seq: - # a.to_d -> bigdecimal - # - # Returns self. - # - # require 'bigdecimal/util' - # - # d = BigDecimal("3.14") - # d.to_d # => 0.314e1 - # - def to_d - self - end -end - - -class Rational < Numeric - # call-seq: - # rat.to_d(precision) -> bigdecimal - # - # Returns the value as a BigDecimal. - # - # The required +precision+ parameter is used to determine the number of - # significant digits for the result. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # Rational(22, 7).to_d(3) # => 0.314e1 - # - # See also BigDecimal::new. - # - def to_d(precision) - BigDecimal(self, precision) - end -end - - -class Complex < Numeric - # call-seq: - # cmp.to_d -> bigdecimal - # cmp.to_d(precision) -> bigdecimal - # - # Returns the value as a BigDecimal. - # - # The +precision+ parameter is required for a rational complex number. - # This parameter is used to determine the number of significant digits - # for the result. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # Complex(0.1234567, 0).to_d(4) # => 0.1235e0 - # Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1 - # - # See also BigDecimal::new. - # - def to_d(*args) - BigDecimal(self) unless self.imag.zero? # to raise eerror - - if args.length == 0 - case self.real - when Rational - BigDecimal(self.real) # to raise error - end - end - self.real.to_d(*args) - end -end - - -class NilClass - # call-seq: - # nil.to_d -> bigdecimal - # - # Returns nil represented as a BigDecimal. - # - # require 'bigdecimal' - # require 'bigdecimal/util' - # - # nil.to_d # => 0.0 - # - def to_d - BigDecimal(0) - end -end diff --git a/ext/bigdecimal/missing.c b/ext/bigdecimal/missing.c deleted file mode 100644 index 703232d92f..0000000000 --- a/ext/bigdecimal/missing.c +++ /dev/null @@ -1,27 +0,0 @@ -#include <ruby/ruby.h> - -#ifdef HAVE_RUBY_ATOMIC_H -# include <ruby/atomic.h> -#endif - -#ifdef RUBY_ATOMIC_PTR_CAS -# define ATOMIC_PTR_CAS(var, old, new) RUBY_ATOMIC_PTR_CAS(var, old, new) -#endif - -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -/* GCC warns about unknown sanitizer, which is annoying. */ -# undef NO_SANITIZE -# define NO_SANITIZE(x, y) \ - _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic ignored \"-Wattributes\"") \ - __attribute__((__no_sanitize__(x))) y; \ - _Pragma("GCC diagnostic pop") -#endif - -#undef strtod -#define strtod BigDecimal_strtod -#undef dtoa -#define dtoa BigDecimal_dtoa -#undef hdtoa -#define hdtoa BigDecimal_hdtoa -#include "missing/dtoa.c" diff --git a/ext/bigdecimal/missing.h b/ext/bigdecimal/missing.h deleted file mode 100644 index 325554b5f5..0000000000 --- a/ext/bigdecimal/missing.h +++ /dev/null @@ -1,196 +0,0 @@ -#ifndef MISSING_H -#define MISSING_H 1 - -#if defined(__cplusplus) -extern "C" { -#if 0 -} /* satisfy cc-mode */ -#endif -#endif - -#ifdef HAVE_STDLIB_H -# include <stdlib.h> -#endif - -#ifdef HAVE_MATH_H -# include <math.h> -#endif - -#ifndef RB_UNUSED_VAR -# if defined(_MSC_VER) && _MSC_VER >= 1911 -# define RB_UNUSED_VAR(x) x [[maybe_unused]] - -# elif defined(__has_cpp_attribute) && __has_cpp_attribute(maybe_unused) -# define RB_UNUSED_VAR(x) x [[maybe_unused]] - -# elif defined(__has_c_attribute) && __has_c_attribute(maybe_unused) -# define RB_UNUSED_VAR(x) x [[maybe_unused]] - -# elif defined(__GNUC__) -# define RB_UNUSED_VAR(x) x __attribute__ ((unused)) - -# else -# define RB_UNUSED_VAR(x) x -# endif -#endif /* RB_UNUSED_VAR */ - -#if defined(_MSC_VER) && _MSC_VER >= 1310 -# define HAVE___ASSUME 1 - -#elif defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1300 -# define HAVE___ASSUME 1 -#endif - -#ifndef UNREACHABLE -# if __has_builtin(__builtin_unreachable) -# define UNREACHABLE __builtin_unreachable() - -# elif defined(HAVE___ASSUME) -# define UNREACHABLE __assume(0) - -# else -# define UNREACHABLE /* unreachable */ -# endif -#endif /* UNREACHABLE */ - -/* bool */ - -#if defined(__bool_true_false_are_defined) -# /* Take that. */ - -#elif defined(HAVE_STDBOOL_H) -# include <stdbool.h> - -#else -typedef unsigned char _Bool; -# define bool _Bool -# define true ((_Bool)+1) -# define false ((_Bool)-1) -# define __bool_true_false_are_defined -#endif - -/* abs */ - -#ifndef HAVE_LABS -static inline long -labs(long const x) -{ - if (x < 0) return -x; - return x; -} -#endif - -#ifndef HAVE_LLABS -static inline LONG_LONG -llabs(LONG_LONG const x) -{ - if (x < 0) return -x; - return x; -} -#endif - -#ifdef vabs -# undef vabs -#endif -#if SIZEOF_VALUE <= SIZEOF_INT -# define vabs abs -#elif SIZEOF_VALUE <= SIZEOF_LONG -# define vabs labs -#elif SIZEOF_VALUE <= SIZEOF_LONG_LONG -# define vabs llabs -#endif - -/* finite */ - -#ifndef HAVE_FINITE -static int -finite(double) -{ - return !isnan(n) && !isinf(n); -} -#endif - -#ifndef isfinite -# ifndef HAVE_ISFINITE -# define HAVE_ISFINITE 1 -# define isfinite(x) finite(x) -# endif -#endif - -/* dtoa */ -char *BigDecimal_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve); - -/* rational */ - -#ifndef HAVE_RB_RATIONAL_NUM -static inline VALUE -rb_rational_num(VALUE rat) -{ -#ifdef RRATIONAL - return RRATIONAL(rat)->num; -#else - return rb_funcall(rat, rb_intern("numerator"), 0); -#endif -} -#endif - -#ifndef HAVE_RB_RATIONAL_DEN -static inline VALUE -rb_rational_den(VALUE rat) -{ -#ifdef RRATIONAL - return RRATIONAL(rat)->den; -#else - return rb_funcall(rat, rb_intern("denominator"), 0); -#endif -} -#endif - -/* complex */ - -#ifndef HAVE_RB_COMPLEX_REAL -static inline VALUE -rb_complex_real(VALUE cmp) -{ -#ifdef RCOMPLEX - return RCOMPLEX(cmp)->real; -#else - return rb_funcall(cmp, rb_intern("real"), 0); -#endif -} -#endif - -#ifndef HAVE_RB_COMPLEX_IMAG -static inline VALUE -rb_complex_imag(VALUE cmp) -{ -# ifdef RCOMPLEX - return RCOMPLEX(cmp)->imag; -# else - return rb_funcall(cmp, rb_intern("imag"), 0); -# endif -} -#endif - -/* st */ - -#ifndef ST2FIX -# undef RB_ST2FIX -# define RB_ST2FIX(h) LONG2FIX((long)(h)) -# define ST2FIX(h) RB_ST2FIX(h) -#endif - -/* warning */ - -#if !defined(HAVE_RB_CATEGORY_WARN) || !defined(HAVE_CONST_RB_WARN_CATEGORY_DEPRECATED) -# define rb_category_warn(category, ...) rb_warn(__VA_ARGS__) -#endif - -#if defined(__cplusplus) -#if 0 -{ /* satisfy cc-mode */ -#endif -} /* extern "C" { */ -#endif - -#endif /* MISSING_H */ diff --git a/ext/bigdecimal/missing/dtoa.c b/ext/bigdecimal/missing/dtoa.c deleted file mode 100644 index 41b0a221d1..0000000000 --- a/ext/bigdecimal/missing/dtoa.c +++ /dev/null @@ -1,3462 +0,0 @@ -/**************************************************************** - * - * The author of this software is David M. Gay. - * - * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software and in all copies of the supporting - * documentation for such software. - * - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY - * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY - * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - * - ***************************************************************/ - -/* Please send bug reports to David M. Gay (dmg at acm dot org, - * with " at " changed at "@" and " dot " changed to "."). */ - -/* On a machine with IEEE extended-precision registers, it is - * necessary to specify double-precision (53-bit) rounding precision - * before invoking strtod or dtoa. If the machine uses (the equivalent - * of) Intel 80x87 arithmetic, the call - * _control87(PC_53, MCW_PC); - * does this with many compilers. Whether this or another call is - * appropriate depends on the compiler; for this to work, it may be - * necessary to #include "float.h" or another system-dependent header - * file. - */ - -/* strtod for IEEE-, VAX-, and IBM-arithmetic machines. - * - * This strtod returns a nearest machine number to the input decimal - * string (or sets errno to ERANGE). With IEEE arithmetic, ties are - * broken by the IEEE round-even rule. Otherwise ties are broken by - * biased rounding (add half and chop). - * - * Inspired loosely by William D. Clinger's paper "How to Read Floating - * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. - * - * Modifications: - * - * 1. We only require IEEE, IBM, or VAX double-precision - * arithmetic (not IEEE double-extended). - * 2. We get by with floating-point arithmetic in a case that - * Clinger missed -- when we're computing d * 10^n - * for a small integer d and the integer n is not too - * much larger than 22 (the maximum integer k for which - * we can represent 10^k exactly), we may be able to - * compute (d*10^k) * 10^(e-k) with just one roundoff. - * 3. Rather than a bit-at-a-time adjustment of the binary - * result in the hard case, we use floating-point - * arithmetic to determine the adjustment to within - * one bit; only in really hard cases do we need to - * compute a second residual. - * 4. Because of 3., we don't need a large table of powers of 10 - * for ten-to-e (just some small tables, e.g. of 10^k - * for 0 <= k <= 22). - */ - -/* - * #define IEEE_LITTLE_ENDIAN for IEEE-arithmetic machines where the least - * significant byte has the lowest address. - * #define IEEE_BIG_ENDIAN for IEEE-arithmetic machines where the most - * significant byte has the lowest address. - * #define Long int on machines with 32-bit ints and 64-bit longs. - * #define IBM for IBM mainframe-style floating-point arithmetic. - * #define VAX for VAX-style floating-point arithmetic (D_floating). - * #define No_leftright to omit left-right logic in fast floating-point - * computation of dtoa. - * #define Honor_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 - * and strtod and dtoa should round accordingly. - * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3 - * and Honor_FLT_ROUNDS is not #defined. - * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines - * that use extended-precision instructions to compute rounded - * products and quotients) with IBM. - * #define ROUND_BIASED for IEEE-format with biased rounding. - * #define Inaccurate_Divide for IEEE-format with correctly rounded - * products but inaccurate quotients, e.g., for Intel i860. - * #define NO_LONG_LONG on machines that do not have a "long long" - * integer type (of >= 64 bits). On such machines, you can - * #define Just_16 to store 16 bits per 32-bit Long when doing - * high-precision integer arithmetic. Whether this speeds things - * up or slows things down depends on the machine and the number - * being converted. If long long is available and the name is - * something other than "long long", #define Llong to be the name, - * and if "unsigned Llong" does not work as an unsigned version of - * Llong, #define #ULLong to be the corresponding unsigned type. - * #define KR_headers for old-style C function headers. - * #define Bad_float_h if your system lacks a float.h or if it does not - * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, - * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. - * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) - * if memory is available and otherwise does something you deem - * appropriate. If MALLOC is undefined, malloc will be invoked - * directly -- and assumed always to succeed. - * #define Omit_Private_Memory to omit logic (added Jan. 1998) for making - * memory allocations from a private pool of memory when possible. - * When used, the private pool is PRIVATE_MEM bytes long: 2304 bytes, - * unless #defined to be a different length. This default length - * suffices to get rid of MALLOC calls except for unusual cases, - * such as decimal-to-binary conversion of a very long string of - * digits. The longest string dtoa can return is about 751 bytes - * long. For conversions by strtod of strings of 800 digits and - * all dtoa conversions in single-threaded executions with 8-byte - * pointers, PRIVATE_MEM >= 7400 appears to suffice; with 4-byte - * pointers, PRIVATE_MEM >= 7112 appears adequate. - * #define INFNAN_CHECK on IEEE systems to cause strtod to check for - * Infinity and NaN (case insensitively). On some systems (e.g., - * some HP systems), it may be necessary to #define NAN_WORD0 - * appropriately -- to the most significant word of a quiet NaN. - * (On HP Series 700/800 machines, -DNAN_WORD0=0x7ff40000 works.) - * When INFNAN_CHECK is #defined and No_Hex_NaN is not #defined, - * strtod also accepts (case insensitively) strings of the form - * NaN(x), where x is a string of hexadecimal digits and spaces; - * if there is only one string of hexadecimal digits, it is taken - * for the 52 fraction bits of the resulting NaN; if there are two - * or more strings of hex digits, the first is for the high 20 bits, - * the second and subsequent for the low 32 bits, with intervening - * white space ignored; but if this results in none of the 52 - * fraction bits being on (an IEEE Infinity symbol), then NAN_WORD0 - * and NAN_WORD1 are used instead. - * #define MULTIPLE_THREADS if the system offers preemptively scheduled - * multiple threads. In this case, you must provide (or suitably - * #define) two locks, acquired by ACQUIRE_DTOA_LOCK(n) and freed - * by FREE_DTOA_LOCK(n) for n = 0 or 1. (The second lock, accessed - * in pow5mult, ensures lazy evaluation of only one copy of high - * powers of 5; omitting this lock would introduce a small - * probability of wasting memory, but would otherwise be harmless.) - * You must also invoke freedtoa(s) to free the value s returned by - * dtoa. You may do so whether or not MULTIPLE_THREADS is #defined. - * #define NO_IEEE_Scale to disable new (Feb. 1997) logic in strtod that - * avoids underflows on inputs whose result does not underflow. - * If you #define NO_IEEE_Scale on a machine that uses IEEE-format - * floating-point numbers and flushes underflows to zero rather - * than implementing gradual underflow, then you must also #define - * Sudden_Underflow. - * #define YES_ALIAS to permit aliasing certain double values with - * arrays of ULongs. This leads to slightly better code with - * some compilers and was always used prior to 19990916, but it - * is not strictly legal and can cause trouble with aggressively - * optimizing compilers (e.g., gcc 2.95.1 under -O2). - * #define USE_LOCALE to use the current locale's decimal_point value. - * #define SET_INEXACT if IEEE arithmetic is being used and extra - * computation should be done to set the inexact flag when the - * result is inexact and avoid setting inexact when the result - * is exact. In this case, dtoa.c must be compiled in - * an environment, perhaps provided by #include "dtoa.c" in a - * suitable wrapper, that defines two functions, - * int get_inexact(void); - * void clear_inexact(void); - * such that get_inexact() returns a nonzero value if the - * inexact bit is already set, and clear_inexact() sets the - * inexact bit to 0. When SET_INEXACT is #defined, strtod - * also does extra computations to set the underflow and overflow - * flags when appropriate (i.e., when the result is tiny and - * inexact or when it is a numeric value rounded to +-infinity). - * #define NO_ERRNO if strtod should not assign errno = ERANGE when - * the result overflows to +-Infinity or underflows to 0. - */ - -#ifdef WORDS_BIGENDIAN -#define IEEE_BIG_ENDIAN -#else -#define IEEE_LITTLE_ENDIAN -#endif - -#ifdef __vax__ -#define VAX -#undef IEEE_BIG_ENDIAN -#undef IEEE_LITTLE_ENDIAN -#endif - -#if defined(__arm__) && !defined(__VFP_FP__) -#define IEEE_BIG_ENDIAN -#undef IEEE_LITTLE_ENDIAN -#endif - -#undef Long -#undef ULong - -#include <limits.h> - -#if (INT_MAX >> 30) && !(INT_MAX >> 31) -#define Long int -#define ULong unsigned int -#elif (LONG_MAX >> 30) && !(LONG_MAX >> 31) -#define Long long int -#define ULong unsigned long int -#else -#error No 32bit integer -#endif - -#if HAVE_LONG_LONG -#define Llong LONG_LONG -#else -#define NO_LONG_LONG -#endif - -#ifdef DEBUG -#include <stdio.h> -#define Bug(x) {fprintf(stderr, "%s\n", (x)); exit(EXIT_FAILURE);} -#endif - -#ifndef ISDIGIT -#include <ctype.h> -#define ISDIGIT(c) isdigit(c) -#endif -#include <errno.h> -#include <stdlib.h> -#include <string.h> - -#ifdef USE_LOCALE -#include <locale.h> -#endif - -#ifdef MALLOC -extern void *MALLOC(size_t); -#else -#define MALLOC xmalloc -#endif -#ifdef FREE -extern void FREE(void*); -#else -#define FREE xfree -#endif -#ifndef NO_SANITIZE -#define NO_SANITIZE(x, y) y -#endif - -#ifndef Omit_Private_Memory -#ifndef PRIVATE_MEM -#define PRIVATE_MEM 2304 -#endif -#define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double)) -static double private_mem[PRIVATE_mem], *pmem_next = private_mem; -#endif - -#undef IEEE_Arith -#undef Avoid_Underflow -#ifdef IEEE_BIG_ENDIAN -#define IEEE_Arith -#endif -#ifdef IEEE_LITTLE_ENDIAN -#define IEEE_Arith -#endif - -#ifdef Bad_float_h - -#ifdef IEEE_Arith -#define DBL_DIG 15 -#define DBL_MAX_10_EXP 308 -#define DBL_MAX_EXP 1024 -#define FLT_RADIX 2 -#endif /*IEEE_Arith*/ - -#ifdef IBM -#define DBL_DIG 16 -#define DBL_MAX_10_EXP 75 -#define DBL_MAX_EXP 63 -#define FLT_RADIX 16 -#define DBL_MAX 7.2370055773322621e+75 -#endif - -#ifdef VAX -#define DBL_DIG 16 -#define DBL_MAX_10_EXP 38 -#define DBL_MAX_EXP 127 -#define FLT_RADIX 2 -#define DBL_MAX 1.7014118346046923e+38 -#endif - -#ifndef LONG_MAX -#define LONG_MAX 2147483647 -#endif - -#else /* ifndef Bad_float_h */ -#include <float.h> -#endif /* Bad_float_h */ - -#include <math.h> - -#ifdef __cplusplus -extern "C" { -#if 0 -} /* satisfy cc-mode */ -#endif -#endif - -#ifndef hexdigit -static const char hexdigit[] = "0123456789abcdef0123456789ABCDEF"; -#endif - -#if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) + defined(VAX) + defined(IBM) != 1 -Exactly one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined. -#endif - -typedef union { double d; ULong L[2]; } U; - -#ifdef YES_ALIAS -typedef double double_u; -# define dval(x) (x) -# ifdef IEEE_LITTLE_ENDIAN -# define word0(x) (((ULong *)&(x))[1]) -# define word1(x) (((ULong *)&(x))[0]) -# else -# define word0(x) (((ULong *)&(x))[0]) -# define word1(x) (((ULong *)&(x))[1]) -# endif -#else -typedef U double_u; -# ifdef IEEE_LITTLE_ENDIAN -# define word0(x) ((x).L[1]) -# define word1(x) ((x).L[0]) -# else -# define word0(x) ((x).L[0]) -# define word1(x) ((x).L[1]) -# endif -# define dval(x) ((x).d) -#endif - -/* The following definition of Storeinc is appropriate for MIPS processors. - * An alternative that might be better on some machines is - * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) - */ -#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(__arm__) -#define Storeinc(a,b,c) (((unsigned short *)(a))[1] = (unsigned short)(b), \ -((unsigned short *)(a))[0] = (unsigned short)(c), (a)++) -#else -#define Storeinc(a,b,c) (((unsigned short *)(a))[0] = (unsigned short)(b), \ -((unsigned short *)(a))[1] = (unsigned short)(c), (a)++) -#endif - -/* #define P DBL_MANT_DIG */ -/* Ten_pmax = floor(P*log(2)/log(5)) */ -/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ -/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ -/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ - -#ifdef IEEE_Arith -#define Exp_shift 20 -#define Exp_shift1 20 -#define Exp_msk1 0x100000 -#define Exp_msk11 0x100000 -#define Exp_mask 0x7ff00000 -#define P 53 -#define Bias 1023 -#define Emin (-1022) -#define Exp_1 0x3ff00000 -#define Exp_11 0x3ff00000 -#define Ebits 11 -#define Frac_mask 0xfffff -#define Frac_mask1 0xfffff -#define Ten_pmax 22 -#define Bletch 0x10 -#define Bndry_mask 0xfffff -#define Bndry_mask1 0xfffff -#define LSB 1 -#define Sign_bit 0x80000000 -#define Log2P 1 -#define Tiny0 0 -#define Tiny1 1 -#define Quick_max 14 -#define Int_max 14 -#ifndef NO_IEEE_Scale -#define Avoid_Underflow -#ifdef Flush_Denorm /* debugging option */ -#undef Sudden_Underflow -#endif -#endif - -#ifndef Flt_Rounds -#ifdef FLT_ROUNDS -#define Flt_Rounds FLT_ROUNDS -#else -#define Flt_Rounds 1 -#endif -#endif /*Flt_Rounds*/ - -#ifdef Honor_FLT_ROUNDS -#define Rounding rounding -#undef Check_FLT_ROUNDS -#define Check_FLT_ROUNDS -#else -#define Rounding Flt_Rounds -#endif - -#else /* ifndef IEEE_Arith */ -#undef Check_FLT_ROUNDS -#undef Honor_FLT_ROUNDS -#undef SET_INEXACT -#undef Sudden_Underflow -#define Sudden_Underflow -#ifdef IBM -#undef Flt_Rounds -#define Flt_Rounds 0 -#define Exp_shift 24 -#define Exp_shift1 24 -#define Exp_msk1 0x1000000 -#define Exp_msk11 0x1000000 -#define Exp_mask 0x7f000000 -#define P 14 -#define Bias 65 -#define Exp_1 0x41000000 -#define Exp_11 0x41000000 -#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ -#define Frac_mask 0xffffff -#define Frac_mask1 0xffffff -#define Bletch 4 -#define Ten_pmax 22 -#define Bndry_mask 0xefffff -#define Bndry_mask1 0xffffff -#define LSB 1 -#define Sign_bit 0x80000000 -#define Log2P 4 -#define Tiny0 0x100000 -#define Tiny1 0 -#define Quick_max 14 -#define Int_max 15 -#else /* VAX */ -#undef Flt_Rounds -#define Flt_Rounds 1 -#define Exp_shift 23 -#define Exp_shift1 7 -#define Exp_msk1 0x80 -#define Exp_msk11 0x800000 -#define Exp_mask 0x7f80 -#define P 56 -#define Bias 129 -#define Exp_1 0x40800000 -#define Exp_11 0x4080 -#define Ebits 8 -#define Frac_mask 0x7fffff -#define Frac_mask1 0xffff007f -#define Ten_pmax 24 -#define Bletch 2 -#define Bndry_mask 0xffff007f -#define Bndry_mask1 0xffff007f -#define LSB 0x10000 -#define Sign_bit 0x8000 -#define Log2P 1 -#define Tiny0 0x80 -#define Tiny1 0 -#define Quick_max 15 -#define Int_max 15 -#endif /* IBM, VAX */ -#endif /* IEEE_Arith */ - -#ifndef IEEE_Arith -#define ROUND_BIASED -#endif - -#ifdef RND_PRODQUOT -#define rounded_product(a,b) ((a) = rnd_prod((a), (b))) -#define rounded_quotient(a,b) ((a) = rnd_quot((a), (b))) -extern double rnd_prod(double, double), rnd_quot(double, double); -#else -#define rounded_product(a,b) ((a) *= (b)) -#define rounded_quotient(a,b) ((a) /= (b)) -#endif - -#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) -#define Big1 0xffffffff - -#ifndef Pack_32 -#define Pack_32 -#endif - -#define FFFFFFFF 0xffffffffUL - -#ifdef NO_LONG_LONG -#undef ULLong -#ifdef Just_16 -#undef Pack_32 -/* When Pack_32 is not defined, we store 16 bits per 32-bit Long. - * This makes some inner loops simpler and sometimes saves work - * during multiplications, but it often seems to make things slightly - * slower. Hence the default is now to store 32 bits per Long. - */ -#endif -#else /* long long available */ -#ifndef Llong -#define Llong long long -#endif -#ifndef ULLong -#define ULLong unsigned Llong -#endif -#endif /* NO_LONG_LONG */ - -#define MULTIPLE_THREADS 1 - -#ifndef MULTIPLE_THREADS -#define ACQUIRE_DTOA_LOCK(n) /*nothing*/ -#define FREE_DTOA_LOCK(n) /*nothing*/ -#else -#define ACQUIRE_DTOA_LOCK(n) /*unused right now*/ -#define FREE_DTOA_LOCK(n) /*unused right now*/ -#endif - -#ifndef ATOMIC_PTR_CAS -#define ATOMIC_PTR_CAS(var, old, new) ((var) = (new), (old)) -#endif -#ifndef LIKELY -#define LIKELY(x) (x) -#endif -#ifndef UNLIKELY -#define UNLIKELY(x) (x) -#endif -#ifndef ASSUME -#define ASSUME(x) (void)(x) -#endif - -#define Kmax 15 - -struct Bigint { - struct Bigint *next; - int k, maxwds, sign, wds; - ULong x[1]; -}; - -typedef struct Bigint Bigint; - -static Bigint *freelist[Kmax+1]; - -static Bigint * -Balloc(int k) -{ - int x; - Bigint *rv; -#ifndef Omit_Private_Memory - size_t len; -#endif - - rv = 0; - ACQUIRE_DTOA_LOCK(0); - if (k <= Kmax) { - rv = freelist[k]; - while (rv) { - Bigint *rvn = rv; - rv = ATOMIC_PTR_CAS(freelist[k], rv, rv->next); - if (LIKELY(rvn == rv)) { - ASSUME(rv); - break; - } - } - } - if (!rv) { - x = 1 << k; -#ifdef Omit_Private_Memory - rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong)); -#else - len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) - /sizeof(double); - if (k <= Kmax) { - double *pnext = pmem_next; - while (pnext - private_mem + len <= PRIVATE_mem) { - double *p = pnext; - pnext = ATOMIC_PTR_CAS(pmem_next, pnext, pnext + len); - if (LIKELY(p == pnext)) { - rv = (Bigint*)pnext; - ASSUME(rv); - break; - } - } - } - if (!rv) - rv = (Bigint*)MALLOC(len*sizeof(double)); -#endif - rv->k = k; - rv->maxwds = x; - } - FREE_DTOA_LOCK(0); - rv->sign = rv->wds = 0; - return rv; -} - -static void -Bfree(Bigint *v) -{ - Bigint *vn; - if (v) { - if (v->k > Kmax) { - FREE(v); - return; - } - ACQUIRE_DTOA_LOCK(0); - do { - vn = v->next = freelist[v->k]; - } while (UNLIKELY(ATOMIC_PTR_CAS(freelist[v->k], vn, v) != vn)); - FREE_DTOA_LOCK(0); - } -} - -#define Bcopy(x,y) memcpy((char *)&(x)->sign, (char *)&(y)->sign, \ -(y)->wds*sizeof(Long) + 2*sizeof(int)) - -static Bigint * -multadd(Bigint *b, int m, int a) /* multiply by m and add a */ -{ - int i, wds; - ULong *x; -#ifdef ULLong - ULLong carry, y; -#else - ULong carry, y; -#ifdef Pack_32 - ULong xi, z; -#endif -#endif - Bigint *b1; - - wds = b->wds; - x = b->x; - i = 0; - carry = a; - do { -#ifdef ULLong - y = *x * (ULLong)m + carry; - carry = y >> 32; - *x++ = (ULong)(y & FFFFFFFF); -#else -#ifdef Pack_32 - xi = *x; - y = (xi & 0xffff) * m + carry; - z = (xi >> 16) * m + (y >> 16); - carry = z >> 16; - *x++ = (z << 16) + (y & 0xffff); -#else - y = *x * m + carry; - carry = y >> 16; - *x++ = y & 0xffff; -#endif -#endif - } while (++i < wds); - if (carry) { - if (wds >= b->maxwds) { - b1 = Balloc(b->k+1); - Bcopy(b1, b); - Bfree(b); - b = b1; - } - b->x[wds++] = (ULong)carry; - b->wds = wds; - } - return b; -} - -static Bigint * -s2b(const char *s, int nd0, int nd, ULong y9) -{ - Bigint *b; - int i, k; - Long x, y; - - x = (nd + 8) / 9; - for (k = 0, y = 1; x > y; y <<= 1, k++) ; -#ifdef Pack_32 - b = Balloc(k); - b->x[0] = y9; - b->wds = 1; -#else - b = Balloc(k+1); - b->x[0] = y9 & 0xffff; - b->wds = (b->x[1] = y9 >> 16) ? 2 : 1; -#endif - - i = 9; - if (9 < nd0) { - s += 9; - do { - b = multadd(b, 10, *s++ - '0'); - } while (++i < nd0); - s++; - } - else - s += 10; - for (; i < nd; i++) - b = multadd(b, 10, *s++ - '0'); - return b; -} - -static int -hi0bits(register ULong x) -{ - register int k = 0; - - if (!(x & 0xffff0000)) { - k = 16; - x <<= 16; - } - if (!(x & 0xff000000)) { - k += 8; - x <<= 8; - } - if (!(x & 0xf0000000)) { - k += 4; - x <<= 4; - } - if (!(x & 0xc0000000)) { - k += 2; - x <<= 2; - } - if (!(x & 0x80000000)) { - k++; - if (!(x & 0x40000000)) - return 32; - } - return k; -} - -static int -lo0bits(ULong *y) -{ - register int k; - register ULong x = *y; - - if (x & 7) { - if (x & 1) - return 0; - if (x & 2) { - *y = x >> 1; - return 1; - } - *y = x >> 2; - return 2; - } - k = 0; - if (!(x & 0xffff)) { - k = 16; - x >>= 16; - } - if (!(x & 0xff)) { - k += 8; - x >>= 8; - } - if (!(x & 0xf)) { - k += 4; - x >>= 4; - } - if (!(x & 0x3)) { - k += 2; - x >>= 2; - } - if (!(x & 1)) { - k++; - x >>= 1; - if (!x) - return 32; - } - *y = x; - return k; -} - -static Bigint * -i2b(int i) -{ - Bigint *b; - - b = Balloc(1); - b->x[0] = i; - b->wds = 1; - return b; -} - -static Bigint * -mult(Bigint *a, Bigint *b) -{ - Bigint *c; - int k, wa, wb, wc; - ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; - ULong y; -#ifdef ULLong - ULLong carry, z; -#else - ULong carry, z; -#ifdef Pack_32 - ULong z2; -#endif -#endif - - if (a->wds < b->wds) { - c = a; - a = b; - b = c; - } - k = a->k; - wa = a->wds; - wb = b->wds; - wc = wa + wb; - if (wc > a->maxwds) - k++; - c = Balloc(k); - for (x = c->x, xa = x + wc; x < xa; x++) - *x = 0; - xa = a->x; - xae = xa + wa; - xb = b->x; - xbe = xb + wb; - xc0 = c->x; -#ifdef ULLong - for (; xb < xbe; xc0++) { - if ((y = *xb++) != 0) { - x = xa; - xc = xc0; - carry = 0; - do { - z = *x++ * (ULLong)y + *xc + carry; - carry = z >> 32; - *xc++ = (ULong)(z & FFFFFFFF); - } while (x < xae); - *xc = (ULong)carry; - } - } -#else -#ifdef Pack_32 - for (; xb < xbe; xb++, xc0++) { - if ((y = *xb & 0xffff) != 0) { - x = xa; - xc = xc0; - carry = 0; - do { - z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; - carry = z >> 16; - z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; - carry = z2 >> 16; - Storeinc(xc, z2, z); - } while (x < xae); - *xc = (ULong)carry; - } - if ((y = *xb >> 16) != 0) { - x = xa; - xc = xc0; - carry = 0; - z2 = *xc; - do { - z = (*x & 0xffff) * y + (*xc >> 16) + carry; - carry = z >> 16; - Storeinc(xc, z, z2); - z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; - carry = z2 >> 16; - } while (x < xae); - *xc = z2; - } - } -#else - for (; xb < xbe; xc0++) { - if (y = *xb++) { - x = xa; - xc = xc0; - carry = 0; - do { - z = *x++ * y + *xc + carry; - carry = z >> 16; - *xc++ = z & 0xffff; - } while (x < xae); - *xc = (ULong)carry; - } - } -#endif -#endif - for (xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; - c->wds = wc; - return c; -} - -static Bigint *p5s; - -static Bigint * -pow5mult(Bigint *b, int k) -{ - Bigint *b1, *p5, *p51; - Bigint *p5tmp; - int i; - static const int p05[3] = { 5, 25, 125 }; - - if ((i = k & 3) != 0) - b = multadd(b, p05[i-1], 0); - - if (!(k >>= 2)) - return b; - if (!(p5 = p5s)) { - /* first time */ - ACQUIRE_DTOA_LOCK(1); - if (!(p5 = p5s)) { - p5 = i2b(625); - p5->next = 0; - p5tmp = ATOMIC_PTR_CAS(p5s, NULL, p5); - if (UNLIKELY(p5tmp)) { - Bfree(p5); - p5 = p5tmp; - } - } - FREE_DTOA_LOCK(1); - } - for (;;) { - if (k & 1) { - b1 = mult(b, p5); - Bfree(b); - b = b1; - } - if (!(k >>= 1)) - break; - if (!(p51 = p5->next)) { - ACQUIRE_DTOA_LOCK(1); - if (!(p51 = p5->next)) { - p51 = mult(p5,p5); - p51->next = 0; - p5tmp = ATOMIC_PTR_CAS(p5->next, NULL, p51); - if (UNLIKELY(p5tmp)) { - Bfree(p51); - p51 = p5tmp; - } - } - FREE_DTOA_LOCK(1); - } - p5 = p51; - } - return b; -} - -static Bigint * -lshift(Bigint *b, int k) -{ - int i, k1, n, n1; - Bigint *b1; - ULong *x, *x1, *xe, z; - -#ifdef Pack_32 - n = k >> 5; -#else - n = k >> 4; -#endif - k1 = b->k; - n1 = n + b->wds + 1; - for (i = b->maxwds; n1 > i; i <<= 1) - k1++; - b1 = Balloc(k1); - x1 = b1->x; - for (i = 0; i < n; i++) - *x1++ = 0; - x = b->x; - xe = x + b->wds; -#ifdef Pack_32 - if (k &= 0x1f) { - k1 = 32 - k; - z = 0; - do { - *x1++ = *x << k | z; - z = *x++ >> k1; - } while (x < xe); - if ((*x1 = z) != 0) - ++n1; - } -#else - if (k &= 0xf) { - k1 = 16 - k; - z = 0; - do { - *x1++ = *x << k & 0xffff | z; - z = *x++ >> k1; - } while (x < xe); - if (*x1 = z) - ++n1; - } -#endif - else - do { - *x1++ = *x++; - } while (x < xe); - b1->wds = n1 - 1; - Bfree(b); - return b1; -} - -static int -cmp(Bigint *a, Bigint *b) -{ - ULong *xa, *xa0, *xb, *xb0; - int i, j; - - i = a->wds; - j = b->wds; -#ifdef DEBUG - if (i > 1 && !a->x[i-1]) - Bug("cmp called with a->x[a->wds-1] == 0"); - if (j > 1 && !b->x[j-1]) - Bug("cmp called with b->x[b->wds-1] == 0"); -#endif - if (i -= j) - return i; - xa0 = a->x; - xa = xa0 + j; - xb0 = b->x; - xb = xb0 + j; - for (;;) { - if (*--xa != *--xb) - return *xa < *xb ? -1 : 1; - if (xa <= xa0) - break; - } - return 0; -} - -NO_SANITIZE("unsigned-integer-overflow", static Bigint * diff(Bigint *a, Bigint *b)); -static Bigint * -diff(Bigint *a, Bigint *b) -{ - Bigint *c; - int i, wa, wb; - ULong *xa, *xae, *xb, *xbe, *xc; -#ifdef ULLong - ULLong borrow, y; -#else - ULong borrow, y; -#ifdef Pack_32 - ULong z; -#endif -#endif - - i = cmp(a,b); - if (!i) { - c = Balloc(0); - c->wds = 1; - c->x[0] = 0; - return c; - } - if (i < 0) { - c = a; - a = b; - b = c; - i = 1; - } - else - i = 0; - c = Balloc(a->k); - c->sign = i; - wa = a->wds; - xa = a->x; - xae = xa + wa; - wb = b->wds; - xb = b->x; - xbe = xb + wb; - xc = c->x; - borrow = 0; -#ifdef ULLong - do { - y = (ULLong)*xa++ - *xb++ - borrow; - borrow = y >> 32 & (ULong)1; - *xc++ = (ULong)(y & FFFFFFFF); - } while (xb < xbe); - while (xa < xae) { - y = *xa++ - borrow; - borrow = y >> 32 & (ULong)1; - *xc++ = (ULong)(y & FFFFFFFF); - } -#else -#ifdef Pack_32 - do { - y = (*xa & 0xffff) - (*xb & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*xa++ >> 16) - (*xb++ >> 16) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(xc, z, y); - } while (xb < xbe); - while (xa < xae) { - y = (*xa & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*xa++ >> 16) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(xc, z, y); - } -#else - do { - y = *xa++ - *xb++ - borrow; - borrow = (y & 0x10000) >> 16; - *xc++ = y & 0xffff; - } while (xb < xbe); - while (xa < xae) { - y = *xa++ - borrow; - borrow = (y & 0x10000) >> 16; - *xc++ = y & 0xffff; - } -#endif -#endif - while (!*--xc) - wa--; - c->wds = wa; - return c; -} - -static double -ulp(double x_) -{ - register Long L; - double_u x, a; - dval(x) = x_; - - L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; -#ifndef Avoid_Underflow -#ifndef Sudden_Underflow - if (L > 0) { -#endif -#endif -#ifdef IBM - L |= Exp_msk1 >> 4; -#endif - word0(a) = L; - word1(a) = 0; -#ifndef Avoid_Underflow -#ifndef Sudden_Underflow - } - else { - L = -L >> Exp_shift; - if (L < Exp_shift) { - word0(a) = 0x80000 >> L; - word1(a) = 0; - } - else { - word0(a) = 0; - L -= Exp_shift; - word1(a) = L >= 31 ? 1 : 1 << 31 - L; - } - } -#endif -#endif - return dval(a); -} - -static double -b2d(Bigint *a, int *e) -{ - ULong *xa, *xa0, w, y, z; - int k; - double_u d; -#ifdef VAX - ULong d0, d1; -#else -#define d0 word0(d) -#define d1 word1(d) -#endif - - xa0 = a->x; - xa = xa0 + a->wds; - y = *--xa; -#ifdef DEBUG - if (!y) Bug("zero y in b2d"); -#endif - k = hi0bits(y); - *e = 32 - k; -#ifdef Pack_32 - if (k < Ebits) { - d0 = Exp_1 | y >> (Ebits - k); - w = xa > xa0 ? *--xa : 0; - d1 = y << ((32-Ebits) + k) | w >> (Ebits - k); - goto ret_d; - } - z = xa > xa0 ? *--xa : 0; - if (k -= Ebits) { - d0 = Exp_1 | y << k | z >> (32 - k); - y = xa > xa0 ? *--xa : 0; - d1 = z << k | y >> (32 - k); - } - else { - d0 = Exp_1 | y; - d1 = z; - } -#else - if (k < Ebits + 16) { - z = xa > xa0 ? *--xa : 0; - d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k; - w = xa > xa0 ? *--xa : 0; - y = xa > xa0 ? *--xa : 0; - d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k; - goto ret_d; - } - z = xa > xa0 ? *--xa : 0; - w = xa > xa0 ? *--xa : 0; - k -= Ebits + 16; - d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k; - y = xa > xa0 ? *--xa : 0; - d1 = w << k + 16 | y << k; -#endif -ret_d: -#ifdef VAX - word0(d) = d0 >> 16 | d0 << 16; - word1(d) = d1 >> 16 | d1 << 16; -#else -#undef d0 -#undef d1 -#endif - return dval(d); -} - -static Bigint * -d2b(double d_, int *e, int *bits) -{ - double_u d; - Bigint *b; - int de, k; - ULong *x, y, z; -#ifndef Sudden_Underflow - int i; -#endif -#ifdef VAX - ULong d0, d1; -#endif - dval(d) = d_; -#ifdef VAX - d0 = word0(d) >> 16 | word0(d) << 16; - d1 = word1(d) >> 16 | word1(d) << 16; -#else -#define d0 word0(d) -#define d1 word1(d) -#endif - -#ifdef Pack_32 - b = Balloc(1); -#else - b = Balloc(2); -#endif - x = b->x; - - z = d0 & Frac_mask; - d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ -#ifdef Sudden_Underflow - de = (int)(d0 >> Exp_shift); -#ifndef IBM - z |= Exp_msk11; -#endif -#else - if ((de = (int)(d0 >> Exp_shift)) != 0) - z |= Exp_msk1; -#endif -#ifdef Pack_32 - if ((y = d1) != 0) { - if ((k = lo0bits(&y)) != 0) { - x[0] = y | z << (32 - k); - z >>= k; - } - else - x[0] = y; -#ifndef Sudden_Underflow - i = -#endif - b->wds = (x[1] = z) ? 2 : 1; - } - else { -#ifdef DEBUG - if (!z) - Bug("Zero passed to d2b"); -#endif - k = lo0bits(&z); - x[0] = z; -#ifndef Sudden_Underflow - i = -#endif - b->wds = 1; - k += 32; - } -#else - if (y = d1) { - if (k = lo0bits(&y)) - if (k >= 16) { - x[0] = y | z << 32 - k & 0xffff; - x[1] = z >> k - 16 & 0xffff; - x[2] = z >> k; - i = 2; - } - else { - x[0] = y & 0xffff; - x[1] = y >> 16 | z << 16 - k & 0xffff; - x[2] = z >> k & 0xffff; - x[3] = z >> k+16; - i = 3; - } - else { - x[0] = y & 0xffff; - x[1] = y >> 16; - x[2] = z & 0xffff; - x[3] = z >> 16; - i = 3; - } - } - else { -#ifdef DEBUG - if (!z) - Bug("Zero passed to d2b"); -#endif - k = lo0bits(&z); - if (k >= 16) { - x[0] = z; - i = 0; - } - else { - x[0] = z & 0xffff; - x[1] = z >> 16; - i = 1; - } - k += 32; - } - while (!x[i]) - --i; - b->wds = i + 1; -#endif -#ifndef Sudden_Underflow - if (de) { -#endif -#ifdef IBM - *e = (de - Bias - (P-1) << 2) + k; - *bits = 4*P + 8 - k - hi0bits(word0(d) & Frac_mask); -#else - *e = de - Bias - (P-1) + k; - *bits = P - k; -#endif -#ifndef Sudden_Underflow - } - else { - *e = de - Bias - (P-1) + 1 + k; -#ifdef Pack_32 - *bits = 32*i - hi0bits(x[i-1]); -#else - *bits = (i+2)*16 - hi0bits(x[i]); -#endif - } -#endif - return b; -} -#undef d0 -#undef d1 - -static double -ratio(Bigint *a, Bigint *b) -{ - double_u da, db; - int k, ka, kb; - - dval(da) = b2d(a, &ka); - dval(db) = b2d(b, &kb); -#ifdef Pack_32 - k = ka - kb + 32*(a->wds - b->wds); -#else - k = ka - kb + 16*(a->wds - b->wds); -#endif -#ifdef IBM - if (k > 0) { - word0(da) += (k >> 2)*Exp_msk1; - if (k &= 3) - dval(da) *= 1 << k; - } - else { - k = -k; - word0(db) += (k >> 2)*Exp_msk1; - if (k &= 3) - dval(db) *= 1 << k; - } -#else - if (k > 0) - word0(da) += k*Exp_msk1; - else { - k = -k; - word0(db) += k*Exp_msk1; - } -#endif - return dval(da) / dval(db); -} - -static const double -tens[] = { - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - 1e20, 1e21, 1e22 -#ifdef VAX - , 1e23, 1e24 -#endif -}; - -static const double -#ifdef IEEE_Arith -bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; -static const double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, -#ifdef Avoid_Underflow - 9007199254740992.*9007199254740992.e-256 - /* = 2^106 * 1e-53 */ -#else - 1e-256 -#endif -}; -/* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */ -/* flag unnecessarily. It leads to a song and dance at the end of strtod. */ -#define Scale_Bit 0x10 -#define n_bigtens 5 -#else -#ifdef IBM -bigtens[] = { 1e16, 1e32, 1e64 }; -static const double tinytens[] = { 1e-16, 1e-32, 1e-64 }; -#define n_bigtens 3 -#else -bigtens[] = { 1e16, 1e32 }; -static const double tinytens[] = { 1e-16, 1e-32 }; -#define n_bigtens 2 -#endif -#endif - -#ifndef IEEE_Arith -#undef INFNAN_CHECK -#endif - -#ifdef INFNAN_CHECK - -#ifndef NAN_WORD0 -#define NAN_WORD0 0x7ff80000 -#endif - -#ifndef NAN_WORD1 -#define NAN_WORD1 0 -#endif - -static int -match(const char **sp, char *t) -{ - int c, d; - const char *s = *sp; - - while (d = *t++) { - if ((c = *++s) >= 'A' && c <= 'Z') - c += 'a' - 'A'; - if (c != d) - return 0; - } - *sp = s + 1; - return 1; -} - -#ifndef No_Hex_NaN -static void -hexnan(double *rvp, const char **sp) -{ - ULong c, x[2]; - const char *s; - int havedig, udx0, xshift; - - x[0] = x[1] = 0; - havedig = xshift = 0; - udx0 = 1; - s = *sp; - while (c = *(const unsigned char*)++s) { - if (c >= '0' && c <= '9') - c -= '0'; - else if (c >= 'a' && c <= 'f') - c += 10 - 'a'; - else if (c >= 'A' && c <= 'F') - c += 10 - 'A'; - else if (c <= ' ') { - if (udx0 && havedig) { - udx0 = 0; - xshift = 1; - } - continue; - } - else if (/*(*/ c == ')' && havedig) { - *sp = s + 1; - break; - } - else - return; /* invalid form: don't change *sp */ - havedig = 1; - if (xshift) { - xshift = 0; - x[0] = x[1]; - x[1] = 0; - } - if (udx0) - x[0] = (x[0] << 4) | (x[1] >> 28); - x[1] = (x[1] << 4) | c; - } - if ((x[0] &= 0xfffff) || x[1]) { - word0(*rvp) = Exp_mask | x[0]; - word1(*rvp) = x[1]; - } -} -#endif /*No_Hex_NaN*/ -#endif /* INFNAN_CHECK */ - -NO_SANITIZE("unsigned-integer-overflow", double strtod(const char *s00, char **se)); -double -strtod(const char *s00, char **se) -{ -#ifdef Avoid_Underflow - int scale; -#endif - int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, - e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; - const char *s, *s0, *s1; - double aadj, adj; - double_u aadj1, rv, rv0; - Long L; - ULong y, z; - Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; -#ifdef SET_INEXACT - int inexact, oldinexact; -#endif -#ifdef Honor_FLT_ROUNDS - int rounding; -#endif -#ifdef USE_LOCALE - const char *s2; -#endif - - errno = 0; - sign = nz0 = nz = 0; - dval(rv) = 0.; - for (s = s00;;s++) - switch (*s) { - case '-': - sign = 1; - /* no break */ - case '+': - if (*++s) - goto break2; - /* no break */ - case 0: - goto ret0; - case '\t': - case '\n': - case '\v': - case '\f': - case '\r': - case ' ': - continue; - default: - goto break2; - } -break2: - if (*s == '0') { - if (s[1] == 'x' || s[1] == 'X') { - s0 = ++s; - adj = 0; - aadj = 1.0; - nd0 = -4; - - if (!*++s || !(s1 = strchr(hexdigit, *s))) goto ret0; - if (*s == '0') { - while (*++s == '0'); - s1 = strchr(hexdigit, *s); - } - if (s1 != NULL) { - do { - adj += aadj * ((s1 - hexdigit) & 15); - nd0 += 4; - aadj /= 16; - } while (*++s && (s1 = strchr(hexdigit, *s))); - } - - if (*s == '.') { - dsign = 1; - if (!*++s || !(s1 = strchr(hexdigit, *s))) goto ret0; - if (nd0 < 0) { - while (*s == '0') { - s++; - nd0 -= 4; - } - } - for (; *s && (s1 = strchr(hexdigit, *s)); ++s) { - adj += aadj * ((s1 - hexdigit) & 15); - if ((aadj /= 16) == 0.0) { - while (strchr(hexdigit, *++s)); - break; - } - } - } - else { - dsign = 0; - } - - if (*s == 'P' || *s == 'p') { - dsign = 0x2C - *++s; /* +: 2B, -: 2D */ - if (abs(dsign) == 1) s++; - else dsign = 1; - - nd = 0; - c = *s; - if (c < '0' || '9' < c) goto ret0; - do { - nd *= 10; - nd += c; - nd -= '0'; - c = *++s; - /* Float("0x0."+("0"*267)+"1fp2095") */ - if (nd + dsign * nd0 > 2095) { - while ('0' <= c && c <= '9') c = *++s; - break; - } - } while ('0' <= c && c <= '9'); - nd0 += nd * dsign; - } - else { - if (dsign) goto ret0; - } - dval(rv) = ldexp(adj, nd0); - goto ret; - } - nz0 = 1; - while (*++s == '0') ; - if (!*s) - goto ret; - } - s0 = s; - y = z = 0; - for (nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) - if (nd < 9) - y = 10*y + c - '0'; - else if (nd < DBL_DIG + 2) - z = 10*z + c - '0'; - nd0 = nd; -#ifdef USE_LOCALE - s1 = localeconv()->decimal_point; - if (c == *s1) { - c = '.'; - if (*++s1) { - s2 = s; - for (;;) { - if (*++s2 != *s1) { - c = 0; - break; - } - if (!*++s1) { - s = s2; - break; - } - } - } - } -#endif - if (c == '.') { - if (!ISDIGIT(s[1])) - goto dig_done; - c = *++s; - if (!nd) { - for (; c == '0'; c = *++s) - nz++; - if (c > '0' && c <= '9') { - s0 = s; - nf += nz; - nz = 0; - goto have_dig; - } - goto dig_done; - } - for (; c >= '0' && c <= '9'; c = *++s) { -have_dig: - nz++; - if (nd > DBL_DIG * 4) { - continue; - } - if (c -= '0') { - nf += nz; - for (i = 1; i < nz; i++) - if (nd++ < 9) - y *= 10; - else if (nd <= DBL_DIG + 2) - z *= 10; - if (nd++ < 9) - y = 10*y + c; - else if (nd <= DBL_DIG + 2) - z = 10*z + c; - nz = 0; - } - } - } -dig_done: - e = 0; - if (c == 'e' || c == 'E') { - if (!nd && !nz && !nz0) { - goto ret0; - } - s00 = s; - esign = 0; - switch (c = *++s) { - case '-': - esign = 1; - case '+': - c = *++s; - } - if (c >= '0' && c <= '9') { - while (c == '0') - c = *++s; - if (c > '0' && c <= '9') { - L = c - '0'; - s1 = s; - while ((c = *++s) >= '0' && c <= '9') - L = 10*L + c - '0'; - if (s - s1 > 8 || L > 19999) - /* Avoid confusion from exponents - * so large that e might overflow. - */ - e = 19999; /* safe for 16 bit ints */ - else - e = (int)L; - if (esign) - e = -e; - } - else - e = 0; - } - else - s = s00; - } - if (!nd) { - if (!nz && !nz0) { -#ifdef INFNAN_CHECK - /* Check for Nan and Infinity */ - switch (c) { - case 'i': - case 'I': - if (match(&s,"nf")) { - --s; - if (!match(&s,"inity")) - ++s; - word0(rv) = 0x7ff00000; - word1(rv) = 0; - goto ret; - } - break; - case 'n': - case 'N': - if (match(&s, "an")) { - word0(rv) = NAN_WORD0; - word1(rv) = NAN_WORD1; -#ifndef No_Hex_NaN - if (*s == '(') /*)*/ - hexnan(&rv, &s); -#endif - goto ret; - } - } -#endif /* INFNAN_CHECK */ -ret0: - s = s00; - sign = 0; - } - goto ret; - } - e1 = e -= nf; - - /* Now we have nd0 digits, starting at s0, followed by a - * decimal point, followed by nd-nd0 digits. The number we're - * after is the integer represented by those digits times - * 10**e */ - - if (!nd0) - nd0 = nd; - k = nd < DBL_DIG + 2 ? nd : DBL_DIG + 2; - dval(rv) = y; - if (k > 9) { -#ifdef SET_INEXACT - if (k > DBL_DIG) - oldinexact = get_inexact(); -#endif - dval(rv) = tens[k - 9] * dval(rv) + z; - } - bd0 = bb = bd = bs = delta = 0; - if (nd <= DBL_DIG -#ifndef RND_PRODQUOT -#ifndef Honor_FLT_ROUNDS - && Flt_Rounds == 1 -#endif -#endif - ) { - if (!e) - goto ret; - if (e > 0) { - if (e <= Ten_pmax) { -#ifdef VAX - goto vax_ovfl_check; -#else -#ifdef Honor_FLT_ROUNDS - /* round correctly FLT_ROUNDS = 2 or 3 */ - if (sign) { - dval(rv) = -dval(rv); - sign = 0; - } -#endif - /* rv = */ rounded_product(dval(rv), tens[e]); - goto ret; -#endif - } - i = DBL_DIG - nd; - if (e <= Ten_pmax + i) { - /* A fancier test would sometimes let us do - * this for larger i values. - */ -#ifdef Honor_FLT_ROUNDS - /* round correctly FLT_ROUNDS = 2 or 3 */ - if (sign) { - dval(rv) = -dval(rv); - sign = 0; - } -#endif - e -= i; - dval(rv) *= tens[i]; -#ifdef VAX - /* VAX exponent range is so narrow we must - * worry about overflow here... - */ -vax_ovfl_check: - word0(rv) -= P*Exp_msk1; - /* rv = */ rounded_product(dval(rv), tens[e]); - if ((word0(rv) & Exp_mask) - > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) - goto ovfl; - word0(rv) += P*Exp_msk1; -#else - /* rv = */ rounded_product(dval(rv), tens[e]); -#endif - goto ret; - } - } -#ifndef Inaccurate_Divide - else if (e >= -Ten_pmax) { -#ifdef Honor_FLT_ROUNDS - /* round correctly FLT_ROUNDS = 2 or 3 */ - if (sign) { - dval(rv) = -dval(rv); - sign = 0; - } -#endif - /* rv = */ rounded_quotient(dval(rv), tens[-e]); - goto ret; - } -#endif - } - e1 += nd - k; - -#ifdef IEEE_Arith -#ifdef SET_INEXACT - inexact = 1; - if (k <= DBL_DIG) - oldinexact = get_inexact(); -#endif -#ifdef Avoid_Underflow - scale = 0; -#endif -#ifdef Honor_FLT_ROUNDS - if ((rounding = Flt_Rounds) >= 2) { - if (sign) - rounding = rounding == 2 ? 0 : 2; - else - if (rounding != 2) - rounding = 0; - } -#endif -#endif /*IEEE_Arith*/ - - /* Get starting approximation = rv * 10**e1 */ - - if (e1 > 0) { - if ((i = e1 & 15) != 0) - dval(rv) *= tens[i]; - if (e1 &= ~15) { - if (e1 > DBL_MAX_10_EXP) { -ovfl: -#ifndef NO_ERRNO - errno = ERANGE; -#endif - /* Can't trust HUGE_VAL */ -#ifdef IEEE_Arith -#ifdef Honor_FLT_ROUNDS - switch (rounding) { - case 0: /* toward 0 */ - case 3: /* toward -infinity */ - word0(rv) = Big0; - word1(rv) = Big1; - break; - default: - word0(rv) = Exp_mask; - word1(rv) = 0; - } -#else /*Honor_FLT_ROUNDS*/ - word0(rv) = Exp_mask; - word1(rv) = 0; -#endif /*Honor_FLT_ROUNDS*/ -#ifdef SET_INEXACT - /* set overflow bit */ - dval(rv0) = 1e300; - dval(rv0) *= dval(rv0); -#endif -#else /*IEEE_Arith*/ - word0(rv) = Big0; - word1(rv) = Big1; -#endif /*IEEE_Arith*/ - if (bd0) - goto retfree; - goto ret; - } - e1 >>= 4; - for (j = 0; e1 > 1; j++, e1 >>= 1) - if (e1 & 1) - dval(rv) *= bigtens[j]; - /* The last multiplication could overflow. */ - word0(rv) -= P*Exp_msk1; - dval(rv) *= bigtens[j]; - if ((z = word0(rv) & Exp_mask) - > Exp_msk1*(DBL_MAX_EXP+Bias-P)) - goto ovfl; - if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { - /* set to largest number */ - /* (Can't trust DBL_MAX) */ - word0(rv) = Big0; - word1(rv) = Big1; - } - else - word0(rv) += P*Exp_msk1; - } - } - else if (e1 < 0) { - e1 = -e1; - if ((i = e1 & 15) != 0) - dval(rv) /= tens[i]; - if (e1 >>= 4) { - if (e1 >= 1 << n_bigtens) - goto undfl; -#ifdef Avoid_Underflow - if (e1 & Scale_Bit) - scale = 2*P; - for (j = 0; e1 > 0; j++, e1 >>= 1) - if (e1 & 1) - dval(rv) *= tinytens[j]; - if (scale && (j = 2*P + 1 - ((word0(rv) & Exp_mask) - >> Exp_shift)) > 0) { - /* scaled rv is denormal; zap j low bits */ - if (j >= 32) { - word1(rv) = 0; - if (j >= 53) - word0(rv) = (P+2)*Exp_msk1; - else - word0(rv) &= 0xffffffff << (j-32); - } - else - word1(rv) &= 0xffffffff << j; - } -#else - for (j = 0; e1 > 1; j++, e1 >>= 1) - if (e1 & 1) - dval(rv) *= tinytens[j]; - /* The last multiplication could underflow. */ - dval(rv0) = dval(rv); - dval(rv) *= tinytens[j]; - if (!dval(rv)) { - dval(rv) = 2.*dval(rv0); - dval(rv) *= tinytens[j]; -#endif - if (!dval(rv)) { -undfl: - dval(rv) = 0.; -#ifndef NO_ERRNO - errno = ERANGE; -#endif - if (bd0) - goto retfree; - goto ret; - } -#ifndef Avoid_Underflow - word0(rv) = Tiny0; - word1(rv) = Tiny1; - /* The refinement below will clean - * this approximation up. - */ - } -#endif - } - } - - /* Now the hard part -- adjusting rv to the correct value.*/ - - /* Put digits into bd: true value = bd * 10^e */ - - bd0 = s2b(s0, nd0, nd, y); - - for (;;) { - bd = Balloc(bd0->k); - Bcopy(bd, bd0); - bb = d2b(dval(rv), &bbe, &bbbits); /* rv = bb * 2^bbe */ - bs = i2b(1); - - if (e >= 0) { - bb2 = bb5 = 0; - bd2 = bd5 = e; - } - else { - bb2 = bb5 = -e; - bd2 = bd5 = 0; - } - if (bbe >= 0) - bb2 += bbe; - else - bd2 -= bbe; - bs2 = bb2; -#ifdef Honor_FLT_ROUNDS - if (rounding != 1) - bs2++; -#endif -#ifdef Avoid_Underflow - j = bbe - scale; - i = j + bbbits - 1; /* logb(rv) */ - if (i < Emin) /* denormal */ - j += P - Emin; - else - j = P + 1 - bbbits; -#else /*Avoid_Underflow*/ -#ifdef Sudden_Underflow -#ifdef IBM - j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3); -#else - j = P + 1 - bbbits; -#endif -#else /*Sudden_Underflow*/ - j = bbe; - i = j + bbbits - 1; /* logb(rv) */ - if (i < Emin) /* denormal */ - j += P - Emin; - else - j = P + 1 - bbbits; -#endif /*Sudden_Underflow*/ -#endif /*Avoid_Underflow*/ - bb2 += j; - bd2 += j; -#ifdef Avoid_Underflow - bd2 += scale; -#endif - i = bb2 < bd2 ? bb2 : bd2; - if (i > bs2) - i = bs2; - if (i > 0) { - bb2 -= i; - bd2 -= i; - bs2 -= i; - } - if (bb5 > 0) { - bs = pow5mult(bs, bb5); - bb1 = mult(bs, bb); - Bfree(bb); - bb = bb1; - } - if (bb2 > 0) - bb = lshift(bb, bb2); - if (bd5 > 0) - bd = pow5mult(bd, bd5); - if (bd2 > 0) - bd = lshift(bd, bd2); - if (bs2 > 0) - bs = lshift(bs, bs2); - delta = diff(bb, bd); - dsign = delta->sign; - delta->sign = 0; - i = cmp(delta, bs); -#ifdef Honor_FLT_ROUNDS - if (rounding != 1) { - if (i < 0) { - /* Error is less than an ulp */ - if (!delta->x[0] && delta->wds <= 1) { - /* exact */ -#ifdef SET_INEXACT - inexact = 0; -#endif - break; - } - if (rounding) { - if (dsign) { - adj = 1.; - goto apply_adj; - } - } - else if (!dsign) { - adj = -1.; - if (!word1(rv) - && !(word0(rv) & Frac_mask)) { - y = word0(rv) & Exp_mask; -#ifdef Avoid_Underflow - if (!scale || y > 2*P*Exp_msk1) -#else - if (y) -#endif - { - delta = lshift(delta,Log2P); - if (cmp(delta, bs) <= 0) - adj = -0.5; - } - } -apply_adj: -#ifdef Avoid_Underflow - if (scale && (y = word0(rv) & Exp_mask) - <= 2*P*Exp_msk1) - word0(adj) += (2*P+1)*Exp_msk1 - y; -#else -#ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= - P*Exp_msk1) { - word0(rv) += P*Exp_msk1; - dval(rv) += adj*ulp(dval(rv)); - word0(rv) -= P*Exp_msk1; - } - else -#endif /*Sudden_Underflow*/ -#endif /*Avoid_Underflow*/ - dval(rv) += adj*ulp(dval(rv)); - } - break; - } - adj = ratio(delta, bs); - if (adj < 1.) - adj = 1.; - if (adj <= 0x7ffffffe) { - /* adj = rounding ? ceil(adj) : floor(adj); */ - y = adj; - if (y != adj) { - if (!((rounding>>1) ^ dsign)) - y++; - adj = y; - } - } -#ifdef Avoid_Underflow - if (scale && (y = word0(rv) & Exp_mask) <= 2*P*Exp_msk1) - word0(adj) += (2*P+1)*Exp_msk1 - y; -#else -#ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { - word0(rv) += P*Exp_msk1; - adj *= ulp(dval(rv)); - if (dsign) - dval(rv) += adj; - else - dval(rv) -= adj; - word0(rv) -= P*Exp_msk1; - goto cont; - } -#endif /*Sudden_Underflow*/ -#endif /*Avoid_Underflow*/ - adj *= ulp(dval(rv)); - if (dsign) - dval(rv) += adj; - else - dval(rv) -= adj; - goto cont; - } -#endif /*Honor_FLT_ROUNDS*/ - - if (i < 0) { - /* Error is less than half an ulp -- check for - * special case of mantissa a power of two. - */ - if (dsign || word1(rv) || word0(rv) & Bndry_mask -#ifdef IEEE_Arith -#ifdef Avoid_Underflow - || (word0(rv) & Exp_mask) <= (2*P+1)*Exp_msk1 -#else - || (word0(rv) & Exp_mask) <= Exp_msk1 -#endif -#endif - ) { -#ifdef SET_INEXACT - if (!delta->x[0] && delta->wds <= 1) - inexact = 0; -#endif - break; - } - if (!delta->x[0] && delta->wds <= 1) { - /* exact result */ -#ifdef SET_INEXACT - inexact = 0; -#endif - break; - } - delta = lshift(delta,Log2P); - if (cmp(delta, bs) > 0) - goto drop_down; - break; - } - if (i == 0) { - /* exactly half-way between */ - if (dsign) { - if ((word0(rv) & Bndry_mask1) == Bndry_mask1 - && word1(rv) == ( -#ifdef Avoid_Underflow - (scale && (y = word0(rv) & Exp_mask) <= 2*P*Exp_msk1) - ? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) : -#endif - 0xffffffff)) { - /*boundary case -- increment exponent*/ - word0(rv) = (word0(rv) & Exp_mask) - + Exp_msk1 -#ifdef IBM - | Exp_msk1 >> 4 -#endif - ; - word1(rv) = 0; -#ifdef Avoid_Underflow - dsign = 0; -#endif - break; - } - } - else if (!(word0(rv) & Bndry_mask) && !word1(rv)) { -drop_down: - /* boundary case -- decrement exponent */ -#ifdef Sudden_Underflow /*{{*/ - L = word0(rv) & Exp_mask; -#ifdef IBM - if (L < Exp_msk1) -#else -#ifdef Avoid_Underflow - if (L <= (scale ? (2*P+1)*Exp_msk1 : Exp_msk1)) -#else - if (L <= Exp_msk1) -#endif /*Avoid_Underflow*/ -#endif /*IBM*/ - goto undfl; - L -= Exp_msk1; -#else /*Sudden_Underflow}{*/ -#ifdef Avoid_Underflow - if (scale) { - L = word0(rv) & Exp_mask; - if (L <= (2*P+1)*Exp_msk1) { - if (L > (P+2)*Exp_msk1) - /* round even ==> */ - /* accept rv */ - break; - /* rv = smallest denormal */ - goto undfl; - } - } -#endif /*Avoid_Underflow*/ - L = (word0(rv) & Exp_mask) - Exp_msk1; -#endif /*Sudden_Underflow}}*/ - word0(rv) = L | Bndry_mask1; - word1(rv) = 0xffffffff; -#ifdef IBM - goto cont; -#else - break; -#endif - } -#ifndef ROUND_BIASED - if (!(word1(rv) & LSB)) - break; -#endif - if (dsign) - dval(rv) += ulp(dval(rv)); -#ifndef ROUND_BIASED - else { - dval(rv) -= ulp(dval(rv)); -#ifndef Sudden_Underflow - if (!dval(rv)) - goto undfl; -#endif - } -#ifdef Avoid_Underflow - dsign = 1 - dsign; -#endif -#endif - break; - } - if ((aadj = ratio(delta, bs)) <= 2.) { - if (dsign) - aadj = dval(aadj1) = 1.; - else if (word1(rv) || word0(rv) & Bndry_mask) { -#ifndef Sudden_Underflow - if (word1(rv) == Tiny1 && !word0(rv)) - goto undfl; -#endif - aadj = 1.; - dval(aadj1) = -1.; - } - else { - /* special case -- power of FLT_RADIX to be */ - /* rounded down... */ - - if (aadj < 2./FLT_RADIX) - aadj = 1./FLT_RADIX; - else - aadj *= 0.5; - dval(aadj1) = -aadj; - } - } - else { - aadj *= 0.5; - dval(aadj1) = dsign ? aadj : -aadj; -#ifdef Check_FLT_ROUNDS - switch (Rounding) { - case 2: /* towards +infinity */ - dval(aadj1) -= 0.5; - break; - case 0: /* towards 0 */ - case 3: /* towards -infinity */ - dval(aadj1) += 0.5; - } -#else - if (Flt_Rounds == 0) - dval(aadj1) += 0.5; -#endif /*Check_FLT_ROUNDS*/ - } - y = word0(rv) & Exp_mask; - - /* Check for overflow */ - - if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { - dval(rv0) = dval(rv); - word0(rv) -= P*Exp_msk1; - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; - if ((word0(rv) & Exp_mask) >= - Exp_msk1*(DBL_MAX_EXP+Bias-P)) { - if (word0(rv0) == Big0 && word1(rv0) == Big1) - goto ovfl; - word0(rv) = Big0; - word1(rv) = Big1; - goto cont; - } - else - word0(rv) += P*Exp_msk1; - } - else { -#ifdef Avoid_Underflow - if (scale && y <= 2*P*Exp_msk1) { - if (aadj <= 0x7fffffff) { - if ((z = (int)aadj) <= 0) - z = 1; - aadj = z; - dval(aadj1) = dsign ? aadj : -aadj; - } - word0(aadj1) += (2*P+1)*Exp_msk1 - y; - } - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; -#else -#ifdef Sudden_Underflow - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { - dval(rv0) = dval(rv); - word0(rv) += P*Exp_msk1; - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; -#ifdef IBM - if ((word0(rv) & Exp_mask) < P*Exp_msk1) -#else - if ((word0(rv) & Exp_mask) <= P*Exp_msk1) -#endif - { - if (word0(rv0) == Tiny0 && word1(rv0) == Tiny1) - goto undfl; - word0(rv) = Tiny0; - word1(rv) = Tiny1; - goto cont; - } - else - word0(rv) -= P*Exp_msk1; - } - else { - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; - } -#else /*Sudden_Underflow*/ - /* Compute adj so that the IEEE rounding rules will - * correctly round rv + adj in some half-way cases. - * If rv * ulp(rv) is denormalized (i.e., - * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid - * trouble from bits lost to denormalization; - * example: 1.2e-307 . - */ - if (y <= (P-1)*Exp_msk1 && aadj > 1.) { - dval(aadj1) = (double)(int)(aadj + 0.5); - if (!dsign) - dval(aadj1) = -dval(aadj1); - } - adj = dval(aadj1) * ulp(dval(rv)); - dval(rv) += adj; -#endif /*Sudden_Underflow*/ -#endif /*Avoid_Underflow*/ - } - z = word0(rv) & Exp_mask; -#ifndef SET_INEXACT -#ifdef Avoid_Underflow - if (!scale) -#endif - if (y == z) { - /* Can we stop now? */ - L = (Long)aadj; - aadj -= L; - /* The tolerances below are conservative. */ - if (dsign || word1(rv) || word0(rv) & Bndry_mask) { - if (aadj < .4999999 || aadj > .5000001) - break; - } - else if (aadj < .4999999/FLT_RADIX) - break; - } -#endif -cont: - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(delta); - } -#ifdef SET_INEXACT - if (inexact) { - if (!oldinexact) { - word0(rv0) = Exp_1 + (70 << Exp_shift); - word1(rv0) = 0; - dval(rv0) += 1.; - } - } - else if (!oldinexact) - clear_inexact(); -#endif -#ifdef Avoid_Underflow - if (scale) { - word0(rv0) = Exp_1 - 2*P*Exp_msk1; - word1(rv0) = 0; - dval(rv) *= dval(rv0); -#ifndef NO_ERRNO - /* try to avoid the bug of testing an 8087 register value */ - if (word0(rv) == 0 && word1(rv) == 0) - errno = ERANGE; -#endif - } -#endif /* Avoid_Underflow */ -#ifdef SET_INEXACT - if (inexact && !(word0(rv) & Exp_mask)) { - /* set underflow bit */ - dval(rv0) = 1e-300; - dval(rv0) *= dval(rv0); - } -#endif -retfree: - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(bd0); - Bfree(delta); -ret: - if (se) - *se = (char *)s; - return sign ? -dval(rv) : dval(rv); -} - -NO_SANITIZE("unsigned-integer-overflow", static int quorem(Bigint *b, Bigint *S)); -static int -quorem(Bigint *b, Bigint *S) -{ - int n; - ULong *bx, *bxe, q, *sx, *sxe; -#ifdef ULLong - ULLong borrow, carry, y, ys; -#else - ULong borrow, carry, y, ys; -#ifdef Pack_32 - ULong si, z, zs; -#endif -#endif - - n = S->wds; -#ifdef DEBUG - /*debug*/ if (b->wds > n) - /*debug*/ Bug("oversize b in quorem"); -#endif - if (b->wds < n) - return 0; - sx = S->x; - sxe = sx + --n; - bx = b->x; - bxe = bx + n; - q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ -#ifdef DEBUG - /*debug*/ if (q > 9) - /*debug*/ Bug("oversized quotient in quorem"); -#endif - if (q) { - borrow = 0; - carry = 0; - do { -#ifdef ULLong - ys = *sx++ * (ULLong)q + carry; - carry = ys >> 32; - y = *bx - (ys & FFFFFFFF) - borrow; - borrow = y >> 32 & (ULong)1; - *bx++ = (ULong)(y & FFFFFFFF); -#else -#ifdef Pack_32 - si = *sx++; - ys = (si & 0xffff) * q + carry; - zs = (si >> 16) * q + (ys >> 16); - carry = zs >> 16; - y = (*bx & 0xffff) - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*bx >> 16) - (zs & 0xffff) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(bx, z, y); -#else - ys = *sx++ * q + carry; - carry = ys >> 16; - y = *bx - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - *bx++ = y & 0xffff; -#endif -#endif - } while (sx <= sxe); - if (!*bxe) { - bx = b->x; - while (--bxe > bx && !*bxe) - --n; - b->wds = n; - } - } - if (cmp(b, S) >= 0) { - q++; - borrow = 0; - carry = 0; - bx = b->x; - sx = S->x; - do { -#ifdef ULLong - ys = *sx++ + carry; - carry = ys >> 32; - y = *bx - (ys & FFFFFFFF) - borrow; - borrow = y >> 32 & (ULong)1; - *bx++ = (ULong)(y & FFFFFFFF); -#else -#ifdef Pack_32 - si = *sx++; - ys = (si & 0xffff) + carry; - zs = (si >> 16) + (ys >> 16); - carry = zs >> 16; - y = (*bx & 0xffff) - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*bx >> 16) - (zs & 0xffff) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(bx, z, y); -#else - ys = *sx++ + carry; - carry = ys >> 16; - y = *bx - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - *bx++ = y & 0xffff; -#endif -#endif - } while (sx <= sxe); - bx = b->x; - bxe = bx + n; - if (!*bxe) { - while (--bxe > bx && !*bxe) - --n; - b->wds = n; - } - } - return q; -} - -#ifndef MULTIPLE_THREADS -static char *dtoa_result; -#endif - -#ifndef MULTIPLE_THREADS -static char * -rv_alloc(int i) -{ - return dtoa_result = MALLOC(i); -} -#else -#define rv_alloc(i) MALLOC(i) -#endif - -static char * -nrv_alloc(const char *s, char **rve, size_t n) -{ - char *rv, *t; - - t = rv = rv_alloc(n); - while ((*t = *s++) != 0) t++; - if (rve) - *rve = t; - return rv; -} - -#define rv_strdup(s, rve) nrv_alloc((s), (rve), strlen(s)+1) - -#ifndef MULTIPLE_THREADS -/* freedtoa(s) must be used to free values s returned by dtoa - * when MULTIPLE_THREADS is #defined. It should be used in all cases, - * but for consistency with earlier versions of dtoa, it is optional - * when MULTIPLE_THREADS is not defined. - */ - -static void -freedtoa(char *s) -{ - FREE(s); -} -#endif - -static const char INFSTR[] = "Infinity"; -static const char NANSTR[] = "NaN"; -static const char ZEROSTR[] = "0"; - -/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. - * - * Inspired by "How to Print Floating-Point Numbers Accurately" by - * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. - * - * Modifications: - * 1. Rather than iterating, we use a simple numeric overestimate - * to determine k = floor(log10(d)). We scale relevant - * quantities using O(log2(k)) rather than O(k) multiplications. - * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't - * try to generate digits strictly left to right. Instead, we - * compute with fewer bits and propagate the carry if necessary - * when rounding the final digit up. This is often faster. - * 3. Under the assumption that input will be rounded nearest, - * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. - * That is, we allow equality in stopping tests when the - * round-nearest rule will give the same floating-point value - * as would satisfaction of the stopping test with strict - * inequality. - * 4. We remove common factors of powers of 2 from relevant - * quantities. - * 5. When converting floating-point integers less than 1e16, - * we use floating-point arithmetic rather than resorting - * to multiple-precision integers. - * 6. When asked to produce fewer than 15 digits, we first try - * to get by with floating-point arithmetic; we resort to - * multiple-precision integer arithmetic only if we cannot - * guarantee that the floating-point calculation has given - * the correctly rounded result. For k requested digits and - * "uniformly" distributed input, the probability is - * something like 10^(k-15) that we must resort to the Long - * calculation. - */ - -char * -dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve) -{ - /* Arguments ndigits, decpt, sign are similar to those - of ecvt and fcvt; trailing zeros are suppressed from - the returned string. If not null, *rve is set to point - to the end of the return value. If d is +-Infinity or NaN, - then *decpt is set to 9999. - - mode: - 0 ==> shortest string that yields d when read in - and rounded to nearest. - 1 ==> like 0, but with Steele & White stopping rule; - e.g. with IEEE P754 arithmetic , mode 0 gives - 1e23 whereas mode 1 gives 9.999999999999999e22. - 2 ==> max(1,ndigits) significant digits. This gives a - return value similar to that of ecvt, except - that trailing zeros are suppressed. - 3 ==> through ndigits past the decimal point. This - gives a return value similar to that from fcvt, - except that trailing zeros are suppressed, and - ndigits can be negative. - 4,5 ==> similar to 2 and 3, respectively, but (in - round-nearest mode) with the tests of mode 0 to - possibly return a shorter string that rounds to d. - With IEEE arithmetic and compilation with - -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same - as modes 2 and 3 when FLT_ROUNDS != 1. - 6-9 ==> Debugging modes similar to mode - 4: don't try - fast floating-point estimate (if applicable). - - Values of mode other than 0-9 are treated as mode 0. - - Sufficient space is allocated to the return value - to hold the suppressed trailing zeros. - */ - - int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, - j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, - spec_case, try_quick, half = 0; - Long L; -#ifndef Sudden_Underflow - int denorm; - ULong x; -#endif - Bigint *b, *b1, *delta, *mlo = 0, *mhi = 0, *S; - double ds; - double_u d, d2, eps; - char *s, *s0; -#ifdef Honor_FLT_ROUNDS - int rounding; -#endif -#ifdef SET_INEXACT - int inexact, oldinexact; -#endif - - dval(d) = d_; - -#ifndef MULTIPLE_THREADS - if (dtoa_result) { - freedtoa(dtoa_result); - dtoa_result = 0; - } -#endif - - if (word0(d) & Sign_bit) { - /* set sign for everything, including 0's and NaNs */ - *sign = 1; - word0(d) &= ~Sign_bit; /* clear sign bit */ - } - else - *sign = 0; - -#if defined(IEEE_Arith) + defined(VAX) -#ifdef IEEE_Arith - if ((word0(d) & Exp_mask) == Exp_mask) -#else - if (word0(d) == 0x8000) -#endif - { - /* Infinity or NaN */ - *decpt = 9999; -#ifdef IEEE_Arith - if (!word1(d) && !(word0(d) & 0xfffff)) - return rv_strdup(INFSTR, rve); -#endif - return rv_strdup(NANSTR, rve); - } -#endif -#ifdef IBM - dval(d) += 0; /* normalize */ -#endif - if (!dval(d)) { - *decpt = 1; - return rv_strdup(ZEROSTR, rve); - } - -#ifdef SET_INEXACT - try_quick = oldinexact = get_inexact(); - inexact = 1; -#endif -#ifdef Honor_FLT_ROUNDS - if ((rounding = Flt_Rounds) >= 2) { - if (*sign) - rounding = rounding == 2 ? 0 : 2; - else - if (rounding != 2) - rounding = 0; - } -#endif - - b = d2b(dval(d), &be, &bbits); -#ifdef Sudden_Underflow - i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); -#else - if ((i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) != 0) { -#endif - dval(d2) = dval(d); - word0(d2) &= Frac_mask1; - word0(d2) |= Exp_11; -#ifdef IBM - if (j = 11 - hi0bits(word0(d2) & Frac_mask)) - dval(d2) /= 1 << j; -#endif - - /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 - * log10(x) = log(x) / log(10) - * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) - * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) - * - * This suggests computing an approximation k to log10(d) by - * - * k = (i - Bias)*0.301029995663981 - * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); - * - * We want k to be too large rather than too small. - * The error in the first-order Taylor series approximation - * is in our favor, so we just round up the constant enough - * to compensate for any error in the multiplication of - * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, - * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, - * adding 1e-13 to the constant term more than suffices. - * Hence we adjust the constant term to 0.1760912590558. - * (We could get a more accurate k by invoking log10, - * but this is probably not worthwhile.) - */ - - i -= Bias; -#ifdef IBM - i <<= 2; - i += j; -#endif -#ifndef Sudden_Underflow - denorm = 0; - } - else { - /* d is denormalized */ - - i = bbits + be + (Bias + (P-1) - 1); - x = i > 32 ? word0(d) << (64 - i) | word1(d) >> (i - 32) - : word1(d) << (32 - i); - dval(d2) = x; - word0(d2) -= 31*Exp_msk1; /* adjust exponent */ - i -= (Bias + (P-1) - 1) + 1; - denorm = 1; - } -#endif - ds = (dval(d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; - k = (int)ds; - if (ds < 0. && ds != k) - k--; /* want k = floor(ds) */ - k_check = 1; - if (k >= 0 && k <= Ten_pmax) { - if (dval(d) < tens[k]) - k--; - k_check = 0; - } - j = bbits - i - 1; - if (j >= 0) { - b2 = 0; - s2 = j; - } - else { - b2 = -j; - s2 = 0; - } - if (k >= 0) { - b5 = 0; - s5 = k; - s2 += k; - } - else { - b2 -= k; - b5 = -k; - s5 = 0; - } - if (mode < 0 || mode > 9) - mode = 0; - -#ifndef SET_INEXACT -#ifdef Check_FLT_ROUNDS - try_quick = Rounding == 1; -#else - try_quick = 1; -#endif -#endif /*SET_INEXACT*/ - - if (mode > 5) { - mode -= 4; - try_quick = 0; - } - leftright = 1; - ilim = ilim1 = -1; - switch (mode) { - case 0: - case 1: - i = 18; - ndigits = 0; - break; - case 2: - leftright = 0; - /* no break */ - case 4: - if (ndigits <= 0) - ndigits = 1; - ilim = ilim1 = i = ndigits; - break; - case 3: - leftright = 0; - /* no break */ - case 5: - i = ndigits + k + 1; - ilim = i; - ilim1 = i - 1; - if (i <= 0) - i = 1; - } - s = s0 = rv_alloc(i+1); - -#ifdef Honor_FLT_ROUNDS - if (mode > 1 && rounding != 1) - leftright = 0; -#endif - - if (ilim >= 0 && ilim <= Quick_max && try_quick) { - - /* Try to get by with floating-point arithmetic. */ - - i = 0; - dval(d2) = dval(d); - k0 = k; - ilim0 = ilim; - ieps = 2; /* conservative */ - if (k > 0) { - ds = tens[k&0xf]; - j = k >> 4; - if (j & Bletch) { - /* prevent overflows */ - j &= Bletch - 1; - dval(d) /= bigtens[n_bigtens-1]; - ieps++; - } - for (; j; j >>= 1, i++) - if (j & 1) { - ieps++; - ds *= bigtens[i]; - } - dval(d) /= ds; - } - else if ((j1 = -k) != 0) { - dval(d) *= tens[j1 & 0xf]; - for (j = j1 >> 4; j; j >>= 1, i++) - if (j & 1) { - ieps++; - dval(d) *= bigtens[i]; - } - } - if (k_check && dval(d) < 1. && ilim > 0) { - if (ilim1 <= 0) - goto fast_failed; - ilim = ilim1; - k--; - dval(d) *= 10.; - ieps++; - } - dval(eps) = ieps*dval(d) + 7.; - word0(eps) -= (P-1)*Exp_msk1; - if (ilim == 0) { - S = mhi = 0; - dval(d) -= 5.; - if (dval(d) > dval(eps)) - goto one_digit; - if (dval(d) < -dval(eps)) - goto no_digits; - goto fast_failed; - } -#ifndef No_leftright - if (leftright) { - /* Use Steele & White method of only - * generating digits needed. - */ - dval(eps) = 0.5/tens[ilim-1] - dval(eps); - for (i = 0;;) { - L = (int)dval(d); - dval(d) -= L; - *s++ = '0' + (int)L; - if (dval(d) < dval(eps)) - goto ret1; - if (1. - dval(d) < dval(eps)) - goto bump_up; - if (++i >= ilim) - break; - dval(eps) *= 10.; - dval(d) *= 10.; - } - } - else { -#endif - /* Generate ilim digits, then fix them up. */ - dval(eps) *= tens[ilim-1]; - for (i = 1;; i++, dval(d) *= 10.) { - L = (Long)(dval(d)); - if (!(dval(d) -= L)) - ilim = i; - *s++ = '0' + (int)L; - if (i == ilim) { - if (dval(d) > 0.5 + dval(eps)) - goto bump_up; - else if (dval(d) < 0.5 - dval(eps)) { - while (*--s == '0') ; - s++; - goto ret1; - } - half = 1; - if ((*(s-1) - '0') & 1) { - goto bump_up; - } - break; - } - } -#ifndef No_leftright - } -#endif -fast_failed: - s = s0; - dval(d) = dval(d2); - k = k0; - ilim = ilim0; - } - - /* Do we have a "small" integer? */ - - if (be >= 0 && k <= Int_max) { - /* Yes. */ - ds = tens[k]; - if (ndigits < 0 && ilim <= 0) { - S = mhi = 0; - if (ilim < 0 || dval(d) <= 5*ds) - goto no_digits; - goto one_digit; - } - for (i = 1;; i++, dval(d) *= 10.) { - L = (Long)(dval(d) / ds); - dval(d) -= L*ds; -#ifdef Check_FLT_ROUNDS - /* If FLT_ROUNDS == 2, L will usually be high by 1 */ - if (dval(d) < 0) { - L--; - dval(d) += ds; - } -#endif - *s++ = '0' + (int)L; - if (!dval(d)) { -#ifdef SET_INEXACT - inexact = 0; -#endif - break; - } - if (i == ilim) { -#ifdef Honor_FLT_ROUNDS - if (mode > 1) - switch (rounding) { - case 0: goto ret1; - case 2: goto bump_up; - } -#endif - dval(d) += dval(d); - if (dval(d) > ds || (dval(d) == ds && (L & 1))) { -bump_up: - while (*--s == '9') - if (s == s0) { - k++; - *s = '0'; - break; - } - ++*s++; - } - break; - } - } - goto ret1; - } - - m2 = b2; - m5 = b5; - if (leftright) { - i = -#ifndef Sudden_Underflow - denorm ? be + (Bias + (P-1) - 1 + 1) : -#endif -#ifdef IBM - 1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3); -#else - 1 + P - bbits; -#endif - b2 += i; - s2 += i; - mhi = i2b(1); - } - if (m2 > 0 && s2 > 0) { - i = m2 < s2 ? m2 : s2; - b2 -= i; - m2 -= i; - s2 -= i; - } - if (b5 > 0) { - if (leftright) { - if (m5 > 0) { - mhi = pow5mult(mhi, m5); - b1 = mult(mhi, b); - Bfree(b); - b = b1; - } - if ((j = b5 - m5) != 0) - b = pow5mult(b, j); - } - else - b = pow5mult(b, b5); - } - S = i2b(1); - if (s5 > 0) - S = pow5mult(S, s5); - - /* Check for special case that d is a normalized power of 2. */ - - spec_case = 0; - if ((mode < 2 || leftright) -#ifdef Honor_FLT_ROUNDS - && rounding == 1 -#endif - ) { - if (!word1(d) && !(word0(d) & Bndry_mask) -#ifndef Sudden_Underflow - && word0(d) & (Exp_mask & ~Exp_msk1) -#endif - ) { - /* The special case */ - b2 += Log2P; - s2 += Log2P; - spec_case = 1; - } - } - - /* Arrange for convenient computation of quotients: - * shift left if necessary so divisor has 4 leading 0 bits. - * - * Perhaps we should just compute leading 28 bits of S once - * and for all and pass them and a shift to quorem, so it - * can do shifts and ors to compute the numerator for q. - */ -#ifdef Pack_32 - if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) != 0) - i = 32 - i; -#else - if ((i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf) != 0) - i = 16 - i; -#endif - if (i > 4) { - i -= 4; - b2 += i; - m2 += i; - s2 += i; - } - else if (i < 4) { - i += 28; - b2 += i; - m2 += i; - s2 += i; - } - if (b2 > 0) - b = lshift(b, b2); - if (s2 > 0) - S = lshift(S, s2); - if (k_check) { - if (cmp(b,S) < 0) { - k--; - b = multadd(b, 10, 0); /* we botched the k estimate */ - if (leftright) - mhi = multadd(mhi, 10, 0); - ilim = ilim1; - } - } - if (ilim <= 0 && (mode == 3 || mode == 5)) { - if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) { - /* no digits, fcvt style */ -no_digits: - k = -1 - ndigits; - goto ret; - } -one_digit: - *s++ = '1'; - k++; - goto ret; - } - if (leftright) { - if (m2 > 0) - mhi = lshift(mhi, m2); - - /* Compute mlo -- check for special case - * that d is a normalized power of 2. - */ - - mlo = mhi; - if (spec_case) { - mhi = Balloc(mhi->k); - Bcopy(mhi, mlo); - mhi = lshift(mhi, Log2P); - } - - for (i = 1;;i++) { - dig = quorem(b,S) + '0'; - /* Do we yet have the shortest decimal string - * that will round to d? - */ - j = cmp(b, mlo); - delta = diff(S, mhi); - j1 = delta->sign ? 1 : cmp(b, delta); - Bfree(delta); -#ifndef ROUND_BIASED - if (j1 == 0 && mode != 1 && !(word1(d) & 1) -#ifdef Honor_FLT_ROUNDS - && rounding >= 1 -#endif - ) { - if (dig == '9') - goto round_9_up; - if (j > 0) - dig++; -#ifdef SET_INEXACT - else if (!b->x[0] && b->wds <= 1) - inexact = 0; -#endif - *s++ = dig; - goto ret; - } -#endif - if (j < 0 || (j == 0 && mode != 1 -#ifndef ROUND_BIASED - && !(word1(d) & 1) -#endif - )) { - if (!b->x[0] && b->wds <= 1) { -#ifdef SET_INEXACT - inexact = 0; -#endif - goto accept_dig; - } -#ifdef Honor_FLT_ROUNDS - if (mode > 1) - switch (rounding) { - case 0: goto accept_dig; - case 2: goto keep_dig; - } -#endif /*Honor_FLT_ROUNDS*/ - if (j1 > 0) { - b = lshift(b, 1); - j1 = cmp(b, S); - if ((j1 > 0 || (j1 == 0 && (dig & 1))) && dig++ == '9') - goto round_9_up; - } -accept_dig: - *s++ = dig; - goto ret; - } - if (j1 > 0) { -#ifdef Honor_FLT_ROUNDS - if (!rounding) - goto accept_dig; -#endif - if (dig == '9') { /* possible if i == 1 */ -round_9_up: - *s++ = '9'; - goto roundoff; - } - *s++ = dig + 1; - goto ret; - } -#ifdef Honor_FLT_ROUNDS -keep_dig: -#endif - *s++ = dig; - if (i == ilim) - break; - b = multadd(b, 10, 0); - if (mlo == mhi) - mlo = mhi = multadd(mhi, 10, 0); - else { - mlo = multadd(mlo, 10, 0); - mhi = multadd(mhi, 10, 0); - } - } - } - else - for (i = 1;; i++) { - *s++ = dig = quorem(b,S) + '0'; - if (!b->x[0] && b->wds <= 1) { -#ifdef SET_INEXACT - inexact = 0; -#endif - goto ret; - } - if (i >= ilim) - break; - b = multadd(b, 10, 0); - } - - /* Round off last digit */ - -#ifdef Honor_FLT_ROUNDS - switch (rounding) { - case 0: goto trimzeros; - case 2: goto roundoff; - } -#endif - b = lshift(b, 1); - j = cmp(b, S); - if (j > 0 || (j == 0 && (dig & 1))) { - roundoff: - while (*--s == '9') - if (s == s0) { - k++; - *s++ = '1'; - goto ret; - } - if (!half || (*s - '0') & 1) - ++*s; - } - else { - while (*--s == '0') ; - } - s++; -ret: - Bfree(S); - if (mhi) { - if (mlo && mlo != mhi) - Bfree(mlo); - Bfree(mhi); - } -ret1: -#ifdef SET_INEXACT - if (inexact) { - if (!oldinexact) { - word0(d) = Exp_1 + (70 << Exp_shift); - word1(d) = 0; - dval(d) += 1.; - } - } - else if (!oldinexact) - clear_inexact(); -#endif - Bfree(b); - *s = 0; - *decpt = k + 1; - if (rve) - *rve = s; - return s0; -} - -/*- - * Copyright (c) 2004-2008 David Schultz <das@FreeBSD.ORG> - * 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 DBL_MANH_SIZE 20 -#define DBL_MANL_SIZE 32 -#define DBL_ADJ (DBL_MAX_EXP - 2) -#define SIGFIGS ((DBL_MANT_DIG + 3) / 4 + 1) -#define dexp_get(u) ((int)(word0(u) >> Exp_shift) & ~Exp_msk1) -#define dexp_set(u,v) (word0(u) = (((int)(word0(u)) & ~Exp_mask) | ((v) << Exp_shift))) -#define dmanh_get(u) ((uint32_t)(word0(u) & Frac_mask)) -#define dmanl_get(u) ((uint32_t)word1(u)) - - -/* - * This procedure converts a double-precision number in IEEE format - * into a string of hexadecimal digits and an exponent of 2. Its - * behavior is bug-for-bug compatible with dtoa() in mode 2, with the - * following exceptions: - * - * - An ndigits < 0 causes it to use as many digits as necessary to - * represent the number exactly. - * - The additional xdigs argument should point to either the string - * "0123456789ABCDEF" or the string "0123456789abcdef", depending on - * which case is desired. - * - This routine does not repeat dtoa's mistake of setting decpt - * to 9999 in the case of an infinity or NaN. INT_MAX is used - * for this purpose instead. - * - * Note that the C99 standard does not specify what the leading digit - * should be for non-zero numbers. For instance, 0x1.3p3 is the same - * as 0x2.6p2 is the same as 0x4.cp3. This implementation always makes - * the leading digit a 1. This ensures that the exponent printed is the - * actual base-2 exponent, i.e., ilogb(d). - * - * Inputs: d, xdigs, ndigits - * Outputs: decpt, sign, rve - */ -char * -hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve) -{ - U u; - char *s, *s0; - int bufsize; - uint32_t manh, manl; - - u.d = d; - if (word0(u) & Sign_bit) { - /* set sign for everything, including 0's and NaNs */ - *sign = 1; - word0(u) &= ~Sign_bit; /* clear sign bit */ - } - else - *sign = 0; - - if (isinf(d)) { /* FP_INFINITE */ - *decpt = INT_MAX; - return rv_strdup(INFSTR, rve); - } - else if (isnan(d)) { /* FP_NAN */ - *decpt = INT_MAX; - return rv_strdup(NANSTR, rve); - } - else if (d == 0.0) { /* FP_ZERO */ - *decpt = 1; - return rv_strdup(ZEROSTR, rve); - } - else if (dexp_get(u)) { /* FP_NORMAL */ - *decpt = dexp_get(u) - DBL_ADJ; - } - else { /* FP_SUBNORMAL */ - u.d *= 5.363123171977039e+154 /* 0x1p514 */; - *decpt = dexp_get(u) - (514 + DBL_ADJ); - } - - if (ndigits == 0) /* dtoa() compatibility */ - ndigits = 1; - - /* - * If ndigits < 0, we are expected to auto-size, so we allocate - * enough space for all the digits. - */ - bufsize = (ndigits > 0) ? ndigits : SIGFIGS; - s0 = rv_alloc(bufsize+1); - - /* Round to the desired number of digits. */ - if (SIGFIGS > ndigits && ndigits > 0) { - float redux = 1.0f; - int offset = 4 * ndigits + DBL_MAX_EXP - 4 - DBL_MANT_DIG; - dexp_set(u, offset); - u.d += redux; - u.d -= redux; - *decpt += dexp_get(u) - offset; - } - - manh = dmanh_get(u); - manl = dmanl_get(u); - *s0 = '1'; - for (s = s0 + 1; s < s0 + bufsize; s++) { - *s = xdigs[(manh >> (DBL_MANH_SIZE - 4)) & 0xf]; - manh = (manh << 4) | (manl >> (DBL_MANL_SIZE - 4)); - manl <<= 4; - } - - /* If ndigits < 0, we are expected to auto-size the precision. */ - if (ndigits < 0) { - for (ndigits = SIGFIGS; s0[ndigits - 1] == '0'; ndigits--) - ; - } - - s = s0 + ndigits; - *s = '\0'; - if (rve != NULL) - *rve = s; - return (s0); -} - -#ifdef __cplusplus -#if 0 -{ /* satisfy cc-mode */ -#endif -} -#endif diff --git a/ext/bigdecimal/sample/linear.rb b/ext/bigdecimal/sample/linear.rb deleted file mode 100644 index 516c2473be..0000000000 --- a/ext/bigdecimal/sample/linear.rb +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/local/bin/ruby -# frozen_string_literal: false - -# -# linear.rb -# -# Solves linear equation system(A*x = b) by LU decomposition method. -# where A is a coefficient matrix,x is an answer vector,b is a constant vector. -# -# USAGE: -# ruby linear.rb [input file solved] -# - -# :stopdoc: -require "bigdecimal" -require "bigdecimal/ludcmp" - -# -# NOTE: -# Change following BigDecimal.limit() if needed. -BigDecimal.limit(100) -# - -include LUSolve -def rd_order(na) - printf("Number of equations ?") if(na <= 0) - n = ARGF.gets().to_i -end - -na = ARGV.size -zero = BigDecimal("0.0") -one = BigDecimal("1.0") - -while (n=rd_order(na))>0 - a = [] - as= [] - b = [] - if na <= 0 - # Read data from console. - printf("\nEnter coefficient matrix element A[i,j]\n") - for i in 0...n do - for j in 0...n do - printf("A[%d,%d]? ",i,j); s = ARGF.gets - a << BigDecimal(s) - as << BigDecimal(s) - end - printf("Contatant vector element b[%d] ? ",i) - b << BigDecimal(ARGF.gets) - end - else - # Read data from specified file. - printf("Coefficient matrix and constant vector.\n") - for i in 0...n do - s = ARGF.gets - printf("%d) %s",i,s) - s = s.split - for j in 0...n do - a << BigDecimal(s[j]) - as << BigDecimal(s[j]) - end - b << BigDecimal(s[n]) - end - end - x = lusolve(a,b,ludecomp(a,n,zero,one),zero) - printf("Answer(x[i] & (A*x-b)[i]) follows\n") - for i in 0...n do - printf("x[%d]=%s ",i,x[i].to_s) - s = zero - for j in 0...n do - s = s + as[i*n+j]*x[j] - end - printf(" & %s\n",(s-b[i]).to_s) - end -end diff --git a/ext/bigdecimal/sample/nlsolve.rb b/ext/bigdecimal/sample/nlsolve.rb deleted file mode 100644 index c2227dac73..0000000000 --- a/ext/bigdecimal/sample/nlsolve.rb +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/local/bin/ruby -# frozen_string_literal: false - -# -# nlsolve.rb -# An example for solving nonlinear algebraic equation system. -# - -require "bigdecimal" -require "bigdecimal/newton" -include Newton - -class Function # :nodoc: all - def initialize() - @zero = BigDecimal("0.0") - @one = BigDecimal("1.0") - @two = BigDecimal("2.0") - @ten = BigDecimal("10.0") - @eps = BigDecimal("1.0e-16") - end - def zero;@zero;end - def one ;@one ;end - def two ;@two ;end - def ten ;@ten ;end - def eps ;@eps ;end - def values(x) # <= defines functions solved - f = [] - f1 = x[0]*x[0] + x[1]*x[1] - @two # f1 = x**2 + y**2 - 2 => 0 - f2 = x[0] - x[1] # f2 = x - y => 0 - f <<= f1 - f <<= f2 - f - end -end - -f = BigDecimal.limit(100) -f = Function.new -x = [f.zero,f.zero] # Initial values -n = nlsolve(f,x) -p x diff --git a/ext/bigdecimal/sample/pi.rb b/ext/bigdecimal/sample/pi.rb deleted file mode 100644 index ea9663896c..0000000000 --- a/ext/bigdecimal/sample/pi.rb +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/local/bin/ruby -# frozen_string_literal: false - -# -# pi.rb -# -# Calculates 3.1415.... (the number of times that a circle's diameter -# will fit around the circle) using J. Machin's formula. -# - -require "bigdecimal" -require "bigdecimal/math.rb" - -include BigMath - -if ARGV.size == 1 - print "PI("+ARGV[0]+"):\n" - p PI(ARGV[0].to_i) -else - print "TRY: ruby pi.rb 1000 \n" -end diff --git a/ext/bigdecimal/static_assert.h b/ext/bigdecimal/static_assert.h deleted file mode 100644 index 9295729bf6..0000000000 --- a/ext/bigdecimal/static_assert.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef BIGDECIMAL_STATIC_ASSERT_H -#define BIGDECIMAL_STATIC_ASSERT_H - -#include "feature.h" - -#ifdef HAVE_RUBY_INTERNAL_STATIC_ASSERT_H -# include <ruby/internal/static_assert.h> -#endif - -#ifdef RBIMPL_STATIC_ASSERT -# define STATIC_ASSERT RBIMPL_STATIC_ASSERT -#endif - -#ifndef STATIC_ASSERT -# /* The following section is copied from CRuby's static_assert.h */ - -# if defined(__cplusplus) && defined(__cpp_static_assert) -# /* https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations */ -# define BIGDECIMAL_STATIC_ASSERT0 static_assert - -# elif defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER >= 1600 -# define BIGDECIMAL_STATIC_ASSERT0 static_assert - -# elif defined(__INTEL_CXX11_MODE__) -# define BIGDECIMAL_STATIC_ASSERT0 static_assert - -# elif defined(__cplusplus) && __cplusplus >= 201103L -# define BIGDECIMAL_STATIC_ASSERT0 static_assert - -# elif defined(__cplusplus) && __has_extension(cxx_static_assert) -# define BIGDECIMAL_STATIC_ASSERT0 __extension__ static_assert - -# elif defined(__STDC_VERSION__) && __has_extension(c_static_assert) -# define BIGDECIMAL_STATIC_ASSERT0 __extension__ _Static_assert - -# elif defined(__STDC_VERSION__) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -# define BIGDECIMAL_STATIC_ASSERT0 __extension__ _Static_assert -#endif - -# if defined(__DOXYGEN__) -# define STATIC_ASSERT static_assert - -# elif defined(BIGDECIMAL_STATIC_ASSERT0) -# define STATIC_ASSERT(name, expr) \ - BIGDECIMAL_STATIC_ASSERT0(expr, #name ": " #expr) - -# else -# define STATIC_ASSERT(name, expr) \ - typedef int static_assert_ ## name ## _check[1 - 2 * !(expr)] -# endif -#endif /* STATIC_ASSERT */ - - -#endif /* BIGDECIMAL_STATIC_ASSERT_H */ diff --git a/ext/cgi/escape/depend b/ext/cgi/escape/depend index e3904d0695..746b47246a 100644 --- a/ext/cgi/escape/depend +++ b/ext/cgi/escape/depend @@ -53,6 +53,7 @@ escape.o: $(hdrdir)/ruby/internal/attr/noexcept.h escape.o: $(hdrdir)/ruby/internal/attr/noinline.h escape.o: $(hdrdir)/ruby/internal/attr/nonnull.h escape.o: $(hdrdir)/ruby/internal/attr/noreturn.h +escape.o: $(hdrdir)/ruby/internal/attr/packed_struct.h escape.o: $(hdrdir)/ruby/internal/attr/pure.h escape.o: $(hdrdir)/ruby/internal/attr/restrict.h escape.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ escape.o: $(hdrdir)/ruby/internal/intern/enumerator.h escape.o: $(hdrdir)/ruby/internal/intern/error.h escape.o: $(hdrdir)/ruby/internal/intern/eval.h escape.o: $(hdrdir)/ruby/internal/intern/file.h -escape.o: $(hdrdir)/ruby/internal/intern/gc.h escape.o: $(hdrdir)/ruby/internal/intern/hash.h escape.o: $(hdrdir)/ruby/internal/intern/io.h escape.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ escape.o: $(hdrdir)/ruby/internal/memory.h escape.o: $(hdrdir)/ruby/internal/method.h escape.o: $(hdrdir)/ruby/internal/module.h escape.o: $(hdrdir)/ruby/internal/newobj.h -escape.o: $(hdrdir)/ruby/internal/rgengc.h escape.o: $(hdrdir)/ruby/internal/scan_args.h escape.o: $(hdrdir)/ruby/internal/special_consts.h escape.o: $(hdrdir)/ruby/internal/static_assert.h escape.o: $(hdrdir)/ruby/internal/stdalign.h escape.o: $(hdrdir)/ruby/internal/stdbool.h +escape.o: $(hdrdir)/ruby/internal/stdckdint.h escape.o: $(hdrdir)/ruby/internal/symbol.h escape.o: $(hdrdir)/ruby/internal/value.h escape.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/cgi/escape/escape.c b/ext/cgi/escape/escape.c index c5b76de596..495ad83aa3 100644 --- a/ext/cgi/escape/escape.c +++ b/ext/cgi/escape/escape.c @@ -83,7 +83,7 @@ optimized_unescape_html(VALUE str) unsigned long charlimit = (strcasecmp(rb_enc_name(enc), "UTF-8") == 0 ? UNICODE_MAX : strcasecmp(rb_enc_name(enc), "ISO-8859-1") == 0 ? 256 : 128); - long i, len, beg = 0; + long i, j, len, beg = 0; size_t clen, plen; int overflow; const char *cstr; @@ -100,6 +100,7 @@ optimized_unescape_html(VALUE str) plen = i - beg; if (++i >= len) break; c = (unsigned char)cstr[i]; + j = i; #define MATCH(s) (len - i >= (int)rb_strlen_lit(s) && \ memcmp(&cstr[i], s, rb_strlen_lit(s)) == 0 && \ (i += rb_strlen_lit(s) - 1, 1)) @@ -112,28 +113,40 @@ optimized_unescape_html(VALUE str) else if (MATCH("mp;")) { c = '&'; } - else continue; + else { + i = j; + continue; + } break; case 'q': ++i; if (MATCH("uot;")) { c = '"'; } - else continue; + else { + i = j; + continue; + } break; case 'g': ++i; if (MATCH("t;")) { c = '>'; } - else continue; + else { + i = j; + continue; + } break; case 'l': ++i; if (MATCH("t;")) { c = '<'; } - else continue; + else { + i = j; + continue; + } break; case '#': if (len - ++i >= 2 && ISDIGIT(cstr[i])) { @@ -142,9 +155,15 @@ optimized_unescape_html(VALUE str) else if ((cstr[i] == 'x' || cstr[i] == 'X') && len - ++i >= 2 && ISXDIGIT(cstr[i])) { cc = ruby_scan_digits(&cstr[i], len-i, 16, &clen, &overflow); } - else continue; + else { + i = j; + continue; + } i += clen; - if (overflow || cc >= charlimit || cstr[i] != ';') continue; + if (overflow || cc >= charlimit || cstr[i] != ';') { + i = j; + continue; + } if (!dest) { dest = rb_str_buf_new(len); } @@ -458,7 +477,9 @@ InitVM_escape(void) rb_define_method(rb_mEscape, "escapeHTML", cgiesc_escape_html, 1); rb_define_method(rb_mEscape, "unescapeHTML", cgiesc_unescape_html, 1); rb_define_method(rb_mEscape, "escapeURIComponent", cgiesc_escape_uri_component, 1); + rb_define_alias(rb_mEscape, "escape_uri_component", "escapeURIComponent"); rb_define_method(rb_mEscape, "unescapeURIComponent", cgiesc_unescape_uri_component, -1); + rb_define_alias(rb_mEscape, "unescape_uri_component", "unescapeURIComponent"); rb_define_method(rb_mEscape, "escape", cgiesc_escape, 1); rb_define_method(rb_mEscape, "unescape", cgiesc_unescape, -1); rb_prepend_module(rb_mUtil, rb_mEscape); diff --git a/ext/cgi/escape/extconf.rb b/ext/cgi/escape/extconf.rb index 16e8ff224d..73acd89ca8 100644 --- a/ext/cgi/escape/extconf.rb +++ b/ext/cgi/escape/extconf.rb @@ -1,3 +1,7 @@ require 'mkmf' -create_makefile 'cgi/escape' +if RUBY_ENGINE == 'truffleruby' + File.write("Makefile", dummy_makefile($srcdir).join("")) +else + create_makefile 'cgi/escape' +end diff --git a/ext/continuation/depend b/ext/continuation/depend index 81218f9965..b40e52e29b 100644 --- a/ext/continuation/depend +++ b/ext/continuation/depend @@ -51,6 +51,7 @@ continuation.o: $(hdrdir)/ruby/internal/attr/noexcept.h continuation.o: $(hdrdir)/ruby/internal/attr/noinline.h continuation.o: $(hdrdir)/ruby/internal/attr/nonnull.h continuation.o: $(hdrdir)/ruby/internal/attr/noreturn.h +continuation.o: $(hdrdir)/ruby/internal/attr/packed_struct.h continuation.o: $(hdrdir)/ruby/internal/attr/pure.h continuation.o: $(hdrdir)/ruby/internal/attr/restrict.h continuation.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ continuation.o: $(hdrdir)/ruby/internal/intern/enumerator.h continuation.o: $(hdrdir)/ruby/internal/intern/error.h continuation.o: $(hdrdir)/ruby/internal/intern/eval.h continuation.o: $(hdrdir)/ruby/internal/intern/file.h -continuation.o: $(hdrdir)/ruby/internal/intern/gc.h continuation.o: $(hdrdir)/ruby/internal/intern/hash.h continuation.o: $(hdrdir)/ruby/internal/intern/io.h continuation.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ continuation.o: $(hdrdir)/ruby/internal/memory.h continuation.o: $(hdrdir)/ruby/internal/method.h continuation.o: $(hdrdir)/ruby/internal/module.h continuation.o: $(hdrdir)/ruby/internal/newobj.h -continuation.o: $(hdrdir)/ruby/internal/rgengc.h continuation.o: $(hdrdir)/ruby/internal/scan_args.h continuation.o: $(hdrdir)/ruby/internal/special_consts.h continuation.o: $(hdrdir)/ruby/internal/static_assert.h continuation.o: $(hdrdir)/ruby/internal/stdalign.h continuation.o: $(hdrdir)/ruby/internal/stdbool.h +continuation.o: $(hdrdir)/ruby/internal/stdckdint.h continuation.o: $(hdrdir)/ruby/internal/symbol.h continuation.o: $(hdrdir)/ruby/internal/value.h continuation.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/coverage/coverage.c b/ext/coverage/coverage.c index 4578de54e4..9fc93bb58d 100644 --- a/ext/coverage/coverage.c +++ b/ext/coverage/coverage.c @@ -8,7 +8,7 @@ ************************************************/ -#include "gc.h" +#include "internal/gc.h" #include "internal/hash.h" #include "internal/thread.h" #include "internal/sanitizers.h" @@ -29,7 +29,7 @@ static VALUE me2counter = Qnil; * Returns true if coverage measurement is supported for the given mode. * * The mode should be one of the following symbols: - * +:lines+, +:branches+, +:methods+, +:eval+. + * +:lines+, +:oneshot_lines+, +:branches+, +:methods+, +:eval+. * * Example: * @@ -43,6 +43,7 @@ rb_coverage_supported(VALUE self, VALUE _mode) return RBOOL( mode == rb_intern("lines") || + mode == rb_intern("oneshot_lines") || mode == rb_intern("branches") || mode == rb_intern("methods") || mode == rb_intern("eval") @@ -352,7 +353,8 @@ rb_coverage_peek_result(VALUE klass) rb_raise(rb_eRuntimeError, "coverage measurement is not enabled"); } OBJ_WB_UNPROTECT(coverages); - st_foreach(RHASH_TBL_RAW(coverages), coverage_peek_result_i, ncoverages); + + rb_hash_foreach(coverages, coverage_peek_result_i, ncoverages); if (current_mode & COVERAGE_TARGET_METHODS) { rb_objspace_each_objects(method_coverage_i, &ncoverages); diff --git a/ext/coverage/depend b/ext/coverage/depend index 719c6c6e79..1be81c5e9a 100644 --- a/ext/coverage/depend +++ b/ext/coverage/depend @@ -15,6 +15,7 @@ coverage.o: $(hdrdir)/ruby/backward/2/long_long.h coverage.o: $(hdrdir)/ruby/backward/2/stdalign.h coverage.o: $(hdrdir)/ruby/backward/2/stdarg.h coverage.o: $(hdrdir)/ruby/defines.h +coverage.o: $(hdrdir)/ruby/encoding.h coverage.o: $(hdrdir)/ruby/intern.h coverage.o: $(hdrdir)/ruby/internal/abi.h coverage.o: $(hdrdir)/ruby/internal/anyargs.h @@ -54,6 +55,7 @@ coverage.o: $(hdrdir)/ruby/internal/attr/noexcept.h coverage.o: $(hdrdir)/ruby/internal/attr/noinline.h coverage.o: $(hdrdir)/ruby/internal/attr/nonnull.h coverage.o: $(hdrdir)/ruby/internal/attr/noreturn.h +coverage.o: $(hdrdir)/ruby/internal/attr/packed_struct.h coverage.o: $(hdrdir)/ruby/internal/attr/pure.h coverage.o: $(hdrdir)/ruby/internal/attr/restrict.h coverage.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -86,6 +88,15 @@ coverage.o: $(hdrdir)/ruby/internal/core/rtypeddata.h coverage.o: $(hdrdir)/ruby/internal/ctype.h coverage.o: $(hdrdir)/ruby/internal/dllexport.h coverage.o: $(hdrdir)/ruby/internal/dosish.h +coverage.o: $(hdrdir)/ruby/internal/encoding/coderange.h +coverage.o: $(hdrdir)/ruby/internal/encoding/ctype.h +coverage.o: $(hdrdir)/ruby/internal/encoding/encoding.h +coverage.o: $(hdrdir)/ruby/internal/encoding/pathname.h +coverage.o: $(hdrdir)/ruby/internal/encoding/re.h +coverage.o: $(hdrdir)/ruby/internal/encoding/sprintf.h +coverage.o: $(hdrdir)/ruby/internal/encoding/string.h +coverage.o: $(hdrdir)/ruby/internal/encoding/symbol.h +coverage.o: $(hdrdir)/ruby/internal/encoding/transcode.h coverage.o: $(hdrdir)/ruby/internal/error.h coverage.o: $(hdrdir)/ruby/internal/eval.h coverage.o: $(hdrdir)/ruby/internal/event.h @@ -113,7 +124,6 @@ coverage.o: $(hdrdir)/ruby/internal/intern/enumerator.h coverage.o: $(hdrdir)/ruby/internal/intern/error.h coverage.o: $(hdrdir)/ruby/internal/intern/eval.h coverage.o: $(hdrdir)/ruby/internal/intern/file.h -coverage.o: $(hdrdir)/ruby/internal/intern/gc.h coverage.o: $(hdrdir)/ruby/internal/intern/hash.h coverage.o: $(hdrdir)/ruby/internal/intern/io.h coverage.o: $(hdrdir)/ruby/internal/intern/load.h @@ -144,12 +154,12 @@ coverage.o: $(hdrdir)/ruby/internal/memory.h coverage.o: $(hdrdir)/ruby/internal/method.h coverage.o: $(hdrdir)/ruby/internal/module.h coverage.o: $(hdrdir)/ruby/internal/newobj.h -coverage.o: $(hdrdir)/ruby/internal/rgengc.h coverage.o: $(hdrdir)/ruby/internal/scan_args.h coverage.o: $(hdrdir)/ruby/internal/special_consts.h coverage.o: $(hdrdir)/ruby/internal/static_assert.h coverage.o: $(hdrdir)/ruby/internal/stdalign.h coverage.o: $(hdrdir)/ruby/internal/stdbool.h +coverage.o: $(hdrdir)/ruby/internal/stdckdint.h coverage.o: $(hdrdir)/ruby/internal/symbol.h coverage.o: $(hdrdir)/ruby/internal/value.h coverage.o: $(hdrdir)/ruby/internal/value_type.h @@ -157,6 +167,8 @@ coverage.o: $(hdrdir)/ruby/internal/variable.h coverage.o: $(hdrdir)/ruby/internal/warning_push.h coverage.o: $(hdrdir)/ruby/internal/xmalloc.h coverage.o: $(hdrdir)/ruby/missing.h +coverage.o: $(hdrdir)/ruby/onigmo.h +coverage.o: $(hdrdir)/ruby/oniguruma.h coverage.o: $(hdrdir)/ruby/ruby.h coverage.o: $(hdrdir)/ruby/st.h coverage.o: $(hdrdir)/ruby/subst.h @@ -166,10 +178,10 @@ coverage.o: $(top_srcdir)/ccan/container_of/container_of.h coverage.o: $(top_srcdir)/ccan/list/list.h coverage.o: $(top_srcdir)/ccan/str/str.h coverage.o: $(top_srcdir)/constant.h -coverage.o: $(top_srcdir)/gc.h coverage.o: $(top_srcdir)/id_table.h coverage.o: $(top_srcdir)/internal.h coverage.o: $(top_srcdir)/internal/array.h +coverage.o: $(top_srcdir)/internal/basic_operators.h coverage.o: $(top_srcdir)/internal/compilers.h coverage.o: $(top_srcdir)/internal/gc.h coverage.o: $(top_srcdir)/internal/hash.h @@ -185,6 +197,7 @@ coverage.o: $(top_srcdir)/method.h coverage.o: $(top_srcdir)/node.h coverage.o: $(top_srcdir)/ruby_assert.h coverage.o: $(top_srcdir)/ruby_atomic.h +coverage.o: $(top_srcdir)/rubyparser.h coverage.o: $(top_srcdir)/shape.h coverage.o: $(top_srcdir)/thread_pthread.h coverage.o: $(top_srcdir)/vm_core.h diff --git a/ext/date/date.gemspec b/ext/date/date.gemspec index eecbf786a3..bd42b1518a 100644 --- a/ext/date/date.gemspec +++ b/ext/date/date.gemspec @@ -10,18 +10,27 @@ Gem::Specification.new do |s| s.summary = "A subclass of Object includes Comparable module for handling dates." s.description = "A subclass of Object includes Comparable module for handling dates." - s.require_path = %w{lib} - s.files = [ - "README.md", - "lib/date.rb", "ext/date/date_core.c", "ext/date/date_parse.c", "ext/date/date_strftime.c", - "ext/date/date_strptime.c", "ext/date/date_tmx.h", "ext/date/extconf.rb", "ext/date/prereq.mk", - "ext/date/zonetab.h", "ext/date/zonetab.list" - ] - s.extensions = "ext/date/extconf.rb" - s.required_ruby_version = ">= 2.4.0" + if Gem::Platform === s.platform and s.platform =~ 'java' or RUBY_ENGINE == 'jruby' + s.platform = 'java' + # No files shipped, no require path, no-op for now on JRuby + else + s.require_path = %w{lib} + + s.files = [ + "README.md", + "lib/date.rb", "ext/date/date_core.c", "ext/date/date_parse.c", "ext/date/date_strftime.c", + "ext/date/date_strptime.c", "ext/date/date_tmx.h", "ext/date/extconf.rb", "ext/date/prereq.mk", + "ext/date/zonetab.h", "ext/date/zonetab.list" + ] + s.extensions = "ext/date/extconf.rb" + end + + s.required_ruby_version = ">= 2.6.0" s.authors = ["Tadayoshi Funaba"] s.email = [nil] s.homepage = "https://github.com/ruby/date" s.licenses = ["Ruby", "BSD-2-Clause"] + + s.metadata["changelog_uri"] = s.homepage + "/releases" end diff --git a/ext/date/date_core.c b/ext/date/date_core.c index e58da719e0..0fcefd671b 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -27,6 +27,10 @@ static VALUE eDateError; static VALUE half_days_in_day, day_in_nanoseconds; static double positive_inf, negative_inf; +// used by deconstruct_keys +static VALUE sym_year, sym_month, sym_day, sym_yday, sym_wday; +static VALUE sym_hour, sym_min, sym_sec, sym_sec_fraction, sym_zone; + #define f_boolcast(x) ((x) ? Qtrue : Qfalse) #define f_abs(x) rb_funcall(x, rb_intern("abs"), 0) @@ -60,7 +64,8 @@ static VALUE datetime_initialize(int argc, VALUE *argv, VALUE self); #define RETURN_FALSE_UNLESS_NUMERIC(obj) if(!RTEST(rb_obj_is_kind_of((obj), rb_cNumeric))) return Qfalse inline static void -check_numeric(VALUE obj, const char* field) { +check_numeric(VALUE obj, const char* field) +{ if(!RTEST(rb_obj_is_kind_of(obj, rb_cNumeric))) { rb_raise(rb_eTypeError, "invalid %s (not numeric)", field); } @@ -2584,8 +2589,6 @@ date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass) * * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start]. * - * Date.valid_date? is an alias for Date.valid_civil?. - * * Related: Date.jd, Date.new. */ static VALUE @@ -2981,8 +2984,6 @@ date_s_julian_leap_p(VALUE klass, VALUE y) * Date.gregorian_leap?(2000) # => true * Date.gregorian_leap?(2001) # => false * - * Date.leap? is an alias for Date.gregorian_leap?. - * * Related: Date.julian_leap?. */ static VALUE @@ -3488,8 +3489,6 @@ date_s_civil(int argc, VALUE *argv, VALUE klass) * * See argument {start}[rdoc-ref:calendars.rdoc@Argument+start]. * - * Date.civil is an alias for Date.new. - * * Related: Date.jd. */ static VALUE @@ -4465,12 +4464,6 @@ check_limit(VALUE str, VALUE opt) { size_t slen, limit; if (NIL_P(str)) return; - if (SYMBOL_P(str)) { - rb_category_warn(RB_WARN_CATEGORY_DEPRECATED, - "The ability to parse Symbol is an unintentional bug and is deprecated"); - str = rb_sym2str(str); - } - StringValue(str); slen = RSTRING_LEN(str); limit = get_limit(opt); @@ -4827,8 +4820,6 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass) * * See argument {limit}[rdoc-ref:Date@Argument+limit]. * - * Date._rfc822 is an alias for Date._rfc2822. - * * Related: Date.rfc2822 (returns a \Date object). */ static VALUE @@ -4859,8 +4850,6 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass) * - Argument {start}[rdoc-ref:calendars.rdoc@Argument+start]. * - Argument {limit}[rdoc-ref:Date@Argument+limit]. * - * Date.rfc822 is an alias for Date.rfc2822. - * * Related: Date._rfc2822 (returns a hash). */ static VALUE @@ -5341,7 +5330,6 @@ d_lite_yday(VALUE self) * * Date.new(2001, 2, 3).mon # => 2 * - * Date#month is an alias for Date#mon. */ static VALUE d_lite_mon(VALUE self) @@ -5358,7 +5346,6 @@ d_lite_mon(VALUE self) * * Date.new(2001, 2, 3).mday # => 3 * - * Date#day is an alias for Date#mday. */ static VALUE d_lite_mday(VALUE self) @@ -5608,7 +5595,6 @@ d_lite_hour(VALUE self) * * DateTime.new(2001, 2, 3, 4, 5, 6).min # => 5 * - * Date#minute is an alias for Date#min. */ static VALUE d_lite_min(VALUE self) @@ -5625,7 +5611,6 @@ d_lite_min(VALUE self) * * DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6 * - * Date#second is an alias for Date#sec. */ static VALUE d_lite_sec(VALUE self) @@ -5643,7 +5628,6 @@ d_lite_sec(VALUE self) * * DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2) * - * Date#second_fraction is an alias for Date#sec_fraction. */ static VALUE d_lite_sec_fraction(VALUE self) @@ -6419,7 +6403,6 @@ d_lite_prev_day(int argc, VALUE *argv, VALUE self) * d.to_s # => "2001-02-03" * d.next.to_s # => "2001-02-04" * - * Date#succ is an alias for Date#next. */ static VALUE d_lite_next(VALUE self) @@ -7293,7 +7276,6 @@ strftimev(const char *fmt, VALUE self, * * See {asctime}[https://linux.die.net/man/3/asctime]. * - * Date#ctime is an alias for Date#asctime. */ static VALUE d_lite_asctime(VALUE self) @@ -7311,7 +7293,6 @@ d_lite_asctime(VALUE self) * * Date.new(2001, 2, 3).iso8601 # => "2001-02-03" * - * Date#xmlschema is an alias for Date#iso8601. */ static VALUE d_lite_iso8601(VALUE self) @@ -7344,7 +7325,6 @@ d_lite_rfc3339(VALUE self) * * Date.new(2001, 2, 3).rfc2822 # => "Sat, 3 Feb 2001 00:00:00 +0000" * - * Date#rfc822 is an alias for Date#rfc2822. */ static VALUE d_lite_rfc2822(VALUE self) @@ -7432,6 +7412,96 @@ d_lite_jisx0301(VALUE self) return strftimev(fmt, self, set_tmx); } +static VALUE +deconstruct_keys(VALUE self, VALUE keys, int is_datetime) +{ + VALUE h = rb_hash_new(); + long i; + + get_d1(self); + + if (NIL_P(keys)) { + rb_hash_aset(h, sym_year, m_real_year(dat)); + rb_hash_aset(h, sym_month, INT2FIX(m_mon(dat))); + rb_hash_aset(h, sym_day, INT2FIX(m_mday(dat))); + rb_hash_aset(h, sym_yday, INT2FIX(m_yday(dat))); + rb_hash_aset(h, sym_wday, INT2FIX(m_wday(dat))); + if (is_datetime) { + rb_hash_aset(h, sym_hour, INT2FIX(m_hour(dat))); + rb_hash_aset(h, sym_min, INT2FIX(m_min(dat))); + rb_hash_aset(h, sym_sec, INT2FIX(m_sec(dat))); + rb_hash_aset(h, sym_sec_fraction, m_sf_in_sec(dat)); + rb_hash_aset(h, sym_zone, m_zone(dat)); + } + + return h; + } + if (!RB_TYPE_P(keys, T_ARRAY)) { + rb_raise(rb_eTypeError, + "wrong argument type %"PRIsVALUE" (expected Array or nil)", + rb_obj_class(keys)); + + } + + for (i=0; i<RARRAY_LEN(keys); i++) { + VALUE key = RARRAY_AREF(keys, i); + + if (sym_year == key) rb_hash_aset(h, key, m_real_year(dat)); + if (sym_month == key) rb_hash_aset(h, key, INT2FIX(m_mon(dat))); + if (sym_day == key) rb_hash_aset(h, key, INT2FIX(m_mday(dat))); + if (sym_yday == key) rb_hash_aset(h, key, INT2FIX(m_yday(dat))); + if (sym_wday == key) rb_hash_aset(h, key, INT2FIX(m_wday(dat))); + if (is_datetime) { + if (sym_hour == key) rb_hash_aset(h, key, INT2FIX(m_hour(dat))); + if (sym_min == key) rb_hash_aset(h, key, INT2FIX(m_min(dat))); + if (sym_sec == key) rb_hash_aset(h, key, INT2FIX(m_sec(dat))); + if (sym_sec_fraction == key) rb_hash_aset(h, key, m_sf_in_sec(dat)); + if (sym_zone == key) rb_hash_aset(h, key, m_zone(dat)); + } + } + return h; +} + +/* + * call-seq: + * deconstruct_keys(array_of_names_or_nil) -> hash + * + * Returns a hash of the name/value pairs, to use in pattern matching. + * Possible keys are: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>, + * <tt>:wday</tt>, <tt>:yday</tt>. + * + * Possible usages: + * + * d = Date.new(2022, 10, 5) + * + * if d in wday: 3, day: ..7 # uses deconstruct_keys underneath + * puts "first Wednesday of the month" + * end + * #=> prints "first Wednesday of the month" + * + * case d + * in year: ...2022 + * puts "too old" + * in month: ..9 + * puts "quarter 1-3" + * in wday: 1..5, month: + * puts "working day in month #{month}" + * end + * #=> prints "working day in month 10" + * + * Note that deconstruction by pattern can also be combined with class check: + * + * if d in Date(wday: 3, day: ..7) + * puts "first Wednesday of the month" + * end + * + */ +static VALUE +d_lite_deconstruct_keys(VALUE self, VALUE keys) +{ + return deconstruct_keys(self, keys, /* is_datetime=false */ 0); +} + #ifndef NDEBUG /* :nodoc: */ static VALUE @@ -8650,8 +8720,8 @@ dt_lite_to_s(VALUE self) * * DateTime.now.strftime # => "2022-07-01T11:03:19-05:00" * - * For other formats, see - * {Formats for Dates and Times}[doc/strftime_formatting.rdoc]. + * For other formats, + * see {Formats for Dates and Times}[rdoc-ref:strftime_formatting.rdoc]: * */ static VALUE @@ -8740,6 +8810,47 @@ dt_lite_jisx0301(int argc, VALUE *argv, VALUE self) iso8601_timediv(self, n)); } +/* + * call-seq: + * deconstruct_keys(array_of_names_or_nil) -> hash + * + * Returns a hash of the name/value pairs, to use in pattern matching. + * Possible keys are: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>, + * <tt>:wday</tt>, <tt>:yday</tt>, <tt>:hour</tt>, <tt>:min</tt>, + * <tt>:sec</tt>, <tt>:sec_fraction</tt>, <tt>:zone</tt>. + * + * Possible usages: + * + * dt = DateTime.new(2022, 10, 5, 13, 30) + * + * if d in wday: 1..5, hour: 10..18 # uses deconstruct_keys underneath + * puts "Working time" + * end + * #=> prints "Working time" + * + * case dt + * in year: ...2022 + * puts "too old" + * in month: ..9 + * puts "quarter 1-3" + * in wday: 1..5, month: + * puts "working day in month #{month}" + * end + * #=> prints "working day in month 10" + * + * Note that deconstruction by pattern can also be combined with class check: + * + * if d in DateTime(wday: 1..5, hour: 10..18, day: ..7) + * puts "Working time, first week of the month" + * end + * + */ +static VALUE +dt_lite_deconstruct_keys(VALUE self, VALUE keys) +{ + return deconstruct_keys(self, keys, /* is_datetime=true */ 1); +} + /* conversions */ #define f_subsec(x) rb_funcall(x, rb_intern("subsec"), 0) @@ -9370,6 +9481,17 @@ Init_date_core(void) id_ge_p = rb_intern_const(">="); id_eqeq_p = rb_intern_const("=="); + sym_year = ID2SYM(rb_intern_const("year")); + sym_month = ID2SYM(rb_intern_const("month")); + sym_yday = ID2SYM(rb_intern_const("yday")); + sym_wday = ID2SYM(rb_intern_const("wday")); + sym_day = ID2SYM(rb_intern_const("day")); + sym_hour = ID2SYM(rb_intern_const("hour")); + sym_min = ID2SYM(rb_intern_const("min")); + sym_sec = ID2SYM(rb_intern_const("sec")); + sym_sec_fraction = ID2SYM(rb_intern_const("sec_fraction")); + sym_zone = ID2SYM(rb_intern_const("zone")); + half_days_in_day = rb_rational_new2(INT2FIX(1), INT2FIX(2)); #if (LONG_MAX / DAY_IN_SECONDS) > SECOND_IN_NANOSECONDS @@ -9691,6 +9813,8 @@ Init_date_core(void) rb_define_method(cDate, "httpdate", d_lite_httpdate, 0); rb_define_method(cDate, "jisx0301", d_lite_jisx0301, 0); + rb_define_method(cDate, "deconstruct_keys", d_lite_deconstruct_keys, 1); + #ifndef NDEBUG rb_define_method(cDate, "marshal_dump_old", d_lite_marshal_dump_old, 0); #endif @@ -9901,6 +10025,8 @@ Init_date_core(void) rb_define_method(cDateTime, "rfc3339", dt_lite_rfc3339, -1); rb_define_method(cDateTime, "jisx0301", dt_lite_jisx0301, -1); + rb_define_method(cDateTime, "deconstruct_keys", dt_lite_deconstruct_keys, 1); + /* conversions */ rb_define_method(rb_cTime, "to_time", time_to_time, 0); diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c index 7b06a31471..f731629df1 100644 --- a/ext/date/date_strptime.c +++ b/ext/date/date_strptime.c @@ -10,28 +10,15 @@ static const char *day_names[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", - "Sun", "Mon", "Tue", "Wed", - "Thu", "Fri", "Sat" }; +static const int ABBREVIATED_DAY_NAME_LENGTH = 3; static const char *month_names[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" -}; - -static const char *merid_names[] = { - "am", "pm", - "a.m.", "p.m." -}; - -static const char *extz_pats[] = { - ":z", - "::z", - ":::z" }; +static const int ABBREVIATED_MONTH_NAME_LENGTH = 3; #define sizeof_array(o) (sizeof o / sizeof o[0]) @@ -75,7 +62,7 @@ num_pattern_p(const char *s) #define NUM_PATTERN_P() num_pattern_p(&fmt[fi + 1]) static long -read_digits(const char *s, VALUE *n, size_t width) +read_digits(const char *s, size_t slen, VALUE *n, size_t width) { size_t l; @@ -83,7 +70,7 @@ read_digits(const char *s, VALUE *n, size_t width) return 0; l = 0; - while (ISDIGIT(s[l])) { + while (l < slen && ISDIGIT(s[l])) { if (++l == width) break; } @@ -131,7 +118,7 @@ do { \ #define READ_DIGITS(n,w) \ do { \ size_t l; \ - l = read_digits(&str[si], &n, w); \ + l = read_digits(&str[si], slen - si, &n, w); \ if (l == 0) \ fail(); \ si += l; \ @@ -161,6 +148,12 @@ do { \ VALUE date_zone_to_diff(VALUE); +static inline int +head_match_p(size_t len, const char *name, const char *str, size_t slen, size_t si) +{ + return slen - si >= len && strncasecmp(name, &str[si], len) == 0; +} + static size_t date__strptime_internal(const char *str, size_t slen, const char *fmt, size_t flen, VALUE hash) @@ -168,9 +161,18 @@ date__strptime_internal(const char *str, size_t slen, size_t si, fi; int c; +#define HEAD_MATCH_P(len, name) head_match_p(len, name, str, slen, si) si = fi = 0; while (fi < flen) { + if (isspace((unsigned char)fmt[fi])) { + while (si < slen && isspace((unsigned char)str[si])) + si++; + while (++fi < flen && isspace((unsigned char)fmt[fi])); + continue; + } + + if (si >= slen) fail(); switch (fmt[fi]) { case '%': @@ -194,12 +196,11 @@ date__strptime_internal(const char *str, size_t slen, { int i; - for (i = 0; i < (int)sizeof_array(extz_pats); i++) - if (strncmp(extz_pats[i], &fmt[fi], - strlen(extz_pats[i])) == 0) { - fi += i; - goto again; - } + for (i = 1; i < 3 && fi + i < flen && fmt[fi+i] == ':'; ++i); + if (fmt[fi+i] == 'z') { + fi += i - 1; + goto again; + } fail(); } @@ -209,10 +210,12 @@ date__strptime_internal(const char *str, size_t slen, int i; for (i = 0; i < (int)sizeof_array(day_names); i++) { - size_t l = strlen(day_names[i]); - if (strncasecmp(day_names[i], &str[si], l) == 0) { + const char *day_name = day_names[i]; + size_t l = strlen(day_name); + if (HEAD_MATCH_P(l, day_name) || + HEAD_MATCH_P(l = ABBREVIATED_DAY_NAME_LENGTH, day_name)) { si += l; - set_hash("wday", INT2FIX(i % 7)); + set_hash("wday", INT2FIX(i)); goto matched; } } @@ -225,10 +228,12 @@ date__strptime_internal(const char *str, size_t slen, int i; for (i = 0; i < (int)sizeof_array(month_names); i++) { - size_t l = strlen(month_names[i]); - if (strncasecmp(month_names[i], &str[si], l) == 0) { + const char *month_name = month_names[i]; + size_t l = strlen(month_name); + if (HEAD_MATCH_P(l, month_name) || + HEAD_MATCH_P(l = ABBREVIATED_MONTH_NAME_LENGTH, month_name)) { si += l; - set_hash("mon", INT2FIX((i % 12) + 1)); + set_hash("mon", INT2FIX(i + 1)); goto matched; } } @@ -402,18 +407,19 @@ date__strptime_internal(const char *str, size_t slen, case 'P': case 'p': + if (slen - si < 2) fail(); { - int i; - - for (i = 0; i < 4; i++) { - size_t l = strlen(merid_names[i]); - if (strncasecmp(merid_names[i], &str[si], l) == 0) { - si += l; - set_hash("_merid", INT2FIX((i % 2) == 0 ? 0 : 12)); - goto matched; - } + char c = str[si]; + const int hour = (c == 'P' || c == 'p') ? 12 : 0; + if (!hour && !(c == 'A' || c == 'a')) fail(); + if ((c = str[si+1]) == '.') { + if (slen - si < 4 || str[si+3] != '.') fail(); + c = str[si += 2]; } - fail(); + if (!(c == 'M' || c == 'm')) fail(); + si += 2; + set_hash("_merid", INT2FIX(hour)); + goto matched; } case 'Q': @@ -587,7 +593,7 @@ date__strptime_internal(const char *str, size_t slen, b = rb_backref_get(); rb_match_busy(b); - m = f_match(pat, rb_usascii_str_new2(&str[si])); + m = f_match(pat, rb_usascii_str_new(&str[si], slen - si)); if (!NIL_P(m)) { VALUE s, l, o; @@ -619,22 +625,13 @@ date__strptime_internal(const char *str, size_t slen, if (str[si] != '%') fail(); si++; - if (fi < flen) - if (str[si] != fmt[fi]) + if (fi < flen) { + if (si >= slen || str[si] != fmt[fi]) fail(); - si++; + si++; + } goto matched; } - case ' ': - case '\t': - case '\n': - case '\v': - case '\f': - case '\r': - while (isspace((unsigned char)str[si])) - si++; - fi++; - break; default: ordinal: if (str[si] != fmt[fi]) diff --git a/ext/date/depend b/ext/date/depend index 3f550cd0a7..d07f10a593 100644 --- a/ext/date/depend +++ b/ext/date/depend @@ -53,6 +53,7 @@ date_core.o: $(hdrdir)/ruby/internal/attr/noexcept.h date_core.o: $(hdrdir)/ruby/internal/attr/noinline.h date_core.o: $(hdrdir)/ruby/internal/attr/nonnull.h date_core.o: $(hdrdir)/ruby/internal/attr/noreturn.h +date_core.o: $(hdrdir)/ruby/internal/attr/packed_struct.h date_core.o: $(hdrdir)/ruby/internal/attr/pure.h date_core.o: $(hdrdir)/ruby/internal/attr/restrict.h date_core.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ date_core.o: $(hdrdir)/ruby/internal/intern/enumerator.h date_core.o: $(hdrdir)/ruby/internal/intern/error.h date_core.o: $(hdrdir)/ruby/internal/intern/eval.h date_core.o: $(hdrdir)/ruby/internal/intern/file.h -date_core.o: $(hdrdir)/ruby/internal/intern/gc.h date_core.o: $(hdrdir)/ruby/internal/intern/hash.h date_core.o: $(hdrdir)/ruby/internal/intern/io.h date_core.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ date_core.o: $(hdrdir)/ruby/internal/memory.h date_core.o: $(hdrdir)/ruby/internal/method.h date_core.o: $(hdrdir)/ruby/internal/module.h date_core.o: $(hdrdir)/ruby/internal/newobj.h -date_core.o: $(hdrdir)/ruby/internal/rgengc.h date_core.o: $(hdrdir)/ruby/internal/scan_args.h date_core.o: $(hdrdir)/ruby/internal/special_consts.h date_core.o: $(hdrdir)/ruby/internal/static_assert.h date_core.o: $(hdrdir)/ruby/internal/stdalign.h date_core.o: $(hdrdir)/ruby/internal/stdbool.h +date_core.o: $(hdrdir)/ruby/internal/stdckdint.h date_core.o: $(hdrdir)/ruby/internal/symbol.h date_core.o: $(hdrdir)/ruby/internal/value.h date_core.o: $(hdrdir)/ruby/internal/value_type.h @@ -227,6 +227,7 @@ date_parse.o: $(hdrdir)/ruby/internal/attr/noexcept.h date_parse.o: $(hdrdir)/ruby/internal/attr/noinline.h date_parse.o: $(hdrdir)/ruby/internal/attr/nonnull.h date_parse.o: $(hdrdir)/ruby/internal/attr/noreturn.h +date_parse.o: $(hdrdir)/ruby/internal/attr/packed_struct.h date_parse.o: $(hdrdir)/ruby/internal/attr/pure.h date_parse.o: $(hdrdir)/ruby/internal/attr/restrict.h date_parse.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -296,7 +297,6 @@ date_parse.o: $(hdrdir)/ruby/internal/intern/enumerator.h date_parse.o: $(hdrdir)/ruby/internal/intern/error.h date_parse.o: $(hdrdir)/ruby/internal/intern/eval.h date_parse.o: $(hdrdir)/ruby/internal/intern/file.h -date_parse.o: $(hdrdir)/ruby/internal/intern/gc.h date_parse.o: $(hdrdir)/ruby/internal/intern/hash.h date_parse.o: $(hdrdir)/ruby/internal/intern/io.h date_parse.o: $(hdrdir)/ruby/internal/intern/load.h @@ -327,12 +327,12 @@ date_parse.o: $(hdrdir)/ruby/internal/memory.h date_parse.o: $(hdrdir)/ruby/internal/method.h date_parse.o: $(hdrdir)/ruby/internal/module.h date_parse.o: $(hdrdir)/ruby/internal/newobj.h -date_parse.o: $(hdrdir)/ruby/internal/rgengc.h date_parse.o: $(hdrdir)/ruby/internal/scan_args.h date_parse.o: $(hdrdir)/ruby/internal/special_consts.h date_parse.o: $(hdrdir)/ruby/internal/static_assert.h date_parse.o: $(hdrdir)/ruby/internal/stdalign.h date_parse.o: $(hdrdir)/ruby/internal/stdbool.h +date_parse.o: $(hdrdir)/ruby/internal/stdckdint.h date_parse.o: $(hdrdir)/ruby/internal/symbol.h date_parse.o: $(hdrdir)/ruby/internal/value.h date_parse.o: $(hdrdir)/ruby/internal/value_type.h @@ -402,6 +402,7 @@ date_strftime.o: $(hdrdir)/ruby/internal/attr/noexcept.h date_strftime.o: $(hdrdir)/ruby/internal/attr/noinline.h date_strftime.o: $(hdrdir)/ruby/internal/attr/nonnull.h date_strftime.o: $(hdrdir)/ruby/internal/attr/noreturn.h +date_strftime.o: $(hdrdir)/ruby/internal/attr/packed_struct.h date_strftime.o: $(hdrdir)/ruby/internal/attr/pure.h date_strftime.o: $(hdrdir)/ruby/internal/attr/restrict.h date_strftime.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -461,7 +462,6 @@ date_strftime.o: $(hdrdir)/ruby/internal/intern/enumerator.h date_strftime.o: $(hdrdir)/ruby/internal/intern/error.h date_strftime.o: $(hdrdir)/ruby/internal/intern/eval.h date_strftime.o: $(hdrdir)/ruby/internal/intern/file.h -date_strftime.o: $(hdrdir)/ruby/internal/intern/gc.h date_strftime.o: $(hdrdir)/ruby/internal/intern/hash.h date_strftime.o: $(hdrdir)/ruby/internal/intern/io.h date_strftime.o: $(hdrdir)/ruby/internal/intern/load.h @@ -492,12 +492,12 @@ date_strftime.o: $(hdrdir)/ruby/internal/memory.h date_strftime.o: $(hdrdir)/ruby/internal/method.h date_strftime.o: $(hdrdir)/ruby/internal/module.h date_strftime.o: $(hdrdir)/ruby/internal/newobj.h -date_strftime.o: $(hdrdir)/ruby/internal/rgengc.h date_strftime.o: $(hdrdir)/ruby/internal/scan_args.h date_strftime.o: $(hdrdir)/ruby/internal/special_consts.h date_strftime.o: $(hdrdir)/ruby/internal/static_assert.h date_strftime.o: $(hdrdir)/ruby/internal/stdalign.h date_strftime.o: $(hdrdir)/ruby/internal/stdbool.h +date_strftime.o: $(hdrdir)/ruby/internal/stdckdint.h date_strftime.o: $(hdrdir)/ruby/internal/symbol.h date_strftime.o: $(hdrdir)/ruby/internal/value.h date_strftime.o: $(hdrdir)/ruby/internal/value_type.h @@ -564,6 +564,7 @@ date_strptime.o: $(hdrdir)/ruby/internal/attr/noexcept.h date_strptime.o: $(hdrdir)/ruby/internal/attr/noinline.h date_strptime.o: $(hdrdir)/ruby/internal/attr/nonnull.h date_strptime.o: $(hdrdir)/ruby/internal/attr/noreturn.h +date_strptime.o: $(hdrdir)/ruby/internal/attr/packed_struct.h date_strptime.o: $(hdrdir)/ruby/internal/attr/pure.h date_strptime.o: $(hdrdir)/ruby/internal/attr/restrict.h date_strptime.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -633,7 +634,6 @@ date_strptime.o: $(hdrdir)/ruby/internal/intern/enumerator.h date_strptime.o: $(hdrdir)/ruby/internal/intern/error.h date_strptime.o: $(hdrdir)/ruby/internal/intern/eval.h date_strptime.o: $(hdrdir)/ruby/internal/intern/file.h -date_strptime.o: $(hdrdir)/ruby/internal/intern/gc.h date_strptime.o: $(hdrdir)/ruby/internal/intern/hash.h date_strptime.o: $(hdrdir)/ruby/internal/intern/io.h date_strptime.o: $(hdrdir)/ruby/internal/intern/load.h @@ -664,12 +664,12 @@ date_strptime.o: $(hdrdir)/ruby/internal/memory.h date_strptime.o: $(hdrdir)/ruby/internal/method.h date_strptime.o: $(hdrdir)/ruby/internal/module.h date_strptime.o: $(hdrdir)/ruby/internal/newobj.h -date_strptime.o: $(hdrdir)/ruby/internal/rgengc.h date_strptime.o: $(hdrdir)/ruby/internal/scan_args.h date_strptime.o: $(hdrdir)/ruby/internal/special_consts.h date_strptime.o: $(hdrdir)/ruby/internal/static_assert.h date_strptime.o: $(hdrdir)/ruby/internal/stdalign.h date_strptime.o: $(hdrdir)/ruby/internal/stdbool.h +date_strptime.o: $(hdrdir)/ruby/internal/stdckdint.h date_strptime.o: $(hdrdir)/ruby/internal/symbol.h date_strptime.o: $(hdrdir)/ruby/internal/value.h date_strptime.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/date/lib/date.rb b/ext/date/lib/date.rb index 1899611440..6888bd2d4e 100644 --- a/ext/date/lib/date.rb +++ b/ext/date/lib/date.rb @@ -4,7 +4,7 @@ require 'date_core' class Date - VERSION = "3.2.3" # :nodoc: + VERSION = "3.3.4" # :nodoc: # call-seq: # infinite? -> false diff --git a/ext/digest/.document b/ext/digest/.document new file mode 100644 index 0000000000..beab275b5a --- /dev/null +++ b/ext/digest/.document @@ -0,0 +1,3 @@ +digest.c +bubblebabble/bubblebabble.c +*/*init.c diff --git a/ext/digest/bubblebabble/bubblebabble.c b/ext/digest/bubblebabble/bubblebabble.c index 358ab416b9..dac603c0d7 100644 --- a/ext/digest/bubblebabble/bubblebabble.c +++ b/ext/digest/bubblebabble/bubblebabble.c @@ -129,15 +129,14 @@ Init_bubblebabble(void) rb_require("digest"); - rb_mDigest = rb_path2class("Digest"); - rb_mDigest_Instance = rb_path2class("Digest::Instance"); - rb_cDigest_Class = rb_path2class("Digest::Class"); - #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 + rb_mDigest = rb_digest_namespace(); + rb_mDigest_Instance = rb_const_get(rb_mDigest, rb_intern_const("Instance")); + rb_cDigest_Class = rb_const_get(rb_mDigest, rb_intern_const("Class")); 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); diff --git a/ext/digest/bubblebabble/depend b/ext/digest/bubblebabble/depend index 38f5ddb1e2..0da9c223ee 100644 --- a/ext/digest/bubblebabble/depend +++ b/ext/digest/bubblebabble/depend @@ -52,6 +52,7 @@ bubblebabble.o: $(hdrdir)/ruby/internal/attr/noexcept.h bubblebabble.o: $(hdrdir)/ruby/internal/attr/noinline.h bubblebabble.o: $(hdrdir)/ruby/internal/attr/nonnull.h bubblebabble.o: $(hdrdir)/ruby/internal/attr/noreturn.h +bubblebabble.o: $(hdrdir)/ruby/internal/attr/packed_struct.h bubblebabble.o: $(hdrdir)/ruby/internal/attr/pure.h bubblebabble.o: $(hdrdir)/ruby/internal/attr/restrict.h bubblebabble.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ bubblebabble.o: $(hdrdir)/ruby/internal/intern/enumerator.h bubblebabble.o: $(hdrdir)/ruby/internal/intern/error.h bubblebabble.o: $(hdrdir)/ruby/internal/intern/eval.h bubblebabble.o: $(hdrdir)/ruby/internal/intern/file.h -bubblebabble.o: $(hdrdir)/ruby/internal/intern/gc.h bubblebabble.o: $(hdrdir)/ruby/internal/intern/hash.h bubblebabble.o: $(hdrdir)/ruby/internal/intern/io.h bubblebabble.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ bubblebabble.o: $(hdrdir)/ruby/internal/memory.h bubblebabble.o: $(hdrdir)/ruby/internal/method.h bubblebabble.o: $(hdrdir)/ruby/internal/module.h bubblebabble.o: $(hdrdir)/ruby/internal/newobj.h -bubblebabble.o: $(hdrdir)/ruby/internal/rgengc.h bubblebabble.o: $(hdrdir)/ruby/internal/scan_args.h bubblebabble.o: $(hdrdir)/ruby/internal/special_consts.h bubblebabble.o: $(hdrdir)/ruby/internal/static_assert.h bubblebabble.o: $(hdrdir)/ruby/internal/stdalign.h bubblebabble.o: $(hdrdir)/ruby/internal/stdbool.h +bubblebabble.o: $(hdrdir)/ruby/internal/stdckdint.h bubblebabble.o: $(hdrdir)/ruby/internal/symbol.h bubblebabble.o: $(hdrdir)/ruby/internal/value.h bubblebabble.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/digest/depend b/ext/digest/depend index 5a84fd53ec..cb9e8d4813 100644 --- a/ext/digest/depend +++ b/ext/digest/depend @@ -52,6 +52,7 @@ digest.o: $(hdrdir)/ruby/internal/attr/noexcept.h digest.o: $(hdrdir)/ruby/internal/attr/noinline.h digest.o: $(hdrdir)/ruby/internal/attr/nonnull.h digest.o: $(hdrdir)/ruby/internal/attr/noreturn.h +digest.o: $(hdrdir)/ruby/internal/attr/packed_struct.h digest.o: $(hdrdir)/ruby/internal/attr/pure.h digest.o: $(hdrdir)/ruby/internal/attr/restrict.h digest.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ digest.o: $(hdrdir)/ruby/internal/intern/enumerator.h digest.o: $(hdrdir)/ruby/internal/intern/error.h digest.o: $(hdrdir)/ruby/internal/intern/eval.h digest.o: $(hdrdir)/ruby/internal/intern/file.h -digest.o: $(hdrdir)/ruby/internal/intern/gc.h digest.o: $(hdrdir)/ruby/internal/intern/hash.h digest.o: $(hdrdir)/ruby/internal/intern/io.h digest.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ digest.o: $(hdrdir)/ruby/internal/memory.h digest.o: $(hdrdir)/ruby/internal/method.h digest.o: $(hdrdir)/ruby/internal/module.h digest.o: $(hdrdir)/ruby/internal/newobj.h -digest.o: $(hdrdir)/ruby/internal/rgengc.h digest.o: $(hdrdir)/ruby/internal/scan_args.h digest.o: $(hdrdir)/ruby/internal/special_consts.h digest.o: $(hdrdir)/ruby/internal/static_assert.h digest.o: $(hdrdir)/ruby/internal/stdalign.h digest.o: $(hdrdir)/ruby/internal/stdbool.h +digest.o: $(hdrdir)/ruby/internal/stdckdint.h digest.o: $(hdrdir)/ruby/internal/symbol.h digest.o: $(hdrdir)/ruby/internal/value.h digest.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/digest/digest.h b/ext/digest/digest.h index 8a4c5b7e4e..68a3da5dd2 100644 --- a/ext/digest/digest.h +++ b/ext/digest/digest.h @@ -40,7 +40,8 @@ rb_digest_##name##_update(void *ctx, unsigned char *ptr, size_t size) \ for (; size > stride; size -= stride, ptr += stride) { \ name##_Update(ctx, ptr, stride); \ } \ - if (size > 0) name##_Update(ctx, ptr, size); \ + /* Since size <= stride, size should fit into an unsigned int */ \ + if (size > 0) name##_Update(ctx, ptr, (unsigned int)size); \ } #define DEFINE_FINISH_FUNC_FROM_FINAL(name) \ diff --git a/ext/digest/lib/digest/version.rb b/ext/digest/lib/digest/version.rb index 79e6aeee99..42fd7acf6e 100644 --- a/ext/digest/lib/digest/version.rb +++ b/ext/digest/lib/digest/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Digest - VERSION = "3.1.0" + VERSION = "3.1.1" end diff --git a/ext/digest/md5/depend b/ext/digest/md5/depend index ea1ceec7fd..e71915e5b4 100644 --- a/ext/digest/md5/depend +++ b/ext/digest/md5/depend @@ -55,6 +55,7 @@ md5.o: $(hdrdir)/ruby/internal/attr/noexcept.h md5.o: $(hdrdir)/ruby/internal/attr/noinline.h md5.o: $(hdrdir)/ruby/internal/attr/nonnull.h md5.o: $(hdrdir)/ruby/internal/attr/noreturn.h +md5.o: $(hdrdir)/ruby/internal/attr/packed_struct.h md5.o: $(hdrdir)/ruby/internal/attr/pure.h md5.o: $(hdrdir)/ruby/internal/attr/restrict.h md5.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -114,7 +115,6 @@ md5.o: $(hdrdir)/ruby/internal/intern/enumerator.h md5.o: $(hdrdir)/ruby/internal/intern/error.h md5.o: $(hdrdir)/ruby/internal/intern/eval.h md5.o: $(hdrdir)/ruby/internal/intern/file.h -md5.o: $(hdrdir)/ruby/internal/intern/gc.h md5.o: $(hdrdir)/ruby/internal/intern/hash.h md5.o: $(hdrdir)/ruby/internal/intern/io.h md5.o: $(hdrdir)/ruby/internal/intern/load.h @@ -145,12 +145,12 @@ md5.o: $(hdrdir)/ruby/internal/memory.h md5.o: $(hdrdir)/ruby/internal/method.h md5.o: $(hdrdir)/ruby/internal/module.h md5.o: $(hdrdir)/ruby/internal/newobj.h -md5.o: $(hdrdir)/ruby/internal/rgengc.h md5.o: $(hdrdir)/ruby/internal/scan_args.h md5.o: $(hdrdir)/ruby/internal/special_consts.h md5.o: $(hdrdir)/ruby/internal/static_assert.h md5.o: $(hdrdir)/ruby/internal/stdalign.h md5.o: $(hdrdir)/ruby/internal/stdbool.h +md5.o: $(hdrdir)/ruby/internal/stdckdint.h md5.o: $(hdrdir)/ruby/internal/symbol.h md5.o: $(hdrdir)/ruby/internal/value.h md5.o: $(hdrdir)/ruby/internal/value_type.h @@ -217,6 +217,7 @@ md5init.o: $(hdrdir)/ruby/internal/attr/noexcept.h md5init.o: $(hdrdir)/ruby/internal/attr/noinline.h md5init.o: $(hdrdir)/ruby/internal/attr/nonnull.h md5init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +md5init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h md5init.o: $(hdrdir)/ruby/internal/attr/pure.h md5init.o: $(hdrdir)/ruby/internal/attr/restrict.h md5init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -276,7 +277,6 @@ md5init.o: $(hdrdir)/ruby/internal/intern/enumerator.h md5init.o: $(hdrdir)/ruby/internal/intern/error.h md5init.o: $(hdrdir)/ruby/internal/intern/eval.h md5init.o: $(hdrdir)/ruby/internal/intern/file.h -md5init.o: $(hdrdir)/ruby/internal/intern/gc.h md5init.o: $(hdrdir)/ruby/internal/intern/hash.h md5init.o: $(hdrdir)/ruby/internal/intern/io.h md5init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -307,12 +307,12 @@ md5init.o: $(hdrdir)/ruby/internal/memory.h md5init.o: $(hdrdir)/ruby/internal/method.h md5init.o: $(hdrdir)/ruby/internal/module.h md5init.o: $(hdrdir)/ruby/internal/newobj.h -md5init.o: $(hdrdir)/ruby/internal/rgengc.h md5init.o: $(hdrdir)/ruby/internal/scan_args.h md5init.o: $(hdrdir)/ruby/internal/special_consts.h md5init.o: $(hdrdir)/ruby/internal/static_assert.h md5init.o: $(hdrdir)/ruby/internal/stdalign.h md5init.o: $(hdrdir)/ruby/internal/stdbool.h +md5init.o: $(hdrdir)/ruby/internal/stdckdint.h md5init.o: $(hdrdir)/ruby/internal/symbol.h md5init.o: $(hdrdir)/ruby/internal/value.h md5init.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c index 52cba78bf1..b81fd94864 100644 --- a/ext/digest/md5/md5init.c +++ b/ext/digest/md5/md5init.c @@ -53,9 +53,8 @@ Init_md5(void) mDigest = rb_define_module("Digest"); /* let rdoc know */ #endif mDigest = rb_digest_namespace(); - cDigest_Base = rb_path2class("Digest::Base"); + cDigest_Base = rb_const_get(mDigest, rb_intern_const("Base")); cDigest_MD5 = rb_define_class_under(mDigest, "MD5", cDigest_Base); - rb_iv_set(cDigest_MD5, "metadata", rb_digest_make_metadata(&md5)); } diff --git a/ext/digest/rmd160/depend b/ext/digest/rmd160/depend index 3a0ed72732..09558ad92b 100644 --- a/ext/digest/rmd160/depend +++ b/ext/digest/rmd160/depend @@ -55,6 +55,7 @@ rmd160.o: $(hdrdir)/ruby/internal/attr/noexcept.h rmd160.o: $(hdrdir)/ruby/internal/attr/noinline.h rmd160.o: $(hdrdir)/ruby/internal/attr/nonnull.h rmd160.o: $(hdrdir)/ruby/internal/attr/noreturn.h +rmd160.o: $(hdrdir)/ruby/internal/attr/packed_struct.h rmd160.o: $(hdrdir)/ruby/internal/attr/pure.h rmd160.o: $(hdrdir)/ruby/internal/attr/restrict.h rmd160.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -114,7 +115,6 @@ rmd160.o: $(hdrdir)/ruby/internal/intern/enumerator.h rmd160.o: $(hdrdir)/ruby/internal/intern/error.h rmd160.o: $(hdrdir)/ruby/internal/intern/eval.h rmd160.o: $(hdrdir)/ruby/internal/intern/file.h -rmd160.o: $(hdrdir)/ruby/internal/intern/gc.h rmd160.o: $(hdrdir)/ruby/internal/intern/hash.h rmd160.o: $(hdrdir)/ruby/internal/intern/io.h rmd160.o: $(hdrdir)/ruby/internal/intern/load.h @@ -145,12 +145,12 @@ rmd160.o: $(hdrdir)/ruby/internal/memory.h rmd160.o: $(hdrdir)/ruby/internal/method.h rmd160.o: $(hdrdir)/ruby/internal/module.h rmd160.o: $(hdrdir)/ruby/internal/newobj.h -rmd160.o: $(hdrdir)/ruby/internal/rgengc.h rmd160.o: $(hdrdir)/ruby/internal/scan_args.h rmd160.o: $(hdrdir)/ruby/internal/special_consts.h rmd160.o: $(hdrdir)/ruby/internal/static_assert.h rmd160.o: $(hdrdir)/ruby/internal/stdalign.h rmd160.o: $(hdrdir)/ruby/internal/stdbool.h +rmd160.o: $(hdrdir)/ruby/internal/stdckdint.h rmd160.o: $(hdrdir)/ruby/internal/symbol.h rmd160.o: $(hdrdir)/ruby/internal/value.h rmd160.o: $(hdrdir)/ruby/internal/value_type.h @@ -217,6 +217,7 @@ rmd160init.o: $(hdrdir)/ruby/internal/attr/noexcept.h rmd160init.o: $(hdrdir)/ruby/internal/attr/noinline.h rmd160init.o: $(hdrdir)/ruby/internal/attr/nonnull.h rmd160init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +rmd160init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h rmd160init.o: $(hdrdir)/ruby/internal/attr/pure.h rmd160init.o: $(hdrdir)/ruby/internal/attr/restrict.h rmd160init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -276,7 +277,6 @@ rmd160init.o: $(hdrdir)/ruby/internal/intern/enumerator.h rmd160init.o: $(hdrdir)/ruby/internal/intern/error.h rmd160init.o: $(hdrdir)/ruby/internal/intern/eval.h rmd160init.o: $(hdrdir)/ruby/internal/intern/file.h -rmd160init.o: $(hdrdir)/ruby/internal/intern/gc.h rmd160init.o: $(hdrdir)/ruby/internal/intern/hash.h rmd160init.o: $(hdrdir)/ruby/internal/intern/io.h rmd160init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -307,12 +307,12 @@ rmd160init.o: $(hdrdir)/ruby/internal/memory.h rmd160init.o: $(hdrdir)/ruby/internal/method.h rmd160init.o: $(hdrdir)/ruby/internal/module.h rmd160init.o: $(hdrdir)/ruby/internal/newobj.h -rmd160init.o: $(hdrdir)/ruby/internal/rgengc.h rmd160init.o: $(hdrdir)/ruby/internal/scan_args.h rmd160init.o: $(hdrdir)/ruby/internal/special_consts.h rmd160init.o: $(hdrdir)/ruby/internal/static_assert.h rmd160init.o: $(hdrdir)/ruby/internal/stdalign.h rmd160init.o: $(hdrdir)/ruby/internal/stdbool.h +rmd160init.o: $(hdrdir)/ruby/internal/stdckdint.h rmd160init.o: $(hdrdir)/ruby/internal/symbol.h rmd160init.o: $(hdrdir)/ruby/internal/value.h rmd160init.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/digest/rmd160/rmd160init.c b/ext/digest/rmd160/rmd160init.c index 2ae81ec4d6..e4b707ed9e 100644 --- a/ext/digest/rmd160/rmd160init.c +++ b/ext/digest/rmd160/rmd160init.c @@ -49,9 +49,8 @@ Init_rmd160(void) mDigest = rb_define_module("Digest"); /* let rdoc know */ #endif mDigest = rb_digest_namespace(); - cDigest_Base = rb_path2class("Digest::Base"); + cDigest_Base = rb_const_get(mDigest, rb_intern_const("Base")); cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base); - rb_iv_set(cDigest_RMD160, "metadata", rb_digest_make_metadata(&rmd160)); } diff --git a/ext/digest/sha1/depend b/ext/digest/sha1/depend index 48aaef158b..827b8a0852 100644 --- a/ext/digest/sha1/depend +++ b/ext/digest/sha1/depend @@ -55,6 +55,7 @@ sha1.o: $(hdrdir)/ruby/internal/attr/noexcept.h sha1.o: $(hdrdir)/ruby/internal/attr/noinline.h sha1.o: $(hdrdir)/ruby/internal/attr/nonnull.h sha1.o: $(hdrdir)/ruby/internal/attr/noreturn.h +sha1.o: $(hdrdir)/ruby/internal/attr/packed_struct.h sha1.o: $(hdrdir)/ruby/internal/attr/pure.h sha1.o: $(hdrdir)/ruby/internal/attr/restrict.h sha1.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -114,7 +115,6 @@ sha1.o: $(hdrdir)/ruby/internal/intern/enumerator.h sha1.o: $(hdrdir)/ruby/internal/intern/error.h sha1.o: $(hdrdir)/ruby/internal/intern/eval.h sha1.o: $(hdrdir)/ruby/internal/intern/file.h -sha1.o: $(hdrdir)/ruby/internal/intern/gc.h sha1.o: $(hdrdir)/ruby/internal/intern/hash.h sha1.o: $(hdrdir)/ruby/internal/intern/io.h sha1.o: $(hdrdir)/ruby/internal/intern/load.h @@ -145,12 +145,12 @@ sha1.o: $(hdrdir)/ruby/internal/memory.h sha1.o: $(hdrdir)/ruby/internal/method.h sha1.o: $(hdrdir)/ruby/internal/module.h sha1.o: $(hdrdir)/ruby/internal/newobj.h -sha1.o: $(hdrdir)/ruby/internal/rgengc.h sha1.o: $(hdrdir)/ruby/internal/scan_args.h sha1.o: $(hdrdir)/ruby/internal/special_consts.h sha1.o: $(hdrdir)/ruby/internal/static_assert.h sha1.o: $(hdrdir)/ruby/internal/stdalign.h sha1.o: $(hdrdir)/ruby/internal/stdbool.h +sha1.o: $(hdrdir)/ruby/internal/stdckdint.h sha1.o: $(hdrdir)/ruby/internal/symbol.h sha1.o: $(hdrdir)/ruby/internal/value.h sha1.o: $(hdrdir)/ruby/internal/value_type.h @@ -217,6 +217,7 @@ sha1init.o: $(hdrdir)/ruby/internal/attr/noexcept.h sha1init.o: $(hdrdir)/ruby/internal/attr/noinline.h sha1init.o: $(hdrdir)/ruby/internal/attr/nonnull.h sha1init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +sha1init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h sha1init.o: $(hdrdir)/ruby/internal/attr/pure.h sha1init.o: $(hdrdir)/ruby/internal/attr/restrict.h sha1init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -276,7 +277,6 @@ sha1init.o: $(hdrdir)/ruby/internal/intern/enumerator.h sha1init.o: $(hdrdir)/ruby/internal/intern/error.h sha1init.o: $(hdrdir)/ruby/internal/intern/eval.h sha1init.o: $(hdrdir)/ruby/internal/intern/file.h -sha1init.o: $(hdrdir)/ruby/internal/intern/gc.h sha1init.o: $(hdrdir)/ruby/internal/intern/hash.h sha1init.o: $(hdrdir)/ruby/internal/intern/io.h sha1init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -307,12 +307,12 @@ sha1init.o: $(hdrdir)/ruby/internal/memory.h sha1init.o: $(hdrdir)/ruby/internal/method.h sha1init.o: $(hdrdir)/ruby/internal/module.h sha1init.o: $(hdrdir)/ruby/internal/newobj.h -sha1init.o: $(hdrdir)/ruby/internal/rgengc.h sha1init.o: $(hdrdir)/ruby/internal/scan_args.h sha1init.o: $(hdrdir)/ruby/internal/special_consts.h sha1init.o: $(hdrdir)/ruby/internal/static_assert.h sha1init.o: $(hdrdir)/ruby/internal/stdalign.h sha1init.o: $(hdrdir)/ruby/internal/stdbool.h +sha1init.o: $(hdrdir)/ruby/internal/stdckdint.h sha1init.o: $(hdrdir)/ruby/internal/symbol.h sha1init.o: $(hdrdir)/ruby/internal/value.h sha1init.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c index f7047bc6d3..c39959f428 100644 --- a/ext/digest/sha1/sha1init.c +++ b/ext/digest/sha1/sha1init.c @@ -55,9 +55,8 @@ Init_sha1(void) mDigest = rb_define_module("Digest"); /* let rdoc know */ #endif mDigest = rb_digest_namespace(); - cDigest_Base = rb_path2class("Digest::Base"); + cDigest_Base = rb_const_get(mDigest, rb_intern_const("Base")); cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base); - rb_iv_set(cDigest_SHA1, "metadata", rb_digest_make_metadata(&sha1)); } diff --git a/ext/digest/sha2/depend b/ext/digest/sha2/depend index 47a859068c..af1600d346 100644 --- a/ext/digest/sha2/depend +++ b/ext/digest/sha2/depend @@ -55,6 +55,7 @@ sha2.o: $(hdrdir)/ruby/internal/attr/noexcept.h sha2.o: $(hdrdir)/ruby/internal/attr/noinline.h sha2.o: $(hdrdir)/ruby/internal/attr/nonnull.h sha2.o: $(hdrdir)/ruby/internal/attr/noreturn.h +sha2.o: $(hdrdir)/ruby/internal/attr/packed_struct.h sha2.o: $(hdrdir)/ruby/internal/attr/pure.h sha2.o: $(hdrdir)/ruby/internal/attr/restrict.h sha2.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -114,7 +115,6 @@ sha2.o: $(hdrdir)/ruby/internal/intern/enumerator.h sha2.o: $(hdrdir)/ruby/internal/intern/error.h sha2.o: $(hdrdir)/ruby/internal/intern/eval.h sha2.o: $(hdrdir)/ruby/internal/intern/file.h -sha2.o: $(hdrdir)/ruby/internal/intern/gc.h sha2.o: $(hdrdir)/ruby/internal/intern/hash.h sha2.o: $(hdrdir)/ruby/internal/intern/io.h sha2.o: $(hdrdir)/ruby/internal/intern/load.h @@ -145,12 +145,12 @@ sha2.o: $(hdrdir)/ruby/internal/memory.h sha2.o: $(hdrdir)/ruby/internal/method.h sha2.o: $(hdrdir)/ruby/internal/module.h sha2.o: $(hdrdir)/ruby/internal/newobj.h -sha2.o: $(hdrdir)/ruby/internal/rgengc.h sha2.o: $(hdrdir)/ruby/internal/scan_args.h sha2.o: $(hdrdir)/ruby/internal/special_consts.h sha2.o: $(hdrdir)/ruby/internal/static_assert.h sha2.o: $(hdrdir)/ruby/internal/stdalign.h sha2.o: $(hdrdir)/ruby/internal/stdbool.h +sha2.o: $(hdrdir)/ruby/internal/stdckdint.h sha2.o: $(hdrdir)/ruby/internal/symbol.h sha2.o: $(hdrdir)/ruby/internal/value.h sha2.o: $(hdrdir)/ruby/internal/value_type.h @@ -217,6 +217,7 @@ sha2init.o: $(hdrdir)/ruby/internal/attr/noexcept.h sha2init.o: $(hdrdir)/ruby/internal/attr/noinline.h sha2init.o: $(hdrdir)/ruby/internal/attr/nonnull.h sha2init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +sha2init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h sha2init.o: $(hdrdir)/ruby/internal/attr/pure.h sha2init.o: $(hdrdir)/ruby/internal/attr/restrict.h sha2init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -276,7 +277,6 @@ sha2init.o: $(hdrdir)/ruby/internal/intern/enumerator.h sha2init.o: $(hdrdir)/ruby/internal/intern/error.h sha2init.o: $(hdrdir)/ruby/internal/intern/eval.h sha2init.o: $(hdrdir)/ruby/internal/intern/file.h -sha2init.o: $(hdrdir)/ruby/internal/intern/gc.h sha2init.o: $(hdrdir)/ruby/internal/intern/hash.h sha2init.o: $(hdrdir)/ruby/internal/intern/io.h sha2init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -307,12 +307,12 @@ sha2init.o: $(hdrdir)/ruby/internal/memory.h sha2init.o: $(hdrdir)/ruby/internal/method.h sha2init.o: $(hdrdir)/ruby/internal/module.h sha2init.o: $(hdrdir)/ruby/internal/newobj.h -sha2init.o: $(hdrdir)/ruby/internal/rgengc.h sha2init.o: $(hdrdir)/ruby/internal/scan_args.h sha2init.o: $(hdrdir)/ruby/internal/special_consts.h sha2init.o: $(hdrdir)/ruby/internal/static_assert.h sha2init.o: $(hdrdir)/ruby/internal/stdalign.h sha2init.o: $(hdrdir)/ruby/internal/stdbool.h +sha2init.o: $(hdrdir)/ruby/internal/stdckdint.h sha2init.o: $(hdrdir)/ruby/internal/symbol.h sha2init.o: $(hdrdir)/ruby/internal/value.h sha2init.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/digest/sha2/sha2init.c b/ext/digest/sha2/sha2init.c index 94cccf3feb..3923e3724c 100644 --- a/ext/digest/sha2/sha2init.c +++ b/ext/digest/sha2/sha2init.c @@ -25,29 +25,50 @@ static const rb_digest_metadata_t sha##bitlen = { \ FOREACH_BITLEN(DEFINE_ALGO_METADATA) /* + * Document-class: Digest::SHA256 < Digest::Base + * * Classes for calculating message digests using the SHA-256/384/512 * Secure Hash Algorithm(s) by NIST (the US' National Institute of * Standards and Technology), described in FIPS PUB 180-2. + * + * See SHA2. + */ +/* + * Document-class: Digest::SHA384 < Digest::Base + * + * Classes for calculating message digests using the SHA-256/384/512 + * Secure Hash Algorithm(s) by NIST (the US' National Institute of + * Standards and Technology), described in FIPS PUB 180-2. + * + * See SHA2. + */ +/* + * Document-class: Digest::SHA512 < Digest::Base + * + * Classes for calculating message digests using the SHA-256/384/512 + * Secure Hash Algorithm(s) by NIST (the US' National Institute of + * Standards and Technology), described in FIPS PUB 180-2. + * + * See SHA2. */ void Init_sha2(void) { - VALUE mDigest, cDigest_Base; + VALUE mDigest, cDigest_Base, cDigest_SHA2; ID id_metadata = rb_id_metadata(); -#define DECLARE_ALGO_CLASS(bitlen) \ - VALUE cDigest_SHA##bitlen; - - FOREACH_BITLEN(DECLARE_ALGO_CLASS) - +#if 0 + mDigest = rb_define_module("Digest"); /* let rdoc know */ +#endif mDigest = rb_digest_namespace(); - cDigest_Base = rb_path2class("Digest::Base"); + cDigest_Base = rb_const_get(mDigest, rb_intern_const("Base")); + + cDigest_SHA2 = rb_define_class_under(mDigest, "SHA256", cDigest_Base); + rb_ivar_set(cDigest_SHA2, id_metadata, rb_digest_make_metadata(&sha256)); -#define DEFINE_ALGO_CLASS(bitlen) \ - cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \ -\ - rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \ - rb_digest_make_metadata(&sha##bitlen)); + cDigest_SHA2 = rb_define_class_under(mDigest, "SHA384", cDigest_Base); + rb_ivar_set(cDigest_SHA2, id_metadata, rb_digest_make_metadata(&sha384)); - FOREACH_BITLEN(DEFINE_ALGO_CLASS) + cDigest_SHA2 = rb_define_class_under(mDigest, "SHA512", cDigest_Base); + rb_ivar_set(cDigest_SHA2, id_metadata, rb_digest_make_metadata(&sha512)); } diff --git a/ext/erb/escape/extconf.rb b/ext/erb/escape/extconf.rb index c1002548ad..783e8c1f55 100644 --- a/ext/erb/escape/extconf.rb +++ b/ext/erb/escape/extconf.rb @@ -1,6 +1,7 @@ require 'mkmf' -if RUBY_ENGINE == 'truffleruby' +case RUBY_ENGINE +when 'jruby', 'truffleruby' File.write('Makefile', dummy_makefile($srcdir).join) else create_makefile 'erb/escape' diff --git a/ext/etc/.document b/ext/etc/.document new file mode 100644 index 0000000000..9bbea23b92 --- /dev/null +++ b/ext/etc/.document @@ -0,0 +1,2 @@ +etc.c +constdefs.h diff --git a/ext/etc/depend b/ext/etc/depend index a541db6db6..675699b129 100644 --- a/ext/etc/depend +++ b/ext/etc/depend @@ -58,6 +58,7 @@ etc.o: $(hdrdir)/ruby/internal/attr/noexcept.h etc.o: $(hdrdir)/ruby/internal/attr/noinline.h etc.o: $(hdrdir)/ruby/internal/attr/nonnull.h etc.o: $(hdrdir)/ruby/internal/attr/noreturn.h +etc.o: $(hdrdir)/ruby/internal/attr/packed_struct.h etc.o: $(hdrdir)/ruby/internal/attr/pure.h etc.o: $(hdrdir)/ruby/internal/attr/restrict.h etc.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -126,7 +127,6 @@ etc.o: $(hdrdir)/ruby/internal/intern/enumerator.h etc.o: $(hdrdir)/ruby/internal/intern/error.h etc.o: $(hdrdir)/ruby/internal/intern/eval.h etc.o: $(hdrdir)/ruby/internal/intern/file.h -etc.o: $(hdrdir)/ruby/internal/intern/gc.h etc.o: $(hdrdir)/ruby/internal/intern/hash.h etc.o: $(hdrdir)/ruby/internal/intern/io.h etc.o: $(hdrdir)/ruby/internal/intern/load.h @@ -157,12 +157,12 @@ etc.o: $(hdrdir)/ruby/internal/memory.h etc.o: $(hdrdir)/ruby/internal/method.h etc.o: $(hdrdir)/ruby/internal/module.h etc.o: $(hdrdir)/ruby/internal/newobj.h -etc.o: $(hdrdir)/ruby/internal/rgengc.h etc.o: $(hdrdir)/ruby/internal/scan_args.h etc.o: $(hdrdir)/ruby/internal/special_consts.h etc.o: $(hdrdir)/ruby/internal/static_assert.h etc.o: $(hdrdir)/ruby/internal/stdalign.h etc.o: $(hdrdir)/ruby/internal/stdbool.h +etc.o: $(hdrdir)/ruby/internal/stdckdint.h etc.o: $(hdrdir)/ruby/internal/symbol.h etc.o: $(hdrdir)/ruby/internal/value.h etc.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/etc/etc.c b/ext/etc/etc.c index c355fe117a..fcbd1af1b5 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -54,9 +54,9 @@ static VALUE sGroup; # include <stdlib.h> # endif #endif -char *getlogin(); +RUBY_EXTERN char *getlogin(void); -#define RUBY_ETC_VERSION "1.4.0" +#define RUBY_ETC_VERSION "1.4.3" #ifdef HAVE_RB_DEPRECATE_CONSTANT void rb_deprecate_constant(VALUE mod, const char *name); @@ -66,6 +66,17 @@ void rb_deprecate_constant(VALUE mod, const char *name); #include "constdefs.h" +#ifndef HAVE_RB_IO_DESCRIPTOR +static int +io_descriptor_fallback(VALUE io) +{ + rb_io_t *fptr; + GetOpenFile(io, fptr); + return fptr->fd; +} +#define rb_io_descriptor io_descriptor_fallback +#endif + #ifdef HAVE_RUBY_ATOMIC_H # include "ruby/atomic.h" #else @@ -192,7 +203,7 @@ setup_passwd(struct passwd *pwd) #endif /* call-seq: - * getpwuid(uid) -> Passwd + * getpwuid(uid) -> Etc::Passwd * * Returns the <tt>/etc/passwd</tt> information for the user with the given * integer +uid+. @@ -204,7 +215,7 @@ setup_passwd(struct passwd *pwd) * * See the unix manpage for <code>getpwuid(3)</code> for more detail. * - * === Example: + * *Example:* * * Etc.getpwuid(0) * #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash"> @@ -232,7 +243,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj) } /* call-seq: - * getpwnam(name) -> Passwd + * getpwnam(name) -> Etc::Passwd * * Returns the <tt>/etc/passwd</tt> information for the user with specified * login +name+. @@ -241,7 +252,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj) * * See the unix manpage for <code>getpwnam(3)</code> for more detail. * - * === Example: + * *Example:* * * Etc.getpwnam('root') * #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash"> @@ -296,8 +307,8 @@ each_passwd(void) #endif /* call-seq: - * Etc.passwd { |struct| block } -> Passwd - * Etc.passwd -> Passwd + * passwd { |struct| block } + * passwd -> Etc::Passwd * * Provides a convenient Ruby iterator which executes a block for each entry * in the <tt>/etc/passwd</tt> file. @@ -306,7 +317,7 @@ each_passwd(void) * * See ::getpwent above for details. * - * Example: + * *Example:* * * require 'etc' * @@ -332,7 +343,7 @@ etc_passwd(VALUE obj) } /* call-seq: - * Etc::Passwd.each { |struct| block } -> Passwd + * Etc::Passwd.each { |struct| block } -> Etc::Passwd * Etc::Passwd.each -> Enumerator * * Iterates for each entry in the <tt>/etc/passwd</tt> file if a block is @@ -344,7 +355,7 @@ etc_passwd(VALUE obj) * * See Etc.getpwent above for details. * - * Example: + * *Example:* * * require 'etc' * @@ -366,7 +377,10 @@ etc_each_passwd(VALUE obj) return obj; } -/* Resets the process of reading the <tt>/etc/passwd</tt> file, so that the +/* call-seq: + * setpwent + * + * Resets the process of reading the <tt>/etc/passwd</tt> file, so that the * next call to ::getpwent will return the first entry again. */ static VALUE @@ -378,7 +392,10 @@ etc_setpwent(VALUE obj) return Qnil; } -/* Ends the process of scanning through the <tt>/etc/passwd</tt> file begun +/* call-seq: + * endpwent + * + * Ends the process of scanning through the <tt>/etc/passwd</tt> file begun * with ::getpwent, and closes the file. */ static VALUE @@ -390,7 +407,10 @@ etc_endpwent(VALUE obj) return Qnil; } -/* Returns an entry from the <tt>/etc/passwd</tt> file. +/* call-seq: + * getpwent -> Etc::Passwd + * + * Returns an entry from the <tt>/etc/passwd</tt> 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 @@ -438,7 +458,7 @@ setup_group(struct group *grp) #endif /* call-seq: - * getgrgid(group_id) -> Group + * getgrgid(group_id) -> Etc::Group * * Returns information about the group with specified integer +group_id+, * as found in <tt>/etc/group</tt>. @@ -447,7 +467,7 @@ setup_group(struct group *grp) * * See the unix manpage for <code>getgrgid(3)</code> for more detail. * - * === Example: + * *Example:* * * Etc.getgrgid(100) * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]> @@ -476,7 +496,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj) } /* call-seq: - * getgrnam(name) -> Group + * getgrnam(name) -> Etc::Group * * Returns information about the group with specified +name+, as found in * <tt>/etc/group</tt>. @@ -485,7 +505,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj) * * See the unix manpage for <code>getgrnam(3)</code> for more detail. * - * === Example: + * *Example:* * * Etc.getgrnam('users') * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]> @@ -518,7 +538,6 @@ group_ensure(VALUE _) return Qnil; } - static VALUE group_iterate(VALUE _) { @@ -541,14 +560,18 @@ each_group(void) } #endif -/* Provides a convenient Ruby iterator which executes a block for each entry +/* call-seq: + * group { |struct| block } + * group -> Etc::Group + * + * Provides a convenient Ruby iterator which executes a block for each entry * in the <tt>/etc/group</tt> file. * * The code block is passed an Group struct. * * See ::getgrent above for details. * - * Example: + * *Example:* * * require 'etc' * @@ -575,7 +598,7 @@ etc_group(VALUE obj) #ifdef HAVE_GETGRENT /* call-seq: - * Etc::Group.each { |group| block } -> obj + * Etc::Group.each { |group| block } -> Etc::Group * Etc::Group.each -> Enumerator * * Iterates for each entry in the <tt>/etc/group</tt> file if a block is @@ -585,7 +608,7 @@ etc_group(VALUE obj) * * The code block is passed a Group struct. * - * Example: + * *Example:* * * require 'etc' * @@ -606,7 +629,10 @@ etc_each_group(VALUE obj) } #endif -/* Resets the process of reading the <tt>/etc/group</tt> file, so that the +/* call-seq: + * setgrent + * + * Resets the process of reading the <tt>/etc/group</tt> file, so that the * next call to ::getgrent will return the first entry again. */ static VALUE @@ -618,7 +644,10 @@ etc_setgrent(VALUE obj) return Qnil; } -/* Ends the process of scanning through the <tt>/etc/group</tt> file begun +/* call-seq: + * endgrent + * + * Ends the process of scanning through the <tt>/etc/group</tt> file begun * by ::getgrent, and closes the file. */ static VALUE @@ -630,7 +659,10 @@ etc_endgrent(VALUE obj) return Qnil; } -/* Returns an entry from the <tt>/etc/group</tt> file. +/* call-seq: + * getgrent -> Etc::Group + * + * Returns an entry from the <tt>/etc/group</tt> 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 @@ -661,7 +693,9 @@ UINT rb_w32_system_tmpdir(WCHAR *path, UINT len); VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc); #endif -/* +/* call-seq: + * sysconfdir -> String + * * Returns system configuration directory. * * This is typically <code>"/etc"</code>, but is modified by the prefix used @@ -681,7 +715,9 @@ etc_sysconfdir(VALUE obj) #endif } -/* +/* call-seq: + * systmpdir -> String + * * Returns system temporary directory; typically "/tmp". */ static VALUE @@ -725,13 +761,15 @@ etc_systmpdir(VALUE _) } #ifdef HAVE_UNAME -/* +/* call-seq: + * uname -> hash + * * Returns the system information obtained by uname system call. * * The return value is a hash which has 5 keys at least: * :sysname, :nodename, :release, :version, :machine * - * Example: + * *Example:* * * require 'etc' * require 'pp' @@ -841,7 +879,9 @@ etc_uname(VALUE obj) #endif #ifdef HAVE_SYSCONF -/* +/* call-seq: + * sysconf(name) -> Integer + * * Returns system configuration variable using sysconf(). * * _name_ should be a constant under <code>Etc</code> which begins with <code>SC_</code>. @@ -875,7 +915,9 @@ etc_sysconf(VALUE obj, VALUE arg) #endif #ifdef HAVE_CONFSTR -/* +/* call-seq: + * confstr(name) -> String + * * Returns system configuration variable using confstr(). * * _name_ should be a constant under <code>Etc</code> which begins with <code>CS_</code>. @@ -922,7 +964,9 @@ etc_confstr(VALUE obj, VALUE arg) #endif #ifdef HAVE_FPATHCONF -/* +/* call-seq: + * pathconf(name) -> Integer + * * Returns pathname configuration variable using fpathconf(). * * _name_ should be a constant under <code>Etc</code> which begins with <code>PC_</code>. @@ -941,14 +985,11 @@ io_pathconf(VALUE io, VALUE arg) { int name; long ret; - rb_io_t *fptr; name = NUM2INT(arg); - GetOpenFile(io, fptr); - errno = 0; - ret = fpathconf(fptr->fd, name); + ret = fpathconf(rb_io_descriptor(io), name); if (ret == -1) { if (errno == 0) /* no limit */ return Qnil; @@ -1017,7 +1058,9 @@ etc_nprocessors_affin(void) } #endif -/* +/* call-seq: + * nprocessors -> Integer + * * Returns the number of online processors. * * The result is intended as the number of processes to @@ -1027,7 +1070,7 @@ etc_nprocessors_affin(void) * - sched_getaffinity(): Linux * - sysconf(_SC_NPROCESSORS_ONLN): GNU/Linux, NetBSD, FreeBSD, OpenBSD, DragonFly BSD, OpenIndiana, Mac OS X, AIX * - * Example: + * *Example:* * * require 'etc' * p Etc.nprocessors #=> 4 @@ -1036,7 +1079,7 @@ etc_nprocessors_affin(void) * process is bound to specific cpus. This is intended for getting better * parallel processing. * - * Example: (Linux) + * *Example:* (Linux) * * linux$ taskset 0x3 ./ruby -retc -e "p Etc.nprocessors" #=> 2 * @@ -1086,7 +1129,7 @@ etc_nprocessors(VALUE obj) * The Etc module provides a more reliable way to access information about * the logged in user than environment variables such as +$USER+. * - * == Example: + * *Example:* * * require 'etc' * @@ -1110,6 +1153,7 @@ Init_etc(void) RB_EXT_RACTOR_SAFE(true); #endif mEtc = rb_define_module("Etc"); + /* The version */ rb_define_const(mEtc, "VERSION", rb_str_new_cstr(RUBY_ETC_VERSION)); init_constants(mEtc); diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb index 159b1614b7..2e28d58037 100644 --- a/ext/etc/extconf.rb +++ b/ext/etc/extconf.rb @@ -43,13 +43,23 @@ have_struct_member('struct group', 'gr_passwd', 'grp.h') # for https://github.com/ruby/etc srcdir = File.expand_path("..", __FILE__) -if !File.exist?("#{srcdir}/depend") - %x[#{RbConfig.ruby} #{srcdir}/mkconstants.rb -o #{srcdir}/constdefs.h] +constdefs = "#{srcdir}/constdefs.h" +if !File.exist?(constdefs) + ruby = RbConfig.ruby + if File.file?(ruby) + ruby = [ruby] + else + require "shellwords" + ruby = Shellwords.split(ruby) + end + system(*ruby, "#{srcdir}/mkconstants.rb", "-o", constdefs) end # TODO: remove when dropping 2.7 support, as exported since 3.0 have_func('rb_deprecate_constant(Qnil, "None")') +have_func("rb_io_descriptor") + $distcleanfiles << "constdefs.h" create_makefile("etc") diff --git a/ext/etc/mkconstants.rb b/ext/etc/mkconstants.rb index a752d64519..a766560a8a 100644 --- a/ext/etc/mkconstants.rb +++ b/ext/etc/mkconstants.rb @@ -35,6 +35,12 @@ opt.def_option('-H FILE', 'specify output header file') {|filename| opt.parse! +CONST_PREFIXES = { + 'SC' => 'for Etc.sysconf; See <tt>man sysconf</tt>', + 'CS' => 'for Etc.confstr; See <tt>man constr</tt>', + 'PC' => 'for IO#pathconf; See <tt>man fpathconf</tt>', +} + h = {} COMMENTS = {} @@ -49,6 +55,13 @@ DATA.each_line {|s| next end h[name] = default_value + if additional = CONST_PREFIXES[name[/\A_([A-Z]+)_/, 1]] + if comment&.match(/\w\z/) + comment << " " << additional + else + (comment ||= String.new) << " " << additional.sub(/\A\w/) {$&.upcase} + end + end COMMENTS[name] = comment if comment } DEFS = h.to_a @@ -66,15 +79,11 @@ def each_name(pat) } end -erb_new = lambda do |src, safe, trim| - if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ - ERB.new(src, trim_mode: trim) - else - ERB.new(src, safe, trim) - end +erb_new = lambda do |src, trim| + ERB.new(src, trim_mode: trim) end -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_decls") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_const_decls") % each_const {|name, default_value| #if !defined(<%=name%>) # if defined(HAVE_CONST_<%=name.upcase%>) @@ -88,7 +97,7 @@ erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_decls") % } EOS -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_defs") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_const_defs") % each_const {|name, default_value| #if defined(<%=name%>) % if comment = COMMENTS[name] @@ -99,13 +108,13 @@ erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_defs") % } EOS -header_result = erb_new.call(<<'EOS', nil, '%').result(binding) +header_result = erb_new.call(<<'EOS', '%').result(binding) /* autogenerated file */ <%= gen_const_decls %> EOS -result = erb_new.call(<<'EOS', nil, '%').result(binding) +result = erb_new.call(<<'EOS', '%').result(binding) /* autogenerated file */ #ifdef HAVE_LONG_LONG @@ -123,6 +132,9 @@ result = erb_new.call(<<'EOS', nil, '%').result(binding) static void init_constants(VALUE mod) { +#if 0 + mod = rb_define_module("Etc"); +#endif <%= gen_const_defs %> } EOS diff --git a/ext/extmk.rb b/ext/extmk.rb index cab9a519c1..2f76e174d5 100755 --- a/ext/extmk.rb +++ b/ext/extmk.rb @@ -43,11 +43,7 @@ $" << "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 +@null = File::NULL def verbose? $mflags.defined?("V") == "1" @@ -108,7 +104,7 @@ 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 + srcs = Dir[*SRC_EXT.map {|e| "*.#{e}"}, base: $srcdir].map {|fn| File.basename(fn)}.sort if !srcs.empty? old_srcs = m[/^ORIG_SRCS[ \t]*=[ \t](.*)/, 1] or return false (old_srcs.split - srcs).empty? or return false @@ -136,6 +132,14 @@ def extract_makefile(makefile, keep = true) true end +def create_makefile(target, srcprefix = nil) + if $static and target.include?("/") + base = File.basename(target) + $defs << "-DInit_#{base}=Init_#{target.tr('/', '_')}" + end + super +end + def extmake(target, basedir = 'ext', maybestatic = true) FileUtils.mkpath target unless File.directory?(target) begin @@ -476,12 +480,13 @@ if exts = ARGV.shift $extension = [exts] if exts if ext_prefix.start_with?('.') @gemname = exts - elsif exts - $static_ext.delete_if {|t, *| !File.fnmatch(t, exts)} + exts = [] + else + exts &&= $static_ext.select {|t, *| File.fnmatch(t, exts)} end end -ext_prefix = "#{$top_srcdir}/#{ext_prefix || 'ext'}" -exts = $static_ext.sort_by {|t, i| i}.collect {|t, i| t} +ext_prefix ||= 'ext' +exts = (exts || $static_ext).sort_by {|t, i| i}.collect {|t, i| t} default_exclude_exts = case when $cygwin @@ -494,28 +499,30 @@ default_exclude_exts = mandatory_exts = {} withes, withouts = [["--with", nil], ["--without", default_exclude_exts]].collect {|w, d| if !(w = %w[-extensions -ext].collect {|o|arg_config(w+o)}).any? - d ? proc {|c1| d.any?(&c1)} : proc {true} + d ? proc {|&c1| d.any?(&c1)} : proc {true} elsif (w = w.grep(String)).empty? proc {true} else w = w.collect {|o| o.split(/,/)}.flatten w.collect! {|o| o == '+' ? d : o}.flatten! - proc {|c1| w.any?(&c1)} + proc {|&c1| w.any?(&c1)} end } cond = proc {|ext, *| - withes.call(proc {|n| - !n or (mandatory_exts[ext] = true if File.fnmatch(n, ext)) - }) and - !withouts.call(proc {|n| File.fnmatch(n, ext)}) + withes.call {|n| !n or (mandatory_exts[ext] = true if File.fnmatch(n, ext))} and + !withouts.call {|n| File.fnmatch(n, ext)} } ($extension || %w[*]).each do |e| e = e.sub(/\A(?:\.\/)+/, '') - incl, excl = Dir.glob("#{ext_prefix}/#{e}/**/extconf.rb").collect {|d| - d = File.dirname(d) - d.slice!(0, ext_prefix.length + 1) - d + incl, excl = Dir.glob("#{e}/**/extconf.rb", base: "#$top_srcdir/#{ext_prefix}").collect {|d| + File.dirname(d) }.partition {|ext| + if @gemname + ext = ext[%r[\A[^/]+]] # extract gem name + Dir.glob("*.gemspec", base: "#$top_srcdir/#{ext_prefix}/#{ext}") do |g| + break ext = g if ext.start_with?("#{g.chomp!(".gemspec")}-") + end + end with_config(ext, &cond) } incl.sort! @@ -526,7 +533,7 @@ cond = proc {|ext, *| exts.delete_if {|d| File.fnmatch?("-*", d)} end end -ext_prefix = ext_prefix[$top_srcdir.size+1..-2] +ext_prefix.chomp!("/") @ext_prefix = ext_prefix @inplace = inplace @@ -549,7 +556,13 @@ extend Module.new { end def create_makefile(*args, &block) - return super unless @gemname + unless @gemname + if $static and (target = args.first).include?("/") + base = File.basename(target) + $defs << "-DInit_#{base}=Init_#{target.tr('/', '_')}" + end + return super + end super(*args) do |conf| conf.find do |s| s.sub!(%r(^(srcdir *= *)\$\(top_srcdir\)/\.bundle/gems/[^/]+(?=/))) { @@ -632,7 +645,9 @@ $hdrdir = ($top_srcdir = relative_from(srcdir, $topdir = "..")) + "/include" extso = [] fails = [] exts.each do |d| - $static = $force_static ? true : $static_ext[d] + $static = $force_static ? true : $static_ext.fetch(d) do + $static_ext.any? {|t, | File.fnmatch?(t, d)} + end if !$nodynamic or $static result = extmake(d, ext_prefix, !@gemname) or abort @@ -758,12 +773,18 @@ begin end submakeopts << 'EXTLDFLAGS="$(EXTLDFLAGS)"' submakeopts << 'EXTINITS="$(EXTINITS)"' - submakeopts << 'UPDATE_LIBRARIES="$(UPDATE_LIBRARIES)"' submakeopts << 'SHOWFLAGS=' mf.macro "SUBMAKEOPTS", submakeopts mf.macro "NOTE_MESG", %w[$(RUBY) $(top_srcdir)/tool/lib/colorize.rb skip] mf.macro "NOTE_NAME", %w[$(RUBY) $(top_srcdir)/tool/lib/colorize.rb fail] %w[RM RMDIRS RMDIR RMALL].each {|w| mf.macro w, [RbConfig::CONFIG[w]]} + if $nmake + message = ['@(for %I in (', ') do @echo.%~I)'] + else + message = ['@for line in', '; do echo "$$line"; done'] + end + mf.macro "MESSAGE_BEGIN", [message.first] + mf.macro "MESSAGE_END", [message.last] mf.puts targets = %w[all install static install-so install-rb clean distclean realclean] targets.each do |tgt| @@ -807,7 +828,7 @@ begin end mf.puts "#{t}:#{pd}\n\t$(Q)#{submake} $(MFLAGS) V=$(V) $(@F)" if clean and clean.begin(1) - mf.puts "\t$(Q)$(RM) $(ext_build_dir)/exts.mk\n\t$(Q)$(RMDIRS) -p $(@D)" + mf.puts "\t$(Q)$(RM) $(ext_build_dir)/exts.mk\n\t$(Q)$(RMDIRS) $(@D)" end end end @@ -826,15 +847,17 @@ begin fails.each do |ext, (parent, err)| abandon ||= mandatory_exts[ext] mf.puts %Q<\t@$(NOTE_NAME) "#{ext}:"> + mf.puts "\t$(MESSAGE_BEGIN) \\" if parent - mf.puts %Q<\t@echo "\tCould not be configured. It will not be installed."> + mf.puts %Q<\t"\tCould not be configured. It will not be installed." \\> err and err.scan(/.+/) do |ee| - mf.puts %Q<\t@echo "\t#{ee.gsub(/["`$^]/, '\\\\\\&')}"> + mf.puts %Q<\t"\t#{ee.gsub(/["`$^]/, '\\\\\\&')}" \\> end - mf.puts %Q<\t@echo "\tCheck #{ext_prefix}/#{ext}/mkmf.log for more details."> + mf.puts %Q<\t"\tCheck #{ext_prefix}/#{ext}/mkmf.log for more details." \\> else - mf.puts %Q<\t@echo "\tSkipped because its parent was not configured."> + mf.puts %Q<\t"\tSkipped because its parent was not configured." \\> end + mf.puts "\t$(MESSAGE_END)" end mf.puts "note:\n" mf.puts %Q<\t@$(NOTE_MESG) "*** Fix the problems, then remove these directories and try again if you want."> diff --git a/ext/fcntl/depend b/ext/fcntl/depend index 718de62e26..5ed652563b 100644 --- a/ext/fcntl/depend +++ b/ext/fcntl/depend @@ -52,6 +52,7 @@ fcntl.o: $(hdrdir)/ruby/internal/attr/noexcept.h fcntl.o: $(hdrdir)/ruby/internal/attr/noinline.h fcntl.o: $(hdrdir)/ruby/internal/attr/nonnull.h fcntl.o: $(hdrdir)/ruby/internal/attr/noreturn.h +fcntl.o: $(hdrdir)/ruby/internal/attr/packed_struct.h fcntl.o: $(hdrdir)/ruby/internal/attr/pure.h fcntl.o: $(hdrdir)/ruby/internal/attr/restrict.h fcntl.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -111,7 +112,6 @@ fcntl.o: $(hdrdir)/ruby/internal/intern/enumerator.h fcntl.o: $(hdrdir)/ruby/internal/intern/error.h fcntl.o: $(hdrdir)/ruby/internal/intern/eval.h fcntl.o: $(hdrdir)/ruby/internal/intern/file.h -fcntl.o: $(hdrdir)/ruby/internal/intern/gc.h fcntl.o: $(hdrdir)/ruby/internal/intern/hash.h fcntl.o: $(hdrdir)/ruby/internal/intern/io.h fcntl.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +142,12 @@ fcntl.o: $(hdrdir)/ruby/internal/memory.h fcntl.o: $(hdrdir)/ruby/internal/method.h fcntl.o: $(hdrdir)/ruby/internal/module.h fcntl.o: $(hdrdir)/ruby/internal/newobj.h -fcntl.o: $(hdrdir)/ruby/internal/rgengc.h fcntl.o: $(hdrdir)/ruby/internal/scan_args.h fcntl.o: $(hdrdir)/ruby/internal/special_consts.h fcntl.o: $(hdrdir)/ruby/internal/static_assert.h fcntl.o: $(hdrdir)/ruby/internal/stdalign.h fcntl.o: $(hdrdir)/ruby/internal/stdbool.h +fcntl.o: $(hdrdir)/ruby/internal/stdckdint.h fcntl.o: $(hdrdir)/ruby/internal/symbol.h fcntl.o: $(hdrdir)/ruby/internal/value.h fcntl.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/fcntl/fcntl.c b/ext/fcntl/fcntl.c index 3bccc41e4c..e34a3aeae3 100644 --- a/ext/fcntl/fcntl.c +++ b/ext/fcntl/fcntl.c @@ -28,7 +28,10 @@ pack up your own arguments to pass as args for locking functions, etc. #include "ruby.h" #include <fcntl.h> -/* Fcntl loads the constants defined in the system's <fcntl.h> C header +/* + * Document-module: Fcntl + * + * 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. * * To perform a fcntl(2) operation, use IO::fcntl. @@ -61,13 +64,19 @@ pack up your own arguments to pass as args for locking functions, etc. * f.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK|m) * */ + +#define FCNTL_VERSION "1.1.0" + void Init_fcntl(void) { VALUE mFcntl = rb_define_module("Fcntl"); + + /* The version string. */ + rb_define_const(mFcntl, "VERSION", rb_str_new_cstr(FCNTL_VERSION)); + #ifdef F_DUPFD - /* Document-const: F_DUPFD - * + /* * Duplicate a file descriptor to the minimum unused file descriptor * greater than or equal to the argument. * @@ -78,195 +87,164 @@ Init_fcntl(void) 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 F_SETPIPE_SZ - /* Document-const: F_SETPIPE_SZ - * + /* * Change the capacity of the pipe referred to by fd to be at least arg bytes. */ rb_define_const(mFcntl, "F_SETPIPE_SZ", INT2NUM(F_SETPIPE_SZ)); #endif #ifdef F_GETPIPE_SZ - /* Document-const: F_GETPIPE_SZ - * + /* * Return (as the function result) the capacity of the pipe referred to by fd. */ rb_define_const(mFcntl, "F_GETPIPE_SZ", INT2NUM(F_GETPIPE_SZ)); #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 - * +#ifndef O_ACCMODE + int O_ACCMODE = (O_RDONLY | O_WRONLY | O_RDWR); +#endif + /* * 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 #ifdef F_DUP2FD - /* Document-const: F_DUP2FD - * + /* * It is a FreeBSD specific constant and equivalent * to dup2 call. */ rb_define_const(mFcntl, "F_DUP2FD", INT2NUM(F_DUP2FD)); #endif #ifdef F_DUP2FD_CLOEXEC - /* Document-const: F_DUP2FD_CLOEXEC - * + /* * It is a FreeBSD specific constant and acts * similarly as F_DUP2FD but set the FD_CLOEXEC * flag in addition. diff --git a/ext/fcntl/fcntl.gemspec b/ext/fcntl/fcntl.gemspec index 048e101aa5..d621bc0491 100644 --- a/ext/fcntl/fcntl.gemspec +++ b/ext/fcntl/fcntl.gemspec @@ -1,9 +1,19 @@ # coding: utf-8 # frozen_string_literal: true +source_version = ["", "ext/fcntl/"].find do |dir| + begin + break File.open(File.join(__dir__, "#{dir}fcntl.c")) {|f| + f.gets("\n#define FCNTL_VERSION ") + f.gets[/\s*"(.+)"/, 1] + } + rescue Errno::ENOENT + end +end + Gem::Specification.new do |spec| spec.name = "fcntl" - spec.version = "1.0.1" + spec.version = source_version spec.authors = ["Yukihiro Matsumoto"] spec.email = ["matz@ruby-lang.org"] @@ -13,9 +23,10 @@ Gem::Specification.new do |spec| spec.licenses = ["Ruby", "BSD-2-Clause"] spec.files = ["ext/fcntl/extconf.rb", "ext/fcntl/fcntl.c"] + spec.extra_rdoc_files = [".document", ".rdoc_options", "LICENSE.txt", "README.md"] spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.extensions = "ext/fcntl/extconf.rb" - spec.required_ruby_version = ">= 2.3.0" + spec.required_ruby_version = ">= 2.5.0" end diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c index 892f522a62..2b4cdb6608 100644 --- a/ext/fiddle/closure.c +++ b/ext/fiddle/closure.c @@ -1,4 +1,5 @@ #include <fiddle.h> +#include <stdbool.h> #include <ruby/thread.h> int ruby_thread_has_gvl_p(void); /* from internal.h */ @@ -54,10 +55,13 @@ closure_memsize(const void * ptr) } const rb_data_type_t closure_data_type = { - "fiddle/closure", - {0, dealloc, closure_memsize,}, - 0, 0, - RUBY_TYPED_FREE_IMMEDIATELY, + .wrap_struct_name = "fiddle/closure", + .function = { + .dmark = 0, + .dfree = dealloc, + .dsize = closure_memsize + }, + .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; struct callback_args { @@ -136,6 +140,20 @@ with_gvl_callback(void *ptr) rb_ary_push(params, rb_str_new_cstr(*((const char **)(x->args[i])))); break; + case TYPE_BOOL: + if (sizeof(bool) == sizeof(char)) { + rb_ary_push(params, CBOOL2RBBOOL(*(unsigned char *)x->args[i])); + } else if (sizeof(bool) == sizeof(short)) { + rb_ary_push(params, CBOOL2RBBOOL(*(unsigned short *)x->args[i])); + } else if (sizeof(bool) == sizeof(int)) { + rb_ary_push(params, CBOOL2RBBOOL(*(unsigned int *)x->args[i])); + } else if (sizeof(bool) == sizeof(long)) { + rb_ary_push(params, CBOOL2RBBOOL(*(unsigned long *)x->args[i])); + } else { + rb_raise(rb_eNotImpError, "bool isn't supported: %u", + (unsigned int)sizeof(bool)); + } + break; default: rb_raise(rb_eRuntimeError, "closure args: %d", type); } @@ -185,6 +203,13 @@ with_gvl_callback(void *ptr) /* Dangerous. Callback must keep reference of the String. */ *((const char **)(x->resp)) = StringValueCStr(ret); break; + case TYPE_BOOL: + if (sizeof(bool) == sizeof(long)) { + *(unsigned long *)x->resp = RB_TEST(ret); + } else { + *(ffi_arg *)x->resp = RB_TEST(ret); + } + break; default: rb_raise(rb_eRuntimeError, "closure retval: %d", type); } diff --git a/ext/fiddle/conversions.c b/ext/fiddle/conversions.c index 3b70f7de4c..796bf929c3 100644 --- a/ext/fiddle/conversions.c +++ b/ext/fiddle/conversions.c @@ -1,3 +1,5 @@ +#include <stdbool.h> + #include <fiddle.h> VALUE @@ -44,6 +46,7 @@ rb_fiddle_type_ensure(VALUE type) ID ptrdiff_t_id; ID intptr_t_id; ID uintptr_t_id; + ID bool_id; RUBY_CONST_ID(void_id, "void"); RUBY_CONST_ID(voidp_id, "voidp"); RUBY_CONST_ID(char_id, "char"); @@ -74,6 +77,7 @@ rb_fiddle_type_ensure(VALUE type) RUBY_CONST_ID(ptrdiff_t_id, "ptrdiff_t"); RUBY_CONST_ID(intptr_t_id, "intptr_t"); RUBY_CONST_ID(uintptr_t_id, "uintptr_t"); + RUBY_CONST_ID(bool_id, "bool"); if (type_id == void_id) { return INT2NUM(TYPE_VOID); } @@ -144,6 +148,9 @@ rb_fiddle_type_ensure(VALUE type) else if (type_id == uintptr_t_id) { return INT2NUM(TYPE_UINTPTR_T); } + else if (type_id == bool_id) { + return INT2NUM(TYPE_BOOL); + } else { type = original_type; } @@ -187,6 +194,20 @@ rb_fiddle_int_to_ffi_type(int type) return &ffi_type_double; case TYPE_CONST_STRING: return &ffi_type_pointer; + case TYPE_BOOL: + signed_p = 0; + if (sizeof(bool) == sizeof(char)) { + return rb_ffi_type_of(char); + } else if (sizeof(bool) == sizeof(short)) { + return rb_ffi_type_of(short); + } else if (sizeof(bool) == sizeof(int)) { + return rb_ffi_type_of(int); + } else if (sizeof(bool) == sizeof(long)) { + return rb_ffi_type_of(long); + } else { + rb_raise(rb_eNotImpError, "bool isn't supported: %u", + (unsigned int)sizeof(bool)); + } default: rb_raise(rb_eRuntimeError, "unknown type %d", type); } @@ -209,7 +230,11 @@ rb_fiddle_value_to_generic(int type, VALUE *src, fiddle_generic *dst) dst->pointer = NUM2PTR(rb_Integer(*src)); break; case TYPE_CHAR: - dst->schar = (signed char)NUM2INT(*src); + if (RB_TYPE_P(*src, RUBY_T_STRING) && RSTRING_LEN(*src) == 1) { + dst->schar = RSTRING_PTR(*src)[0]; + } else { + dst->schar = (signed char)NUM2INT(*src); + } break; case TYPE_UCHAR: dst->uchar = (unsigned char)NUM2UINT(*src); @@ -254,8 +279,23 @@ rb_fiddle_value_to_generic(int type, VALUE *src, fiddle_generic *dst) dst->pointer = rb_string_value_cstr(src); } break; + case TYPE_BOOL: + if (sizeof(bool) == sizeof(char)) { + dst->uchar = RB_TEST(*src); + } else if (sizeof(bool) == sizeof(short)) { + dst->ushort = RB_TEST(*src); + } else if (sizeof(bool) == sizeof(int)) { + dst->uint = RB_TEST(*src); + } else if (sizeof(bool) == sizeof(long)) { + dst->ulong = RB_TEST(*src); + } else { + rb_raise(rb_eNotImpError, "bool isn't supported: %u", + (unsigned int)sizeof(bool)); + } + break; default: rb_raise(rb_eRuntimeError, "unknown type %d", type); + break; } } @@ -314,6 +354,19 @@ rb_fiddle_generic_to_value(VALUE rettype, fiddle_generic retval) else { return Qnil; } + case TYPE_BOOL: + if (sizeof(bool) == sizeof(char)) { + return CBOOL2RBBOOL((unsigned char)retval.fffi_arg); + } else if (sizeof(bool) == sizeof(short)) { + return CBOOL2RBBOOL((unsigned short)retval.fffi_arg); + } else if (sizeof(bool) == sizeof(int)) { + return CBOOL2RBBOOL((unsigned int)retval.fffi_arg); + } else if (sizeof(bool) == sizeof(long)) { + return CBOOL2RBBOOL(retval.ulong); + } else { + rb_raise(rb_eNotImpError, "bool isn't supported: %u", + (unsigned int)sizeof(bool)); + } default: rb_raise(rb_eRuntimeError, "unknown type %d", type); } diff --git a/ext/fiddle/conversions.h b/ext/fiddle/conversions.h index c7c12a9234..7a1e928d56 100644 --- a/ext/fiddle/conversions.h +++ b/ext/fiddle/conversions.h @@ -50,4 +50,6 @@ VALUE generic_to_value(VALUE rettype, fiddle_generic retval); # define NUM2PTR(x) ((void*)(NUM2ULL(x))) #endif +#define CBOOL2RBBOOL(cbool) ((cbool) ? RUBY_Qtrue : RUBY_Qfalse) + #endif diff --git a/ext/fiddle/depend b/ext/fiddle/depend index d6a053f05b..43b11ca780 100644 --- a/ext/fiddle/depend +++ b/ext/fiddle/depend @@ -105,6 +105,7 @@ closure.o: $(hdrdir)/ruby/internal/attr/noexcept.h closure.o: $(hdrdir)/ruby/internal/attr/noinline.h closure.o: $(hdrdir)/ruby/internal/attr/nonnull.h closure.o: $(hdrdir)/ruby/internal/attr/noreturn.h +closure.o: $(hdrdir)/ruby/internal/attr/packed_struct.h closure.o: $(hdrdir)/ruby/internal/attr/pure.h closure.o: $(hdrdir)/ruby/internal/attr/restrict.h closure.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -164,7 +165,6 @@ closure.o: $(hdrdir)/ruby/internal/intern/enumerator.h closure.o: $(hdrdir)/ruby/internal/intern/error.h closure.o: $(hdrdir)/ruby/internal/intern/eval.h closure.o: $(hdrdir)/ruby/internal/intern/file.h -closure.o: $(hdrdir)/ruby/internal/intern/gc.h closure.o: $(hdrdir)/ruby/internal/intern/hash.h closure.o: $(hdrdir)/ruby/internal/intern/io.h closure.o: $(hdrdir)/ruby/internal/intern/load.h @@ -195,12 +195,12 @@ closure.o: $(hdrdir)/ruby/internal/memory.h closure.o: $(hdrdir)/ruby/internal/method.h closure.o: $(hdrdir)/ruby/internal/module.h closure.o: $(hdrdir)/ruby/internal/newobj.h -closure.o: $(hdrdir)/ruby/internal/rgengc.h closure.o: $(hdrdir)/ruby/internal/scan_args.h closure.o: $(hdrdir)/ruby/internal/special_consts.h closure.o: $(hdrdir)/ruby/internal/static_assert.h closure.o: $(hdrdir)/ruby/internal/stdalign.h closure.o: $(hdrdir)/ruby/internal/stdbool.h +closure.o: $(hdrdir)/ruby/internal/stdckdint.h closure.o: $(hdrdir)/ruby/internal/symbol.h closure.o: $(hdrdir)/ruby/internal/value.h closure.o: $(hdrdir)/ruby/internal/value_type.h @@ -270,6 +270,7 @@ conversions.o: $(hdrdir)/ruby/internal/attr/noexcept.h conversions.o: $(hdrdir)/ruby/internal/attr/noinline.h conversions.o: $(hdrdir)/ruby/internal/attr/nonnull.h conversions.o: $(hdrdir)/ruby/internal/attr/noreturn.h +conversions.o: $(hdrdir)/ruby/internal/attr/packed_struct.h conversions.o: $(hdrdir)/ruby/internal/attr/pure.h conversions.o: $(hdrdir)/ruby/internal/attr/restrict.h conversions.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -329,7 +330,6 @@ conversions.o: $(hdrdir)/ruby/internal/intern/enumerator.h conversions.o: $(hdrdir)/ruby/internal/intern/error.h conversions.o: $(hdrdir)/ruby/internal/intern/eval.h conversions.o: $(hdrdir)/ruby/internal/intern/file.h -conversions.o: $(hdrdir)/ruby/internal/intern/gc.h conversions.o: $(hdrdir)/ruby/internal/intern/hash.h conversions.o: $(hdrdir)/ruby/internal/intern/io.h conversions.o: $(hdrdir)/ruby/internal/intern/load.h @@ -360,12 +360,12 @@ conversions.o: $(hdrdir)/ruby/internal/memory.h conversions.o: $(hdrdir)/ruby/internal/method.h conversions.o: $(hdrdir)/ruby/internal/module.h conversions.o: $(hdrdir)/ruby/internal/newobj.h -conversions.o: $(hdrdir)/ruby/internal/rgengc.h conversions.o: $(hdrdir)/ruby/internal/scan_args.h conversions.o: $(hdrdir)/ruby/internal/special_consts.h conversions.o: $(hdrdir)/ruby/internal/static_assert.h conversions.o: $(hdrdir)/ruby/internal/stdalign.h conversions.o: $(hdrdir)/ruby/internal/stdbool.h +conversions.o: $(hdrdir)/ruby/internal/stdckdint.h conversions.o: $(hdrdir)/ruby/internal/symbol.h conversions.o: $(hdrdir)/ruby/internal/value.h conversions.o: $(hdrdir)/ruby/internal/value_type.h @@ -434,6 +434,7 @@ fiddle.o: $(hdrdir)/ruby/internal/attr/noexcept.h fiddle.o: $(hdrdir)/ruby/internal/attr/noinline.h fiddle.o: $(hdrdir)/ruby/internal/attr/nonnull.h fiddle.o: $(hdrdir)/ruby/internal/attr/noreturn.h +fiddle.o: $(hdrdir)/ruby/internal/attr/packed_struct.h fiddle.o: $(hdrdir)/ruby/internal/attr/pure.h fiddle.o: $(hdrdir)/ruby/internal/attr/restrict.h fiddle.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -493,7 +494,6 @@ fiddle.o: $(hdrdir)/ruby/internal/intern/enumerator.h fiddle.o: $(hdrdir)/ruby/internal/intern/error.h fiddle.o: $(hdrdir)/ruby/internal/intern/eval.h fiddle.o: $(hdrdir)/ruby/internal/intern/file.h -fiddle.o: $(hdrdir)/ruby/internal/intern/gc.h fiddle.o: $(hdrdir)/ruby/internal/intern/hash.h fiddle.o: $(hdrdir)/ruby/internal/intern/io.h fiddle.o: $(hdrdir)/ruby/internal/intern/load.h @@ -524,12 +524,12 @@ fiddle.o: $(hdrdir)/ruby/internal/memory.h fiddle.o: $(hdrdir)/ruby/internal/method.h fiddle.o: $(hdrdir)/ruby/internal/module.h fiddle.o: $(hdrdir)/ruby/internal/newobj.h -fiddle.o: $(hdrdir)/ruby/internal/rgengc.h fiddle.o: $(hdrdir)/ruby/internal/scan_args.h fiddle.o: $(hdrdir)/ruby/internal/special_consts.h fiddle.o: $(hdrdir)/ruby/internal/static_assert.h fiddle.o: $(hdrdir)/ruby/internal/stdalign.h fiddle.o: $(hdrdir)/ruby/internal/stdbool.h +fiddle.o: $(hdrdir)/ruby/internal/stdckdint.h fiddle.o: $(hdrdir)/ruby/internal/symbol.h fiddle.o: $(hdrdir)/ruby/internal/value.h fiddle.o: $(hdrdir)/ruby/internal/value_type.h @@ -598,6 +598,7 @@ function.o: $(hdrdir)/ruby/internal/attr/noexcept.h function.o: $(hdrdir)/ruby/internal/attr/noinline.h function.o: $(hdrdir)/ruby/internal/attr/nonnull.h function.o: $(hdrdir)/ruby/internal/attr/noreturn.h +function.o: $(hdrdir)/ruby/internal/attr/packed_struct.h function.o: $(hdrdir)/ruby/internal/attr/pure.h function.o: $(hdrdir)/ruby/internal/attr/restrict.h function.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -657,7 +658,6 @@ function.o: $(hdrdir)/ruby/internal/intern/enumerator.h function.o: $(hdrdir)/ruby/internal/intern/error.h function.o: $(hdrdir)/ruby/internal/intern/eval.h function.o: $(hdrdir)/ruby/internal/intern/file.h -function.o: $(hdrdir)/ruby/internal/intern/gc.h function.o: $(hdrdir)/ruby/internal/intern/hash.h function.o: $(hdrdir)/ruby/internal/intern/io.h function.o: $(hdrdir)/ruby/internal/intern/load.h @@ -688,12 +688,12 @@ function.o: $(hdrdir)/ruby/internal/memory.h function.o: $(hdrdir)/ruby/internal/method.h function.o: $(hdrdir)/ruby/internal/module.h function.o: $(hdrdir)/ruby/internal/newobj.h -function.o: $(hdrdir)/ruby/internal/rgengc.h function.o: $(hdrdir)/ruby/internal/scan_args.h function.o: $(hdrdir)/ruby/internal/special_consts.h function.o: $(hdrdir)/ruby/internal/static_assert.h function.o: $(hdrdir)/ruby/internal/stdalign.h function.o: $(hdrdir)/ruby/internal/stdbool.h +function.o: $(hdrdir)/ruby/internal/stdckdint.h function.o: $(hdrdir)/ruby/internal/symbol.h function.o: $(hdrdir)/ruby/internal/value.h function.o: $(hdrdir)/ruby/internal/value_type.h @@ -763,6 +763,7 @@ handle.o: $(hdrdir)/ruby/internal/attr/noexcept.h handle.o: $(hdrdir)/ruby/internal/attr/noinline.h handle.o: $(hdrdir)/ruby/internal/attr/nonnull.h handle.o: $(hdrdir)/ruby/internal/attr/noreturn.h +handle.o: $(hdrdir)/ruby/internal/attr/packed_struct.h handle.o: $(hdrdir)/ruby/internal/attr/pure.h handle.o: $(hdrdir)/ruby/internal/attr/restrict.h handle.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -822,7 +823,6 @@ handle.o: $(hdrdir)/ruby/internal/intern/enumerator.h handle.o: $(hdrdir)/ruby/internal/intern/error.h handle.o: $(hdrdir)/ruby/internal/intern/eval.h handle.o: $(hdrdir)/ruby/internal/intern/file.h -handle.o: $(hdrdir)/ruby/internal/intern/gc.h handle.o: $(hdrdir)/ruby/internal/intern/hash.h handle.o: $(hdrdir)/ruby/internal/intern/io.h handle.o: $(hdrdir)/ruby/internal/intern/load.h @@ -853,12 +853,12 @@ handle.o: $(hdrdir)/ruby/internal/memory.h handle.o: $(hdrdir)/ruby/internal/method.h handle.o: $(hdrdir)/ruby/internal/module.h handle.o: $(hdrdir)/ruby/internal/newobj.h -handle.o: $(hdrdir)/ruby/internal/rgengc.h handle.o: $(hdrdir)/ruby/internal/scan_args.h handle.o: $(hdrdir)/ruby/internal/special_consts.h handle.o: $(hdrdir)/ruby/internal/static_assert.h handle.o: $(hdrdir)/ruby/internal/stdalign.h handle.o: $(hdrdir)/ruby/internal/stdbool.h +handle.o: $(hdrdir)/ruby/internal/stdckdint.h handle.o: $(hdrdir)/ruby/internal/symbol.h handle.o: $(hdrdir)/ruby/internal/value.h handle.o: $(hdrdir)/ruby/internal/value_type.h @@ -928,6 +928,7 @@ memory_view.o: $(hdrdir)/ruby/internal/attr/noexcept.h memory_view.o: $(hdrdir)/ruby/internal/attr/noinline.h memory_view.o: $(hdrdir)/ruby/internal/attr/nonnull.h memory_view.o: $(hdrdir)/ruby/internal/attr/noreturn.h +memory_view.o: $(hdrdir)/ruby/internal/attr/packed_struct.h memory_view.o: $(hdrdir)/ruby/internal/attr/pure.h memory_view.o: $(hdrdir)/ruby/internal/attr/restrict.h memory_view.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -996,7 +997,6 @@ memory_view.o: $(hdrdir)/ruby/internal/intern/enumerator.h memory_view.o: $(hdrdir)/ruby/internal/intern/error.h memory_view.o: $(hdrdir)/ruby/internal/intern/eval.h memory_view.o: $(hdrdir)/ruby/internal/intern/file.h -memory_view.o: $(hdrdir)/ruby/internal/intern/gc.h memory_view.o: $(hdrdir)/ruby/internal/intern/hash.h memory_view.o: $(hdrdir)/ruby/internal/intern/io.h memory_view.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1027,12 +1027,12 @@ memory_view.o: $(hdrdir)/ruby/internal/memory.h memory_view.o: $(hdrdir)/ruby/internal/method.h memory_view.o: $(hdrdir)/ruby/internal/module.h memory_view.o: $(hdrdir)/ruby/internal/newobj.h -memory_view.o: $(hdrdir)/ruby/internal/rgengc.h memory_view.o: $(hdrdir)/ruby/internal/scan_args.h memory_view.o: $(hdrdir)/ruby/internal/special_consts.h memory_view.o: $(hdrdir)/ruby/internal/static_assert.h memory_view.o: $(hdrdir)/ruby/internal/stdalign.h memory_view.o: $(hdrdir)/ruby/internal/stdbool.h +memory_view.o: $(hdrdir)/ruby/internal/stdckdint.h memory_view.o: $(hdrdir)/ruby/internal/symbol.h memory_view.o: $(hdrdir)/ruby/internal/value.h memory_view.o: $(hdrdir)/ruby/internal/value_type.h @@ -1104,6 +1104,7 @@ pinned.o: $(hdrdir)/ruby/internal/attr/noexcept.h pinned.o: $(hdrdir)/ruby/internal/attr/noinline.h pinned.o: $(hdrdir)/ruby/internal/attr/nonnull.h pinned.o: $(hdrdir)/ruby/internal/attr/noreturn.h +pinned.o: $(hdrdir)/ruby/internal/attr/packed_struct.h pinned.o: $(hdrdir)/ruby/internal/attr/pure.h pinned.o: $(hdrdir)/ruby/internal/attr/restrict.h pinned.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1163,7 +1164,6 @@ pinned.o: $(hdrdir)/ruby/internal/intern/enumerator.h pinned.o: $(hdrdir)/ruby/internal/intern/error.h pinned.o: $(hdrdir)/ruby/internal/intern/eval.h pinned.o: $(hdrdir)/ruby/internal/intern/file.h -pinned.o: $(hdrdir)/ruby/internal/intern/gc.h pinned.o: $(hdrdir)/ruby/internal/intern/hash.h pinned.o: $(hdrdir)/ruby/internal/intern/io.h pinned.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1194,12 +1194,12 @@ pinned.o: $(hdrdir)/ruby/internal/memory.h pinned.o: $(hdrdir)/ruby/internal/method.h pinned.o: $(hdrdir)/ruby/internal/module.h pinned.o: $(hdrdir)/ruby/internal/newobj.h -pinned.o: $(hdrdir)/ruby/internal/rgengc.h pinned.o: $(hdrdir)/ruby/internal/scan_args.h pinned.o: $(hdrdir)/ruby/internal/special_consts.h pinned.o: $(hdrdir)/ruby/internal/static_assert.h pinned.o: $(hdrdir)/ruby/internal/stdalign.h pinned.o: $(hdrdir)/ruby/internal/stdbool.h +pinned.o: $(hdrdir)/ruby/internal/stdckdint.h pinned.o: $(hdrdir)/ruby/internal/symbol.h pinned.o: $(hdrdir)/ruby/internal/value.h pinned.o: $(hdrdir)/ruby/internal/value_type.h @@ -1269,6 +1269,7 @@ pointer.o: $(hdrdir)/ruby/internal/attr/noexcept.h pointer.o: $(hdrdir)/ruby/internal/attr/noinline.h pointer.o: $(hdrdir)/ruby/internal/attr/nonnull.h pointer.o: $(hdrdir)/ruby/internal/attr/noreturn.h +pointer.o: $(hdrdir)/ruby/internal/attr/packed_struct.h pointer.o: $(hdrdir)/ruby/internal/attr/pure.h pointer.o: $(hdrdir)/ruby/internal/attr/restrict.h pointer.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1337,7 +1338,6 @@ pointer.o: $(hdrdir)/ruby/internal/intern/enumerator.h pointer.o: $(hdrdir)/ruby/internal/intern/error.h pointer.o: $(hdrdir)/ruby/internal/intern/eval.h pointer.o: $(hdrdir)/ruby/internal/intern/file.h -pointer.o: $(hdrdir)/ruby/internal/intern/gc.h pointer.o: $(hdrdir)/ruby/internal/intern/hash.h pointer.o: $(hdrdir)/ruby/internal/intern/io.h pointer.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1368,12 +1368,12 @@ pointer.o: $(hdrdir)/ruby/internal/memory.h pointer.o: $(hdrdir)/ruby/internal/method.h pointer.o: $(hdrdir)/ruby/internal/module.h pointer.o: $(hdrdir)/ruby/internal/newobj.h -pointer.o: $(hdrdir)/ruby/internal/rgengc.h pointer.o: $(hdrdir)/ruby/internal/scan_args.h pointer.o: $(hdrdir)/ruby/internal/special_consts.h pointer.o: $(hdrdir)/ruby/internal/static_assert.h pointer.o: $(hdrdir)/ruby/internal/stdalign.h pointer.o: $(hdrdir)/ruby/internal/stdbool.h +pointer.o: $(hdrdir)/ruby/internal/stdckdint.h pointer.o: $(hdrdir)/ruby/internal/symbol.h pointer.o: $(hdrdir)/ruby/internal/value.h pointer.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/fiddle/extconf.rb b/ext/fiddle/extconf.rb index d550d23f79..2d85b3eea5 100644 --- a/ext/fiddle/extconf.rb +++ b/ext/fiddle/extconf.rb @@ -63,6 +63,11 @@ unless bundle end if have_ffi_header && (have_library('ffi') || have_library('libffi')) have_libffi = true + checking_for("undefined FFI_GO_CLOSURES is used") do + if egrep_cpp(/warning: 'FFI_GO_CLOSURES' is not defined/, cpp_include(ffi_header), "2>&1") + $defs.push('-DFFI_GO_CLOSURES=0') + end + end end end @@ -151,7 +156,7 @@ if libffi_version libffi_version = libffi_version.gsub(/-rc\d+/, '') libffi_version = (libffi_version.split('.').map(&:to_i) + [0,0])[0,3] $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % libffi_version }}) - puts "libffi_version: #{libffi_version.join('.')}" + warn "libffi_version: #{libffi_version.join('.')}" end case diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c index acc1cd0837..f420d9fa3b 100644 --- a/ext/fiddle/fiddle.c +++ b/ext/fiddle/fiddle.c @@ -1,3 +1,5 @@ +#include <stdbool.h> + #include <fiddle.h> VALUE mFiddle; @@ -58,18 +60,16 @@ rb_fiddle_free(VALUE self, VALUE addr) /* * call-seq: Fiddle.dlunwrap(addr) * - * Returns the hexadecimal representation of a memory pointer address +addr+ + * Returns the Ruby object stored at the memory 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" + * x = Object.new + * # => #<Object:0x0000000107c7d870> + * Fiddle.dlwrap(x) + * # => 4425504880 + * Fiddle.dlunwrap(_) + * # => #<Object:0x0000000107c7d870> */ VALUE rb_fiddle_ptr2value(VALUE self, VALUE addr) @@ -80,15 +80,22 @@ rb_fiddle_ptr2value(VALUE self, VALUE addr) /* * call-seq: Fiddle.dlwrap(val) * - * Returns a memory pointer of a function's hexadecimal address location +val+ + * Returns the memory address of the Ruby object stored at +val+ * * Example: * - * lib = Fiddle.dlopen('/lib64/libc-2.15.so') - * => #<Fiddle::Handle:0x00000001342460> + * x = Object.new + * # => #<Object:0x0000000107c7d870> + * Fiddle.dlwrap(x) + * # => 4425504880 + * + * In the case +val+ is not a heap allocated object, this method will return + * the tagged pointer value. * - * Fiddle.dlwrap(lib['strcpy'].to_s(16)) - * => 25522520 + * Example: + * + * Fiddle.dlwrap(123) + * # => 247 */ static VALUE rb_fiddle_value2ptr(VALUE self, VALUE val) @@ -352,6 +359,12 @@ Init_fiddle(void) */ rb_define_const(mFiddleTypes, "UINTPTR_T", INT2NUM(TYPE_UINTPTR_T)); + /* Document-const: Fiddle::Types::BOOL + * + * C type - bool + */ + rb_define_const(mFiddleTypes, "BOOL" , INT2NUM(TYPE_BOOL)); + /* Document-const: ALIGN_VOIDP * * The alignment size of a void* @@ -456,6 +469,12 @@ Init_fiddle(void) */ rb_define_const(mFiddle, "ALIGN_UINTPTR_T", INT2NUM(ALIGN_OF(uintptr_t))); + /* Document-const: ALIGN_BOOL + * + * The alignment size of a bool + */ + rb_define_const(mFiddle, "ALIGN_BOOL", INT2NUM(ALIGN_OF(bool))); + /* Document-const: WINDOWS * * Returns a boolean regarding whether the host is WIN32 @@ -630,6 +649,12 @@ Init_fiddle(void) */ rb_define_const(mFiddle, "SIZEOF_CONST_STRING", INT2NUM(sizeof(const char*))); + /* Document-const: SIZEOF_BOOL + * + * size of a bool + */ + rb_define_const(mFiddle, "SIZEOF_BOOL", INT2NUM(sizeof(bool))); + /* Document-const: RUBY_FREE * * Address of the ruby_xfree() function @@ -650,6 +675,30 @@ Init_fiddle(void) rb_define_module_function(mFiddle, "realloc", rb_fiddle_realloc, 2); rb_define_module_function(mFiddle, "free", rb_fiddle_free, 1); + /* Document-const: Qtrue + * + * The value of Qtrue + */ + rb_define_const(mFiddle, "Qtrue", INT2NUM(Qtrue)); + + /* Document-const: Qfalse + * + * The value of Qfalse + */ + rb_define_const(mFiddle, "Qfalse", INT2NUM(Qfalse)); + + /* Document-const: Qnil + * + * The value of Qnil + */ + rb_define_const(mFiddle, "Qnil", INT2NUM(Qnil)); + + /* Document-const: Qundef + * + * The value of Qundef + */ + rb_define_const(mFiddle, "Qundef", INT2NUM(Qundef)); + Init_fiddle_function(); Init_fiddle_closure(); Init_fiddle_handle(); diff --git a/ext/fiddle/fiddle.gemspec b/ext/fiddle/fiddle.gemspec index 878109395b..3a1072dd49 100644 --- a/ext/fiddle/fiddle.gemspec +++ b/ext/fiddle/fiddle.gemspec @@ -56,4 +56,5 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 2.5.0" spec.metadata["msys2_mingw_dependencies"] = "libffi" + spec.metadata["changelog_uri"] = "https://github.com/ruby/fiddle/releases" end diff --git a/ext/fiddle/fiddle.h b/ext/fiddle/fiddle.h index 10eb9ceedb..348baa9ab9 100644 --- a/ext/fiddle/fiddle.h +++ b/ext/fiddle/fiddle.h @@ -118,7 +118,7 @@ #define TYPE_UINT -TYPE_INT #define TYPE_LONG 5 #define TYPE_ULONG -TYPE_LONG -#if HAVE_LONG_LONG +#ifdef HAVE_LONG_LONG #define TYPE_LONG_LONG 6 #define TYPE_ULONG_LONG -TYPE_LONG_LONG #endif @@ -126,6 +126,7 @@ #define TYPE_DOUBLE 8 #define TYPE_VARIADIC 9 #define TYPE_CONST_STRING 10 +#define TYPE_BOOL 11 #define TYPE_INT8_T TYPE_CHAR #define TYPE_UINT8_T -TYPE_INT8_T @@ -196,7 +197,20 @@ #endif #define TYPE_UINTPTR_T (-TYPE_INTPTR_T) -#define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x) +/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023 + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>. + clang versions < 8.0.0 have the same bug. */ +#if defined(HAVE__ALIGNOF) +# /* Autoconf detected availability of a sane `_Alignof()`. */ +# define ALIGN_OF(type) RB_GNUC_EXTENSION(_Alignof(type)) +#elif (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112 \ + || (defined(__GNUC__) && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ + && !defined(__clang__)) \ + || (defined(__clang__) && __clang_major__ < 8)) +# define ALIGN_OF(type) offsetof(struct {char align_c; type align_x;}, align_x) +#else +# define ALIGN_OF(type) _Alignof(type) +#endif #define ALIGN_VOIDP ALIGN_OF(void*) #define ALIGN_CHAR ALIGN_OF(char) diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c index 274d181d17..5469e09e37 100644 --- a/ext/fiddle/function.c +++ b/ext/fiddle/function.c @@ -53,8 +53,13 @@ function_memsize(const void *p) } const rb_data_type_t function_data_type = { - "fiddle/function", - {0, deallocate, function_memsize,}, + .wrap_struct_name = "fiddle/function", + .function = { + .dmark = 0, + .dfree = deallocate, + .dsize = function_memsize + }, + .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE diff --git a/ext/fiddle/handle.c b/ext/fiddle/handle.c index ae8cc3a581..8ba416952a 100644 --- a/ext/fiddle/handle.c +++ b/ext/fiddle/handle.c @@ -50,8 +50,13 @@ fiddle_handle_memsize(const void *ptr) } static const rb_data_type_t fiddle_handle_data_type = { - "fiddle/handle", - {0, fiddle_handle_free, fiddle_handle_memsize,}, + .wrap_struct_name = "fiddle/handle", + .function = { + .dmark = 0, + .dfree = fiddle_handle_free, + .dsize = fiddle_handle_memsize + }, + .flags = RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/fiddle/lib/fiddle/cparser.rb b/ext/fiddle/lib/fiddle/cparser.rb index 9a70402953..264ca166dd 100644 --- a/ext/fiddle/lib/fiddle/cparser.rb +++ b/ext/fiddle/lib/fiddle/cparser.rb @@ -165,18 +165,30 @@ module Fiddle raise(RuntimeError, "unsupported type: #{ty}") end return TYPE_ULONG_LONG - when /\A(?:signed\s+)?long(?:\s+int\s+)?(?:\s+\w+)?\z/ - return TYPE_LONG - when /\Aunsigned\s+long(?:\s+int\s+)?(?:\s+\w+)?\z/ + when /\Aunsigned\s+long(?:\s+int\s+)?(?:\s+\w+)?\z/, + /\Aunsigned\s+int\s+long(?:\s+\w+)?\z/, + /\Along(?:\s+int)?\s+unsigned(?:\s+\w+)?\z/, + /\Aint\s+unsigned\s+long(?:\s+\w+)?\z/, + /\A(?:int\s+)?long\s+unsigned(?:\s+\w+)?\z/ return TYPE_ULONG + when /\A(?:signed\s+)?long(?:\s+int\s+)?(?:\s+\w+)?\z/, + /\A(?:signed\s+)?int\s+long(?:\s+\w+)?\z/, + /\Along(?:\s+int)?\s+signed(?:\s+\w+)?\z/ + return TYPE_LONG + when /\Aunsigned\s+short(?:\s+int\s+)?(?:\s+\w+)?\z/, + /\Aunsigned\s+int\s+short(?:\s+\w+)?\z/, + /\Ashort(?:\s+int)?\s+unsigned(?:\s+\w+)?\z/, + /\Aint\s+unsigned\s+short(?:\s+\w+)?\z/, + /\A(?:int\s+)?short\s+unsigned(?:\s+\w+)?\z/ + return TYPE_USHORT + when /\A(?:signed\s+)?short(?:\s+int\s+)?(?:\s+\w+)?\z/, + /\A(?:signed\s+)?int\s+short(?:\s+\w+)?\z/, + /\Aint\s+(?:signed\s+)?short(?:\s+\w+)?\z/ + return TYPE_SHORT when /\A(?:signed\s+)?int(?:\s+\w+)?\z/ return TYPE_INT when /\A(?:unsigned\s+int|uint)(?:\s+\w+)?\z/ return TYPE_UINT - when /\A(?:signed\s+)?short(?:\s+int\s+)?(?:\s+\w+)?\z/ - return TYPE_SHORT - when /\Aunsigned\s+short(?:\s+int\s+)?(?:\s+\w+)?\z/ - return TYPE_USHORT when /\A(?:signed\s+)?char(?:\s+\w+)?\z/ return TYPE_CHAR when /\Aunsigned\s+char(?:\s+\w+)?\z/ @@ -235,6 +247,8 @@ module Fiddle return TYPE_INTPTR_T when /\Auintptr_t(?:\s+\w+)?\z/ return TYPE_UINTPTR_T + when "bool" + return TYPE_BOOL when /\*/, /\[[\s\d]*\]/ return TYPE_VOIDP when "..." diff --git a/ext/fiddle/lib/fiddle/import.rb b/ext/fiddle/lib/fiddle/import.rb index 09ffcef544..050708fb96 100644 --- a/ext/fiddle/lib/fiddle/import.rb +++ b/ext/fiddle/lib/fiddle/import.rb @@ -119,6 +119,8 @@ module Fiddle return SIZEOF_VOIDP when TYPE_CONST_STRING return SIZEOF_CONST_STRING + when TYPE_BOOL + return SIZEOF_BOOL else if defined?(TYPE_LONG_LONG) and ty == TYPE_LONG_LONG diff --git a/ext/fiddle/lib/fiddle/pack.rb b/ext/fiddle/lib/fiddle/pack.rb index 545b985d50..81088f402b 100644 --- a/ext/fiddle/lib/fiddle/pack.rb +++ b/ext/fiddle/lib/fiddle/pack.rb @@ -15,6 +15,7 @@ module Fiddle TYPE_USHORT => ALIGN_SHORT, TYPE_UINT => ALIGN_INT, TYPE_ULONG => ALIGN_LONG, + TYPE_BOOL => ALIGN_BOOL, } PACK_MAP = { @@ -30,6 +31,16 @@ module Fiddle TYPE_UINT => "I!", TYPE_ULONG => "L!", } + case SIZEOF_BOOL + when SIZEOF_CHAR + PACK_MAP[TYPE_BOOL] = PACK_MAP[TYPE_UCHAR] + when SIZEOF_SHORT + PACK_MAP[TYPE_BOOL] = PACK_MAP[TYPE_USHORT] + when SIZEOF_INT + PACK_MAP[TYPE_BOOL] = PACK_MAP[TYPE_UINT] + when SIZEOF_LONG + PACK_MAP[TYPE_BOOL] = PACK_MAP[TYPE_ULONG] + end SIZE_MAP = { TYPE_VOIDP => SIZEOF_VOIDP, @@ -43,6 +54,7 @@ module Fiddle TYPE_USHORT => SIZEOF_SHORT, TYPE_UINT => SIZEOF_INT, TYPE_ULONG => SIZEOF_LONG, + TYPE_BOOL => SIZEOF_BOOL, } if defined?(TYPE_LONG_LONG) ALIGN_MAP[TYPE_LONG_LONG] = ALIGN_MAP[TYPE_ULONG_LONG] = ALIGN_LONG_LONG diff --git a/ext/fiddle/lib/fiddle/value.rb b/ext/fiddle/lib/fiddle/value.rb index 01fec1c206..5f0b2e951e 100644 --- a/ext/fiddle/lib/fiddle/value.rb +++ b/ext/fiddle/lib/fiddle/value.rb @@ -6,17 +6,17 @@ module Fiddle def unsigned_value(val, ty) case ty.abs when TYPE_CHAR - [val].pack("c").unpack("C")[0] + [val].pack("c").unpack1("C") when TYPE_SHORT - [val].pack("s!").unpack("S!")[0] + [val].pack("s!").unpack1("S!") when TYPE_INT - [val].pack("i!").unpack("I!")[0] + [val].pack("i!").unpack1("I!") when TYPE_LONG - [val].pack("l!").unpack("L!")[0] + [val].pack("l!").unpack1("L!") else if defined?(TYPE_LONG_LONG) and ty.abs == TYPE_LONG_LONG - [val].pack("q").unpack("Q")[0] + [val].pack("q").unpack1("Q") else val end @@ -26,17 +26,17 @@ module Fiddle def signed_value(val, ty) case ty.abs when TYPE_CHAR - [val].pack("C").unpack("c")[0] + [val].pack("C").unpack1("c") when TYPE_SHORT - [val].pack("S!").unpack("s!")[0] + [val].pack("S!").unpack1("s!") when TYPE_INT - [val].pack("I!").unpack("i!")[0] + [val].pack("I!").unpack1("i!") when TYPE_LONG - [val].pack("L!").unpack("l!")[0] + [val].pack("L!").unpack1("l!") else if defined?(TYPE_LONG_LONG) and ty.abs == TYPE_LONG_LONG - [val].pack("Q").unpack("q")[0] + [val].pack("Q").unpack1("q") else val end @@ -80,11 +80,11 @@ module Fiddle else case SIZEOF_VOIDP when SIZEOF_LONG - return [arg].pack("p").unpack("l!")[0] + return [arg].pack("p").unpack1("l!") else if defined?(SIZEOF_LONG_LONG) and SIZEOF_VOIDP == SIZEOF_LONG_LONG - return [arg].pack("p").unpack("q")[0] + return [arg].pack("p").unpack1("q") else raise(RuntimeError, "sizeof(void*)?") end @@ -102,10 +102,8 @@ module Fiddle return val.unpack('C*') end end - return arg - else - return arg end + return arg else if( arg.respond_to?(:to_ptr) ) return arg.to_ptr.to_i diff --git a/ext/fiddle/lib/fiddle/version.rb b/ext/fiddle/lib/fiddle/version.rb index 719dc62e37..6c5109dca8 100644 --- a/ext/fiddle/lib/fiddle/version.rb +++ b/ext/fiddle/lib/fiddle/version.rb @@ -1,3 +1,3 @@ module Fiddle - VERSION = "1.1.1" + VERSION = "1.1.3" end diff --git a/ext/fiddle/pointer.c b/ext/fiddle/pointer.c index 15107e3862..1b7d7a69f6 100644 --- a/ext/fiddle/pointer.c +++ b/ext/fiddle/pointer.c @@ -88,8 +88,13 @@ fiddle_ptr_memsize(const void *ptr) } static const rb_data_type_t fiddle_ptr_data_type = { - "fiddle/pointer", - {fiddle_ptr_mark, fiddle_ptr_free, fiddle_ptr_memsize,}, + .wrap_struct_name = "fiddle/pointer", + .function = { + .dmark = fiddle_ptr_mark, + .dfree = fiddle_ptr_free, + .dsize = fiddle_ptr_memsize, + }, + .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED }; #ifdef HAVE_RUBY_MEMORY_VIEW_H @@ -135,8 +140,8 @@ rb_fiddle_ptr_new2(VALUE klass, void *ptr, long size, freefunc_t func, VALUE wra data->free = func; data->freed = false; data->size = size; - data->wrap[0] = wrap0; - data->wrap[1] = wrap1; + RB_OBJ_WRITE(val, &data->wrap[0], wrap0); + RB_OBJ_WRITE(val, &data->wrap[1], wrap1); return val; } @@ -235,8 +240,8 @@ rb_fiddle_ptr_initialize(int argc, VALUE argv[], VALUE self) /* Free previous memory. Use of inappropriate initialize may cause SEGV. */ (*(data->free))(data->ptr); } - data->wrap[0] = wrap; - data->wrap[1] = funcwrap; + RB_OBJ_WRITE(self, &data->wrap[0], wrap); + RB_OBJ_WRITE(self, &data->wrap[1], funcwrap); data->ptr = p; data->size = s; data->free = f; @@ -314,7 +319,7 @@ rb_fiddle_ptr_s_malloc(int argc, VALUE argv[], VALUE klass) } obj = rb_fiddle_ptr_malloc(klass, s,f); - if (wrap) RPTR_DATA(obj)->wrap[1] = wrap; + if (wrap) RB_OBJ_WRITE(obj, &RPTR_DATA(obj)->wrap[1], wrap); if (rb_block_given_p()) { if (!f) { @@ -795,10 +800,37 @@ rb_fiddle_ptr_s_to_ptr(VALUE self, VALUE val) if (num == val) wrap = 0; ptr = rb_fiddle_ptr_new(NUM2PTR(num), 0, NULL); } - if (wrap) RPTR_DATA(ptr)->wrap[0] = wrap; + if (wrap) RB_OBJ_WRITE(ptr, &RPTR_DATA(ptr)->wrap[0], wrap); return ptr; } +/* + * call-seq: + * Fiddle::Pointer.read(address, len) => string + * + * Or read the memory at address +address+ with length +len+ and return a + * string with that memory + */ + +static VALUE +rb_fiddle_ptr_read_mem(VALUE klass, VALUE address, VALUE len) +{ + return rb_str_new((char *)NUM2PTR(address), NUM2ULONG(len)); +} + +/* + * call-seq: + * Fiddle::Pointer.write(address, str) + * + * Write bytes in +str+ to the location pointed to by +address+. + */ +static VALUE +rb_fiddle_ptr_write_mem(VALUE klass, VALUE addr, VALUE str) +{ + memcpy(NUM2PTR(addr), StringValuePtr(str), RSTRING_LEN(str)); + return str; +} + void Init_fiddle_pointer(void) { @@ -815,6 +847,8 @@ Init_fiddle_pointer(void) 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_singleton_method(rb_cPointer, "read", rb_fiddle_ptr_read_mem, 2); + rb_define_singleton_method(rb_cPointer, "write", rb_fiddle_ptr_write_mem, 2); 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); diff --git a/ext/fiddle/win32/libffi-config.rb b/ext/fiddle/win32/libffi-config.rb index 985fc29d36..8e8069a943 100755 --- a/ext/fiddle/win32/libffi-config.rb +++ b/ext/fiddle/win32/libffi-config.rb @@ -23,7 +23,7 @@ until ARGV.empty? end end -IO.foreach("#{srcdir}/configure.ac") do |line| +File.foreach("#{srcdir}/configure.ac") do |line| if /^AC_INIT\((.*)\)/ =~ line version = $1.split(/,\s*/)[1] version.gsub!(/\A\[|\]\z/, '') @@ -38,11 +38,11 @@ conf['TARGET'] = /^x64/ =~ host ? "X86_WIN64" : "X86_WIN32" FileUtils.mkdir_p([builddir, "#{builddir}/include", "#{builddir}/src/x86"]) FileUtils.cp("#{basedir}/fficonfig.h", ".", preserve: true) -hdr = IO.binread("#{srcdir}/include/ffi.h.in") +hdr = File.binread("#{srcdir}/include/ffi.h.in") hdr.gsub!(/@(\w+)@/) {conf[$1] || $&} hdr.gsub!(/^(#if\s+)@\w+@/, '\10') -IO.binwrite("#{builddir}/include/ffi.h", hdr) +File.binwrite("#{builddir}/include/ffi.h", hdr) -mk = IO.binread("#{basedir}/libffi.mk.tmpl") +mk = File.binread("#{basedir}/libffi.mk.tmpl") mk.gsub!(/@(\w+)@/) {conf[$1] || $&} -IO.binwrite("Makefile", mk) +File.binwrite("Makefile", mk) diff --git a/ext/io/console/.document b/ext/io/console/.document new file mode 100644 index 0000000000..945a377256 --- /dev/null +++ b/ext/io/console/.document @@ -0,0 +1,2 @@ +console.c +lib/size.rb diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 4ec24178c4..7130c29a8b 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -2,6 +2,10 @@ /* * console IO module */ + +static const char *const +IO_CONSOLE_VERSION = "0.7.2"; + #include "ruby.h" #include "ruby/io.h" #include "ruby/thread.h" @@ -75,10 +79,10 @@ getattr(int fd, conmode *t) #define SET_LAST_ERROR (0) #endif -static ID id_getc, id_console, id_close, id_min, id_time, id_intr; -#if ENABLE_IO_GETPASS -static ID id_gets, id_chomp_bang; -#endif +#define CSI "\x1b\x5b" + +static ID id_getc, id_console, id_close; +static ID id_gets, id_flush, id_chomp_bang; #if defined HAVE_RUBY_FIBER_SCHEDULER_H # include "ruby/fiber/scheduler.h" @@ -87,7 +91,41 @@ extern VALUE rb_scheduler_timeout(struct timeval *timeout); # define rb_fiber_scheduler_make_timeout rb_scheduler_timeout #endif -#define sys_fail_fptr(fptr) rb_sys_fail_str((fptr)->pathv) +#ifndef HAVE_RB_IO_DESCRIPTOR +static int +io_descriptor_fallback(VALUE io) +{ + rb_io_t *fptr; + GetOpenFile(io, fptr); + return fptr->fd; +} +#define rb_io_descriptor io_descriptor_fallback +#endif + +#ifndef HAVE_RB_IO_PATH +static VALUE +io_path_fallback(VALUE io) +{ + rb_io_t *fptr; + GetOpenFile(io, fptr); + return fptr->pathv; +} +#define rb_io_path io_path_fallback +#endif + +#ifndef HAVE_RB_IO_GET_WRITE_IO +static VALUE +io_get_write_io_fallback(VALUE io) +{ + rb_io_t *fptr; + GetOpenFile(io, fptr); + VALUE wio = fptr->tied_io_for_writing; + return wio ? wio : io; +} +#define rb_io_get_write_io io_get_write_io_fallback +#endif + +#define sys_fail(io) rb_sys_fail_str(rb_io_path(io)) #ifndef HAVE_RB_F_SEND #ifndef RB_PASS_CALLED_KEYWORDS @@ -112,18 +150,34 @@ rb_f_send(int argc, VALUE *argv, VALUE recv) } #endif +enum rawmode_opt_ids { + kwd_min, + kwd_time, + kwd_intr, + rawmode_opt_id_count +}; +static ID rawmode_opt_ids[rawmode_opt_id_count]; + typedef struct { int vmin; int vtime; int intr; } rawmode_arg_t; +#ifndef UNDEF_P +# define UNDEF_P(obj) ((obj) == Qundef) +#endif +#ifndef NIL_OR_UNDEF_P +# define NIL_OR_UNDEF_P(obj) (NIL_P(obj) || UNDEF_P(obj)) +#endif + static rawmode_arg_t * rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t *opts) { int argc = *argcp; rawmode_arg_t *optp = NULL; VALUE vopts = Qnil; + VALUE optvals[rawmode_opt_id_count]; #ifdef RB_SCAN_ARGS_PASS_CALLED_KEYWORDS argc = rb_scan_args(argc, argv, "*:", NULL, &vopts); #else @@ -138,19 +192,20 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t * } #endif rb_check_arity(argc, min_argc, max_argc); - if (!NIL_P(vopts)) { - VALUE vmin = rb_hash_aref(vopts, ID2SYM(id_min)); - VALUE vtime = rb_hash_aref(vopts, ID2SYM(id_time)); - VALUE intr = rb_hash_aref(vopts, ID2SYM(id_intr)); + if (rb_get_kwargs(vopts, rawmode_opt_ids, + 0, rawmode_opt_id_count, optvals)) { + VALUE vmin = optvals[kwd_min]; + VALUE vtime = optvals[kwd_time]; + VALUE intr = optvals[kwd_intr]; /* default values by `stty raw` */ opts->vmin = 1; opts->vtime = 0; opts->intr = 0; - if (!NIL_P(vmin)) { + if (!NIL_OR_UNDEF_P(vmin)) { opts->vmin = NUM2INT(vmin); optp = opts; } - if (!NIL_P(vtime)) { + if (!NIL_OR_UNDEF_P(vtime)) { VALUE v10 = INT2FIX(10); vtime = rb_funcall3(vtime, '*', 1, &v10); opts->vtime = NUM2INT(vtime); @@ -165,6 +220,7 @@ rawmode_opt(int *argcp, VALUE *argv, int min_argc, int max_argc, rawmode_arg_t * opts->intr = 0; optp = opts; break; + case Qundef: case Qnil: break; default: @@ -275,33 +331,21 @@ set_ttymode(int fd, conmode *t, void (*setter)(conmode *, void *), void *arg) return setattr(fd, &r); } -#define GetReadFD(fptr) ((fptr)->fd) - -static inline int -get_write_fd(const rb_io_t *fptr) -{ - VALUE wio = fptr->tied_io_for_writing; - rb_io_t *ofptr; - if (!wio) return fptr->fd; - GetOpenFile(wio, ofptr); - return ofptr->fd; -} -#define GetWriteFD(fptr) get_write_fd(fptr) +#define GetReadFD(io) rb_io_descriptor(io) +#define GetWriteFD(io) rb_io_descriptor(rb_io_get_write_io(io)) #define FD_PER_IO 2 static VALUE ttymode(VALUE io, VALUE (*func)(VALUE), VALUE farg, void (*setter)(conmode *, void *), void *arg) { - rb_io_t *fptr; int status = -1; int error = 0; int fd[FD_PER_IO]; conmode t[FD_PER_IO]; VALUE result = Qnil; - GetOpenFile(io, fptr); - fd[0] = GetReadFD(fptr); + fd[0] = GetReadFD(io); if (fd[0] != -1) { if (set_ttymode(fd[0], t+0, setter, arg)) { status = 0; @@ -311,7 +355,7 @@ ttymode(VALUE io, VALUE (*func)(VALUE), VALUE farg, void (*setter)(conmode *, vo fd[0] = -1; } } - fd[1] = GetWriteFD(fptr); + fd[1] = GetWriteFD(io); if (fd[1] != -1 && fd[1] != fd[0]) { if (set_ttymode(fd[1], t+1, setter, arg)) { status = 0; @@ -324,14 +368,13 @@ ttymode(VALUE io, VALUE (*func)(VALUE), VALUE farg, void (*setter)(conmode *, vo if (status == 0) { result = rb_protect(func, farg, &status); } - GetOpenFile(io, fptr); - if (fd[0] != -1 && fd[0] == GetReadFD(fptr)) { + if (fd[0] != -1 && fd[0] == GetReadFD(io)) { if (!setattr(fd[0], t+0)) { error = errno; status = -1; } } - if (fd[1] != -1 && fd[1] != fd[0] && fd[1] == GetWriteFD(fptr)) { + if (fd[1] != -1 && fd[1] != fd[0] && fd[1] == GetWriteFD(io)) { if (!setattr(fd[1], t+1)) { error = errno; status = -1; @@ -417,15 +460,11 @@ static VALUE console_set_raw(int argc, VALUE *argv, VALUE io) { conmode t; - rb_io_t *fptr; - int fd; rawmode_arg_t opts, *optp = rawmode_opt(&argc, argv, 0, 0, &opts); - - GetOpenFile(io, fptr); - fd = GetReadFD(fptr); - if (!getattr(fd, &t)) sys_fail_fptr(fptr); + int fd = GetReadFD(io); + if (!getattr(fd, &t)) sys_fail(io); set_rawmode(&t, optp); - if (!setattr(fd, &t)) sys_fail_fptr(fptr); + if (!setattr(fd, &t)) sys_fail(io); return io; } @@ -461,14 +500,10 @@ static VALUE console_set_cooked(VALUE io) { conmode t; - rb_io_t *fptr; - int fd; - - GetOpenFile(io, fptr); - fd = GetReadFD(fptr); - if (!getattr(fd, &t)) sys_fail_fptr(fptr); + int fd = GetReadFD(io); + if (!getattr(fd, &t)) sys_fail(io); set_cookedmode(&t, NULL); - if (!setattr(fd, &t)) sys_fail_fptr(fptr); + if (!setattr(fd, &t)) sys_fail(io); return io; } @@ -620,17 +655,17 @@ static VALUE console_set_echo(VALUE io, VALUE f) { conmode t; - rb_io_t *fptr; - int fd; + int fd = GetReadFD(io); + + if (!getattr(fd, &t)) sys_fail(io); - GetOpenFile(io, fptr); - fd = GetReadFD(fptr); - if (!getattr(fd, &t)) sys_fail_fptr(fptr); if (RTEST(f)) - set_echo(&t, NULL); + set_echo(&t, NULL); else - set_noecho(&t, NULL); - if (!setattr(fd, &t)) sys_fail_fptr(fptr); + set_noecho(&t, NULL); + + if (!setattr(fd, &t)) sys_fail(io); + return io; } @@ -646,12 +681,9 @@ static VALUE console_echo_p(VALUE io) { conmode t; - rb_io_t *fptr; - int fd; + int fd = GetReadFD(io); - GetOpenFile(io, fptr); - fd = GetReadFD(fptr); - if (!getattr(fd, &t)) sys_fail_fptr(fptr); + if (!getattr(fd, &t)) sys_fail(io); return echo_p(&t) ? Qtrue : Qfalse; } @@ -730,12 +762,9 @@ static VALUE console_conmode_get(VALUE io) { conmode t; - rb_io_t *fptr; - int fd; + int fd = GetReadFD(io); - GetOpenFile(io, fptr); - fd = GetReadFD(fptr); - if (!getattr(fd, &t)) sys_fail_fptr(fptr); + if (!getattr(fd, &t)) sys_fail(io); return conmode_new(cConmode, &t); } @@ -752,14 +781,12 @@ static VALUE console_conmode_set(VALUE io, VALUE mode) { conmode *t, r; - rb_io_t *fptr; - int fd; + int fd = GetReadFD(io); TypedData_Get_Struct(mode, conmode, &conmode_type, t); r = *t; - GetOpenFile(io, fptr); - fd = GetReadFD(fptr); - if (!setattr(fd, &r)) sys_fail_fptr(fptr); + + if (!setattr(fd, &r)) sys_fail(io); return mode; } @@ -795,13 +822,9 @@ typedef CONSOLE_SCREEN_BUFFER_INFO rb_console_size_t; static VALUE console_winsize(VALUE io) { - rb_io_t *fptr; - int fd; rb_console_size_t ws; - - GetOpenFile(io, fptr); - fd = GetWriteFD(fptr); - if (!getwinsize(fd, &ws)) sys_fail_fptr(fptr); + int fd = GetWriteFD(io); + if (!getwinsize(fd, &ws)) sys_fail(io); return rb_assoc_new(INT2NUM(winsize_row(&ws)), INT2NUM(winsize_col(&ws))); } @@ -817,7 +840,6 @@ console_winsize(VALUE io) static VALUE console_set_winsize(VALUE io, VALUE size) { - rb_io_t *fptr; rb_console_size_t ws; #if defined _WIN32 HANDLE wh; @@ -826,20 +848,17 @@ console_set_winsize(VALUE io, VALUE size) #endif VALUE row, col, xpixel, ypixel; const VALUE *sz; - int fd; long sizelen; + int fd; - GetOpenFile(io, fptr); size = rb_Array(size); if ((sizelen = RARRAY_LEN(size)) != 2 && sizelen != 4) { - rb_raise(rb_eArgError, - "wrong number of arguments (given %ld, expected 2 or 4)", - sizelen); + rb_raise(rb_eArgError, "wrong number of arguments (given %ld, expected 2 or 4)", sizelen); } sz = RARRAY_CONST_PTR(size); row = sz[0], col = sz[1], xpixel = ypixel = Qnil; if (sizelen == 4) xpixel = sz[2], ypixel = sz[3]; - fd = GetWriteFD(fptr); + fd = GetWriteFD(io); #if defined TIOCSWINSZ ws.ws_row = ws.ws_col = ws.ws_xpixel = ws.ws_ypixel = 0; #define SET(m) ws.ws_##m = NIL_P(m) ? 0 : (unsigned short)NUM2UINT(m) @@ -848,7 +867,7 @@ console_set_winsize(VALUE io, VALUE size) SET(xpixel); SET(ypixel); #undef SET - if (!setwinsize(fd, &ws)) sys_fail_fptr(fptr); + if (!setwinsize(fd, &ws)) sys_fail(io); #elif defined _WIN32 wh = (HANDLE)rb_w32_get_osfhandle(fd); #define SET(m) new##m = NIL_P(m) ? 0 : (unsigned short)NUM2UINT(m) @@ -883,15 +902,23 @@ console_set_winsize(VALUE io, VALUE size) #endif #ifdef _WIN32 +/* + * call-seq: + * io.check_winsize_changed { ... } -> io + * + * Yields while console input events are queued. + * + * This method is Windows only. + * + * You must require 'io/console' to use this method. + */ static VALUE console_check_winsize_changed(VALUE io) { - rb_io_t *fptr; HANDLE h; DWORD num; - GetOpenFile(io, fptr); - h = (HANDLE)rb_w32_get_osfhandle(GetReadFD(fptr)); + h = (HANDLE)rb_w32_get_osfhandle(GetReadFD(io)); while (GetNumberOfConsoleInputEvents(h, &num) && num > 0) { INPUT_RECORD rec; if (ReadConsoleInput(h, &rec, 1, &num)) { @@ -917,15 +944,11 @@ console_check_winsize_changed(VALUE io) static VALUE console_iflush(VALUE io) { - rb_io_t *fptr; - int fd; - - GetOpenFile(io, fptr); - fd = GetReadFD(fptr); #if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H - if (tcflush(fd, TCIFLUSH)) sys_fail_fptr(fptr); + int fd = GetReadFD(io); + if (tcflush(fd, TCIFLUSH)) sys_fail(io); #endif - (void)fd; + return io; } @@ -940,13 +963,9 @@ console_iflush(VALUE io) static VALUE console_oflush(VALUE io) { - rb_io_t *fptr; - int fd; - - GetOpenFile(io, fptr); - fd = GetWriteFD(fptr); + int fd = GetWriteFD(io); #if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H - if (tcflush(fd, TCOFLUSH)) sys_fail_fptr(fptr); + if (tcflush(fd, TCOFLUSH)) sys_fail(io); #endif (void)fd; return io; @@ -963,40 +982,38 @@ console_oflush(VALUE io) static VALUE console_ioflush(VALUE io) { - rb_io_t *fptr; #if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H - int fd1, fd2; -#endif + int fd1 = GetReadFD(io); + int fd2 = GetWriteFD(io); - GetOpenFile(io, fptr); -#if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H - fd1 = GetReadFD(fptr); - fd2 = GetWriteFD(fptr); if (fd2 != -1 && fd1 != fd2) { - if (tcflush(fd1, TCIFLUSH)) sys_fail_fptr(fptr); - if (tcflush(fd2, TCOFLUSH)) sys_fail_fptr(fptr); + if (tcflush(fd1, TCIFLUSH)) sys_fail(io); + if (tcflush(fd2, TCOFLUSH)) sys_fail(io); } else { - if (tcflush(fd1, TCIOFLUSH)) sys_fail_fptr(fptr); + if (tcflush(fd1, TCIOFLUSH)) sys_fail(io); } #endif + return io; } +/* + * call-seq: + * io.beep + * + * Beeps on the output console. + * + * You must require 'io/console' to use this method. + */ static VALUE console_beep(VALUE io) { - rb_io_t *fptr; - int fd; - - GetOpenFile(io, fptr); - fd = GetWriteFD(fptr); #ifdef _WIN32 - (void)fd; MessageBeep(0); #else - if (write(fd, "\a", 1) < 0) - sys_fail_fptr(fptr); + int fd = GetWriteFD(io); + if (write(fd, "\a", 1) < 0) sys_fail(io); #endif return io; } @@ -1017,79 +1034,6 @@ mode_in_range(VALUE val, int high, const char *modename) } #if defined _WIN32 -static VALUE -console_goto(VALUE io, VALUE y, VALUE x) -{ - rb_io_t *fptr; - int fd; - COORD pos; - - GetOpenFile(io, fptr); - fd = GetWriteFD(fptr); - pos.X = NUM2UINT(x); - pos.Y = NUM2UINT(y); - if (!SetConsoleCursorPosition((HANDLE)rb_w32_get_osfhandle(fd), pos)) { - rb_syserr_fail(LAST_ERROR, 0); - } - return io; -} - -static VALUE -console_cursor_pos(VALUE io) -{ - rb_io_t *fptr; - int fd; - rb_console_size_t ws; - - GetOpenFile(io, fptr); - fd = GetWriteFD(fptr); - if (!GetConsoleScreenBufferInfo((HANDLE)rb_w32_get_osfhandle(fd), &ws)) { - rb_syserr_fail(LAST_ERROR, 0); - } - return rb_assoc_new(UINT2NUM(ws.dwCursorPosition.Y), UINT2NUM(ws.dwCursorPosition.X)); -} - -static VALUE -console_move(VALUE io, int y, int x) -{ - rb_io_t *fptr; - HANDLE h; - rb_console_size_t ws; - COORD *pos = &ws.dwCursorPosition; - - GetOpenFile(io, fptr); - h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(fptr)); - if (!GetConsoleScreenBufferInfo(h, &ws)) { - rb_syserr_fail(LAST_ERROR, 0); - } - pos->X += x; - pos->Y += y; - if (!SetConsoleCursorPosition(h, *pos)) { - rb_syserr_fail(LAST_ERROR, 0); - } - return io; -} - -static VALUE -console_goto_column(VALUE io, VALUE val) -{ - rb_io_t *fptr; - HANDLE h; - rb_console_size_t ws; - COORD *pos = &ws.dwCursorPosition; - - GetOpenFile(io, fptr); - h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(fptr)); - if (!GetConsoleScreenBufferInfo(h, &ws)) { - rb_syserr_fail(LAST_ERROR, 0); - } - pos->X = NUM2INT(val); - if (!SetConsoleCursorPosition(h, *pos)) { - rb_syserr_fail(LAST_ERROR, 0); - } - return io; -} - static void constat_clear(HANDLE handle, WORD attr, DWORD len, COORD pos) { @@ -1100,86 +1044,12 @@ constat_clear(HANDLE handle, WORD attr, DWORD len, COORD pos) } static VALUE -console_erase_line(VALUE io, VALUE val) -{ - rb_io_t *fptr; - HANDLE h; - rb_console_size_t ws; - COORD *pos = &ws.dwCursorPosition; - DWORD w; - int mode = mode_in_range(val, 2, "line erase"); - - GetOpenFile(io, fptr); - h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(fptr)); - if (!GetConsoleScreenBufferInfo(h, &ws)) { - rb_syserr_fail(LAST_ERROR, 0); - } - w = winsize_col(&ws); - switch (mode) { - case 0: /* after cursor */ - w -= pos->X; - break; - case 1: /* before *and* cursor */ - w = pos->X + 1; - pos->X = 0; - break; - case 2: /* entire line */ - pos->X = 0; - break; - } - constat_clear(h, ws.wAttributes, w, *pos); - return io; -} - -static VALUE -console_erase_screen(VALUE io, VALUE val) -{ - rb_io_t *fptr; - HANDLE h; - rb_console_size_t ws; - COORD *pos = &ws.dwCursorPosition; - DWORD w; - int mode = mode_in_range(val, 3, "screen erase"); - - GetOpenFile(io, fptr); - h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(fptr)); - if (!GetConsoleScreenBufferInfo(h, &ws)) { - rb_syserr_fail(LAST_ERROR, 0); - } - w = winsize_col(&ws); - switch (mode) { - case 0: /* erase after cursor */ - w = (w * (ws.srWindow.Bottom - pos->Y + 1) - pos->X); - break; - case 1: /* erase before *and* cursor */ - w = (w * (pos->Y - ws.srWindow.Top) + pos->X + 1); - pos->X = 0; - pos->Y = ws.srWindow.Top; - break; - case 2: /* erase entire screen */ - w = (w * winsize_row(&ws)); - pos->X = 0; - pos->Y = ws.srWindow.Top; - break; - case 3: /* erase entire screen */ - w = (w * ws.dwSize.Y); - pos->X = 0; - pos->Y = 0; - break; - } - constat_clear(h, ws.wAttributes, w, *pos); - return io; -} - -static VALUE console_scroll(VALUE io, int line) { - rb_io_t *fptr; HANDLE h; rb_console_size_t ws; - GetOpenFile(io, fptr); - h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(fptr)); + h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(io)); if (!GetConsoleScreenBufferInfo(h, &ws)) { rb_syserr_fail(LAST_ERROR, 0); } @@ -1203,6 +1073,17 @@ console_scroll(VALUE io, int line) #include "win32_vk.inc" +/* + * call-seq: + * io.pressed?(key) -> bool + * + * Returns +true+ if +key+ is pressed. +key+ may be a virtual key + * code or its name (String or Symbol) with out "VK_" prefix. + * + * This method is Windows only. + * + * You must require 'io/console' to use this method. + */ static VALUE console_key_pressed_p(VALUE io, VALUE k) { @@ -1238,23 +1119,11 @@ static int direct_query(VALUE io, const struct query_args *query) { if (RB_TYPE_P(io, T_FILE)) { - rb_io_t *fptr; - VALUE wio; - GetOpenFile(io, fptr); - wio = fptr->tied_io_for_writing; - if (wio) { - VALUE s = rb_str_new_cstr(query->qstr); - rb_io_write(wio, s); - rb_io_flush(wio); - return 1; - } - if (write(fptr->fd, query->qstr, strlen(query->qstr)) != -1) { - return 1; - } - if (fptr->fd == 0 && - write(1, query->qstr, strlen(query->qstr)) != -1) { - return 1; - } + VALUE wio = rb_io_get_write_io(io); + VALUE s = rb_str_new_cstr(query->qstr); + rb_io_write(wio, s); + rb_io_flush(wio); + return 1; } return 0; } @@ -1305,8 +1174,40 @@ console_vt_response(int argc, VALUE *argv, VALUE io, const struct query_args *qa } static VALUE +console_scroll(VALUE io, int line) +{ + if (line) { + VALUE s = rb_sprintf(CSI "%d%c", line < 0 ? -line : line, + line < 0 ? 'T' : 'S'); + rb_io_write(io, s); + } + return io; +} + +# define console_key_pressed_p rb_f_notimplement +#endif + +/* + * call-seq: + * io.cursor -> [row, column] + * + * Returns the current cursor position as a two-element array of integers (row, column) + * + * io.cursor # => [3, 5] + * + * You must require 'io/console' to use this method. + */ +static VALUE console_cursor_pos(VALUE io) { +#ifdef _WIN32 + rb_console_size_t ws; + int fd = GetWriteFD(io); + if (!GetConsoleScreenBufferInfo((HANDLE)rb_w32_get_osfhandle(fd), &ws)) { + rb_syserr_fail(LAST_ERROR, 0); + } + return rb_assoc_new(UINT2NUM(ws.dwCursorPosition.Y), UINT2NUM(ws.dwCursorPosition.X)); +#else static const struct query_args query = {"\033[6n", 0}; VALUE resp = console_vt_response(0, 0, io, &query); VALUE row, column, term; @@ -1323,64 +1224,205 @@ console_cursor_pos(VALUE io) RARRAY_ASET(resp, 0, INT2NUM(r)); RARRAY_ASET(resp, 1, INT2NUM(c)); return resp; +#endif } +/* + * call-seq: + * io.goto(line, column) -> io + * + * Set the cursor position at +line+ and +column+. + * + * You must require 'io/console' to use this method. + */ static VALUE console_goto(VALUE io, VALUE y, VALUE x) { - rb_io_write(io, rb_sprintf("\x1b[%d;%dH", NUM2UINT(y)+1, NUM2UINT(x)+1)); +#ifdef _WIN32 + COORD pos; + int fd = GetWriteFD(io); + pos.X = NUM2UINT(x); + pos.Y = NUM2UINT(y); + if (!SetConsoleCursorPosition((HANDLE)rb_w32_get_osfhandle(fd), pos)) { + rb_syserr_fail(LAST_ERROR, 0); + } +#else + rb_io_write(io, rb_sprintf(CSI "%d;%dH", NUM2UINT(y)+1, NUM2UINT(x)+1)); +#endif return io; } static VALUE console_move(VALUE io, int y, int x) { +#ifdef _WIN32 + HANDLE h; + rb_console_size_t ws; + COORD *pos = &ws.dwCursorPosition; + + h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(io)); + if (!GetConsoleScreenBufferInfo(h, &ws)) { + rb_syserr_fail(LAST_ERROR, 0); + } + pos->X += x; + pos->Y += y; + if (!SetConsoleCursorPosition(h, *pos)) { + rb_syserr_fail(LAST_ERROR, 0); + } +#else if (x || y) { VALUE s = rb_str_new_cstr(""); - if (y) rb_str_catf(s, "\x1b[%d%c", y < 0 ? -y : y, y < 0 ? 'A' : 'B'); - if (x) rb_str_catf(s, "\x1b[%d%c", x < 0 ? -x : x, x < 0 ? 'D' : 'C'); + if (y) rb_str_catf(s, CSI "%d%c", y < 0 ? -y : y, y < 0 ? 'A' : 'B'); + if (x) rb_str_catf(s, CSI "%d%c", x < 0 ? -x : x, x < 0 ? 'D' : 'C'); rb_io_write(io, s); rb_io_flush(io); } +#endif return io; } +/* + * call-seq: + * io.goto_column(column) -> io + * + * Set the cursor position at +column+ in the same line of the current + * position. + * + * You must require 'io/console' to use this method. + */ static VALUE console_goto_column(VALUE io, VALUE val) { - rb_io_write(io, rb_sprintf("\x1b[%dG", NUM2UINT(val)+1)); +#ifdef _WIN32 + HANDLE h; + rb_console_size_t ws; + COORD *pos = &ws.dwCursorPosition; + + h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(io)); + if (!GetConsoleScreenBufferInfo(h, &ws)) { + rb_syserr_fail(LAST_ERROR, 0); + } + pos->X = NUM2INT(val); + if (!SetConsoleCursorPosition(h, *pos)) { + rb_syserr_fail(LAST_ERROR, 0); + } +#else + rb_io_write(io, rb_sprintf(CSI "%dG", NUM2UINT(val)+1)); +#endif return io; } +/* + * call-seq: + * io.erase_line(mode) -> io + * + * Erases the line at the cursor corresponding to +mode+. + * +mode+ may be either: + * 0: after cursor + * 1: before and cursor + * 2: entire line + * + * You must require 'io/console' to use this method. + */ static VALUE console_erase_line(VALUE io, VALUE val) { int mode = mode_in_range(val, 2, "line erase"); - rb_io_write(io, rb_sprintf("\x1b[%dK", mode)); +#ifdef _WIN32 + HANDLE h; + rb_console_size_t ws; + COORD *pos = &ws.dwCursorPosition; + DWORD w; + + h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(io)); + if (!GetConsoleScreenBufferInfo(h, &ws)) { + rb_syserr_fail(LAST_ERROR, 0); + } + w = winsize_col(&ws); + switch (mode) { + case 0: /* after cursor */ + w -= pos->X; + break; + case 1: /* before *and* cursor */ + w = pos->X + 1; + pos->X = 0; + break; + case 2: /* entire line */ + pos->X = 0; + break; + } + constat_clear(h, ws.wAttributes, w, *pos); + return io; +#else + rb_io_write(io, rb_sprintf(CSI "%dK", mode)); +#endif return io; } +/* + * call-seq: + * io.erase_screen(mode) -> io + * + * Erases the screen at the cursor corresponding to +mode+. + * +mode+ may be either: + * 0: after cursor + * 1: before and cursor + * 2: entire screen + * + * You must require 'io/console' to use this method. + */ static VALUE console_erase_screen(VALUE io, VALUE val) { int mode = mode_in_range(val, 3, "screen erase"); - rb_io_write(io, rb_sprintf("\x1b[%dJ", mode)); - return io; -} +#ifdef _WIN32 + HANDLE h; + rb_console_size_t ws; + COORD *pos = &ws.dwCursorPosition; + DWORD w; -static VALUE -console_scroll(VALUE io, int line) -{ - if (line) { - VALUE s = rb_sprintf("\x1b[%d%c", line < 0 ? -line : line, - line < 0 ? 'T' : 'S'); - rb_io_write(io, s); + h = (HANDLE)rb_w32_get_osfhandle(GetWriteFD(io)); + if (!GetConsoleScreenBufferInfo(h, &ws)) { + rb_syserr_fail(LAST_ERROR, 0); + } + w = winsize_col(&ws); + switch (mode) { + case 0: /* erase after cursor */ + w = (w * (ws.srWindow.Bottom - pos->Y + 1) - pos->X); + break; + case 1: /* erase before *and* cursor */ + w = (w * (pos->Y - ws.srWindow.Top) + pos->X + 1); + pos->X = 0; + pos->Y = ws.srWindow.Top; + break; + case 2: /* erase entire screen */ + w = (w * winsize_row(&ws)); + pos->X = 0; + pos->Y = ws.srWindow.Top; + break; + case 3: /* erase entire screen */ + w = (w * ws.dwSize.Y); + pos->X = 0; + pos->Y = 0; + break; } + constat_clear(h, ws.wAttributes, w, *pos); +#else + rb_io_write(io, rb_sprintf(CSI "%dJ", mode)); +#endif return io; } -# define console_key_pressed_p rb_f_notimplement -#endif +/* + * call-seq: + * io.cursor = [line, column] -> io + * + * Same as <tt>io.goto(line, column)</tt> + * + * See IO#goto. + * + * You must require 'io/console' to use this method. + */ static VALUE console_cursor_set(VALUE io, VALUE cpos) { @@ -1389,42 +1431,98 @@ console_cursor_set(VALUE io, VALUE cpos) return console_goto(io, RARRAY_AREF(cpos, 0), RARRAY_AREF(cpos, 1)); } +/* + * call-seq: + * io.cursor_up(n) -> io + * + * Moves the cursor up +n+ lines. + * + * You must require 'io/console' to use this method. + */ static VALUE console_cursor_up(VALUE io, VALUE val) { return console_move(io, -NUM2INT(val), 0); } +/* + * call-seq: + * io.cursor_down(n) -> io + * + * Moves the cursor down +n+ lines. + * + * You must require 'io/console' to use this method. + */ static VALUE console_cursor_down(VALUE io, VALUE val) { return console_move(io, +NUM2INT(val), 0); } +/* + * call-seq: + * io.cursor_left(n) -> io + * + * Moves the cursor left +n+ columns. + * + * You must require 'io/console' to use this method. + */ static VALUE console_cursor_left(VALUE io, VALUE val) { return console_move(io, 0, -NUM2INT(val)); } +/* + * call-seq: + * io.cursor_right(n) -> io + * + * Moves the cursor right +n+ columns. + * + * You must require 'io/console' to use this method. + */ static VALUE console_cursor_right(VALUE io, VALUE val) { return console_move(io, 0, +NUM2INT(val)); } +/* + * call-seq: + * io.scroll_forward(n) -> io + * + * Scrolls the entire scrolls forward +n+ lines. + * + * You must require 'io/console' to use this method. + */ static VALUE console_scroll_forward(VALUE io, VALUE val) { return console_scroll(io, +NUM2INT(val)); } +/* + * call-seq: + * io.scroll_backward(n) -> io + * + * Scrolls the entire scrolls backward +n+ lines. + * + * You must require 'io/console' to use this method. + */ static VALUE console_scroll_backward(VALUE io, VALUE val) { return console_scroll(io, -NUM2INT(val)); } +/* + * call-seq: + * io.clear_screen -> io + * + * Clears the entire screen and moves the cursor top-left corner. + * + * You must require 'io/console' to use this method. + */ static VALUE console_clear_screen(VALUE io) { @@ -1433,6 +1531,38 @@ console_clear_screen(VALUE io) return io; } +#ifndef HAVE_RB_IO_OPEN_DESCRIPTOR +static VALUE +io_open_descriptor_fallback(VALUE klass, int descriptor, int mode, VALUE path, VALUE timeout, void *encoding) +{ + rb_update_max_fd(descriptor); + + VALUE arguments[2] = { + INT2NUM(descriptor), + INT2FIX(mode), + }; + + VALUE self = rb_class_new_instance(2, arguments, klass); + + rb_io_t *fptr; + GetOpenFile(self, fptr); + fptr->pathv = path; + fptr->mode |= mode; + + return self; +} +#define rb_io_open_descriptor io_open_descriptor_fallback +#endif + +#ifndef HAVE_RB_IO_CLOSED_P +static VALUE +rb_io_closed_p(VALUE io) +{ + rb_io_t *fptr = RFILE(io)->fptr; + return fptr->fd == -1 ? Qtrue : Qfalse; +} +#endif + /* * call-seq: * IO.console -> #<File:/dev/tty> @@ -1450,34 +1580,37 @@ static VALUE console_dev(int argc, VALUE *argv, VALUE klass) { VALUE con = 0; - rb_io_t *fptr; VALUE sym = 0; rb_check_arity(argc, 0, UNLIMITED_ARGUMENTS); + if (argc) { - Check_Type(sym = argv[0], T_SYMBOL); + Check_Type(sym = argv[0], T_SYMBOL); } + + // Force the class to be File. if (klass == rb_cIO) klass = rb_cFile; + if (rb_const_defined(klass, id_console)) { - con = rb_const_get(klass, id_console); - if (!RB_TYPE_P(con, T_FILE) || - (!(fptr = RFILE(con)->fptr) || GetReadFD(fptr) == -1)) { - rb_const_remove(klass, id_console); - con = 0; - } + con = rb_const_get(klass, id_console); + if (!RB_TYPE_P(con, T_FILE) || RTEST(rb_io_closed_p(con))) { + rb_const_remove(klass, id_console); + con = 0; + } } + if (sym) { - if (sym == ID2SYM(id_close) && argc == 1) { - if (con) { - rb_io_close(con); - rb_const_remove(klass, id_console); - con = 0; - } - return Qnil; - } + if (sym == ID2SYM(id_close) && argc == 1) { + if (con) { + rb_io_close(con); + rb_const_remove(klass, id_console); + con = 0; + } + return Qnil; + } } + if (!con) { - VALUE args[2]; #if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H || defined HAVE_SGTTY_H # define CONSOLE_DEVICE "/dev/tty" #elif defined _WIN32 @@ -1489,44 +1622,36 @@ console_dev(int argc, VALUE *argv, VALUE klass) # define CONSOLE_DEVICE_FOR_READING CONSOLE_DEVICE #endif #ifdef CONSOLE_DEVICE_FOR_WRITING - VALUE out; - rb_io_t *ofptr; + VALUE out; + rb_io_t *ofptr; #endif - int fd; + int fd; + VALUE path = rb_obj_freeze(rb_str_new2(CONSOLE_DEVICE)); #ifdef CONSOLE_DEVICE_FOR_WRITING - fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_RDWR, 0); - if (fd < 0) return Qnil; - rb_update_max_fd(fd); - args[1] = INT2FIX(O_WRONLY); - args[0] = INT2NUM(fd); - out = rb_class_new_instance(2, args, klass); + fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_RDWR, 0); + if (fd < 0) return Qnil; + out = rb_io_open_descriptor(klass, fd, FMODE_WRITABLE | FMODE_SYNC, path, Qnil, NULL); #endif - fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_READING, O_RDWR, 0); - if (fd < 0) { + fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_READING, O_RDWR, 0); + if (fd < 0) { #ifdef CONSOLE_DEVICE_FOR_WRITING - rb_io_close(out); + rb_io_close(out); #endif - return Qnil; - } - rb_update_max_fd(fd); - args[1] = INT2FIX(O_RDWR); - args[0] = INT2NUM(fd); - con = rb_class_new_instance(2, args, klass); - GetOpenFile(con, fptr); - fptr->pathv = rb_obj_freeze(rb_str_new2(CONSOLE_DEVICE)); + return Qnil; + } + + con = rb_io_open_descriptor(klass, fd, FMODE_READWRITE | FMODE_SYNC, path, Qnil, NULL); #ifdef CONSOLE_DEVICE_FOR_WRITING - GetOpenFile(out, ofptr); - ofptr->pathv = fptr->pathv; - fptr->tied_io_for_writing = out; - ofptr->mode |= FMODE_SYNC; + rb_io_set_write_io(con, out); #endif - fptr->mode |= FMODE_SYNC; - rb_const_set(klass, id_console, con); + rb_const_set(klass, id_console, con); } + if (sym) { - return rb_f_send(argc, argv, con); + return rb_f_send(argc, argv, con); } + return con; } @@ -1542,7 +1667,6 @@ io_getch(int argc, VALUE *argv, VALUE io) return rb_funcallv(io, id_getc, argc, argv); } -#if ENABLE_IO_GETPASS static VALUE puts_call(VALUE io) { @@ -1550,6 +1674,12 @@ puts_call(VALUE io) } static VALUE +gets_call(VALUE io) +{ + return rb_funcallv(io, id_gets, 0, 0); +} + +static VALUE getpass_call(VALUE io) { return ttymode(io, rb_io_gets, io, set_noecho, NULL); @@ -1569,7 +1699,8 @@ static VALUE str_chomp(VALUE str) { if (!NIL_P(str)) { - rb_funcallv(str, id_chomp_bang, 0, 0); + const VALUE rs = rb_default_rs; /* rvalue in TruffleRuby */ + rb_funcallv(str, id_chomp_bang, 1, &rs); } return str; } @@ -1586,6 +1717,12 @@ str_chomp(VALUE str) * see String#chomp!. * * You must require 'io/console' to use this method. + * + * require 'io/console' + * IO::console.getpass("Enter password:") + * Enter password: + * # => "mypassword" + * */ static VALUE console_getpass(int argc, VALUE *argv, VALUE io) @@ -1596,6 +1733,7 @@ console_getpass(int argc, VALUE *argv, VALUE io) wio = rb_io_get_write_io(io); if (wio == io && io == rb_stdin) wio = rb_stderr; prompt(argc, argv, wio); + rb_io_flush(wio); str = rb_ensure(getpass_call, io, puts_call, wio); return str_chomp(str); } @@ -1613,11 +1751,10 @@ io_getpass(int argc, VALUE *argv, VALUE io) rb_check_arity(argc, 0, 1); prompt(argc, argv, io); - str = str_chomp(rb_funcallv(io, id_gets, 0, 0)); - puts_call(io); - return str; + rb_check_funcall(io, id_flush, 0, 0); + str = rb_ensure(gets_call, io, puts_call, io); + return str_chomp(str); } -#endif /* * IO console methods @@ -1627,15 +1764,16 @@ Init_console(void) { #undef rb_intern id_getc = rb_intern("getc"); -#if ENABLE_IO_GETPASS id_gets = rb_intern("gets"); + id_flush = rb_intern("flush"); id_chomp_bang = rb_intern("chomp!"); -#endif id_console = rb_intern("console"); id_close = rb_intern("close"); - id_min = rb_intern("min"); - id_time = rb_intern("time"); - id_intr = rb_intern("intr"); +#define init_rawmode_opt_id(name) \ + rawmode_opt_ids[kwd_##name] = rb_intern(#name) + init_rawmode_opt_id(min); + init_rawmode_opt_id(time); + init_rawmode_opt_id(intr); #ifndef HAVE_RB_F_SEND id___send__ = rb_intern("__send__"); #endif @@ -1676,20 +1814,19 @@ InitVM_console(void) rb_define_method(rb_cIO, "clear_screen", console_clear_screen, 0); rb_define_method(rb_cIO, "pressed?", console_key_pressed_p, 1); rb_define_method(rb_cIO, "check_winsize_changed", console_check_winsize_changed, 0); -#if ENABLE_IO_GETPASS rb_define_method(rb_cIO, "getpass", console_getpass, -1); -#endif rb_define_singleton_method(rb_cIO, "console", console_dev, -1); { + /* :stopdoc: */ VALUE mReadable = rb_define_module_under(rb_cIO, "generic_readable"); + /* :startdoc: */ rb_define_method(mReadable, "getch", io_getch, -1); -#if ENABLE_IO_GETPASS rb_define_method(mReadable, "getpass", io_getpass, -1); -#endif } { /* :stopdoc: */ cConmode = rb_define_class_under(rb_cIO, "ConsoleMode", rb_cObject); + rb_define_const(cConmode, "VERSION", rb_str_new_cstr(IO_CONSOLE_VERSION)); rb_define_alloc_func(cConmode, conmode_alloc); rb_undef_method(cConmode, "initialize"); rb_define_method(cConmode, "initialize_copy", conmode_init_copy, 1); diff --git a/ext/io/console/depend b/ext/io/console/depend index 06ccdde70d..5b91413f38 100644 --- a/ext/io/console/depend +++ b/ext/io/console/depend @@ -54,6 +54,7 @@ console.o: $(hdrdir)/ruby/internal/attr/noexcept.h console.o: $(hdrdir)/ruby/internal/attr/noinline.h console.o: $(hdrdir)/ruby/internal/attr/nonnull.h console.o: $(hdrdir)/ruby/internal/attr/noreturn.h +console.o: $(hdrdir)/ruby/internal/attr/packed_struct.h console.o: $(hdrdir)/ruby/internal/attr/pure.h console.o: $(hdrdir)/ruby/internal/attr/restrict.h console.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -122,7 +123,6 @@ console.o: $(hdrdir)/ruby/internal/intern/enumerator.h console.o: $(hdrdir)/ruby/internal/intern/error.h console.o: $(hdrdir)/ruby/internal/intern/eval.h console.o: $(hdrdir)/ruby/internal/intern/file.h -console.o: $(hdrdir)/ruby/internal/intern/gc.h console.o: $(hdrdir)/ruby/internal/intern/hash.h console.o: $(hdrdir)/ruby/internal/intern/io.h console.o: $(hdrdir)/ruby/internal/intern/load.h @@ -153,12 +153,12 @@ console.o: $(hdrdir)/ruby/internal/memory.h console.o: $(hdrdir)/ruby/internal/method.h console.o: $(hdrdir)/ruby/internal/module.h console.o: $(hdrdir)/ruby/internal/newobj.h -console.o: $(hdrdir)/ruby/internal/rgengc.h console.o: $(hdrdir)/ruby/internal/scan_args.h console.o: $(hdrdir)/ruby/internal/special_consts.h console.o: $(hdrdir)/ruby/internal/static_assert.h console.o: $(hdrdir)/ruby/internal/stdalign.h console.o: $(hdrdir)/ruby/internal/stdbool.h +console.o: $(hdrdir)/ruby/internal/stdckdint.h console.o: $(hdrdir)/ruby/internal/symbol.h console.o: $(hdrdir)/ruby/internal/value.h console.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb index e8c5923b18..a72403c7f9 100644 --- a/ext/io/console/extconf.rb +++ b/ext/io/console/extconf.rb @@ -1,6 +1,12 @@ # frozen_string_literal: false require 'mkmf' +have_func("rb_io_path") +have_func("rb_io_descriptor") +have_func("rb_io_get_write_io") +have_func("rb_io_closed_p") +have_func("rb_io_open_descriptor") + ok = true if RUBY_ENGINE == "ruby" || RUBY_ENGINE == "truffleruby" hdr = nil case @@ -29,7 +35,6 @@ when true elsif have_func("rb_scheduler_timeout") # 3.0 have_func("rb_io_wait") end - $defs << "-D""ENABLE_IO_GETPASS=1" create_makefile("io/console") {|conf| conf << "\n""VK_HEADER = #{vk_header}\n" } diff --git a/ext/io/console/io-console.gemspec b/ext/io/console/io-console.gemspec index aa57f8ac52..f9c1729cb7 100644 --- a/ext/io/console/io-console.gemspec +++ b/ext/io/console/io-console.gemspec @@ -1,5 +1,13 @@ # -*- ruby -*- -_VERSION = "0.5.11" +_VERSION = ["", "ext/io/console/"].find do |dir| + begin + break File.open(File.join(__dir__, "#{dir}console.c")) {|f| + f.gets("\nIO_CONSOLE_VERSION ") + f.gets[/"(.+)"/, 1] + } + rescue Errno::ENOENT + end +end Gem::Specification.new do |s| s.name = "io-console" @@ -10,9 +18,11 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 2.6.0" s.homepage = "https://github.com/ruby/io-console" s.metadata["source_code_url"] = s.homepage + s.metadata["changelog_uri"] = s.homepage + "/releases" s.authors = ["Nobu Nakada"] s.require_path = %[lib] s.files = %w[ + .document LICENSE.txt README.md ext/io/console/console.c @@ -25,15 +35,16 @@ Gem::Specification.new do |s| if Gem::Platform === s.platform and s.platform =~ 'java' s.files.delete_if {|f| f.start_with?("ext/")} s.extensions.clear + s.require_paths.unshift('lib/ffi') s.files.concat(%w[ - lib/io/console.rb - lib/io/console/ffi/bsd_console.rb - lib/io/console/ffi/common.rb - lib/io/console/ffi/console.rb - lib/io/console/ffi/linux_console.rb - lib/io/console/ffi/native_console.rb - lib/io/console/ffi/stty_console.rb - lib/io/console/ffi/stub_console.rb + lib/ffi/io/console.rb + lib/ffi/io/console/bsd_console.rb + lib/ffi/io/console/common.rb + lib/ffi/io/console/linux_console.rb + lib/ffi/io/console/native_console.rb + lib/ffi/io/console/stty_console.rb + lib/ffi/io/console/stub_console.rb + lib/ffi/io/console/version.rb ]) end diff --git a/ext/io/nonblock/depend b/ext/io/nonblock/depend index 7f2db65732..20a96f1252 100644 --- a/ext/io/nonblock/depend +++ b/ext/io/nonblock/depend @@ -53,6 +53,7 @@ nonblock.o: $(hdrdir)/ruby/internal/attr/noexcept.h nonblock.o: $(hdrdir)/ruby/internal/attr/noinline.h nonblock.o: $(hdrdir)/ruby/internal/attr/nonnull.h nonblock.o: $(hdrdir)/ruby/internal/attr/noreturn.h +nonblock.o: $(hdrdir)/ruby/internal/attr/packed_struct.h nonblock.o: $(hdrdir)/ruby/internal/attr/pure.h nonblock.o: $(hdrdir)/ruby/internal/attr/restrict.h nonblock.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ nonblock.o: $(hdrdir)/ruby/internal/intern/enumerator.h nonblock.o: $(hdrdir)/ruby/internal/intern/error.h nonblock.o: $(hdrdir)/ruby/internal/intern/eval.h nonblock.o: $(hdrdir)/ruby/internal/intern/file.h -nonblock.o: $(hdrdir)/ruby/internal/intern/gc.h nonblock.o: $(hdrdir)/ruby/internal/intern/hash.h nonblock.o: $(hdrdir)/ruby/internal/intern/io.h nonblock.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ nonblock.o: $(hdrdir)/ruby/internal/memory.h nonblock.o: $(hdrdir)/ruby/internal/method.h nonblock.o: $(hdrdir)/ruby/internal/module.h nonblock.o: $(hdrdir)/ruby/internal/newobj.h -nonblock.o: $(hdrdir)/ruby/internal/rgengc.h nonblock.o: $(hdrdir)/ruby/internal/scan_args.h nonblock.o: $(hdrdir)/ruby/internal/special_consts.h nonblock.o: $(hdrdir)/ruby/internal/static_assert.h nonblock.o: $(hdrdir)/ruby/internal/stdalign.h nonblock.o: $(hdrdir)/ruby/internal/stdbool.h +nonblock.o: $(hdrdir)/ruby/internal/stdckdint.h nonblock.o: $(hdrdir)/ruby/internal/symbol.h nonblock.o: $(hdrdir)/ruby/internal/value.h nonblock.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/io/nonblock/extconf.rb b/ext/io/nonblock/extconf.rb index d813a01e7c..a1e6075c9b 100644 --- a/ext/io/nonblock/extconf.rb +++ b/ext/io/nonblock/extconf.rb @@ -2,6 +2,13 @@ require 'mkmf' target = "io/nonblock" +unless RUBY_ENGINE == 'ruby' + File.write("Makefile", dummy_makefile($srcdir).join("")) + return +end + +have_func("rb_io_descriptor") + hdr = %w"fcntl.h" if have_macro("O_NONBLOCK", hdr) and (have_macro("F_GETFL", hdr) or have_macro("F_SETFL", hdr)) diff --git a/ext/io/nonblock/io-nonblock.gemspec b/ext/io/nonblock/io-nonblock.gemspec index f81d4fda0a..6a16c8b03b 100644 --- a/ext/io/nonblock/io-nonblock.gemspec +++ b/ext/io/nonblock/io-nonblock.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |spec| spec.name = "io-nonblock" - spec.version = "0.1.1" + spec.version = "0.3.0" spec.authors = ["Nobu Nakada"] spec.email = ["nobu@ruby-lang.org"] diff --git a/ext/io/nonblock/nonblock.c b/ext/io/nonblock/nonblock.c index b8a40ff38e..d90538f735 100644 --- a/ext/io/nonblock/nonblock.c +++ b/ext/io/nonblock/nonblock.c @@ -17,6 +17,17 @@ #endif #include <fcntl.h> +#ifndef HAVE_RB_IO_DESCRIPTOR +static int +io_descriptor_fallback(VALUE io) +{ + rb_io_t *fptr; + GetOpenFile(io, fptr); + return fptr->fd; +} +#define rb_io_descriptor io_descriptor_fallback +#endif + #ifdef F_GETFL static int get_fcntl_flags(int fd) @@ -39,10 +50,8 @@ get_fcntl_flags(int fd) static VALUE rb_io_nonblock_p(VALUE io) { - rb_io_t *fptr; - GetOpenFile(io, fptr); - if (get_fcntl_flags(fptr->fd) & O_NONBLOCK) - return Qtrue; + if (get_fcntl_flags(rb_io_descriptor(io)) & O_NONBLOCK) + return Qtrue; return Qfalse; } #else @@ -57,6 +66,8 @@ set_fcntl_flags(int fd, int f) rb_sys_fail(0); } +#ifndef RUBY_IO_NONBLOCK_METHODS + static int io_nonblock_set(int fd, int f, int nb) { @@ -122,17 +133,23 @@ io_nonblock_set(int fd, int f, int nb) * */ static VALUE -rb_io_nonblock_set(VALUE io, VALUE nb) +rb_io_nonblock_set(VALUE self, VALUE value) { - rb_io_t *fptr; - GetOpenFile(io, fptr); - if (RTEST(nb)) - rb_io_set_nonblock(fptr); - else - io_nonblock_set(fptr->fd, get_fcntl_flags(fptr->fd), RTEST(nb)); - return io; + if (RTEST(value)) { + rb_io_t *fptr; + GetOpenFile(self, fptr); + rb_io_set_nonblock(fptr); + } + else { + int descriptor = rb_io_descriptor(self); + io_nonblock_set(descriptor, get_fcntl_flags(descriptor), RTEST(value)); + } + + return self; } +#endif /* RUBY_IO_NONBLOCK_METHODS */ + static VALUE io_nonblock_restore(VALUE arg) { @@ -152,24 +169,25 @@ io_nonblock_restore(VALUE arg) * The original mode is restored after the block is executed. */ static VALUE -rb_io_nonblock_block(int argc, VALUE *argv, VALUE io) +rb_io_nonblock_block(int argc, VALUE *argv, VALUE self) { int nb = 1; - rb_io_t *fptr; - int f, restore[2]; - GetOpenFile(io, fptr); + int descriptor = rb_io_descriptor(self); + if (argc > 0) { - VALUE v; - rb_scan_args(argc, argv, "01", &v); - nb = RTEST(v); + VALUE v; + rb_scan_args(argc, argv, "01", &v); + nb = RTEST(v); } - f = get_fcntl_flags(fptr->fd); - restore[0] = fptr->fd; - restore[1] = f; - if (!io_nonblock_set(fptr->fd, f, nb)) - return rb_yield(io); - return rb_ensure(rb_yield, io, io_nonblock_restore, (VALUE)restore); + + int current_flags = get_fcntl_flags(descriptor); + int restore[2] = {descriptor, current_flags}; + + if (!io_nonblock_set(descriptor, current_flags, nb)) + return rb_yield(self); + + return rb_ensure(rb_yield, self, io_nonblock_restore, (VALUE)restore); } #else #define rb_io_nonblock_set rb_f_notimplement @@ -179,7 +197,10 @@ rb_io_nonblock_block(int argc, VALUE *argv, VALUE io) void Init_nonblock(void) { +#ifndef RUBY_IO_NONBLOCK_METHODS rb_define_method(rb_cIO, "nonblock?", rb_io_nonblock_p, 0); rb_define_method(rb_cIO, "nonblock=", rb_io_nonblock_set, 1); +#endif + rb_define_method(rb_cIO, "nonblock", rb_io_nonblock_block, -1); } diff --git a/ext/io/wait/depend b/ext/io/wait/depend index 51e1af8280..70317b1497 100644 --- a/ext/io/wait/depend +++ b/ext/io/wait/depend @@ -54,6 +54,7 @@ wait.o: $(hdrdir)/ruby/internal/attr/noexcept.h wait.o: $(hdrdir)/ruby/internal/attr/noinline.h wait.o: $(hdrdir)/ruby/internal/attr/nonnull.h wait.o: $(hdrdir)/ruby/internal/attr/noreturn.h +wait.o: $(hdrdir)/ruby/internal/attr/packed_struct.h wait.o: $(hdrdir)/ruby/internal/attr/pure.h wait.o: $(hdrdir)/ruby/internal/attr/restrict.h wait.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -122,7 +123,6 @@ wait.o: $(hdrdir)/ruby/internal/intern/enumerator.h wait.o: $(hdrdir)/ruby/internal/intern/error.h wait.o: $(hdrdir)/ruby/internal/intern/eval.h wait.o: $(hdrdir)/ruby/internal/intern/file.h -wait.o: $(hdrdir)/ruby/internal/intern/gc.h wait.o: $(hdrdir)/ruby/internal/intern/hash.h wait.o: $(hdrdir)/ruby/internal/intern/io.h wait.o: $(hdrdir)/ruby/internal/intern/load.h @@ -153,12 +153,12 @@ wait.o: $(hdrdir)/ruby/internal/memory.h wait.o: $(hdrdir)/ruby/internal/method.h wait.o: $(hdrdir)/ruby/internal/module.h wait.o: $(hdrdir)/ruby/internal/newobj.h -wait.o: $(hdrdir)/ruby/internal/rgengc.h wait.o: $(hdrdir)/ruby/internal/scan_args.h wait.o: $(hdrdir)/ruby/internal/special_consts.h wait.o: $(hdrdir)/ruby/internal/static_assert.h wait.o: $(hdrdir)/ruby/internal/stdalign.h wait.o: $(hdrdir)/ruby/internal/stdbool.h +wait.o: $(hdrdir)/ruby/internal/stdckdint.h wait.o: $(hdrdir)/ruby/internal/symbol.h wait.o: $(hdrdir)/ruby/internal/value.h wait.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/io/wait/extconf.rb b/ext/io/wait/extconf.rb index eecdcce99f..e63c046187 100644 --- a/ext/io/wait/extconf.rb +++ b/ext/io/wait/extconf.rb @@ -6,6 +6,7 @@ if RUBY_VERSION < "2.6" else target = "io/wait" have_func("rb_io_wait") + have_func("rb_io_descriptor") unless macro_defined?("DOSISH", "#include <ruby.h>") have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h| diff --git a/ext/io/wait/io-wait.gemspec b/ext/io/wait/io-wait.gemspec index 7b73d64200..e850e10bf9 100644 --- a/ext/io/wait/io-wait.gemspec +++ b/ext/io/wait/io-wait.gemspec @@ -1,4 +1,4 @@ -_VERSION = "0.3.0.pre" +_VERSION = "0.3.1" Gem::Specification.new do |spec| spec.name = "io-wait" diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c index d74afb580b..8835670e59 100644 --- a/ext/io/wait/wait.c +++ b/ext/io/wait/wait.c @@ -87,8 +87,15 @@ io_nread(VALUE io) rb_io_check_readable(fptr); len = rb_io_read_pending(fptr); if (len > 0) return INT2FIX(len); - if (!FIONREAD_POSSIBLE_P(fptr->fd)) return INT2FIX(0); - if (ioctl(fptr->fd, FIONREAD, &n)) return INT2FIX(0); + +#ifdef HAVE_RB_IO_DESCRIPTOR + int fd = rb_io_descriptor(io); +#else + int fd = fptr->fd; +#endif + + if (!FIONREAD_POSSIBLE_P(fd)) return INT2FIX(0); + if (ioctl(fd, FIONREAD, &n)) return INT2FIX(0); if (n > 0) return ioctl_arg2num(n); return INT2FIX(0); } diff --git a/ext/json/VERSION b/ext/json/VERSION deleted file mode 100644 index 097a15a2af..0000000000 --- a/ext/json/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.6.2 diff --git a/ext/json/generator/depend b/ext/json/generator/depend index 28ef06b36d..f47e5f3a70 100644 --- a/ext/json/generator/depend +++ b/ext/json/generator/depend @@ -56,6 +56,7 @@ generator.o: $(hdrdir)/ruby/internal/attr/noexcept.h generator.o: $(hdrdir)/ruby/internal/attr/noinline.h generator.o: $(hdrdir)/ruby/internal/attr/nonnull.h generator.o: $(hdrdir)/ruby/internal/attr/noreturn.h +generator.o: $(hdrdir)/ruby/internal/attr/packed_struct.h generator.o: $(hdrdir)/ruby/internal/attr/pure.h generator.o: $(hdrdir)/ruby/internal/attr/restrict.h generator.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -125,7 +126,6 @@ generator.o: $(hdrdir)/ruby/internal/intern/enumerator.h generator.o: $(hdrdir)/ruby/internal/intern/error.h generator.o: $(hdrdir)/ruby/internal/intern/eval.h generator.o: $(hdrdir)/ruby/internal/intern/file.h -generator.o: $(hdrdir)/ruby/internal/intern/gc.h generator.o: $(hdrdir)/ruby/internal/intern/hash.h generator.o: $(hdrdir)/ruby/internal/intern/io.h generator.o: $(hdrdir)/ruby/internal/intern/load.h @@ -156,12 +156,12 @@ generator.o: $(hdrdir)/ruby/internal/memory.h generator.o: $(hdrdir)/ruby/internal/method.h generator.o: $(hdrdir)/ruby/internal/module.h generator.o: $(hdrdir)/ruby/internal/newobj.h -generator.o: $(hdrdir)/ruby/internal/rgengc.h generator.o: $(hdrdir)/ruby/internal/scan_args.h generator.o: $(hdrdir)/ruby/internal/special_consts.h generator.o: $(hdrdir)/ruby/internal/static_assert.h generator.o: $(hdrdir)/ruby/internal/stdalign.h generator.o: $(hdrdir)/ruby/internal/stdbool.h +generator.o: $(hdrdir)/ruby/internal/stdckdint.h generator.o: $(hdrdir)/ruby/internal/symbol.h generator.o: $(hdrdir)/ruby/internal/value.h generator.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c index 98d0ea46c3..6d78284bc4 100644 --- a/ext/json/generator/generator.c +++ b/ext/json/generator/generator.c @@ -16,7 +16,7 @@ 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_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_buffer_initial_length, i_dup, i_escape_slash; + i_buffer_initial_length, i_dup, i_script_safe, i_escape_slash, i_strict; /* * Copyright 2001-2004 Unicode, Inc. @@ -124,7 +124,7 @@ static void unicode_escape_to_buffer(FBuffer *buffer, char buf[6], UTF16 /* Converts string to a JSON string in FBuffer buffer, where all but the ASCII * and control characters are JSON escaped. */ -static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string, char escape_slash) +static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string, char script_safe) { const UTF8 *source = (UTF8 *) RSTRING_PTR(string); const UTF8 *sourceEnd = source + RSTRING_LEN(string); @@ -175,7 +175,7 @@ static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string, char escap fbuffer_append(buffer, "\\\"", 2); break; case '/': - if(escape_slash) { + if(script_safe) { fbuffer_append(buffer, "\\/", 2); break; } @@ -228,7 +228,7 @@ static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string, char escap * characters required by the JSON standard are JSON escaped. The remaining * characters (should be UTF8) are just passed through and appended to the * result. */ -static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string, char escape_slash) +static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string, char script_safe) { const char *ptr = RSTRING_PTR(string), *p; unsigned long len = RSTRING_LEN(string), start = 0, end = 0; @@ -280,7 +280,7 @@ static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string, char escape_slas escape_len = 2; break; case '/': - if(escape_slash) { + if(script_safe) { escape = "\\/"; escape_len = 2; break; @@ -294,6 +294,22 @@ static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string, char escape_slas rb_raise(rb_path2class("JSON::GeneratorError"), "partial character in source, but hit end"); } + + if (script_safe && c == 0xE2) { + unsigned char c2 = (unsigned char) *(p+1); + unsigned char c3 = (unsigned char) *(p+2); + if (c2 == 0x80 && (c3 == 0xA8 || c3 == 0xA9)) { + fbuffer_append(buffer, ptr + start, end - start); + start = end = (end + clen); + if (c3 == 0xA8) { + fbuffer_append(buffer, "\\u2028", 6); + } else { + fbuffer_append(buffer, "\\u2029", 6); + } + continue; + } + } + if (!isLegalUTF8((UTF8 *) p, clen)) { rb_raise(rb_path2class("JSON::GeneratorError"), "source sequence is illegal/malformed utf-8"); @@ -478,6 +494,7 @@ static VALUE mFloat_to_json(int argc, VALUE *argv, VALUE self) */ static VALUE mString_included_s(VALUE self, VALUE modul) { VALUE result = rb_funcall(modul, i_extend, 1, mString_Extend); + rb_call_super(1, &modul); return result; } @@ -726,8 +743,14 @@ static VALUE cState_configure(VALUE self, VALUE opts) state->allow_nan = RTEST(tmp); tmp = rb_hash_aref(opts, ID2SYM(i_ascii_only)); state->ascii_only = RTEST(tmp); - tmp = rb_hash_aref(opts, ID2SYM(i_escape_slash)); - state->escape_slash = RTEST(tmp); + tmp = rb_hash_aref(opts, ID2SYM(i_script_safe)); + state->script_safe = RTEST(tmp); + if (!state->script_safe) { + tmp = rb_hash_aref(opts, ID2SYM(i_escape_slash)); + state->script_safe = RTEST(tmp); + } + tmp = rb_hash_aref(opts, ID2SYM(i_strict)); + state->strict = RTEST(tmp); return self; } @@ -762,7 +785,8 @@ static VALUE cState_to_h(VALUE self) rb_hash_aset(result, ID2SYM(i_allow_nan), state->allow_nan ? Qtrue : Qfalse); rb_hash_aset(result, ID2SYM(i_ascii_only), state->ascii_only ? Qtrue : Qfalse); rb_hash_aset(result, ID2SYM(i_max_nesting), LONG2FIX(state->max_nesting)); - rb_hash_aset(result, ID2SYM(i_escape_slash), state->escape_slash ? Qtrue : Qfalse); + rb_hash_aset(result, ID2SYM(i_script_safe), state->script_safe ? Qtrue : Qfalse); + rb_hash_aset(result, ID2SYM(i_strict), state->strict ? Qtrue : Qfalse); 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; @@ -843,7 +867,7 @@ json_object_i(VALUE key, VALUE val, VALUE _arg) if (klass == rb_cString) { key_to_s = key; } else if (klass == rb_cSymbol) { - key_to_s = rb_id2str(SYM2ID(key)); + key_to_s = rb_sym2str(key); } else { key_to_s = rb_funcall(key, i_to_s, 0); } @@ -868,7 +892,6 @@ static void generate_json_object(FBuffer *buffer, VALUE Vstate, JSON_Generator_S struct hash_foreach_arg arg; if (max_nesting != 0 && depth > max_nesting) { - fbuffer_free(buffer); rb_raise(eNestingError, "nesting of %ld is too deep", --state->depth); } fbuffer_append_char(buffer, '{'); @@ -903,7 +926,6 @@ static void generate_json_array(FBuffer *buffer, VALUE Vstate, JSON_Generator_St long depth = ++state->depth; int i, j; if (max_nesting != 0 && depth > max_nesting) { - fbuffer_free(buffer); rb_raise(eNestingError, "nesting of %ld is too deep", --state->depth); } fbuffer_append_char(buffer, '['); @@ -947,9 +969,9 @@ static void generate_json_string(FBuffer *buffer, VALUE Vstate, JSON_Generator_S } #endif if (state->ascii_only) { - convert_UTF8_to_JSON_ASCII(buffer, obj, state->escape_slash); + convert_UTF8_to_JSON_ASCII(buffer, obj, state->script_safe); } else { - convert_UTF8_to_JSON(buffer, obj, state->escape_slash); + convert_UTF8_to_JSON(buffer, obj, state->script_safe); } fbuffer_append_char(buffer, '"'); } @@ -996,10 +1018,8 @@ static void generate_json_float(FBuffer *buffer, VALUE Vstate, JSON_Generator_St VALUE tmp = rb_funcall(obj, i_to_s, 0); if (!allow_nan) { if (isinf(value)) { - fbuffer_free(buffer); rb_raise(eGeneratorError, "%"PRIsVALUE" not allowed in JSON", RB_OBJ_STRING(tmp)); } else if (isnan(value)) { - fbuffer_free(buffer); rb_raise(eGeneratorError, "%"PRIsVALUE" not allowed in JSON", RB_OBJ_STRING(tmp)); } } @@ -1028,6 +1048,8 @@ static void generate_json(FBuffer *buffer, VALUE Vstate, JSON_Generator_State *s generate_json_bignum(buffer, Vstate, state, obj); } else if (klass == rb_cFloat) { generate_json_float(buffer, Vstate, state, obj); + } else if (state->strict) { + rb_raise(eGeneratorError, "%"PRIsVALUE" not allowed in JSON", RB_OBJ_STRING(CLASS_OF(obj))); } else if (rb_respond_to(obj, i_to_json)) { tmp = rb_funcall(obj, i_to_json, 1, Vstate); Check_Type(tmp, T_STRING); @@ -1070,11 +1092,45 @@ static FBuffer *cState_prepare_buffer(VALUE self) return buffer; } +struct generate_json_data { + FBuffer *buffer; + VALUE vstate; + JSON_Generator_State *state; + VALUE obj; +}; + +static VALUE generate_json_try(VALUE d) +{ + struct generate_json_data *data = (struct generate_json_data *)d; + + generate_json(data->buffer, data->vstate, data->state, data->obj); + + return Qnil; +} + +static VALUE generate_json_rescue(VALUE d, VALUE exc) +{ + struct generate_json_data *data = (struct generate_json_data *)d; + fbuffer_free(data->buffer); + + rb_exc_raise(exc); + + return Qundef; +} + static VALUE cState_partial_generate(VALUE self, VALUE obj) { FBuffer *buffer = cState_prepare_buffer(self); GET_STATE(self); - generate_json(buffer, self, state, obj); + + struct generate_json_data data = { + .buffer = buffer, + .vstate = self, + .state = state, + .obj = obj + }; + rb_rescue(generate_json_try, (VALUE)&data, generate_json_rescue, (VALUE)&data); + return fbuffer_to_s(buffer); } @@ -1390,27 +1446,58 @@ static VALUE cState_max_nesting_set(VALUE self, VALUE depth) } /* - * call-seq: escape_slash + * call-seq: script_safe * * If this boolean is true, the forward slashes will be escaped in * the json output. */ -static VALUE cState_escape_slash(VALUE self) +static VALUE cState_script_safe(VALUE self) { GET_STATE(self); - return state->escape_slash ? Qtrue : Qfalse; + return state->script_safe ? Qtrue : Qfalse; } /* - * call-seq: escape_slash=(depth) + * call-seq: script_safe=(enable) * * This sets whether or not the forward slashes will be escaped in * the json output. */ -static VALUE cState_escape_slash_set(VALUE self, VALUE enable) +static VALUE cState_script_safe_set(VALUE self, VALUE enable) +{ + GET_STATE(self); + state->script_safe = RTEST(enable); + return Qnil; +} + +/* + * call-seq: strict + * + * If this boolean is false, types unsupported by the JSON format will + * be serialized as strings. + * If this boolean is true, types unsupported by the JSON format will + * raise a JSON::GeneratorError. + */ +static VALUE cState_strict(VALUE self) +{ + GET_STATE(self); + return state->strict ? Qtrue : Qfalse; +} + +/* + * call-seq: strict=(enable) + * + * This sets whether or not to serialize types unsupported by the + * JSON format as strings. + * If this boolean is false, types unsupported by the JSON format will + * be serialized as strings. + * If this boolean is true, types unsupported by the JSON format will + * raise a JSON::GeneratorError. + */ +static VALUE cState_strict_set(VALUE self, VALUE enable) { GET_STATE(self); - state->escape_slash = RTEST(enable); + state->strict = RTEST(enable); return Qnil; } @@ -1530,9 +1617,15 @@ void Init_generator(void) rb_define_method(cState, "array_nl=", cState_array_nl_set, 1); rb_define_method(cState, "max_nesting", cState_max_nesting, 0); rb_define_method(cState, "max_nesting=", cState_max_nesting_set, 1); - rb_define_method(cState, "escape_slash", cState_escape_slash, 0); - rb_define_method(cState, "escape_slash?", cState_escape_slash, 0); - rb_define_method(cState, "escape_slash=", cState_escape_slash_set, 1); + rb_define_method(cState, "script_safe", cState_script_safe, 0); + rb_define_method(cState, "script_safe?", cState_script_safe, 0); + rb_define_method(cState, "script_safe=", cState_script_safe_set, 1); + rb_define_alias(cState, "escape_slash", "script_safe"); + rb_define_alias(cState, "escape_slash?", "script_safe?"); + rb_define_alias(cState, "escape_slash=", "script_safe="); + rb_define_method(cState, "strict", cState_strict, 0); + rb_define_method(cState, "strict?", cState_strict, 0); + rb_define_method(cState, "strict=", cState_strict_set, 1); rb_define_method(cState, "check_circular?", cState_check_circular_p, 0); rb_define_method(cState, "allow_nan?", cState_allow_nan_p, 0); rb_define_method(cState, "ascii_only?", cState_ascii_only_p, 0); @@ -1589,7 +1682,9 @@ void Init_generator(void) i_object_nl = rb_intern("object_nl"); i_array_nl = rb_intern("array_nl"); i_max_nesting = rb_intern("max_nesting"); + i_script_safe = rb_intern("script_safe"); i_escape_slash = rb_intern("escape_slash"); + i_strict = rb_intern("strict"); i_allow_nan = rb_intern("allow_nan"); i_ascii_only = rb_intern("ascii_only"); i_depth = rb_intern("depth"); diff --git a/ext/json/generator/generator.h b/ext/json/generator/generator.h index 3ebd622554..1a736b84dd 100644 --- a/ext/json/generator/generator.h +++ b/ext/json/generator/generator.h @@ -49,8 +49,8 @@ static const UTF32 halfMask = 0x3FFUL; static unsigned char isLegalUTF8(const UTF8 *source, unsigned long length); 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, char escape_slash); -static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string, char escape_slash); +static void convert_UTF8_to_JSON_ASCII(FBuffer *buffer, VALUE string, char script_safe); +static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string, char script_safe); static char *fstrndup(const char *ptr, unsigned long len); /* ruby api and some helpers */ @@ -72,7 +72,8 @@ typedef struct JSON_Generator_StateStruct { long max_nesting; char allow_nan; char ascii_only; - char escape_slash; + char script_safe; + char strict; long depth; long buffer_initial_length; } JSON_Generator_State; @@ -151,8 +152,10 @@ static VALUE cState_allow_nan_p(VALUE self); static VALUE cState_ascii_only_p(VALUE self); static VALUE cState_depth(VALUE self); static VALUE cState_depth_set(VALUE self, VALUE depth); -static VALUE cState_escape_slash(VALUE self); -static VALUE cState_escape_slash_set(VALUE self, VALUE depth); +static VALUE cState_script_safe(VALUE self); +static VALUE cState_script_safe_set(VALUE self, VALUE depth); +static VALUE cState_strict(VALUE self); +static VALUE cState_strict_set(VALUE self, VALUE strict); static FBuffer *cState_prepare_buffer(VALUE self); #ifndef ZALLOC #define ZALLOC(type) ((type *)ruby_zalloc(sizeof(type))) diff --git a/ext/json/json.gemspec b/ext/json/json.gemspec index 948e92c501..64d0c81391 100644 --- a/ext/json/json.gemspec +++ b/ext/json/json.gemspec @@ -1,8 +1,10 @@ -# -*- encoding: utf-8 -*- +version = File.foreach(File.join(__dir__, "lib/json/version.rb")) do |line| + /^\s*VERSION\s*=\s*'(.*)'/ =~ line and break $1 +end rescue nil Gem::Specification.new do |s| s.name = "json" - s.version = File.read(File.expand_path('../VERSION', __FILE__)).chomp + s.version = version s.summary = "JSON Implementation for Ruby" s.description = "This is a JSON implementation as a Ruby extension in C." @@ -17,7 +19,6 @@ Gem::Specification.new do |s| "CHANGES.md", "LICENSE", "README.md", - "VERSION", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/depend", "ext/json/ext/generator/extconf.rb", @@ -53,12 +54,12 @@ Gem::Specification.new do |s| "lib/json/pure/parser.rb", "lib/json/version.rb", ] - s.homepage = "http://flori.github.com/json" + s.homepage = "https://flori.github.io/json" s.metadata = { 'bug_tracker_uri' => 'https://github.com/flori/json/issues', 'changelog_uri' => 'https://github.com/flori/json/blob/master/CHANGES.md', - 'documentation_uri' => 'http://flori.github.io/json/doc/index.html', - 'homepage_uri' => 'http://flori.github.io/json/', + 'documentation_uri' => 'https://flori.github.io/json/doc/index.html', + 'homepage_uri' => s.homepage, 'source_code_uri' => 'https://github.com/flori/json', 'wiki_uri' => 'https://github.com/flori/json/wiki' } diff --git a/ext/json/lib/json.rb b/ext/json/lib/json.rb index 1e64bfcb1a..807488ffef 100644 --- a/ext/json/lib/json.rb +++ b/ext/json/lib/json.rb @@ -285,6 +285,15 @@ require 'json/common' # # Raises JSON::NestingError (nesting of 2 is too deep): # JSON.generate(obj, max_nesting: 2) # +# ====== Escaping Options +# +# Options +script_safe+ (boolean) specifies wether <tt>'\u2028'</tt>, <tt>'\u2029'</tt> +# and <tt>'/'</tt> should be escaped as to make the JSON object safe to interpolate in script +# tags. +# +# Options +ascii_only+ (boolean) specifies wether all characters outside the ASCII range +# should be escaped. +# # ====== Output Options # # The default formatting options generate the most compact diff --git a/ext/json/lib/json/add/bigdecimal.rb b/ext/json/lib/json/add/bigdecimal.rb index c8b4f567cb..b1d0cfa043 100644 --- a/ext/json/lib/json/add/bigdecimal.rb +++ b/ext/json/lib/json/add/bigdecimal.rb @@ -2,19 +2,36 @@ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end -defined?(::BigDecimal) or require 'bigdecimal' +begin + require 'bigdecimal' +rescue LoadError +end class BigDecimal - # Import a JSON Marshalled object. - # - # method used for JSON marshalling support. + + # See #as_json. def self.json_create(object) BigDecimal._load object['b'] end - # Marshal the object to JSON. + # Methods <tt>BigDecimal#as_json</tt> and +BigDecimal.json_create+ may be used + # to serialize and deserialize a \BigDecimal object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>BigDecimal#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/bigdecimal' + # x = BigDecimal(2).as_json # => {"json_class"=>"BigDecimal", "b"=>"27:0.2e1"} + # y = BigDecimal(2.0, 4).as_json # => {"json_class"=>"BigDecimal", "b"=>"36:0.2e1"} + # z = BigDecimal(Complex(2, 0)).as_json # => {"json_class"=>"BigDecimal", "b"=>"27:0.2e1"} + # + # \Method +JSON.create+ deserializes such a hash, returning a \BigDecimal object: + # + # BigDecimal.json_create(x) # => 0.2e1 + # BigDecimal.json_create(y) # => 0.2e1 + # BigDecimal.json_create(z) # => 0.2e1 # - # method used for JSON marshalling support. def as_json(*) { JSON.create_id => self.class.name, @@ -22,8 +39,20 @@ class BigDecimal } end - # return the JSON value + # Returns a JSON string representing +self+: + # + # require 'json/add/bigdecimal' + # puts BigDecimal(2).to_json + # puts BigDecimal(2.0, 4).to_json + # puts BigDecimal(Complex(2, 0)).to_json + # + # Output: + # + # {"json_class":"BigDecimal","b":"27:0.2e1"} + # {"json_class":"BigDecimal","b":"36:0.2e1"} + # {"json_class":"BigDecimal","b":"27:0.2e1"} + # def to_json(*args) as_json.to_json(*args) end -end +end if defined?(::BigDecimal) diff --git a/ext/json/lib/json/add/complex.rb b/ext/json/lib/json/add/complex.rb index e63e29fd22..ef48c554c6 100644 --- a/ext/json/lib/json/add/complex.rb +++ b/ext/json/lib/json/add/complex.rb @@ -5,14 +5,27 @@ end class Complex - # Deserializes JSON string by converting Real value <tt>r</tt>, imaginary - # value <tt>i</tt>, to a Complex object. + # See #as_json. def self.json_create(object) Complex(object['r'], object['i']) end - # Returns a hash, that will be turned into a JSON object and represent this - # object. + # Methods <tt>Complex#as_json</tt> and +Complex.json_create+ may be used + # to serialize and deserialize a \Complex object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Complex#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/complex' + # x = Complex(2).as_json # => {"json_class"=>"Complex", "r"=>2, "i"=>0} + # y = Complex(2.0, 4).as_json # => {"json_class"=>"Complex", "r"=>2.0, "i"=>4} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Complex object: + # + # Complex.json_create(x) # => (2+0i) + # Complex.json_create(y) # => (2.0+4i) + # def as_json(*) { JSON.create_id => self.class.name, @@ -21,7 +34,17 @@ class Complex } end - # Stores class name (Complex) along with real value <tt>r</tt> and imaginary value <tt>i</tt> as JSON string + # Returns a JSON string representing +self+: + # + # require 'json/add/complex' + # puts Complex(2).to_json + # puts Complex(2.0, 4).to_json + # + # Output: + # + # {"json_class":"Complex","r":2,"i":0} + # {"json_class":"Complex","r":2.0,"i":4} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/date.rb b/ext/json/lib/json/add/date.rb index 25523561a5..19688f751b 100644 --- a/ext/json/lib/json/add/date.rb +++ b/ext/json/lib/json/add/date.rb @@ -6,16 +6,29 @@ require 'date' 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. + # See #as_json. 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. + # Methods <tt>Date#as_json</tt> and +Date.json_create+ may be used + # to serialize and deserialize a \Date object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Date#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/date' + # x = Date.today.as_json + # # => {"json_class"=>"Date", "y"=>2023, "m"=>11, "d"=>21, "sg"=>2299161.0} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Date object: + # + # Date.json_create(x) + # # => #<Date: 2023-11-21 ((2460270j,0s,0n),+0s,2299161j)> + # def as_json(*) { JSON.create_id => self.class.name, @@ -26,8 +39,15 @@ class Date } 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 + # Returns a JSON string representing +self+: + # + # require 'json/add/date' + # puts Date.today.to_json + # + # Output: + # + # {"json_class":"Date","y":2023,"m":11,"d":21,"sg":2299161.0} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/date_time.rb b/ext/json/lib/json/add/date_time.rb index 38b0e86ab8..d7d42591cf 100644 --- a/ext/json/lib/json/add/date_time.rb +++ b/ext/json/lib/json/add/date_time.rb @@ -6,9 +6,7 @@ require 'date' 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. + # See #as_json. def self.json_create(object) args = object.values_at('y', 'm', 'd', 'H', 'M', 'S') of_a, of_b = object['of'].split('/') @@ -23,8 +21,21 @@ class DateTime alias start sg unless method_defined?(:start) - # Returns a hash, that will be turned into a JSON object and represent this - # object. + # Methods <tt>DateTime#as_json</tt> and +DateTime.json_create+ may be used + # to serialize and deserialize a \DateTime object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>DateTime#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/datetime' + # x = DateTime.now.as_json + # # => {"json_class"=>"DateTime", "y"=>2023, "m"=>11, "d"=>21, "sg"=>2299161.0} + # + # \Method +JSON.create+ deserializes such a hash, returning a \DateTime object: + # + # DateTime.json_create(x) # BUG? Raises Date::Error "invalid date" + # def as_json(*) { JSON.create_id => self.class.name, @@ -39,9 +50,15 @@ class DateTime } 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 + # Returns a JSON string representing +self+: + # + # require 'json/add/datetime' + # puts DateTime.now.to_json + # + # Output: + # + # {"json_class":"DateTime","y":2023,"m":11,"d":21,"sg":2299161.0} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/exception.rb b/ext/json/lib/json/add/exception.rb index a107e5b3c4..71d8deb0ea 100644 --- a/ext/json/lib/json/add/exception.rb +++ b/ext/json/lib/json/add/exception.rb @@ -5,16 +5,27 @@ end 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> + # See #as_json. 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. + # Methods <tt>Exception#as_json</tt> and +Exception.json_create+ may be used + # to serialize and deserialize a \Exception object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Exception#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/exception' + # x = Exception.new('Foo').as_json # => {"json_class"=>"Exception", "m"=>"Foo", "b"=>nil} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Exception object: + # + # Exception.json_create(x) # => #<Exception: Foo> + # def as_json(*) { JSON.create_id => self.class.name, @@ -23,8 +34,15 @@ class Exception } end - # Stores class name (Exception) with message <tt>m</tt> and backtrace array - # <tt>b</tt> as JSON string + # Returns a JSON string representing +self+: + # + # require 'json/add/exception' + # puts Exception.new('Foo').to_json + # + # Output: + # + # {"json_class":"Exception","m":"Foo","b":null} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/ostruct.rb b/ext/json/lib/json/add/ostruct.rb index 686cf0025d..1e6f408248 100644 --- a/ext/json/lib/json/add/ostruct.rb +++ b/ext/json/lib/json/add/ostruct.rb @@ -2,18 +2,34 @@ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end -require 'ostruct' +begin + require 'ostruct' +rescue LoadError +end class OpenStruct - # Deserializes JSON string by constructing new Struct object with values - # <tt>t</tt> serialized by <tt>to_json</tt>. + # See #as_json. 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. + # Methods <tt>OpenStruct#as_json</tt> and +OpenStruct.json_create+ may be used + # to serialize and deserialize a \OpenStruct object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>OpenStruct#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/ostruct' + # x = OpenStruct.new('name' => 'Rowdy', :age => nil).as_json + # # => {"json_class"=>"OpenStruct", "t"=>{:name=>'Rowdy', :age=>nil}} + # + # \Method +JSON.create+ deserializes such a hash, returning a \OpenStruct object: + # + # OpenStruct.json_create(x) + # # => #<OpenStruct name='Rowdy', age=nil> + # def as_json(*) klass = self.class.name klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!" @@ -23,9 +39,16 @@ class OpenStruct } end - # Stores class name (OpenStruct) with this struct's values <tt>t</tt> as a - # JSON string. + # Returns a JSON string representing +self+: + # + # require 'json/add/ostruct' + # puts OpenStruct.new('name' => 'Rowdy', :age => nil).to_json + # + # Output: + # + # {"json_class":"OpenStruct","t":{'name':'Rowdy',"age":null}} + # def to_json(*args) as_json.to_json(*args) end -end +end if defined?(::OpenStruct) diff --git a/ext/json/lib/json/add/range.rb b/ext/json/lib/json/add/range.rb index 93529fb1c4..53f54ac372 100644 --- a/ext/json/lib/json/add/range.rb +++ b/ext/json/lib/json/add/range.rb @@ -5,14 +5,29 @@ end class Range - # Deserializes JSON string by constructing new Range object with arguments - # <tt>a</tt> serialized by <tt>to_json</tt>. + # See #as_json. def self.json_create(object) new(*object['a']) end - # Returns a hash, that will be turned into a JSON object and represent this - # object. + # Methods <tt>Range#as_json</tt> and +Range.json_create+ may be used + # to serialize and deserialize a \Range object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Range#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/range' + # x = (1..4).as_json # => {"json_class"=>"Range", "a"=>[1, 4, false]} + # y = (1...4).as_json # => {"json_class"=>"Range", "a"=>[1, 4, true]} + # z = ('a'..'d').as_json # => {"json_class"=>"Range", "a"=>["a", "d", false]} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Range object: + # + # Range.json_create(x) # => 1..4 + # Range.json_create(y) # => 1...4 + # Range.json_create(z) # => "a".."d" + # def as_json(*) { JSON.create_id => self.class.name, @@ -20,9 +35,19 @@ class Range } 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. + # Returns a JSON string representing +self+: + # + # require 'json/add/range' + # puts (1..4).to_json + # puts (1...4).to_json + # puts ('a'..'d').to_json + # + # Output: + # + # {"json_class":"Range","a":[1,4,false]} + # {"json_class":"Range","a":[1,4,true]} + # {"json_class":"Range","a":["a","d",false]} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/rational.rb b/ext/json/lib/json/add/rational.rb index f776226046..8c39a7db55 100644 --- a/ext/json/lib/json/add/rational.rb +++ b/ext/json/lib/json/add/rational.rb @@ -4,14 +4,28 @@ unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED end class Rational - # Deserializes JSON string by converting numerator value <tt>n</tt>, - # denominator value <tt>d</tt>, to a Rational object. + + # See #as_json. def self.json_create(object) Rational(object['n'], object['d']) end - # Returns a hash, that will be turned into a JSON object and represent this - # object. + # Methods <tt>Rational#as_json</tt> and +Rational.json_create+ may be used + # to serialize and deserialize a \Rational object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Rational#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/rational' + # x = Rational(2, 3).as_json + # # => {"json_class"=>"Rational", "n"=>2, "d"=>3} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Rational object: + # + # Rational.json_create(x) + # # => (2/3) + # def as_json(*) { JSON.create_id => self.class.name, @@ -20,7 +34,15 @@ class Rational } end - # Stores class name (Rational) along with numerator value <tt>n</tt> and denominator value <tt>d</tt> as JSON string + # Returns a JSON string representing +self+: + # + # require 'json/add/rational' + # puts Rational(2, 3).to_json + # + # Output: + # + # {"json_class":"Rational","n":2,"d":3} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/regexp.rb b/ext/json/lib/json/add/regexp.rb index 39d69fede7..b63f49608f 100644 --- a/ext/json/lib/json/add/regexp.rb +++ b/ext/json/lib/json/add/regexp.rb @@ -5,15 +5,26 @@ end 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> + # See #as_json. 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. + # Methods <tt>Regexp#as_json</tt> and +Regexp.json_create+ may be used + # to serialize and deserialize a \Regexp object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Regexp#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/regexp' + # x = /foo/.as_json + # # => {"json_class"=>"Regexp", "o"=>0, "s"=>"foo"} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Regexp object: + # + # Regexp.json_create(x) # => /foo/ + # def as_json(*) { JSON.create_id => self.class.name, @@ -22,8 +33,15 @@ class Regexp } end - # Stores class name (Regexp) with options <tt>o</tt> and source <tt>s</tt> - # (Regexp or String) as JSON string + # Returns a JSON string representing +self+: + # + # require 'json/add/regexp' + # puts /foo/.to_json + # + # Output: + # + # {"json_class":"Regexp","o":0,"s":"foo"} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/set.rb b/ext/json/lib/json/add/set.rb index 71e2a0ac8b..1918353187 100644 --- a/ext/json/lib/json/add/set.rb +++ b/ext/json/lib/json/add/set.rb @@ -4,16 +4,27 @@ end defined?(::Set) or require 'set' class Set - # Import a JSON Marshalled object. - # - # method used for JSON marshalling support. + + # See #as_json. def self.json_create(object) new object['a'] end - # Marshal the object to JSON. + # Methods <tt>Set#as_json</tt> and +Set.json_create+ may be used + # to serialize and deserialize a \Set object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Set#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/set' + # x = Set.new(%w/foo bar baz/).as_json + # # => {"json_class"=>"Set", "a"=>["foo", "bar", "baz"]} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Set object: + # + # Set.json_create(x) # => #<Set: {"foo", "bar", "baz"}> # - # method used for JSON marshalling support. def as_json(*) { JSON.create_id => self.class.name, @@ -21,7 +32,15 @@ class Set } end - # return the JSON value + # Returns a JSON string representing +self+: + # + # require 'json/add/set' + # puts Set.new(%w/foo bar baz/).to_json + # + # Output: + # + # {"json_class":"Set","a":["foo","bar","baz"]} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/struct.rb b/ext/json/lib/json/add/struct.rb index e8395ed42f..86847762ac 100644 --- a/ext/json/lib/json/add/struct.rb +++ b/ext/json/lib/json/add/struct.rb @@ -5,14 +5,28 @@ end class Struct - # Deserializes JSON string by constructing new Struct object with values - # <tt>v</tt> serialized by <tt>to_json</tt>. + # See #as_json. def self.json_create(object) new(*object['v']) end - # Returns a hash, that will be turned into a JSON object and represent this - # object. + # Methods <tt>Struct#as_json</tt> and +Struct.json_create+ may be used + # to serialize and deserialize a \Struct object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Struct#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/struct' + # Customer = Struct.new('Customer', :name, :address, :zip) + # x = Struct::Customer.new.as_json + # # => {"json_class"=>"Struct::Customer", "v"=>[nil, nil, nil]} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Struct object: + # + # Struct::Customer.json_create(x) + # # => #<struct Struct::Customer name=nil, address=nil, zip=nil> + # def as_json(*) klass = self.class.name klass.to_s.empty? and raise JSON::JSONError, "Only named structs are supported!" @@ -22,8 +36,16 @@ class Struct } end - # Stores class name (Struct) with Struct values <tt>v</tt> as a JSON string. - # Only named structs are supported. + # Returns a JSON string representing +self+: + # + # require 'json/add/struct' + # Customer = Struct.new('Customer', :name, :address, :zip) + # puts Struct::Customer.new.to_json + # + # Output: + # + # {"json_class":"Struct","t":{'name':'Rowdy',"age":null}} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/add/symbol.rb b/ext/json/lib/json/add/symbol.rb index 74b13a423f..b5f3623158 100644 --- a/ext/json/lib/json/add/symbol.rb +++ b/ext/json/lib/json/add/symbol.rb @@ -1,11 +1,26 @@ + #frozen_string_literal: false unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED require 'json' end class Symbol - # Returns a hash, that will be turned into a JSON object and represent this - # object. + + # Methods <tt>Symbol#as_json</tt> and +Symbol.json_create+ may be used + # to serialize and deserialize a \Symbol object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Symbol#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/symbol' + # x = :foo.as_json + # # => {"json_class"=>"Symbol", "s"=>"foo"} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Symbol object: + # + # Symbol.json_create(x) # => :foo + # def as_json(*) { JSON.create_id => self.class.name, @@ -13,12 +28,20 @@ class Symbol } end - # Stores class name (Symbol) with String representation of Symbol as a JSON string. + # Returns a JSON string representing +self+: + # + # require 'json/add/symbol' + # puts :foo.to_json + # + # Output: + # + # # {"json_class":"Symbol","s":"foo"} + # 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 + # See #as_json. def self.json_create(o) o['s'].to_sym end diff --git a/ext/json/lib/json/add/time.rb b/ext/json/lib/json/add/time.rb index b73acc4086..599ed9e24b 100644 --- a/ext/json/lib/json/add/time.rb +++ b/ext/json/lib/json/add/time.rb @@ -5,7 +5,7 @@ end class Time - # Deserializes JSON string by converting time since epoch to Time + # See #as_json. def self.json_create(object) if usec = object.delete('u') # used to be tv_usec -> tv_nsec object['n'] = usec * 1000 @@ -17,8 +17,22 @@ class Time end end - # Returns a hash, that will be turned into a JSON object and represent this - # object. + # Methods <tt>Time#as_json</tt> and +Time.json_create+ may be used + # to serialize and deserialize a \Time object; + # see Marshal[rdoc-ref:Marshal]. + # + # \Method <tt>Time#as_json</tt> serializes +self+, + # returning a 2-element hash representing +self+: + # + # require 'json/add/time' + # x = Time.now.as_json + # # => {"json_class"=>"Time", "s"=>1700931656, "n"=>472846644} + # + # \Method +JSON.create+ deserializes such a hash, returning a \Time object: + # + # Time.json_create(x) + # # => 2023-11-25 11:00:56.472846644 -0600 + # def as_json(*) nanoseconds = [ tv_usec * 1000 ] respond_to?(:tv_nsec) and nanoseconds << tv_nsec @@ -30,8 +44,15 @@ class Time } end - # Stores class name (Time) with number of seconds since epoch and number of - # microseconds for Time as JSON string + # Returns a JSON string representing +self+: + # + # require 'json/add/time' + # puts Time.now.to_json + # + # Output: + # + # {"json_class":"Time","s":1700931678,"n":980650786} + # def to_json(*args) as_json.to_json(*args) end diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb index ea46896fcc..95098d3bb4 100644 --- a/ext/json/lib/json/common.rb +++ b/ext/json/lib/json/common.rb @@ -1,8 +1,12 @@ #frozen_string_literal: false require 'json/version' -require 'json/generic_object' module JSON + autoload :GenericObject, 'json/generic_object' + + NOT_SET = Object.new.freeze + private_constant :NOT_SET + class << self # :call-seq: # JSON[object] -> new_array or new_string @@ -295,19 +299,9 @@ module JSON # def generate(obj, opts = nil) if State === opts - state, opts = opts, nil + state = opts else - state = State.new - end - if opts - if opts.respond_to? :to_hash - opts = opts.to_hash - elsif opts.respond_to? :to_h - opts = opts.to_h - else - raise TypeError, "can't convert #{opts.class} into Hash" - end - state = state.configure(opts) + state = State.new(opts) end state.generate(obj) end @@ -334,19 +328,9 @@ module JSON # JSON.fast_generate(a) def fast_generate(obj, opts = nil) if State === opts - state, opts = opts, nil + state = opts else - state = JSON.create_fast_state - end - if opts - if opts.respond_to? :to_hash - opts = opts.to_hash - elsif opts.respond_to? :to_h - opts = opts.to_h - else - raise TypeError, "can't convert #{opts.class} into Hash" - end - state.configure(opts) + state = JSON.create_fast_state.configure(opts) end state.generate(obj) end @@ -592,13 +576,13 @@ module JSON # Sets or returns the default options for the JSON.dump method. # Initially: # opts = JSON.dump_default_options - # opts # => {:max_nesting=>false, :allow_nan=>true, :escape_slash=>false} + # opts # => {:max_nesting=>false, :allow_nan=>true, :script_safe=>false} attr_accessor :dump_default_options end self.dump_default_options = { :max_nesting => false, :allow_nan => true, - :escape_slash => false, + :script_safe => false, } # :call-seq: @@ -628,16 +612,18 @@ module JSON # puts File.read(path) # Output: # {"foo":[0,1],"bar":{"baz":2,"bat":3},"bam":"bad"} - def dump(obj, anIO = nil, limit = nil) - if anIO and limit.nil? - anIO = anIO.to_io if anIO.respond_to?(:to_io) - unless anIO.respond_to?(:write) - limit = anIO - anIO = nil - end + def dump(obj, anIO = nil, limit = nil, kwargs = nil) + io_limit_opt = [anIO, limit, kwargs].compact + kwargs = io_limit_opt.pop if io_limit_opt.last.is_a?(Hash) + anIO, limit = io_limit_opt + if anIO.respond_to?(:to_io) + anIO = anIO.to_io + elsif limit.nil? && !anIO.respond_to?(:write) + anIO, limit = nil, anIO end opts = JSON.dump_default_options opts = opts.merge(:max_nesting => limit) if limit + opts = merge_dump_options(opts, **kwargs) if kwargs result = generate(obj, opts) if anIO anIO.write result @@ -653,6 +639,15 @@ module JSON def self.iconv(to, from, string) string.encode(to, from) end + + def merge_dump_options(opts, strict: NOT_SET) + opts = opts.merge(strict: strict) if NOT_SET != strict + opts + end + + class << self + private :merge_dump_options + end end module ::Kernel diff --git a/ext/json/lib/json/generic_object.rb b/ext/json/lib/json/generic_object.rb index 108309db26..56efda6495 100644 --- a/ext/json/lib/json/generic_object.rb +++ b/ext/json/lib/json/generic_object.rb @@ -1,5 +1,9 @@ #frozen_string_literal: false -require 'ostruct' +begin + require 'ostruct' +rescue LoadError + warn "JSON::GenericObject requires 'ostruct'. Please install it with `gem install ostruct`." +end module JSON class GenericObject < OpenStruct @@ -67,5 +71,5 @@ module JSON def to_json(*a) as_json.to_json(*a) end - end + end if defined?(::OpenStruct) end diff --git a/ext/json/lib/json/version.rb b/ext/json/lib/json/version.rb index 9bedb65fa7..836f47edf4 100644 --- a/ext/json/lib/json/version.rb +++ b/ext/json/lib/json/version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: false module JSON # JSON version - VERSION = '2.6.2' + VERSION = '2.7.2' 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 a8e066ce15..f3422b4f84 100644 --- a/ext/json/parser/depend +++ b/ext/json/parser/depend @@ -56,6 +56,7 @@ parser.o: $(hdrdir)/ruby/internal/attr/noexcept.h parser.o: $(hdrdir)/ruby/internal/attr/noinline.h parser.o: $(hdrdir)/ruby/internal/attr/nonnull.h parser.o: $(hdrdir)/ruby/internal/attr/noreturn.h +parser.o: $(hdrdir)/ruby/internal/attr/packed_struct.h parser.o: $(hdrdir)/ruby/internal/attr/pure.h parser.o: $(hdrdir)/ruby/internal/attr/restrict.h parser.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -124,7 +125,6 @@ parser.o: $(hdrdir)/ruby/internal/intern/enumerator.h parser.o: $(hdrdir)/ruby/internal/intern/error.h parser.o: $(hdrdir)/ruby/internal/intern/eval.h parser.o: $(hdrdir)/ruby/internal/intern/file.h -parser.o: $(hdrdir)/ruby/internal/intern/gc.h parser.o: $(hdrdir)/ruby/internal/intern/hash.h parser.o: $(hdrdir)/ruby/internal/intern/io.h parser.o: $(hdrdir)/ruby/internal/intern/load.h @@ -155,12 +155,12 @@ parser.o: $(hdrdir)/ruby/internal/memory.h parser.o: $(hdrdir)/ruby/internal/method.h parser.o: $(hdrdir)/ruby/internal/module.h parser.o: $(hdrdir)/ruby/internal/newobj.h -parser.o: $(hdrdir)/ruby/internal/rgengc.h parser.o: $(hdrdir)/ruby/internal/scan_args.h parser.o: $(hdrdir)/ruby/internal/special_consts.h parser.o: $(hdrdir)/ruby/internal/static_assert.h parser.o: $(hdrdir)/ruby/internal/stdalign.h parser.o: $(hdrdir)/ruby/internal/stdbool.h +parser.o: $(hdrdir)/ruby/internal/stdckdint.h parser.o: $(hdrdir)/ruby/internal/symbol.h parser.o: $(hdrdir)/ruby/internal/value.h parser.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c index 9bd7f1971e..57f87432b6 100644 --- a/ext/json/parser/parser.c +++ b/ext/json/parser/parser.c @@ -9,14 +9,14 @@ static void enc_raise(rb_encoding *enc, VALUE exc, const char *fmt, ...) { - va_list args; - VALUE mesg; + va_list args; + VALUE mesg; - va_start(args, fmt); - mesg = rb_enc_vsprintf(enc, fmt, args); - va_end(args); + va_start(args, fmt); + mesg = rb_enc_vsprintf(enc, fmt, args); + va_end(args); - rb_exc_raise(rb_exc_new3(exc, mesg)); + rb_exc_raise(rb_exc_new3(exc, mesg)); } # define rb_enc_raise enc_raise # endif @@ -28,3320 +28,2184 @@ enc_raise(rb_encoding *enc, VALUE exc, const char *fmt, ...) /* unicode */ static const signed char digit_values[256] = { - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, - -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, + -1, -1, -1, -1, -1, -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1 }; static UTF32 unescape_unicode(const unsigned char *p) { - signed char b; - UTF32 result = 0; - b = digit_values[p[0]]; - if (b < 0) return UNI_REPLACEMENT_CHAR; - result = (result << 4) | (unsigned char)b; - b = digit_values[p[1]]; - if (b < 0) return UNI_REPLACEMENT_CHAR; - result = (result << 4) | (unsigned char)b; - b = digit_values[p[2]]; - if (b < 0) return UNI_REPLACEMENT_CHAR; - result = (result << 4) | (unsigned char)b; - b = digit_values[p[3]]; - if (b < 0) return UNI_REPLACEMENT_CHAR; - result = (result << 4) | (unsigned char)b; - return result; + signed char b; + UTF32 result = 0; + b = digit_values[p[0]]; + if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; + b = digit_values[p[1]]; + if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; + b = digit_values[p[2]]; + if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; + b = digit_values[p[3]]; + if (b < 0) return UNI_REPLACEMENT_CHAR; + result = (result << 4) | (unsigned char)b; + return result; } static int convert_UTF32_to_UTF8(char *buf, UTF32 ch) { - int len = 1; - if (ch <= 0x7F) { - buf[0] = (char) ch; - } else if (ch <= 0x07FF) { - buf[0] = (char) ((ch >> 6) | 0xC0); - buf[1] = (char) ((ch & 0x3F) | 0x80); - len++; - } else if (ch <= 0xFFFF) { - buf[0] = (char) ((ch >> 12) | 0xE0); - buf[1] = (char) (((ch >> 6) & 0x3F) | 0x80); - buf[2] = (char) ((ch & 0x3F) | 0x80); - len += 2; - } else if (ch <= 0x1fffff) { - buf[0] =(char) ((ch >> 18) | 0xF0); - buf[1] =(char) (((ch >> 12) & 0x3F) | 0x80); - buf[2] =(char) (((ch >> 6) & 0x3F) | 0x80); - buf[3] =(char) ((ch & 0x3F) | 0x80); - len += 3; - } else { - buf[0] = '?'; - } - return len; + int len = 1; + if (ch <= 0x7F) { + buf[0] = (char) ch; + } else if (ch <= 0x07FF) { + buf[0] = (char) ((ch >> 6) | 0xC0); + buf[1] = (char) ((ch & 0x3F) | 0x80); + len++; + } else if (ch <= 0xFFFF) { + buf[0] = (char) ((ch >> 12) | 0xE0); + buf[1] = (char) (((ch >> 6) & 0x3F) | 0x80); + buf[2] = (char) ((ch & 0x3F) | 0x80); + len += 2; + } else if (ch <= 0x1fffff) { + buf[0] =(char) ((ch >> 18) | 0xF0); + buf[1] =(char) (((ch >> 12) & 0x3F) | 0x80); + buf[2] =(char) (((ch >> 6) & 0x3F) | 0x80); + buf[3] =(char) ((ch & 0x3F) | 0x80); + len += 3; + } else { + buf[0] = '?'; + } + return len; } static VALUE mJSON, mExt, cParser, eParserError, eNestingError; static VALUE CNaN, CInfinity, CMinusInfinity; static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions, -i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, -i_object_class, i_array_class, i_decimal_class, i_key_p, -i_deep_const_get, i_match, i_match_string, i_aset, i_aref, -i_leftshift, i_new, i_try_convert, i_freeze, i_uminus; + i_chr, i_max_nesting, i_allow_nan, i_symbolize_names, + i_object_class, i_array_class, i_decimal_class, i_key_p, + i_deep_const_get, i_match, i_match_string, i_aset, i_aref, + i_leftshift, i_new, i_try_convert, i_freeze, i_uminus; #line 125 "parser.rl" +#line 107 "parser.c" enum {JSON_object_start = 1}; enum {JSON_object_first_final = 27}; enum {JSON_object_error = 0}; enum {JSON_object_en_main = 1}; -static const char MAYBE_UNUSED(_JSON_object_nfa_targs)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_object_nfa_offsets)[] = { - 0, 0, 0, 0, 0, 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 char MAYBE_UNUSED(_JSON_object_nfa_push_actions)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_object_nfa_pop_trans)[] = { - 0, 0 -}; - #line 167 "parser.rl" static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting) { - int cs = EVIL; - VALUE last_name = Qnil; - VALUE object_class = json->object_class; + int cs = EVIL; + VALUE last_name = Qnil; + VALUE object_class = json->object_class; - if (json->max_nesting && current_nesting > json->max_nesting) { - rb_raise(eNestingError, "nesting of %d is too deep", current_nesting); - } + if (json->max_nesting && current_nesting > json->max_nesting) { + rb_raise(eNestingError, "nesting of %d is too deep", current_nesting); + } - *result = NIL_P(object_class) ? rb_hash_new() : rb_class_new_instance(0, 0, object_class); + *result = NIL_P(object_class) ? rb_hash_new() : rb_class_new_instance(0, 0, object_class); +#line 131 "parser.c" { - cs = (int)JSON_object_start; + cs = JSON_object_start; } - #line 182 "parser.rl" - +#line 182 "parser.rl" +#line 138 "parser.c" { - if ( p == pe ) + if ( p == pe ) goto _test_eof; - switch ( cs ) - { - case 1: - goto st_case_1; - case 0: - goto st_case_0; - case 2: - goto st_case_2; - case 3: - goto st_case_3; - case 4: - goto st_case_4; - case 5: - goto st_case_5; - case 6: - goto st_case_6; - case 7: - goto st_case_7; - case 8: - goto st_case_8; - case 9: - goto st_case_9; - case 10: - goto st_case_10; - case 11: - goto st_case_11; - case 12: - goto st_case_12; - case 13: - goto st_case_13; - case 14: - goto st_case_14; - case 15: - goto st_case_15; - case 16: - goto st_case_16; - case 17: - goto st_case_17; - case 18: - goto st_case_18; - case 27: - goto st_case_27; - case 19: - goto st_case_19; - case 20: - goto st_case_20; - case 21: - goto st_case_21; - case 22: - goto st_case_22; - case 23: - goto st_case_23; - case 24: - goto st_case_24; - case 25: - goto st_case_25; - case 26: - goto st_case_26; - } - goto st_out; - st_case_1: - if ( ( (*( p))) == 123 ) { - goto st2; - } - { - goto st0; - } - st_case_0: - st0: - cs = 0; - goto _out; - st2: - p+= 1; - if ( p == pe ) + switch ( cs ) + { +case 1: + if ( (*p) == 123 ) + goto st2; + goto st0; +st0: +cs = 0; + goto _out; +st2: + if ( ++p == pe ) goto _test_eof2; - st_case_2: - switch( ( (*( p))) ) { - case 13: { - goto st2; - } - case 32: { - goto st2; - } - case 34: { - goto ctr2; - } - case 47: { - goto st23; - } - case 125: { - goto ctr4; - } - } - if ( 9 <= ( (*( p))) && ( (*( p))) <= 10 ) { - goto st2; - } - { - goto st0; - } - ctr2: - { - #line 149 "parser.rl" - - char *np; - json->parsing_name = 1; - np = JSON_parse_string(json, p, pe, &last_name); - json->parsing_name = 0; - if (np == NULL) { {p = p - 1; } {p+= 1; cs = 3; goto _out;} } else {p = (( np))-1;} - - } - - goto st3; - st3: - p+= 1; - if ( p == pe ) +case 2: + switch( (*p) ) { + case 13: goto st2; + case 32: goto st2; + case 34: goto tr2; + case 47: goto st23; + case 125: goto tr4; + } + if ( 9 <= (*p) && (*p) <= 10 ) + goto st2; + goto st0; +tr2: +#line 149 "parser.rl" + { + char *np; + json->parsing_name = 1; + np = JSON_parse_string(json, p, pe, &last_name); + json->parsing_name = 0; + if (np == NULL) { p--; {p++; cs = 3; goto _out;} } else {p = (( np))-1;} + } + goto st3; +st3: + if ( ++p == pe ) goto _test_eof3; - st_case_3: - switch( ( (*( p))) ) { - case 13: { - goto st3; - } - case 32: { - goto st3; - } - case 47: { - goto st4; - } - case 58: { - goto st8; - } - } - if ( 9 <= ( (*( p))) && ( (*( p))) <= 10 ) { - goto st3; - } - { - goto st0; - } - st4: - p+= 1; - if ( p == pe ) +case 3: +#line 179 "parser.c" + switch( (*p) ) { + case 13: goto st3; + case 32: goto st3; + case 47: goto st4; + case 58: goto st8; + } + if ( 9 <= (*p) && (*p) <= 10 ) + goto st3; + goto st0; +st4: + if ( ++p == pe ) goto _test_eof4; - st_case_4: - switch( ( (*( p))) ) { - case 42: { - goto st5; - } - case 47: { - goto st7; - } - } - { - goto st0; - } - st5: - p+= 1; - if ( p == pe ) +case 4: + switch( (*p) ) { + case 42: goto st5; + case 47: goto st7; + } + goto st0; +st5: + if ( ++p == pe ) goto _test_eof5; - st_case_5: - if ( ( (*( p))) == 42 ) { - goto st6; - } - { - goto st5; - } - st6: - p+= 1; - if ( p == pe ) +case 5: + if ( (*p) == 42 ) + goto st6; + goto st5; +st6: + if ( ++p == pe ) goto _test_eof6; - st_case_6: - switch( ( (*( p))) ) { - case 42: { - goto st6; - } - case 47: { - goto st3; - } - } - { - goto st5; - } - st7: - p+= 1; - if ( p == pe ) +case 6: + switch( (*p) ) { + case 42: goto st6; + case 47: goto st3; + } + goto st5; +st7: + if ( ++p == pe ) goto _test_eof7; - st_case_7: - if ( ( (*( p))) == 10 ) { - goto st3; - } - { - goto st7; - } - st8: - p+= 1; - if ( p == pe ) +case 7: + if ( (*p) == 10 ) + goto st3; + goto st7; +st8: + if ( ++p == pe ) goto _test_eof8; - st_case_8: - switch( ( (*( p))) ) { - case 13: { - goto st8; - } - case 32: { - goto st8; - } - case 34: { - goto ctr11; - } - case 45: { - goto ctr11; - } - case 47: { - goto st19; - } - case 73: { - goto ctr11; - } - case 78: { - goto ctr11; - } - case 91: { - goto ctr11; - } - case 102: { - goto ctr11; - } - case 110: { - goto ctr11; - } - case 116: { - goto ctr11; - } - case 123: { - goto ctr11; - } - } - if ( ( (*( p))) > 10 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto ctr11; - } - } else if ( ( (*( p))) >= 9 ) { - goto st8; - } - { - goto st0; - } - ctr11: - { - #line 133 "parser.rl" - - VALUE v = Qnil; - char *np = JSON_parse_value(json, p, pe, &v, current_nesting); - if (np == NULL) { - {p = p - 1; } {p+= 1; cs = 9; goto _out;} - } else { - if (NIL_P(json->object_class)) { - OBJ_FREEZE(last_name); - rb_hash_aset(*result, last_name, v); - } else { - rb_funcall(*result, i_aset, 2, last_name, v); - } - {p = (( np))-1;} - - } - } - - goto st9; - st9: - p+= 1; - if ( p == pe ) +case 8: + switch( (*p) ) { + case 13: goto st8; + case 32: goto st8; + case 34: goto tr11; + case 45: goto tr11; + case 47: goto st19; + case 73: goto tr11; + case 78: goto tr11; + case 91: goto tr11; + case 102: goto tr11; + case 110: goto tr11; + case 116: goto tr11; + case 123: goto tr11; + } + if ( (*p) > 10 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr11; + } else if ( (*p) >= 9 ) + goto st8; + goto st0; +tr11: +#line 133 "parser.rl" + { + VALUE v = Qnil; + char *np = JSON_parse_value(json, p, pe, &v, current_nesting); + if (np == NULL) { + p--; {p++; cs = 9; goto _out;} + } else { + if (NIL_P(json->object_class)) { + OBJ_FREEZE(last_name); + rb_hash_aset(*result, last_name, v); + } else { + rb_funcall(*result, i_aset, 2, last_name, v); + } + {p = (( np))-1;} + } + } + goto st9; +st9: + if ( ++p == pe ) goto _test_eof9; - st_case_9: - switch( ( (*( p))) ) { - case 13: { - goto st9; - } - case 32: { - goto st9; - } - case 44: { - goto st10; - } - case 47: { - goto st15; - } - case 125: { - goto ctr4; - } - } - if ( 9 <= ( (*( p))) && ( (*( p))) <= 10 ) { - goto st9; - } - { - goto st0; - } - st10: - p+= 1; - if ( p == pe ) +case 9: +#line 267 "parser.c" + switch( (*p) ) { + case 13: goto st9; + case 32: goto st9; + case 44: goto st10; + case 47: goto st15; + case 125: goto tr4; + } + if ( 9 <= (*p) && (*p) <= 10 ) + goto st9; + goto st0; +st10: + if ( ++p == pe ) goto _test_eof10; - st_case_10: - switch( ( (*( p))) ) { - case 13: { - goto st10; - } - case 32: { - goto st10; - } - case 34: { - goto ctr2; - } - case 47: { - goto st11; - } - } - if ( 9 <= ( (*( p))) && ( (*( p))) <= 10 ) { - goto st10; - } - { - goto st0; - } - st11: - p+= 1; - if ( p == pe ) +case 10: + switch( (*p) ) { + case 13: goto st10; + case 32: goto st10; + case 34: goto tr2; + case 47: goto st11; + } + if ( 9 <= (*p) && (*p) <= 10 ) + goto st10; + goto st0; +st11: + if ( ++p == pe ) goto _test_eof11; - st_case_11: - switch( ( (*( p))) ) { - case 42: { - goto st12; - } - case 47: { - goto st14; - } - } - { - goto st0; - } - st12: - p+= 1; - if ( p == pe ) +case 11: + switch( (*p) ) { + case 42: goto st12; + case 47: goto st14; + } + goto st0; +st12: + if ( ++p == pe ) goto _test_eof12; - st_case_12: - if ( ( (*( p))) == 42 ) { - goto st13; - } - { - goto st12; - } - st13: - p+= 1; - if ( p == pe ) +case 12: + if ( (*p) == 42 ) + goto st13; + goto st12; +st13: + if ( ++p == pe ) goto _test_eof13; - st_case_13: - switch( ( (*( p))) ) { - case 42: { - goto st13; - } - case 47: { - goto st10; - } - } - { - goto st12; - } - st14: - p+= 1; - if ( p == pe ) +case 13: + switch( (*p) ) { + case 42: goto st13; + case 47: goto st10; + } + goto st12; +st14: + if ( ++p == pe ) goto _test_eof14; - st_case_14: - if ( ( (*( p))) == 10 ) { - goto st10; - } - { - goto st14; - } - st15: - p+= 1; - if ( p == pe ) +case 14: + if ( (*p) == 10 ) + goto st10; + goto st14; +st15: + if ( ++p == pe ) goto _test_eof15; - st_case_15: - switch( ( (*( p))) ) { - case 42: { - goto st16; - } - case 47: { - goto st18; - } - } - { - goto st0; - } - st16: - p+= 1; - if ( p == pe ) +case 15: + switch( (*p) ) { + case 42: goto st16; + case 47: goto st18; + } + goto st0; +st16: + if ( ++p == pe ) goto _test_eof16; - st_case_16: - if ( ( (*( p))) == 42 ) { - goto st17; - } - { - goto st16; - } - st17: - p+= 1; - if ( p == pe ) +case 16: + if ( (*p) == 42 ) + goto st17; + goto st16; +st17: + if ( ++p == pe ) goto _test_eof17; - st_case_17: - switch( ( (*( p))) ) { - case 42: { - goto st17; - } - case 47: { - goto st9; - } - } - { - goto st16; - } - st18: - p+= 1; - if ( p == pe ) +case 17: + switch( (*p) ) { + case 42: goto st17; + case 47: goto st9; + } + goto st16; +st18: + if ( ++p == pe ) goto _test_eof18; - st_case_18: - if ( ( (*( p))) == 10 ) { - goto st9; - } - { - goto st18; - } - ctr4: - { - #line 157 "parser.rl" - {p = p - 1; } {p+= 1; cs = 27; goto _out;} } - - goto st27; - st27: - p+= 1; - if ( p == pe ) +case 18: + if ( (*p) == 10 ) + goto st9; + goto st18; +tr4: +#line 157 "parser.rl" + { p--; {p++; cs = 27; goto _out;} } + goto st27; +st27: + if ( ++p == pe ) goto _test_eof27; - st_case_27: - { - goto st0; - } - st19: - p+= 1; - if ( p == pe ) +case 27: +#line 363 "parser.c" + goto st0; +st19: + if ( ++p == pe ) goto _test_eof19; - st_case_19: - switch( ( (*( p))) ) { - case 42: { - goto st20; - } - case 47: { - goto st22; - } - } - { - goto st0; - } - st20: - p+= 1; - if ( p == pe ) +case 19: + switch( (*p) ) { + case 42: goto st20; + case 47: goto st22; + } + goto st0; +st20: + if ( ++p == pe ) goto _test_eof20; - st_case_20: - if ( ( (*( p))) == 42 ) { - goto st21; - } - { - goto st20; - } - st21: - p+= 1; - if ( p == pe ) +case 20: + if ( (*p) == 42 ) + goto st21; + goto st20; +st21: + if ( ++p == pe ) goto _test_eof21; - st_case_21: - switch( ( (*( p))) ) { - case 42: { - goto st21; - } - case 47: { - goto st8; - } - } - { - goto st20; - } - st22: - p+= 1; - if ( p == pe ) +case 21: + switch( (*p) ) { + case 42: goto st21; + case 47: goto st8; + } + goto st20; +st22: + if ( ++p == pe ) goto _test_eof22; - st_case_22: - if ( ( (*( p))) == 10 ) { - goto st8; - } - { - goto st22; - } - st23: - p+= 1; - if ( p == pe ) +case 22: + if ( (*p) == 10 ) + goto st8; + goto st22; +st23: + if ( ++p == pe ) goto _test_eof23; - st_case_23: - switch( ( (*( p))) ) { - case 42: { - goto st24; - } - case 47: { - goto st26; - } - } - { - goto st0; - } - st24: - p+= 1; - if ( p == pe ) +case 23: + switch( (*p) ) { + case 42: goto st24; + case 47: goto st26; + } + goto st0; +st24: + if ( ++p == pe ) goto _test_eof24; - st_case_24: - if ( ( (*( p))) == 42 ) { - goto st25; - } - { - goto st24; - } - st25: - p+= 1; - if ( p == pe ) +case 24: + if ( (*p) == 42 ) + goto st25; + goto st24; +st25: + if ( ++p == pe ) goto _test_eof25; - st_case_25: - switch( ( (*( p))) ) { - case 42: { - goto st25; - } - case 47: { - goto st2; - } - } - { - goto st24; - } - st26: - p+= 1; - if ( p == pe ) +case 25: + switch( (*p) ) { + case 42: goto st25; + case 47: goto st2; + } + goto st24; +st26: + if ( ++p == pe ) goto _test_eof26; - st_case_26: - if ( ( (*( p))) == 10 ) { - goto st2; - } - { - goto st26; - } - st_out: - _test_eof2: cs = 2; goto _test_eof; - _test_eof3: cs = 3; goto _test_eof; - _test_eof4: cs = 4; goto _test_eof; - _test_eof5: cs = 5; goto _test_eof; - _test_eof6: cs = 6; goto _test_eof; - _test_eof7: cs = 7; goto _test_eof; - _test_eof8: cs = 8; goto _test_eof; - _test_eof9: cs = 9; goto _test_eof; - _test_eof10: cs = 10; goto _test_eof; - _test_eof11: cs = 11; goto _test_eof; - _test_eof12: cs = 12; goto _test_eof; - _test_eof13: cs = 13; goto _test_eof; - _test_eof14: cs = 14; goto _test_eof; - _test_eof15: cs = 15; goto _test_eof; - _test_eof16: cs = 16; goto _test_eof; - _test_eof17: cs = 17; goto _test_eof; - _test_eof18: cs = 18; goto _test_eof; - _test_eof27: cs = 27; goto _test_eof; - _test_eof19: cs = 19; goto _test_eof; - _test_eof20: cs = 20; goto _test_eof; - _test_eof21: cs = 21; goto _test_eof; - _test_eof22: cs = 22; goto _test_eof; - _test_eof23: cs = 23; goto _test_eof; - _test_eof24: cs = 24; goto _test_eof; - _test_eof25: cs = 25; goto _test_eof; - _test_eof26: cs = 26; goto _test_eof; - - _test_eof: {} - _out: {} - } - - #line 183 "parser.rl" - - - if (cs >= JSON_object_first_final) { - if (json->create_additions) { - 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); - } - 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))) { - *result = rb_funcall(klass, i_json_create, 1, *result); - } - } - } - return p + 1; - } else { - return NULL; +case 26: + if ( (*p) == 10 ) + goto st2; + goto st26; + } + _test_eof2: cs = 2; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; + _test_eof4: cs = 4; goto _test_eof; + _test_eof5: cs = 5; goto _test_eof; + _test_eof6: cs = 6; goto _test_eof; + _test_eof7: cs = 7; goto _test_eof; + _test_eof8: cs = 8; goto _test_eof; + _test_eof9: cs = 9; goto _test_eof; + _test_eof10: cs = 10; goto _test_eof; + _test_eof11: cs = 11; goto _test_eof; + _test_eof12: cs = 12; goto _test_eof; + _test_eof13: cs = 13; goto _test_eof; + _test_eof14: cs = 14; goto _test_eof; + _test_eof15: cs = 15; goto _test_eof; + _test_eof16: cs = 16; goto _test_eof; + _test_eof17: cs = 17; goto _test_eof; + _test_eof18: cs = 18; goto _test_eof; + _test_eof27: cs = 27; goto _test_eof; + _test_eof19: cs = 19; goto _test_eof; + _test_eof20: cs = 20; goto _test_eof; + _test_eof21: cs = 21; goto _test_eof; + _test_eof22: cs = 22; goto _test_eof; + _test_eof23: cs = 23; goto _test_eof; + _test_eof24: cs = 24; goto _test_eof; + _test_eof25: cs = 25; goto _test_eof; + _test_eof26: cs = 26; goto _test_eof; + + _test_eof: {} + _out: {} } + +#line 183 "parser.rl" + + if (cs >= JSON_object_first_final) { + if (json->create_additions) { + 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); + } + 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))) { + *result = rb_funcall(klass, i_json_create, 1, *result); + } + } + } + return p + 1; + } else { + return NULL; + } } +#line 486 "parser.c" enum {JSON_value_start = 1}; enum {JSON_value_first_final = 29}; enum {JSON_value_error = 0}; enum {JSON_value_en_main = 1}; -static const char MAYBE_UNUSED(_JSON_value_nfa_targs)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_value_nfa_offsets)[] = { - 0, 0, 0, 0, 0, 0, 0, 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 char MAYBE_UNUSED(_JSON_value_nfa_push_actions)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_value_nfa_pop_trans)[] = { - 0, 0 -}; - #line 283 "parser.rl" static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting) { - int cs = EVIL; + int cs = EVIL; +#line 502 "parser.c" { - cs = (int)JSON_value_start; + cs = JSON_value_start; } - #line 290 "parser.rl" - +#line 290 "parser.rl" +#line 509 "parser.c" { - if ( p == pe ) + if ( p == pe ) goto _test_eof; - switch ( cs ) - { - case 1: - goto st_case_1; - case 0: - goto st_case_0; - case 29: - goto st_case_29; - case 2: - goto st_case_2; - case 3: - goto st_case_3; - case 4: - goto st_case_4; - case 5: - goto st_case_5; - case 6: - goto st_case_6; - case 7: - goto st_case_7; - case 8: - goto st_case_8; - case 9: - goto st_case_9; - case 10: - goto st_case_10; - case 11: - goto st_case_11; - case 12: - goto st_case_12; - case 13: - goto st_case_13; - case 14: - goto st_case_14; - case 15: - goto st_case_15; - case 16: - goto st_case_16; - case 17: - goto st_case_17; - case 18: - goto st_case_18; - case 19: - goto st_case_19; - case 20: - goto st_case_20; - case 21: - goto st_case_21; - case 22: - goto st_case_22; - case 23: - goto st_case_23; - case 24: - goto st_case_24; - case 25: - goto st_case_25; - case 26: - goto st_case_26; - case 27: - goto st_case_27; - case 28: - goto st_case_28; - } - goto st_out; - st1: - p+= 1; - if ( p == pe ) + switch ( cs ) + { +st1: + if ( ++p == pe ) goto _test_eof1; - st_case_1: - switch( ( (*( p))) ) { - case 13: { - goto st1; - } - case 32: { - goto st1; - } - case 34: { - goto ctr2; - } - case 45: { - goto ctr3; - } - case 47: { - goto st6; - } - case 73: { - goto st10; - } - case 78: { - goto st17; - } - case 91: { - goto ctr7; - } - case 102: { - goto st19; - } - case 110: { - goto st23; - } - case 116: { - goto st26; - } - case 123: { - goto ctr11; - } - } - if ( ( (*( p))) > 10 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto ctr3; - } - } else if ( ( (*( p))) >= 9 ) { - goto st1; - } - { - goto st0; - } - st_case_0: - st0: - cs = 0; - goto _out; - ctr2: - { - #line 235 "parser.rl" - - char *np = JSON_parse_string(json, p, pe, result); - if (np == NULL) { {p = p - 1; } {p+= 1; cs = 29; goto _out;} } else {p = (( np))-1;} - - } - - goto st29; - ctr3: - { - #line 240 "parser.rl" - - char *np; - if(pe > p + 8 && !strncmp(MinusInfinity, p, 9)) { - if (json->allow_nan) { - *result = CMinusInfinity; - {p = (( p + 10))-1;} - - {p = p - 1; } {p+= 1; cs = 29; goto _out;} - } else { - rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p); - } - } - np = JSON_parse_float(json, p, pe, result); - if (np != NULL) {p = (( np))-1;} - - np = JSON_parse_integer(json, p, pe, result); - if (np != NULL) {p = (( np))-1;} - - {p = p - 1; } {p+= 1; cs = 29; goto _out;} - } - - goto st29; - ctr7: - { - #line 258 "parser.rl" - - char *np; - np = JSON_parse_array(json, p, pe, result, current_nesting + 1); - if (np == NULL) { {p = p - 1; } {p+= 1; cs = 29; goto _out;} } else {p = (( np))-1;} - - } - - goto st29; - ctr11: - { - #line 264 "parser.rl" - - char *np; - np = JSON_parse_object(json, p, pe, result, current_nesting + 1); - if (np == NULL) { {p = p - 1; } {p+= 1; cs = 29; goto _out;} } else {p = (( np))-1;} - - } - - goto st29; - ctr25: - { - #line 228 "parser.rl" - - if (json->allow_nan) { - *result = CInfinity; - } else { - rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 8); - } - } - - goto st29; - ctr27: - { - #line 221 "parser.rl" - - if (json->allow_nan) { - *result = CNaN; - } else { - rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 2); - } - } - - goto st29; - ctr31: - { - #line 215 "parser.rl" - - *result = Qfalse; - } - - goto st29; - ctr34: - { - #line 212 "parser.rl" - - *result = Qnil; - } - - goto st29; - ctr37: - { - #line 218 "parser.rl" - - *result = Qtrue; - } - - goto st29; - st29: - p+= 1; - if ( p == pe ) +case 1: + switch( (*p) ) { + case 13: goto st1; + case 32: goto st1; + case 34: goto tr2; + case 45: goto tr3; + case 47: goto st6; + case 73: goto st10; + case 78: goto st17; + case 91: goto tr7; + case 102: goto st19; + case 110: goto st23; + case 116: goto st26; + case 123: goto tr11; + } + if ( (*p) > 10 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr3; + } else if ( (*p) >= 9 ) + goto st1; + goto st0; +st0: +cs = 0; + goto _out; +tr2: +#line 235 "parser.rl" + { + char *np = JSON_parse_string(json, p, pe, result); + if (np == NULL) { p--; {p++; cs = 29; goto _out;} } else {p = (( np))-1;} + } + goto st29; +tr3: +#line 240 "parser.rl" + { + char *np; + if(pe > p + 8 && !strncmp(MinusInfinity, p, 9)) { + if (json->allow_nan) { + *result = CMinusInfinity; + {p = (( p + 10))-1;} + p--; {p++; cs = 29; goto _out;} + } else { + rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p); + } + } + np = JSON_parse_float(json, p, pe, result); + if (np != NULL) {p = (( np))-1;} + np = JSON_parse_integer(json, p, pe, result); + if (np != NULL) {p = (( np))-1;} + p--; {p++; cs = 29; goto _out;} + } + goto st29; +tr7: +#line 258 "parser.rl" + { + char *np; + np = JSON_parse_array(json, p, pe, result, current_nesting + 1); + if (np == NULL) { p--; {p++; cs = 29; goto _out;} } else {p = (( np))-1;} + } + goto st29; +tr11: +#line 264 "parser.rl" + { + char *np; + np = JSON_parse_object(json, p, pe, result, current_nesting + 1); + if (np == NULL) { p--; {p++; cs = 29; goto _out;} } else {p = (( np))-1;} + } + goto st29; +tr25: +#line 228 "parser.rl" + { + if (json->allow_nan) { + *result = CInfinity; + } else { + rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 7); + } + } + goto st29; +tr27: +#line 221 "parser.rl" + { + if (json->allow_nan) { + *result = CNaN; + } else { + rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 2); + } + } + goto st29; +tr31: +#line 215 "parser.rl" + { + *result = Qfalse; + } + goto st29; +tr34: +#line 212 "parser.rl" + { + *result = Qnil; + } + goto st29; +tr37: +#line 218 "parser.rl" + { + *result = Qtrue; + } + goto st29; +st29: + if ( ++p == pe ) goto _test_eof29; - st_case_29: - { - #line 270 "parser.rl" - {p = p - 1; } {p+= 1; cs = 29; goto _out;} } - switch( ( (*( p))) ) { - case 13: { - goto st29; - } - case 32: { - goto st29; - } - case 47: { - goto st2; - } - } - if ( 9 <= ( (*( p))) && ( (*( p))) <= 10 ) { - goto st29; - } - { - goto st0; - } - st2: - p+= 1; - if ( p == pe ) +case 29: +#line 270 "parser.rl" + { p--; {p++; cs = 29; goto _out;} } +#line 629 "parser.c" + switch( (*p) ) { + case 13: goto st29; + case 32: goto st29; + case 47: goto st2; + } + if ( 9 <= (*p) && (*p) <= 10 ) + goto st29; + goto st0; +st2: + if ( ++p == pe ) goto _test_eof2; - st_case_2: - switch( ( (*( p))) ) { - case 42: { - goto st3; - } - case 47: { - goto st5; - } - } - { - goto st0; - } - st3: - p+= 1; - if ( p == pe ) +case 2: + switch( (*p) ) { + case 42: goto st3; + case 47: goto st5; + } + goto st0; +st3: + if ( ++p == pe ) goto _test_eof3; - st_case_3: - if ( ( (*( p))) == 42 ) { - goto st4; - } - { - goto st3; - } - st4: - p+= 1; - if ( p == pe ) +case 3: + if ( (*p) == 42 ) + goto st4; + goto st3; +st4: + if ( ++p == pe ) goto _test_eof4; - st_case_4: - switch( ( (*( p))) ) { - case 42: { - goto st4; - } - case 47: { - goto st29; - } - } - { - goto st3; - } - st5: - p+= 1; - if ( p == pe ) +case 4: + switch( (*p) ) { + case 42: goto st4; + case 47: goto st29; + } + goto st3; +st5: + if ( ++p == pe ) goto _test_eof5; - st_case_5: - if ( ( (*( p))) == 10 ) { - goto st29; - } - { - goto st5; - } - st6: - p+= 1; - if ( p == pe ) +case 5: + if ( (*p) == 10 ) + goto st29; + goto st5; +st6: + if ( ++p == pe ) goto _test_eof6; - st_case_6: - switch( ( (*( p))) ) { - case 42: { - goto st7; - } - case 47: { - goto st9; - } - } - { - goto st0; - } - st7: - p+= 1; - if ( p == pe ) +case 6: + switch( (*p) ) { + case 42: goto st7; + case 47: goto st9; + } + goto st0; +st7: + if ( ++p == pe ) goto _test_eof7; - st_case_7: - if ( ( (*( p))) == 42 ) { - goto st8; - } - { - goto st7; - } - st8: - p+= 1; - if ( p == pe ) +case 7: + if ( (*p) == 42 ) + goto st8; + goto st7; +st8: + if ( ++p == pe ) goto _test_eof8; - st_case_8: - switch( ( (*( p))) ) { - case 42: { - goto st8; - } - case 47: { - goto st1; - } - } - { - goto st7; - } - st9: - p+= 1; - if ( p == pe ) +case 8: + switch( (*p) ) { + case 42: goto st8; + case 47: goto st1; + } + goto st7; +st9: + if ( ++p == pe ) goto _test_eof9; - st_case_9: - if ( ( (*( p))) == 10 ) { - goto st1; - } - { - goto st9; - } - st10: - p+= 1; - if ( p == pe ) +case 9: + if ( (*p) == 10 ) + goto st1; + goto st9; +st10: + if ( ++p == pe ) goto _test_eof10; - st_case_10: - if ( ( (*( p))) == 110 ) { - goto st11; - } - { - goto st0; - } - st11: - p+= 1; - if ( p == pe ) +case 10: + if ( (*p) == 110 ) + goto st11; + goto st0; +st11: + if ( ++p == pe ) goto _test_eof11; - st_case_11: - if ( ( (*( p))) == 102 ) { - goto st12; - } - { - goto st0; - } - st12: - p+= 1; - if ( p == pe ) +case 11: + if ( (*p) == 102 ) + goto st12; + goto st0; +st12: + if ( ++p == pe ) goto _test_eof12; - st_case_12: - if ( ( (*( p))) == 105 ) { - goto st13; - } - { - goto st0; - } - st13: - p+= 1; - if ( p == pe ) +case 12: + if ( (*p) == 105 ) + goto st13; + goto st0; +st13: + if ( ++p == pe ) goto _test_eof13; - st_case_13: - if ( ( (*( p))) == 110 ) { - goto st14; - } - { - goto st0; - } - st14: - p+= 1; - if ( p == pe ) +case 13: + if ( (*p) == 110 ) + goto st14; + goto st0; +st14: + if ( ++p == pe ) goto _test_eof14; - st_case_14: - if ( ( (*( p))) == 105 ) { - goto st15; - } - { - goto st0; - } - st15: - p+= 1; - if ( p == pe ) +case 14: + if ( (*p) == 105 ) + goto st15; + goto st0; +st15: + if ( ++p == pe ) goto _test_eof15; - st_case_15: - if ( ( (*( p))) == 116 ) { - goto st16; - } - { - goto st0; - } - st16: - p+= 1; - if ( p == pe ) +case 15: + if ( (*p) == 116 ) + goto st16; + goto st0; +st16: + if ( ++p == pe ) goto _test_eof16; - st_case_16: - if ( ( (*( p))) == 121 ) { - goto ctr25; - } - { - goto st0; - } - st17: - p+= 1; - if ( p == pe ) +case 16: + if ( (*p) == 121 ) + goto tr25; + goto st0; +st17: + if ( ++p == pe ) goto _test_eof17; - st_case_17: - if ( ( (*( p))) == 97 ) { - goto st18; - } - { - goto st0; - } - st18: - p+= 1; - if ( p == pe ) +case 17: + if ( (*p) == 97 ) + goto st18; + goto st0; +st18: + if ( ++p == pe ) goto _test_eof18; - st_case_18: - if ( ( (*( p))) == 78 ) { - goto ctr27; - } - { - goto st0; - } - st19: - p+= 1; - if ( p == pe ) +case 18: + if ( (*p) == 78 ) + goto tr27; + goto st0; +st19: + if ( ++p == pe ) goto _test_eof19; - st_case_19: - if ( ( (*( p))) == 97 ) { - goto st20; - } - { - goto st0; - } - st20: - p+= 1; - if ( p == pe ) +case 19: + if ( (*p) == 97 ) + goto st20; + goto st0; +st20: + if ( ++p == pe ) goto _test_eof20; - st_case_20: - if ( ( (*( p))) == 108 ) { - goto st21; - } - { - goto st0; - } - st21: - p+= 1; - if ( p == pe ) +case 20: + if ( (*p) == 108 ) + goto st21; + goto st0; +st21: + if ( ++p == pe ) goto _test_eof21; - st_case_21: - if ( ( (*( p))) == 115 ) { - goto st22; - } - { - goto st0; - } - st22: - p+= 1; - if ( p == pe ) +case 21: + if ( (*p) == 115 ) + goto st22; + goto st0; +st22: + if ( ++p == pe ) goto _test_eof22; - st_case_22: - if ( ( (*( p))) == 101 ) { - goto ctr31; - } - { - goto st0; - } - st23: - p+= 1; - if ( p == pe ) +case 22: + if ( (*p) == 101 ) + goto tr31; + goto st0; +st23: + if ( ++p == pe ) goto _test_eof23; - st_case_23: - if ( ( (*( p))) == 117 ) { - goto st24; - } - { - goto st0; - } - st24: - p+= 1; - if ( p == pe ) +case 23: + if ( (*p) == 117 ) + goto st24; + goto st0; +st24: + if ( ++p == pe ) goto _test_eof24; - st_case_24: - if ( ( (*( p))) == 108 ) { - goto st25; - } - { - goto st0; - } - st25: - p+= 1; - if ( p == pe ) +case 24: + if ( (*p) == 108 ) + goto st25; + goto st0; +st25: + if ( ++p == pe ) goto _test_eof25; - st_case_25: - if ( ( (*( p))) == 108 ) { - goto ctr34; - } - { - goto st0; - } - st26: - p+= 1; - if ( p == pe ) +case 25: + if ( (*p) == 108 ) + goto tr34; + goto st0; +st26: + if ( ++p == pe ) goto _test_eof26; - st_case_26: - if ( ( (*( p))) == 114 ) { - goto st27; - } - { - goto st0; - } - st27: - p+= 1; - if ( p == pe ) +case 26: + if ( (*p) == 114 ) + goto st27; + goto st0; +st27: + if ( ++p == pe ) goto _test_eof27; - st_case_27: - if ( ( (*( p))) == 117 ) { - goto st28; - } - { - goto st0; - } - st28: - p+= 1; - if ( p == pe ) +case 27: + if ( (*p) == 117 ) + goto st28; + goto st0; +st28: + if ( ++p == pe ) goto _test_eof28; - st_case_28: - if ( ( (*( p))) == 101 ) { - goto ctr37; - } - { - goto st0; - } - st_out: - _test_eof1: cs = 1; goto _test_eof; - _test_eof29: cs = 29; goto _test_eof; - _test_eof2: cs = 2; goto _test_eof; - _test_eof3: cs = 3; goto _test_eof; - _test_eof4: cs = 4; goto _test_eof; - _test_eof5: cs = 5; goto _test_eof; - _test_eof6: cs = 6; goto _test_eof; - _test_eof7: cs = 7; goto _test_eof; - _test_eof8: cs = 8; goto _test_eof; - _test_eof9: cs = 9; goto _test_eof; - _test_eof10: cs = 10; goto _test_eof; - _test_eof11: cs = 11; goto _test_eof; - _test_eof12: cs = 12; goto _test_eof; - _test_eof13: cs = 13; goto _test_eof; - _test_eof14: cs = 14; goto _test_eof; - _test_eof15: cs = 15; goto _test_eof; - _test_eof16: cs = 16; goto _test_eof; - _test_eof17: cs = 17; goto _test_eof; - _test_eof18: cs = 18; goto _test_eof; - _test_eof19: cs = 19; goto _test_eof; - _test_eof20: cs = 20; goto _test_eof; - _test_eof21: cs = 21; goto _test_eof; - _test_eof22: cs = 22; goto _test_eof; - _test_eof23: cs = 23; goto _test_eof; - _test_eof24: cs = 24; goto _test_eof; - _test_eof25: cs = 25; goto _test_eof; - _test_eof26: cs = 26; goto _test_eof; - _test_eof27: cs = 27; goto _test_eof; - _test_eof28: cs = 28; goto _test_eof; - - _test_eof: {} - _out: {} - } - - #line 291 "parser.rl" - - - if (json->freeze) { - OBJ_FREEZE(*result); - } - - if (cs >= JSON_value_first_final) { - return p; - } else { - return NULL; +case 28: + if ( (*p) == 101 ) + goto tr37; + goto st0; + } + _test_eof1: cs = 1; goto _test_eof; + _test_eof29: cs = 29; goto _test_eof; + _test_eof2: cs = 2; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; + _test_eof4: cs = 4; goto _test_eof; + _test_eof5: cs = 5; goto _test_eof; + _test_eof6: cs = 6; goto _test_eof; + _test_eof7: cs = 7; goto _test_eof; + _test_eof8: cs = 8; goto _test_eof; + _test_eof9: cs = 9; goto _test_eof; + _test_eof10: cs = 10; goto _test_eof; + _test_eof11: cs = 11; goto _test_eof; + _test_eof12: cs = 12; goto _test_eof; + _test_eof13: cs = 13; goto _test_eof; + _test_eof14: cs = 14; goto _test_eof; + _test_eof15: cs = 15; goto _test_eof; + _test_eof16: cs = 16; goto _test_eof; + _test_eof17: cs = 17; goto _test_eof; + _test_eof18: cs = 18; goto _test_eof; + _test_eof19: cs = 19; goto _test_eof; + _test_eof20: cs = 20; goto _test_eof; + _test_eof21: cs = 21; goto _test_eof; + _test_eof22: cs = 22; goto _test_eof; + _test_eof23: cs = 23; goto _test_eof; + _test_eof24: cs = 24; goto _test_eof; + _test_eof25: cs = 25; goto _test_eof; + _test_eof26: cs = 26; goto _test_eof; + _test_eof27: cs = 27; goto _test_eof; + _test_eof28: cs = 28; goto _test_eof; + + _test_eof: {} + _out: {} } + +#line 291 "parser.rl" + + if (json->freeze) { + OBJ_FREEZE(*result); + } + + if (cs >= JSON_value_first_final) { + return p; + } else { + return NULL; + } } +#line 884 "parser.c" enum {JSON_integer_start = 1}; enum {JSON_integer_first_final = 3}; enum {JSON_integer_error = 0}; enum {JSON_integer_en_main = 1}; -static const char MAYBE_UNUSED(_JSON_integer_nfa_targs)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_integer_nfa_offsets)[] = { - 0, 0, 0, 0, 0, 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_integer_nfa_push_actions)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_integer_nfa_pop_trans)[] = { - 0, 0 -}; - #line 311 "parser.rl" static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result) { - int cs = EVIL; + int cs = EVIL; +#line 900 "parser.c" { - cs = (int)JSON_integer_start; + cs = JSON_integer_start; } - #line 318 "parser.rl" - - json->memo = p; +#line 318 "parser.rl" + json->memo = p; +#line 908 "parser.c" { - if ( p == pe ) + if ( p == pe ) goto _test_eof; - switch ( cs ) - { - case 1: - goto st_case_1; - case 0: - goto st_case_0; - case 2: - goto st_case_2; - case 3: - goto st_case_3; - case 4: - goto st_case_4; - case 5: - goto st_case_5; - } - goto st_out; - st_case_1: - switch( ( (*( p))) ) { - case 45: { - goto st2; - } - case 48: { - goto st3; - } - } - if ( 49 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st5; - } - { - goto st0; - } - st_case_0: - st0: - cs = 0; - goto _out; - st2: - p+= 1; - if ( p == pe ) + switch ( cs ) + { +case 1: + switch( (*p) ) { + case 45: goto st2; + case 48: goto st3; + } + if ( 49 <= (*p) && (*p) <= 57 ) + goto st5; + goto st0; +st0: +cs = 0; + goto _out; +st2: + if ( ++p == pe ) goto _test_eof2; - st_case_2: - if ( ( (*( p))) == 48 ) { - goto st3; - } - if ( 49 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st5; - } - { - goto st0; - } - st3: - p+= 1; - if ( p == pe ) +case 2: + if ( (*p) == 48 ) + goto st3; + if ( 49 <= (*p) && (*p) <= 57 ) + goto st5; + goto st0; +st3: + if ( ++p == pe ) goto _test_eof3; - st_case_3: - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st0; - } - { - goto ctr4; - } - ctr4: - { - #line 308 "parser.rl" - {p = p - 1; } {p+= 1; cs = 4; goto _out;} } - - goto st4; - st4: - p+= 1; - if ( p == pe ) +case 3: + if ( 48 <= (*p) && (*p) <= 57 ) + goto st0; + goto tr4; +tr4: +#line 308 "parser.rl" + { p--; {p++; cs = 4; goto _out;} } + goto st4; +st4: + if ( ++p == pe ) goto _test_eof4; - st_case_4: - { - goto st0; - } - st5: - p+= 1; - if ( p == pe ) +case 4: +#line 949 "parser.c" + goto st0; +st5: + if ( ++p == pe ) goto _test_eof5; - st_case_5: - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st5; - } - { - goto ctr4; - } - st_out: - _test_eof2: cs = 2; goto _test_eof; - _test_eof3: cs = 3; goto _test_eof; - _test_eof4: cs = 4; goto _test_eof; - _test_eof5: cs = 5; goto _test_eof; - - _test_eof: {} - _out: {} - } - - #line 320 "parser.rl" - - - if (cs >= JSON_integer_first_final) { - long len = p - json->memo; - 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; +case 5: + if ( 48 <= (*p) && (*p) <= 57 ) + goto st5; + goto tr4; + } + _test_eof2: cs = 2; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; + _test_eof4: cs = 4; goto _test_eof; + _test_eof5: cs = 5; goto _test_eof; + + _test_eof: {} + _out: {} } + +#line 320 "parser.rl" + + if (cs >= JSON_integer_first_final) { + long len = p - json->memo; + 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; + } } +#line 983 "parser.c" enum {JSON_float_start = 1}; enum {JSON_float_first_final = 8}; enum {JSON_float_error = 0}; enum {JSON_float_en_main = 1}; -static const char MAYBE_UNUSED(_JSON_float_nfa_targs)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_float_nfa_offsets)[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_float_nfa_push_actions)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_float_nfa_pop_trans)[] = { - 0, 0 -}; - #line 345 "parser.rl" static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result) { - int cs = EVIL; + int cs = EVIL; +#line 999 "parser.c" { - cs = (int)JSON_float_start; + cs = JSON_float_start; } - #line 352 "parser.rl" - - json->memo = p; +#line 352 "parser.rl" + json->memo = p; +#line 1007 "parser.c" { - if ( p == pe ) + if ( p == pe ) goto _test_eof; - switch ( cs ) - { - case 1: - goto st_case_1; - case 0: - goto st_case_0; - case 2: - goto st_case_2; - case 3: - goto st_case_3; - case 4: - goto st_case_4; - case 8: - goto st_case_8; - case 9: - goto st_case_9; - case 5: - goto st_case_5; - case 6: - goto st_case_6; - case 10: - goto st_case_10; - case 7: - goto st_case_7; - } - goto st_out; - st_case_1: - switch( ( (*( p))) ) { - case 45: { - goto st2; - } - case 48: { - goto st3; - } - } - if ( 49 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st7; - } - { - goto st0; - } - st_case_0: - st0: - cs = 0; - goto _out; - st2: - p+= 1; - if ( p == pe ) + switch ( cs ) + { +case 1: + switch( (*p) ) { + case 45: goto st2; + case 48: goto st3; + } + if ( 49 <= (*p) && (*p) <= 57 ) + goto st7; + goto st0; +st0: +cs = 0; + goto _out; +st2: + if ( ++p == pe ) goto _test_eof2; - st_case_2: - if ( ( (*( p))) == 48 ) { - goto st3; - } - if ( 49 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st7; - } - { - goto st0; - } - st3: - p+= 1; - if ( p == pe ) +case 2: + if ( (*p) == 48 ) + goto st3; + if ( 49 <= (*p) && (*p) <= 57 ) + goto st7; + goto st0; +st3: + if ( ++p == pe ) goto _test_eof3; - st_case_3: - switch( ( (*( p))) ) { - case 46: { - goto st4; - } - case 69: { - goto st5; - } - case 101: { - goto st5; - } - } - { - goto st0; - } - st4: - p+= 1; - if ( p == pe ) +case 3: + switch( (*p) ) { + case 46: goto st4; + case 69: goto st5; + case 101: goto st5; + } + goto st0; +st4: + if ( ++p == pe ) goto _test_eof4; - st_case_4: - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st8; - } - { - goto st0; - } - st8: - p+= 1; - if ( p == pe ) +case 4: + if ( 48 <= (*p) && (*p) <= 57 ) + goto st8; + goto st0; +st8: + if ( ++p == pe ) goto _test_eof8; - st_case_8: - switch( ( (*( p))) ) { - case 69: { - goto st5; - } - case 101: { - goto st5; - } - } - if ( ( (*( p))) > 46 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st8; - } - } else if ( ( (*( p))) >= 45 ) { - goto st0; - } - { - goto ctr9; - } - ctr9: - { - #line 339 "parser.rl" - {p = p - 1; } {p+= 1; cs = 9; goto _out;} } - - goto st9; - st9: - p+= 1; - if ( p == pe ) +case 8: + switch( (*p) ) { + case 69: goto st5; + case 101: goto st5; + } + if ( (*p) > 46 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto st8; + } else if ( (*p) >= 45 ) + goto st0; + goto tr9; +tr9: +#line 339 "parser.rl" + { p--; {p++; cs = 9; goto _out;} } + goto st9; +st9: + if ( ++p == pe ) goto _test_eof9; - st_case_9: - { - goto st0; - } - st5: - p+= 1; - if ( p == pe ) +case 9: +#line 1072 "parser.c" + goto st0; +st5: + if ( ++p == pe ) goto _test_eof5; - st_case_5: - switch( ( (*( p))) ) { - case 43: { - goto st6; - } - case 45: { - goto st6; - } - } - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st10; - } - { - goto st0; - } - st6: - p+= 1; - if ( p == pe ) +case 5: + switch( (*p) ) { + case 43: goto st6; + case 45: goto st6; + } + if ( 48 <= (*p) && (*p) <= 57 ) + goto st10; + goto st0; +st6: + if ( ++p == pe ) goto _test_eof6; - st_case_6: - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st10; - } - { - goto st0; - } - st10: - p+= 1; - if ( p == pe ) +case 6: + if ( 48 <= (*p) && (*p) <= 57 ) + goto st10; + goto st0; +st10: + if ( ++p == pe ) goto _test_eof10; - st_case_10: - switch( ( (*( p))) ) { - case 69: { - goto st0; - } - case 101: { - goto st0; - } - } - if ( ( (*( p))) > 46 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st10; - } - } else if ( ( (*( p))) >= 45 ) { - goto st0; - } - { - goto ctr9; - } - st7: - p+= 1; - if ( p == pe ) +case 10: + switch( (*p) ) { + case 69: goto st0; + case 101: goto st0; + } + if ( (*p) > 46 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto st10; + } else if ( (*p) >= 45 ) + goto st0; + goto tr9; +st7: + if ( ++p == pe ) goto _test_eof7; - st_case_7: - switch( ( (*( p))) ) { - case 46: { - goto st4; - } - case 69: { - goto st5; - } - case 101: { - goto st5; - } - } - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st7; - } - { - goto st0; - } - st_out: - _test_eof2: cs = 2; goto _test_eof; - _test_eof3: cs = 3; goto _test_eof; - _test_eof4: cs = 4; goto _test_eof; - _test_eof8: cs = 8; goto _test_eof; - _test_eof9: cs = 9; goto _test_eof; - _test_eof5: cs = 5; goto _test_eof; - _test_eof6: cs = 6; goto _test_eof; - _test_eof10: cs = 10; goto _test_eof; - _test_eof7: cs = 7; goto _test_eof; - - _test_eof: {} - _out: {} - } - - #line 354 "parser.rl" - - - if (cs >= JSON_float_first_final) { - VALUE mod = Qnil; - ID method_id = 0; - if (rb_respond_to(json->decimal_class, i_try_convert)) { - mod = json->decimal_class; - method_id = i_try_convert; - } else if (rb_respond_to(json->decimal_class, i_new)) { - mod = json->decimal_class; - method_id = i_new; - } else if (RB_TYPE_P(json->decimal_class, T_CLASS)) { - VALUE name = rb_class_name(json->decimal_class); - const char *name_cstr = RSTRING_PTR(name); - const char *last_colon = strrchr(name_cstr, ':'); - if (last_colon) { - const char *mod_path_end = last_colon - 1; - VALUE mod_path = rb_str_substr(name, 0, mod_path_end - name_cstr); - mod = rb_path_to_class(mod_path); - - const char *method_name_beg = last_colon + 1; - long before_len = method_name_beg - name_cstr; - long len = RSTRING_LEN(name) - before_len; - VALUE method_name = rb_str_substr(name, before_len, len); - method_id = SYM2ID(rb_str_intern(method_name)); - } else { - mod = rb_mKernel; - method_id = SYM2ID(rb_str_intern(name)); - } - } - - long len = p - json->memo; - fbuffer_clear(json->fbuffer); - fbuffer_append(json->fbuffer, json->memo, len); - fbuffer_append_char(json->fbuffer, '\0'); - - if (method_id) { - VALUE text = rb_str_new2(FBUFFER_PTR(json->fbuffer)); - *result = rb_funcallv(mod, method_id, 1, &text); - } else { - *result = DBL2NUM(rb_cstr_to_dbl(FBUFFER_PTR(json->fbuffer), 1)); - } - - return p + 1; - } else { - return NULL; +case 7: + switch( (*p) ) { + case 46: goto st4; + case 69: goto st5; + case 101: goto st5; + } + if ( 48 <= (*p) && (*p) <= 57 ) + goto st7; + goto st0; + } + _test_eof2: cs = 2; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; + _test_eof4: cs = 4; goto _test_eof; + _test_eof8: cs = 8; goto _test_eof; + _test_eof9: cs = 9; goto _test_eof; + _test_eof5: cs = 5; goto _test_eof; + _test_eof6: cs = 6; goto _test_eof; + _test_eof10: cs = 10; goto _test_eof; + _test_eof7: cs = 7; goto _test_eof; + + _test_eof: {} + _out: {} } + +#line 354 "parser.rl" + + if (cs >= JSON_float_first_final) { + VALUE mod = Qnil; + ID method_id = 0; + if (rb_respond_to(json->decimal_class, i_try_convert)) { + mod = json->decimal_class; + method_id = i_try_convert; + } else if (rb_respond_to(json->decimal_class, i_new)) { + mod = json->decimal_class; + method_id = i_new; + } else if (RB_TYPE_P(json->decimal_class, T_CLASS)) { + VALUE name = rb_class_name(json->decimal_class); + const char *name_cstr = RSTRING_PTR(name); + const char *last_colon = strrchr(name_cstr, ':'); + if (last_colon) { + const char *mod_path_end = last_colon - 1; + VALUE mod_path = rb_str_substr(name, 0, mod_path_end - name_cstr); + mod = rb_path_to_class(mod_path); + + const char *method_name_beg = last_colon + 1; + long before_len = method_name_beg - name_cstr; + long len = RSTRING_LEN(name) - before_len; + VALUE method_name = rb_str_substr(name, before_len, len); + method_id = SYM2ID(rb_str_intern(method_name)); + } else { + mod = rb_mKernel; + method_id = SYM2ID(rb_str_intern(name)); + } + } + + long len = p - json->memo; + fbuffer_clear(json->fbuffer); + fbuffer_append(json->fbuffer, json->memo, len); + fbuffer_append_char(json->fbuffer, '\0'); + + if (method_id) { + VALUE text = rb_str_new2(FBUFFER_PTR(json->fbuffer)); + *result = rb_funcallv(mod, method_id, 1, &text); + } else { + *result = DBL2NUM(rb_cstr_to_dbl(FBUFFER_PTR(json->fbuffer), 1)); + } + + return p + 1; + } else { + return NULL; + } } +#line 1184 "parser.c" enum {JSON_array_start = 1}; enum {JSON_array_first_final = 17}; enum {JSON_array_error = 0}; enum {JSON_array_en_main = 1}; -static const char MAYBE_UNUSED(_JSON_array_nfa_targs)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_array_nfa_offsets)[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_array_nfa_push_actions)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_array_nfa_pop_trans)[] = { - 0, 0 -}; - #line 432 "parser.rl" static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result, int current_nesting) { - int cs = EVIL; - VALUE array_class = json->array_class; + int cs = EVIL; + VALUE array_class = json->array_class; - if (json->max_nesting && current_nesting > json->max_nesting) { - rb_raise(eNestingError, "nesting of %d is too deep", current_nesting); - } - *result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class); + if (json->max_nesting && current_nesting > json->max_nesting) { + rb_raise(eNestingError, "nesting of %d is too deep", current_nesting); + } + *result = NIL_P(array_class) ? rb_ary_new() : rb_class_new_instance(0, 0, array_class); +#line 1206 "parser.c" { - cs = (int)JSON_array_start; + cs = JSON_array_start; } - #line 445 "parser.rl" - +#line 445 "parser.rl" +#line 1213 "parser.c" { - if ( p == pe ) + if ( p == pe ) goto _test_eof; - switch ( cs ) - { - case 1: - goto st_case_1; - case 0: - goto st_case_0; - case 2: - goto st_case_2; - case 3: - goto st_case_3; - case 4: - goto st_case_4; - case 5: - goto st_case_5; - case 6: - goto st_case_6; - case 7: - goto st_case_7; - case 8: - goto st_case_8; - case 9: - goto st_case_9; - case 10: - goto st_case_10; - case 11: - goto st_case_11; - case 12: - goto st_case_12; - case 17: - goto st_case_17; - case 13: - goto st_case_13; - case 14: - goto st_case_14; - case 15: - goto st_case_15; - case 16: - goto st_case_16; - } - goto st_out; - st_case_1: - if ( ( (*( p))) == 91 ) { - goto st2; - } - { - goto st0; - } - st_case_0: - st0: - cs = 0; - goto _out; - st2: - p+= 1; - if ( p == pe ) + switch ( cs ) + { +case 1: + if ( (*p) == 91 ) + goto st2; + goto st0; +st0: +cs = 0; + goto _out; +st2: + if ( ++p == pe ) goto _test_eof2; - st_case_2: - switch( ( (*( p))) ) { - case 13: { - goto st2; - } - case 32: { - goto st2; - } - case 34: { - goto ctr2; - } - case 45: { - goto ctr2; - } - case 47: { - goto st13; - } - case 73: { - goto ctr2; - } - case 78: { - goto ctr2; - } - case 91: { - goto ctr2; - } - case 93: { - goto ctr4; - } - case 102: { - goto ctr2; - } - case 110: { - goto ctr2; - } - case 116: { - goto ctr2; - } - case 123: { - goto ctr2; - } - } - if ( ( (*( p))) > 10 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto ctr2; - } - } else if ( ( (*( p))) >= 9 ) { - goto st2; - } - { - goto st0; - } - ctr2: - { - #line 409 "parser.rl" - - VALUE v = Qnil; - char *np = JSON_parse_value(json, p, pe, &v, current_nesting); - if (np == NULL) { - {p = p - 1; } {p+= 1; cs = 3; goto _out;} - } else { - if (NIL_P(json->array_class)) { - rb_ary_push(*result, v); - } else { - rb_funcall(*result, i_leftshift, 1, v); - } - {p = (( np))-1;} - - } - } - - goto st3; - st3: - p+= 1; - if ( p == pe ) +case 2: + switch( (*p) ) { + case 13: goto st2; + case 32: goto st2; + case 34: goto tr2; + case 45: goto tr2; + case 47: goto st13; + case 73: goto tr2; + case 78: goto tr2; + case 91: goto tr2; + case 93: goto tr4; + case 102: goto tr2; + case 110: goto tr2; + case 116: goto tr2; + case 123: goto tr2; + } + if ( (*p) > 10 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr2; + } else if ( (*p) >= 9 ) + goto st2; + goto st0; +tr2: +#line 409 "parser.rl" + { + VALUE v = Qnil; + char *np = JSON_parse_value(json, p, pe, &v, current_nesting); + if (np == NULL) { + p--; {p++; cs = 3; goto _out;} + } else { + if (NIL_P(json->array_class)) { + rb_ary_push(*result, v); + } else { + rb_funcall(*result, i_leftshift, 1, v); + } + {p = (( np))-1;} + } + } + goto st3; +st3: + if ( ++p == pe ) goto _test_eof3; - st_case_3: - switch( ( (*( p))) ) { - case 13: { - goto st3; - } - case 32: { - goto st3; - } - case 44: { - goto st4; - } - case 47: { - goto st9; - } - case 93: { - goto ctr4; - } - } - if ( 9 <= ( (*( p))) && ( (*( p))) <= 10 ) { - goto st3; - } - { - goto st0; - } - st4: - p+= 1; - if ( p == pe ) +case 3: +#line 1272 "parser.c" + switch( (*p) ) { + case 13: goto st3; + case 32: goto st3; + case 44: goto st4; + case 47: goto st9; + case 93: goto tr4; + } + if ( 9 <= (*p) && (*p) <= 10 ) + goto st3; + goto st0; +st4: + if ( ++p == pe ) goto _test_eof4; - st_case_4: - switch( ( (*( p))) ) { - case 13: { - goto st4; - } - case 32: { - goto st4; - } - case 34: { - goto ctr2; - } - case 45: { - goto ctr2; - } - case 47: { - goto st5; - } - case 73: { - goto ctr2; - } - case 78: { - goto ctr2; - } - case 91: { - goto ctr2; - } - case 102: { - goto ctr2; - } - case 110: { - goto ctr2; - } - case 116: { - goto ctr2; - } - case 123: { - goto ctr2; - } - } - if ( ( (*( p))) > 10 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto ctr2; - } - } else if ( ( (*( p))) >= 9 ) { - goto st4; - } - { - goto st0; - } - st5: - p+= 1; - if ( p == pe ) +case 4: + switch( (*p) ) { + case 13: goto st4; + case 32: goto st4; + case 34: goto tr2; + case 45: goto tr2; + case 47: goto st5; + case 73: goto tr2; + case 78: goto tr2; + case 91: goto tr2; + case 102: goto tr2; + case 110: goto tr2; + case 116: goto tr2; + case 123: goto tr2; + } + if ( (*p) > 10 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr2; + } else if ( (*p) >= 9 ) + goto st4; + goto st0; +st5: + if ( ++p == pe ) goto _test_eof5; - st_case_5: - switch( ( (*( p))) ) { - case 42: { - goto st6; - } - case 47: { - goto st8; - } - } - { - goto st0; - } - st6: - p+= 1; - if ( p == pe ) +case 5: + switch( (*p) ) { + case 42: goto st6; + case 47: goto st8; + } + goto st0; +st6: + if ( ++p == pe ) goto _test_eof6; - st_case_6: - if ( ( (*( p))) == 42 ) { - goto st7; - } - { - goto st6; - } - st7: - p+= 1; - if ( p == pe ) +case 6: + if ( (*p) == 42 ) + goto st7; + goto st6; +st7: + if ( ++p == pe ) goto _test_eof7; - st_case_7: - switch( ( (*( p))) ) { - case 42: { - goto st7; - } - case 47: { - goto st4; - } - } - { - goto st6; - } - st8: - p+= 1; - if ( p == pe ) +case 7: + switch( (*p) ) { + case 42: goto st7; + case 47: goto st4; + } + goto st6; +st8: + if ( ++p == pe ) goto _test_eof8; - st_case_8: - if ( ( (*( p))) == 10 ) { - goto st4; - } - { - goto st8; - } - st9: - p+= 1; - if ( p == pe ) +case 8: + if ( (*p) == 10 ) + goto st4; + goto st8; +st9: + if ( ++p == pe ) goto _test_eof9; - st_case_9: - switch( ( (*( p))) ) { - case 42: { - goto st10; - } - case 47: { - goto st12; - } - } - { - goto st0; - } - st10: - p+= 1; - if ( p == pe ) +case 9: + switch( (*p) ) { + case 42: goto st10; + case 47: goto st12; + } + goto st0; +st10: + if ( ++p == pe ) goto _test_eof10; - st_case_10: - if ( ( (*( p))) == 42 ) { - goto st11; - } - { - goto st10; - } - st11: - p+= 1; - if ( p == pe ) +case 10: + if ( (*p) == 42 ) + goto st11; + goto st10; +st11: + if ( ++p == pe ) goto _test_eof11; - st_case_11: - switch( ( (*( p))) ) { - case 42: { - goto st11; - } - case 47: { - goto st3; - } - } - { - goto st10; - } - st12: - p+= 1; - if ( p == pe ) +case 11: + switch( (*p) ) { + case 42: goto st11; + case 47: goto st3; + } + goto st10; +st12: + if ( ++p == pe ) goto _test_eof12; - st_case_12: - if ( ( (*( p))) == 10 ) { - goto st3; - } - { - goto st12; - } - ctr4: - { - #line 424 "parser.rl" - {p = p - 1; } {p+= 1; cs = 17; goto _out;} } - - goto st17; - st17: - p+= 1; - if ( p == pe ) +case 12: + if ( (*p) == 10 ) + goto st3; + goto st12; +tr4: +#line 424 "parser.rl" + { p--; {p++; cs = 17; goto _out;} } + goto st17; +st17: + if ( ++p == pe ) goto _test_eof17; - st_case_17: - { - goto st0; - } - st13: - p+= 1; - if ( p == pe ) +case 17: +#line 1379 "parser.c" + goto st0; +st13: + if ( ++p == pe ) goto _test_eof13; - st_case_13: - switch( ( (*( p))) ) { - case 42: { - goto st14; - } - case 47: { - goto st16; - } - } - { - goto st0; - } - st14: - p+= 1; - if ( p == pe ) +case 13: + switch( (*p) ) { + case 42: goto st14; + case 47: goto st16; + } + goto st0; +st14: + if ( ++p == pe ) goto _test_eof14; - st_case_14: - if ( ( (*( p))) == 42 ) { - goto st15; - } - { - goto st14; - } - st15: - p+= 1; - if ( p == pe ) +case 14: + if ( (*p) == 42 ) + goto st15; + goto st14; +st15: + if ( ++p == pe ) goto _test_eof15; - st_case_15: - switch( ( (*( p))) ) { - case 42: { - goto st15; - } - case 47: { - goto st2; - } - } - { - goto st14; - } - st16: - p+= 1; - if ( p == pe ) +case 15: + switch( (*p) ) { + case 42: goto st15; + case 47: goto st2; + } + goto st14; +st16: + if ( ++p == pe ) goto _test_eof16; - st_case_16: - if ( ( (*( p))) == 10 ) { - goto st2; - } - { - goto st16; - } - st_out: - _test_eof2: cs = 2; goto _test_eof; - _test_eof3: cs = 3; goto _test_eof; - _test_eof4: cs = 4; goto _test_eof; - _test_eof5: cs = 5; goto _test_eof; - _test_eof6: cs = 6; goto _test_eof; - _test_eof7: cs = 7; goto _test_eof; - _test_eof8: cs = 8; goto _test_eof; - _test_eof9: cs = 9; goto _test_eof; - _test_eof10: cs = 10; goto _test_eof; - _test_eof11: cs = 11; goto _test_eof; - _test_eof12: cs = 12; goto _test_eof; - _test_eof17: cs = 17; goto _test_eof; - _test_eof13: cs = 13; goto _test_eof; - _test_eof14: cs = 14; goto _test_eof; - _test_eof15: cs = 15; goto _test_eof; - _test_eof16: cs = 16; goto _test_eof; - - _test_eof: {} - _out: {} - } - - #line 446 "parser.rl" - - - if(cs >= JSON_array_first_final) { - return p + 1; - } else { - rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p); - return NULL; +case 16: + if ( (*p) == 10 ) + goto st2; + goto st16; } + _test_eof2: cs = 2; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; + _test_eof4: cs = 4; goto _test_eof; + _test_eof5: cs = 5; goto _test_eof; + _test_eof6: cs = 6; goto _test_eof; + _test_eof7: cs = 7; goto _test_eof; + _test_eof8: cs = 8; goto _test_eof; + _test_eof9: cs = 9; goto _test_eof; + _test_eof10: cs = 10; goto _test_eof; + _test_eof11: cs = 11; goto _test_eof; + _test_eof12: cs = 12; goto _test_eof; + _test_eof17: cs = 17; goto _test_eof; + _test_eof13: cs = 13; goto _test_eof; + _test_eof14: cs = 14; goto _test_eof; + _test_eof15: cs = 15; goto _test_eof; + _test_eof16: cs = 16; goto _test_eof; + + _test_eof: {} + _out: {} + } + +#line 446 "parser.rl" + + if(cs >= JSON_array_first_final) { + return p + 1; + } else { + rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p); + return NULL; + } } static const size_t MAX_STACK_BUFFER_SIZE = 128; static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int symbolize) { - VALUE result = Qnil; - size_t bufferSize = stringEnd - string; - char *p = string, *pe = string, *unescape, *bufferStart, *buffer; - int unescape_len; - char buf[4]; + VALUE result = Qnil; + size_t bufferSize = stringEnd - string; + char *p = string, *pe = string, *unescape, *bufferStart, *buffer; + int unescape_len; + char buf[4]; - if (bufferSize > MAX_STACK_BUFFER_SIZE) { + if (bufferSize > MAX_STACK_BUFFER_SIZE) { # ifdef HAVE_RB_ENC_INTERNED_STR - bufferStart = buffer = ALLOC_N(char, bufferSize ? bufferSize : 1); + bufferStart = buffer = ALLOC_N(char, bufferSize ? bufferSize : 1); # else - bufferStart = buffer = ALLOC_N(char, bufferSize); + bufferStart = buffer = ALLOC_N(char, bufferSize); # endif - } else { + } else { # ifdef HAVE_RB_ENC_INTERNED_STR - bufferStart = buffer = ALLOCA_N(char, bufferSize ? bufferSize : 1); + bufferStart = buffer = ALLOCA_N(char, bufferSize ? bufferSize : 1); # else - bufferStart = buffer = ALLOCA_N(char, bufferSize); + bufferStart = buffer = ALLOCA_N(char, bufferSize); # endif - } - - while (pe < stringEnd) { - if (*pe == '\\') { - unescape = (char *) "?"; - unescape_len = 1; - if (pe > p) { - MEMCPY(buffer, p, char, pe - p); - buffer += pe - p; - } - switch (*++pe) { - case 'n': - unescape = (char *) "\n"; - break; - case 'r': - unescape = (char *) "\r"; - break; - case 't': - unescape = (char *) "\t"; - break; - case '"': - unescape = (char *) "\""; - break; - case '\\': - unescape = (char *) "\\"; - break; - case 'b': - unescape = (char *) "\b"; - break; - case 'f': - unescape = (char *) "\f"; - break; - case 'u': - if (pe > stringEnd - 4) { - if (bufferSize > MAX_STACK_BUFFER_SIZE) { - free(bufferStart); - } - rb_enc_raise( - EXC_ENCODING eParserError, - "incomplete unicode character escape sequence at '%s'", p - ); - } else { - UTF32 ch = unescape_unicode((unsigned char *) ++pe); - pe += 3; - if (UNI_SUR_HIGH_START == (ch & 0xFC00)) { - pe++; - if (pe > stringEnd - 6) { - if (bufferSize > MAX_STACK_BUFFER_SIZE) { - free(bufferStart); - } - rb_enc_raise( - EXC_ENCODING eParserError, - "incomplete surrogate pair at '%s'", p - ); - } - if (pe[0] == '\\' && pe[1] == 'u') { - UTF32 sur = unescape_unicode((unsigned char *) pe + 2); - ch = (((ch & 0x3F) << 10) | ((((ch >> 6) & 0xF) + 1) << 16) - | (sur & 0x3FF)); - pe += 5; - } else { - unescape = (char *) "?"; - break; - } - } - unescape_len = convert_UTF32_to_UTF8(buf, ch); - unescape = buf; - } - break; - default: - p = pe; - continue; - } - MEMCPY(buffer, unescape, char, unescape_len); - buffer += unescape_len; - p = ++pe; - } else { - pe++; - } - } - - if (pe > p) { - MEMCPY(buffer, p, char, pe - p); - buffer += pe - p; - } - - # ifdef HAVE_RB_ENC_INTERNED_STR - if (intern) { - result = rb_enc_interned_str(bufferStart, (long)(buffer - bufferStart), rb_utf8_encoding()); - } else { - result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart)); - } - if (bufferSize > MAX_STACK_BUFFER_SIZE) { - free(bufferStart); - } - # else - result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart)); + } + + while (pe < stringEnd) { + if (*pe == '\\') { + unescape = (char *) "?"; + unescape_len = 1; + if (pe > p) { + MEMCPY(buffer, p, char, pe - p); + buffer += pe - p; + } + switch (*++pe) { + case 'n': + unescape = (char *) "\n"; + break; + case 'r': + unescape = (char *) "\r"; + break; + case 't': + unescape = (char *) "\t"; + break; + case '"': + unescape = (char *) "\""; + break; + case '\\': + unescape = (char *) "\\"; + break; + case 'b': + unescape = (char *) "\b"; + break; + case 'f': + unescape = (char *) "\f"; + break; + case 'u': + if (pe > stringEnd - 4) { + if (bufferSize > MAX_STACK_BUFFER_SIZE) { + ruby_xfree(bufferStart); + } + rb_enc_raise( + EXC_ENCODING eParserError, + "incomplete unicode character escape sequence at '%s'", p + ); + } else { + UTF32 ch = unescape_unicode((unsigned char *) ++pe); + pe += 3; + if (UNI_SUR_HIGH_START == (ch & 0xFC00)) { + pe++; + if (pe > stringEnd - 6) { + if (bufferSize > MAX_STACK_BUFFER_SIZE) { + ruby_xfree(bufferStart); + } + rb_enc_raise( + EXC_ENCODING eParserError, + "incomplete surrogate pair at '%s'", p + ); + } + if (pe[0] == '\\' && pe[1] == 'u') { + UTF32 sur = unescape_unicode((unsigned char *) pe + 2); + ch = (((ch & 0x3F) << 10) | ((((ch >> 6) & 0xF) + 1) << 16) + | (sur & 0x3FF)); + pe += 5; + } else { + unescape = (char *) "?"; + break; + } + } + unescape_len = convert_UTF32_to_UTF8(buf, ch); + unescape = buf; + } + break; + default: + p = pe; + continue; + } + MEMCPY(buffer, unescape, char, unescape_len); + buffer += unescape_len; + p = ++pe; + } else { + pe++; + } + } + + if (pe > p) { + MEMCPY(buffer, p, char, pe - p); + buffer += pe - p; + } - if (bufferSize > MAX_STACK_BUFFER_SIZE) { - free(bufferStart); - } - - if (intern) { - # if STR_UMINUS_DEDUPE_FROZEN - // Starting from MRI 2.8 it is preferable to freeze the string - // before deduplication so that it can be interned directly - // otherwise it would be duplicated first which is wasteful. - result = rb_funcall(rb_str_freeze(result), i_uminus, 0); - # elif STR_UMINUS_DEDUPE - // MRI 2.5 and older do not deduplicate strings that are already - // frozen. - result = rb_funcall(result, i_uminus, 0); - # else - result = rb_str_freeze(result); - # endif - } - # endif +# ifdef HAVE_RB_ENC_INTERNED_STR + if (intern) { + result = rb_enc_interned_str(bufferStart, (long)(buffer - bufferStart), rb_utf8_encoding()); + } else { + result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart)); + } + if (bufferSize > MAX_STACK_BUFFER_SIZE) { + ruby_xfree(bufferStart); + } +# else + result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart)); + + if (bufferSize > MAX_STACK_BUFFER_SIZE) { + ruby_xfree(bufferStart); + } + + if (intern) { + # if STR_UMINUS_DEDUPE_FROZEN + // Starting from MRI 2.8 it is preferable to freeze the string + // before deduplication so that it can be interned directly + // otherwise it would be duplicated first which is wasteful. + result = rb_funcall(rb_str_freeze(result), i_uminus, 0); + # elif STR_UMINUS_DEDUPE + // MRI 2.5 and older do not deduplicate strings that are already + // frozen. + result = rb_funcall(result, i_uminus, 0); + # else + result = rb_str_freeze(result); + # endif + } +# endif - if (symbolize) { - result = rb_str_intern(result); - } + if (symbolize) { + result = rb_str_intern(result); + } - return result; + return result; } +#line 1592 "parser.c" enum {JSON_string_start = 1}; enum {JSON_string_first_final = 8}; enum {JSON_string_error = 0}; enum {JSON_string_en_main = 1}; -static const char MAYBE_UNUSED(_JSON_string_nfa_targs)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_string_nfa_offsets)[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0 -}; -static const char MAYBE_UNUSED(_JSON_string_nfa_push_actions)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_string_nfa_pop_trans)[] = { - 0, 0 -}; - - -#line 612 "parser.rl" +#line 620 "parser.rl" static int match_i(VALUE regexp, VALUE klass, VALUE memo) { - if (regexp == Qundef) return ST_STOP; - if (RTEST(rb_funcall(klass, i_json_creatable_p, 0)) && - RTEST(rb_funcall(regexp, i_match, 1, rb_ary_entry(memo, 0)))) { - rb_ary_push(memo, klass); - return ST_STOP; - } - return ST_CONTINUE; + if (regexp == Qundef) return ST_STOP; + if (RTEST(rb_funcall(klass, i_json_creatable_p, 0)) && + RTEST(rb_funcall(regexp, i_match, 1, rb_ary_entry(memo, 0)))) { + rb_ary_push(memo, klass); + return ST_STOP; + } + return ST_CONTINUE; } static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result) { - int cs = EVIL; - VALUE match_string; + int cs = EVIL; + VALUE match_string; +#line 1621 "parser.c" { - cs = (int)JSON_string_start; + cs = JSON_string_start; } - #line 632 "parser.rl" - - json->memo = p; +#line 640 "parser.rl" + json->memo = p; +#line 1629 "parser.c" { - if ( p == pe ) + if ( p == pe ) goto _test_eof; - switch ( cs ) - { - case 1: - goto st_case_1; - case 0: - goto st_case_0; - case 2: - goto st_case_2; - case 8: - goto st_case_8; - case 3: - goto st_case_3; - case 4: - goto st_case_4; - case 5: - goto st_case_5; - case 6: - goto st_case_6; - case 7: - goto st_case_7; - } - goto st_out; - st_case_1: - if ( ( (*( p))) == 34 ) { - goto st2; - } - { - goto st0; - } - st_case_0: - st0: - cs = 0; - goto _out; - st2: - p+= 1; - if ( p == pe ) + switch ( cs ) + { +case 1: + if ( (*p) == 34 ) + goto st2; + goto st0; +st0: +cs = 0; + goto _out; +st2: + if ( ++p == pe ) goto _test_eof2; - st_case_2: - switch( ( (*( p))) ) { - case 34: { - goto ctr2; - } - case 92: { - goto st3; - } - } - if ( 0 <= (signed char)(*(p)) && (*(p)) <= 31 ) { - goto st0; - } - { - goto st2; - } - ctr2: - { - #line 599 "parser.rl" - - *result = json_string_unescape(json->memo + 1, p, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names); - if (NIL_P(*result)) { - {p = p - 1; } - {p+= 1; cs = 8; goto _out;} - } else { - {p = (( p + 1))-1;} - - } - } - { - #line 609 "parser.rl" - {p = p - 1; } {p+= 1; cs = 8; goto _out;} } - - goto st8; - st8: - p+= 1; - if ( p == pe ) +case 2: + switch( (*p) ) { + case 34: goto tr2; + case 92: goto st3; + } + if ( 0 <= (signed char)(*(p)) && (*(p)) <= 31 ) + goto st0; + goto st2; +tr2: +#line 607 "parser.rl" + { + *result = json_string_unescape(json->memo + 1, p, json->parsing_name || json-> freeze, json->parsing_name && json->symbolize_names); + if (NIL_P(*result)) { + p--; + {p++; cs = 8; goto _out;} + } else { + {p = (( p + 1))-1;} + } + } +#line 617 "parser.rl" + { p--; {p++; cs = 8; goto _out;} } + goto st8; +st8: + if ( ++p == pe ) goto _test_eof8; - st_case_8: - { - goto st0; - } - st3: - p+= 1; - if ( p == pe ) +case 8: +#line 1671 "parser.c" + goto st0; +st3: + if ( ++p == pe ) goto _test_eof3; - st_case_3: - if ( ( (*( p))) == 117 ) { - goto st4; - } - if ( 0 <= (signed char)(*(p)) && (*(p)) <= 31 ) { - goto st0; - } - { - goto st2; - } - st4: - p+= 1; - if ( p == pe ) +case 3: + if ( (*p) == 117 ) + goto st4; + if ( 0 <= (signed char)(*(p)) && (*(p)) <= 31 ) + goto st0; + goto st2; +st4: + if ( ++p == pe ) goto _test_eof4; - st_case_4: - if ( ( (*( p))) < 65 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st5; - } - } else if ( ( (*( p))) > 70 ) { - if ( 97 <= ( (*( p))) && ( (*( p))) <= 102 ) { - goto st5; - } - } else { +case 4: + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) goto st5; - } - { - goto st0; - } - st5: - p+= 1; - if ( p == pe ) + } else if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st5; + } else + goto st5; + goto st0; +st5: + if ( ++p == pe ) goto _test_eof5; - st_case_5: - if ( ( (*( p))) < 65 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st6; - } - } else if ( ( (*( p))) > 70 ) { - if ( 97 <= ( (*( p))) && ( (*( p))) <= 102 ) { - goto st6; - } - } else { +case 5: + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto st6; + } else if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) goto st6; - } - { - goto st0; - } - st6: - p+= 1; - if ( p == pe ) + } else + goto st6; + goto st0; +st6: + if ( ++p == pe ) goto _test_eof6; - st_case_6: - if ( ( (*( p))) < 65 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st7; - } - } else if ( ( (*( p))) > 70 ) { - if ( 97 <= ( (*( p))) && ( (*( p))) <= 102 ) { - goto st7; - } - } else { +case 6: + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) goto st7; - } - { - goto st0; - } - st7: - p+= 1; - if ( p == pe ) + } else if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st7; + } else + goto st7; + goto st0; +st7: + if ( ++p == pe ) goto _test_eof7; - st_case_7: - if ( ( (*( p))) < 65 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto st2; - } - } else if ( ( (*( p))) > 70 ) { - if ( 97 <= ( (*( p))) && ( (*( p))) <= 102 ) { - goto st2; - } - } else { +case 7: + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) goto st2; - } - { - goto st0; - } - st_out: - _test_eof2: cs = 2; goto _test_eof; - _test_eof8: cs = 8; goto _test_eof; - _test_eof3: cs = 3; goto _test_eof; - _test_eof4: cs = 4; goto _test_eof; - _test_eof5: cs = 5; goto _test_eof; - _test_eof6: cs = 6; goto _test_eof; - _test_eof7: cs = 7; goto _test_eof; - - _test_eof: {} - _out: {} - } - - #line 634 "parser.rl" - - - if (json->create_additions && RTEST(match_string = json->match_string)) { - VALUE klass; - VALUE memo = rb_ary_new2(2); - rb_ary_push(memo, *result); - rb_hash_foreach(match_string, match_i, memo); - klass = rb_ary_entry(memo, 1); - if (RTEST(klass)) { - *result = rb_funcall(klass, i_json_create, 1, *result); - } - } - - if (cs >= JSON_string_first_final) { - return p + 1; - } else { - return NULL; + } else if ( (*p) > 70 ) { + if ( 97 <= (*p) && (*p) <= 102 ) + goto st2; + } else + goto st2; + goto st0; } + _test_eof2: cs = 2; goto _test_eof; + _test_eof8: cs = 8; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; + _test_eof4: cs = 4; goto _test_eof; + _test_eof5: cs = 5; goto _test_eof; + _test_eof6: cs = 6; goto _test_eof; + _test_eof7: cs = 7; goto _test_eof; + + _test_eof: {} + _out: {} + } + +#line 642 "parser.rl" + + if (json->create_additions && RTEST(match_string = json->match_string)) { + VALUE klass; + VALUE memo = rb_ary_new2(2); + rb_ary_push(memo, *result); + rb_hash_foreach(match_string, match_i, memo); + klass = rb_ary_entry(memo, 1); + if (RTEST(klass)) { + *result = rb_funcall(klass, i_json_create, 1, *result); + } + } + + if (cs >= JSON_string_first_final) { + return p + 1; + } else { + return NULL; + } } /* -* Document-class: JSON::Ext::Parser -* -* This is the JSON parser implemented as a C extension. It can be configured -* to be used by setting -* -* JSON.parser = JSON::Ext::Parser -* -* with the method parser= in JSON. -* -*/ + * Document-class: JSON::Ext::Parser + * + * This is the JSON parser implemented as a C extension. It can be configured + * to be used by setting + * + * JSON.parser = JSON::Ext::Parser + * + * with the method parser= in JSON. + * + */ static VALUE convert_encoding(VALUE source) { - #ifdef HAVE_RUBY_ENCODING_H - rb_encoding *enc = rb_enc_get(source); - if (enc == rb_ascii8bit_encoding()) { - if (OBJ_FROZEN(source)) { - source = rb_str_dup(source); - } - FORCE_UTF8(source); - } else { - source = rb_str_conv_enc(source, rb_enc_get(source), rb_utf8_encoding()); - } - #endif - return source; +#ifdef HAVE_RUBY_ENCODING_H + rb_encoding *enc = rb_enc_get(source); + if (enc == rb_ascii8bit_encoding()) { + if (OBJ_FROZEN(source)) { + source = rb_str_dup(source); + } + FORCE_UTF8(source); + } else { + source = rb_str_conv_enc(source, rb_enc_get(source), rb_utf8_encoding()); + } +#endif + return source; } /* -* call-seq: new(source, opts => {}) -* -* Creates a new JSON::Ext::Parser instance for the string _source_. -* -* Creates a new JSON::Ext::Parser instance for the string _source_. -* -* It will be configured by the _opts_ hash. _opts_ can have the following -* keys: -* -* _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 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. -* * *symbolize_names*: If set to true, returns symbols for the names -* (keys) in a JSON object. Otherwise strings are returned, which is -* also the default. It's not possible to use this option in -* conjunction with the *create_additions* option. -* * *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. -* * *object_class*: Defaults to Hash -* * *array_class*: Defaults to Array -*/ + * call-seq: new(source, opts => {}) + * + * Creates a new JSON::Ext::Parser instance for the string _source_. + * + * It will be configured by the _opts_ hash. _opts_ can have the following + * keys: + * + * _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 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. + * * *symbolize_names*: If set to true, returns symbols for the names + * (keys) in a JSON object. Otherwise strings are returned, which is + * also the default. It's not possible to use this option in + * conjunction with the *create_additions* option. + * * *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. + * * *object_class*: Defaults to Hash + * * *array_class*: Defaults to Array + */ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) { - VALUE source, opts; - GET_PARSER_INIT; - - if (json->Vsource) { - rb_raise(rb_eTypeError, "already initialized instance"); - } - #ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH - rb_scan_args(argc, argv, "1:", &source, &opts); - #else - rb_scan_args(argc, argv, "11", &source, &opts); - #endif - if (!NIL_P(opts)) { - #ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH - opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); - if (NIL_P(opts)) { - rb_raise(rb_eArgError, "opts needs to be like a hash"); - } else { - #endif - VALUE tmp = ID2SYM(i_max_nesting); - if (option_given_p(opts, tmp)) { - VALUE max_nesting = rb_hash_aref(opts, tmp); - if (RTEST(max_nesting)) { - Check_Type(max_nesting, T_FIXNUM); - json->max_nesting = FIX2INT(max_nesting); - } else { - json->max_nesting = 0; - } - } else { - json->max_nesting = 100; - } - tmp = ID2SYM(i_allow_nan); - if (option_given_p(opts, tmp)) { - json->allow_nan = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; - } else { - json->allow_nan = 0; - } - tmp = ID2SYM(i_symbolize_names); - if (option_given_p(opts, tmp)) { - json->symbolize_names = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; - } else { - json->symbolize_names = 0; - } - tmp = ID2SYM(i_freeze); - if (option_given_p(opts, tmp)) { - json->freeze = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; - } else { - json->freeze = 0; - } - tmp = ID2SYM(i_create_additions); - if (option_given_p(opts, tmp)) { - json->create_additions = RTEST(rb_hash_aref(opts, tmp)); - } else { - json->create_additions = 0; - } - if (json->symbolize_names && json->create_additions) { - rb_raise(rb_eArgError, - "options :symbolize_names and :create_additions cannot be " - " used in conjunction"); - } - tmp = ID2SYM(i_create_id); - if (option_given_p(opts, tmp)) { - json->create_id = rb_hash_aref(opts, tmp); - } else { - json->create_id = rb_funcall(mJSON, i_create_id, 0); - } - tmp = ID2SYM(i_object_class); - if (option_given_p(opts, tmp)) { - json->object_class = rb_hash_aref(opts, tmp); - } else { - json->object_class = Qnil; - } - tmp = ID2SYM(i_array_class); - if (option_given_p(opts, tmp)) { - json->array_class = rb_hash_aref(opts, tmp); - } else { - json->array_class = Qnil; - } - tmp = ID2SYM(i_decimal_class); - if (option_given_p(opts, tmp)) { - json->decimal_class = rb_hash_aref(opts, tmp); - } else { - json->decimal_class = Qnil; - } - tmp = ID2SYM(i_match_string); - if (option_given_p(opts, tmp)) { - VALUE match_string = rb_hash_aref(opts, tmp); - json->match_string = RTEST(match_string) ? match_string : Qnil; - } else { - json->match_string = Qnil; - } - #ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH - } - #endif + VALUE source, opts; + GET_PARSER_INIT; + + if (json->Vsource) { + rb_raise(rb_eTypeError, "already initialized instance"); + } + rb_scan_args(argc, argv, "1:", &source, &opts); + if (!NIL_P(opts)) { + VALUE tmp = ID2SYM(i_max_nesting); + if (option_given_p(opts, tmp)) { + VALUE max_nesting = rb_hash_aref(opts, tmp); + if (RTEST(max_nesting)) { + Check_Type(max_nesting, T_FIXNUM); + json->max_nesting = FIX2INT(max_nesting); + } else { + json->max_nesting = 0; + } + } else { + json->max_nesting = 100; + } + tmp = ID2SYM(i_allow_nan); + if (option_given_p(opts, tmp)) { + json->allow_nan = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; + } else { + json->allow_nan = 0; + } + tmp = ID2SYM(i_symbolize_names); + if (option_given_p(opts, tmp)) { + json->symbolize_names = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; + } else { + json->symbolize_names = 0; + } + tmp = ID2SYM(i_freeze); + if (option_given_p(opts, tmp)) { + json->freeze = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; + } else { + json->freeze = 0; + } + tmp = ID2SYM(i_create_additions); + if (option_given_p(opts, tmp)) { + json->create_additions = RTEST(rb_hash_aref(opts, tmp)); + } else { + json->create_additions = 0; + } + if (json->symbolize_names && json->create_additions) { + rb_raise(rb_eArgError, + "options :symbolize_names and :create_additions cannot be " + " used in conjunction"); + } + tmp = ID2SYM(i_create_id); + if (option_given_p(opts, tmp)) { + json->create_id = rb_hash_aref(opts, tmp); + } else { + json->create_id = rb_funcall(mJSON, i_create_id, 0); + } + tmp = ID2SYM(i_object_class); + if (option_given_p(opts, tmp)) { + json->object_class = rb_hash_aref(opts, tmp); + } else { + json->object_class = Qnil; + } + tmp = ID2SYM(i_array_class); + if (option_given_p(opts, tmp)) { + json->array_class = rb_hash_aref(opts, tmp); + } else { + json->array_class = Qnil; + } + tmp = ID2SYM(i_decimal_class); + if (option_given_p(opts, tmp)) { + json->decimal_class = rb_hash_aref(opts, tmp); } else { - json->max_nesting = 100; - json->allow_nan = 0; - json->create_additions = 0; - json->create_id = rb_funcall(mJSON, i_create_id, 0); - json->object_class = Qnil; - json->array_class = Qnil; - json->decimal_class = Qnil; - } - source = convert_encoding(StringValue(source)); - StringValue(source); - json->len = RSTRING_LEN(source); - json->source = RSTRING_PTR(source);; - json->Vsource = source; - return self; + json->decimal_class = Qnil; + } + tmp = ID2SYM(i_match_string); + if (option_given_p(opts, tmp)) { + VALUE match_string = rb_hash_aref(opts, tmp); + json->match_string = RTEST(match_string) ? match_string : Qnil; + } else { + json->match_string = Qnil; + } + } else { + json->max_nesting = 100; + json->allow_nan = 0; + json->create_additions = 0; + json->create_id = Qnil; + json->object_class = Qnil; + json->array_class = Qnil; + json->decimal_class = Qnil; + } + source = convert_encoding(StringValue(source)); + StringValue(source); + json->len = RSTRING_LEN(source); + json->source = RSTRING_PTR(source);; + json->Vsource = source; + return self; } +#line 1920 "parser.c" enum {JSON_start = 1}; enum {JSON_first_final = 10}; enum {JSON_error = 0}; enum {JSON_en_main = 1}; -static const char MAYBE_UNUSED(_JSON_nfa_targs)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_nfa_offsets)[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_nfa_push_actions)[] = { - 0, 0 -}; - -static const char MAYBE_UNUSED(_JSON_nfa_pop_trans)[] = { - 0, 0 -}; - -#line 835 "parser.rl" +#line 828 "parser.rl" /* -* call-seq: parse() -* -* Parses the current JSON text _source_ and returns the complete data -* structure as a result. -* It raises JSON::ParseError if fail to parse. -*/ + * call-seq: parse() + * + * Parses the current JSON text _source_ and returns the complete data + * structure as a result. + * It raises JSON::ParserError if fail to parse. + */ static VALUE cParser_parse(VALUE self) { - char *p, *pe; - int cs = EVIL; - VALUE result = Qnil; - GET_PARSER; + char *p, *pe; + int cs = EVIL; + VALUE result = Qnil; + GET_PARSER; +#line 1946 "parser.c" { - cs = (int)JSON_start; + cs = JSON_start; } - #line 851 "parser.rl" - - p = json->source; - pe = p + json->len; +#line 845 "parser.rl" + p = json->source; + pe = p + json->len; +#line 1955 "parser.c" { - if ( p == pe ) + if ( p == pe ) goto _test_eof; - switch ( cs ) - { - case 1: - goto st_case_1; - case 0: - goto st_case_0; - case 10: - goto st_case_10; - case 2: - goto st_case_2; - case 3: - goto st_case_3; - case 4: - goto st_case_4; - case 5: - goto st_case_5; - case 6: - goto st_case_6; - case 7: - goto st_case_7; - case 8: - goto st_case_8; - case 9: - goto st_case_9; - } - goto st_out; - st1: - p+= 1; - if ( p == pe ) + switch ( cs ) + { +st1: + if ( ++p == pe ) goto _test_eof1; - st_case_1: - switch( ( (*( p))) ) { - case 13: { - goto st1; - } - case 32: { - goto st1; - } - case 34: { - goto ctr2; - } - case 45: { - goto ctr2; - } - case 47: { - goto st6; - } - case 73: { - goto ctr2; - } - case 78: { - goto ctr2; - } - case 91: { - goto ctr2; - } - case 102: { - goto ctr2; - } - case 110: { - goto ctr2; - } - case 116: { - goto ctr2; - } - case 123: { - goto ctr2; - } - } - if ( ( (*( p))) > 10 ) { - if ( 48 <= ( (*( p))) && ( (*( p))) <= 57 ) { - goto ctr2; - } - } else if ( ( (*( p))) >= 9 ) { - goto st1; - } - { - goto st0; - } - st_case_0: - st0: - cs = 0; - goto _out; - ctr2: - { - #line 827 "parser.rl" - - char *np = JSON_parse_value(json, p, pe, &result, 0); - if (np == NULL) { {p = p - 1; } {p+= 1; cs = 10; goto _out;} } else {p = (( np))-1;} - - } - - goto st10; - st10: - p+= 1; - if ( p == pe ) +case 1: + switch( (*p) ) { + case 13: goto st1; + case 32: goto st1; + case 34: goto tr2; + case 45: goto tr2; + case 47: goto st6; + case 73: goto tr2; + case 78: goto tr2; + case 91: goto tr2; + case 102: goto tr2; + case 110: goto tr2; + case 116: goto tr2; + case 123: goto tr2; + } + if ( (*p) > 10 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr2; + } else if ( (*p) >= 9 ) + goto st1; + goto st0; +st0: +cs = 0; + goto _out; +tr2: +#line 820 "parser.rl" + { + char *np = JSON_parse_value(json, p, pe, &result, 0); + if (np == NULL) { p--; {p++; cs = 10; goto _out;} } else {p = (( np))-1;} + } + goto st10; +st10: + if ( ++p == pe ) goto _test_eof10; - st_case_10: - switch( ( (*( p))) ) { - case 13: { - goto st10; - } - case 32: { - goto st10; - } - case 47: { - goto st2; - } - } - if ( 9 <= ( (*( p))) && ( (*( p))) <= 10 ) { - goto st10; - } - { - goto st0; - } - st2: - p+= 1; - if ( p == pe ) +case 10: +#line 1999 "parser.c" + switch( (*p) ) { + case 13: goto st10; + case 32: goto st10; + case 47: goto st2; + } + if ( 9 <= (*p) && (*p) <= 10 ) + goto st10; + goto st0; +st2: + if ( ++p == pe ) goto _test_eof2; - st_case_2: - switch( ( (*( p))) ) { - case 42: { - goto st3; - } - case 47: { - goto st5; - } - } - { - goto st0; - } - st3: - p+= 1; - if ( p == pe ) +case 2: + switch( (*p) ) { + case 42: goto st3; + case 47: goto st5; + } + goto st0; +st3: + if ( ++p == pe ) goto _test_eof3; - st_case_3: - if ( ( (*( p))) == 42 ) { - goto st4; - } - { - goto st3; - } - st4: - p+= 1; - if ( p == pe ) +case 3: + if ( (*p) == 42 ) + goto st4; + goto st3; +st4: + if ( ++p == pe ) goto _test_eof4; - st_case_4: - switch( ( (*( p))) ) { - case 42: { - goto st4; - } - case 47: { - goto st10; - } - } - { - goto st3; - } - st5: - p+= 1; - if ( p == pe ) +case 4: + switch( (*p) ) { + case 42: goto st4; + case 47: goto st10; + } + goto st3; +st5: + if ( ++p == pe ) goto _test_eof5; - st_case_5: - if ( ( (*( p))) == 10 ) { - goto st10; - } - { - goto st5; - } - st6: - p+= 1; - if ( p == pe ) +case 5: + if ( (*p) == 10 ) + goto st10; + goto st5; +st6: + if ( ++p == pe ) goto _test_eof6; - st_case_6: - switch( ( (*( p))) ) { - case 42: { - goto st7; - } - case 47: { - goto st9; - } - } - { - goto st0; - } - st7: - p+= 1; - if ( p == pe ) +case 6: + switch( (*p) ) { + case 42: goto st7; + case 47: goto st9; + } + goto st0; +st7: + if ( ++p == pe ) goto _test_eof7; - st_case_7: - if ( ( (*( p))) == 42 ) { - goto st8; - } - { - goto st7; - } - st8: - p+= 1; - if ( p == pe ) +case 7: + if ( (*p) == 42 ) + goto st8; + goto st7; +st8: + if ( ++p == pe ) goto _test_eof8; - st_case_8: - switch( ( (*( p))) ) { - case 42: { - goto st8; - } - case 47: { - goto st1; - } - } - { - goto st7; - } - st9: - p+= 1; - if ( p == pe ) +case 8: + switch( (*p) ) { + case 42: goto st8; + case 47: goto st1; + } + goto st7; +st9: + if ( ++p == pe ) goto _test_eof9; - st_case_9: - if ( ( (*( p))) == 10 ) { - goto st1; - } - { - goto st9; - } - st_out: - _test_eof1: cs = 1; goto _test_eof; - _test_eof10: cs = 10; goto _test_eof; - _test_eof2: cs = 2; goto _test_eof; - _test_eof3: cs = 3; goto _test_eof; - _test_eof4: cs = 4; goto _test_eof; - _test_eof5: cs = 5; goto _test_eof; - _test_eof6: cs = 6; goto _test_eof; - _test_eof7: cs = 7; goto _test_eof; - _test_eof8: cs = 8; goto _test_eof; - _test_eof9: cs = 9; goto _test_eof; - - _test_eof: {} - _out: {} - } - - #line 854 "parser.rl" - - - if (cs >= JSON_first_final && p == pe) { - return result; - } else { - rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p); - return Qnil; +case 9: + if ( (*p) == 10 ) + goto st1; + goto st9; } + _test_eof1: cs = 1; goto _test_eof; + _test_eof10: cs = 10; goto _test_eof; + _test_eof2: cs = 2; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; + _test_eof4: cs = 4; goto _test_eof; + _test_eof5: cs = 5; goto _test_eof; + _test_eof6: cs = 6; goto _test_eof; + _test_eof7: cs = 7; goto _test_eof; + _test_eof8: cs = 8; goto _test_eof; + _test_eof9: cs = 9; goto _test_eof; + + _test_eof: {} + _out: {} + } + +#line 848 "parser.rl" + + if (cs >= JSON_first_final && p == pe) { + return result; + } else { + rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p); + return Qnil; + } } static void JSON_mark(void *ptr) { - JSON_Parser *json = ptr; - rb_gc_mark_maybe(json->Vsource); - rb_gc_mark_maybe(json->create_id); - rb_gc_mark_maybe(json->object_class); - rb_gc_mark_maybe(json->array_class); - rb_gc_mark_maybe(json->decimal_class); - rb_gc_mark_maybe(json->match_string); + JSON_Parser *json = ptr; + rb_gc_mark_maybe(json->Vsource); + rb_gc_mark_maybe(json->create_id); + rb_gc_mark_maybe(json->object_class); + rb_gc_mark_maybe(json->array_class); + rb_gc_mark_maybe(json->decimal_class); + rb_gc_mark_maybe(json->match_string); } static void JSON_free(void *ptr) { - JSON_Parser *json = ptr; - fbuffer_free(json->fbuffer); - ruby_xfree(json); + JSON_Parser *json = ptr; + fbuffer_free(json->fbuffer); + ruby_xfree(json); } static size_t JSON_memsize(const void *ptr) { - const JSON_Parser *json = ptr; - return sizeof(*json) + FBUFFER_CAPA(json->fbuffer); + const JSON_Parser *json = ptr; + return sizeof(*json) + FBUFFER_CAPA(json->fbuffer); } #ifdef NEW_TYPEDDATA_WRAPPER static const rb_data_type_t JSON_Parser_type = { - "JSON/Parser", - {JSON_mark, JSON_free, JSON_memsize,}, - #ifdef RUBY_TYPED_FREE_IMMEDIATELY - 0, 0, - RUBY_TYPED_FREE_IMMEDIATELY, - #endif + "JSON/Parser", + {JSON_mark, JSON_free, JSON_memsize,}, +#ifdef RUBY_TYPED_FREE_IMMEDIATELY + 0, 0, + RUBY_TYPED_FREE_IMMEDIATELY, +#endif }; #endif static VALUE cJSON_parser_s_allocate(VALUE klass) { - JSON_Parser *json; - VALUE obj = TypedData_Make_Struct(klass, JSON_Parser, &JSON_Parser_type, json); - json->fbuffer = fbuffer_alloc(0); - return obj; + JSON_Parser *json; + VALUE obj = TypedData_Make_Struct(klass, JSON_Parser, &JSON_Parser_type, json); + json->fbuffer = fbuffer_alloc(0); + return obj; } /* -* call-seq: source() -* -* Returns a copy of the current _source_ string, that was used to construct -* this Parser. -*/ + * call-seq: source() + * + * Returns a copy of the current _source_ string, that was used to construct + * this Parser. + */ static VALUE cParser_source(VALUE self) { - GET_PARSER; - return rb_str_dup(json->Vsource); + GET_PARSER; + return rb_str_dup(json->Vsource); } void Init_parser(void) { - #ifdef HAVE_RB_EXT_RACTOR_SAFE - rb_ext_ractor_safe(true); - #endif - - #undef rb_intern - rb_require("json/common"); - mJSON = rb_define_module("JSON"); - mExt = rb_define_module_under(mJSON, "Ext"); - cParser = rb_define_class_under(mExt, "Parser", rb_cObject); - eParserError = rb_path2class("JSON::ParserError"); - eNestingError = rb_path2class("JSON::NestingError"); - rb_gc_register_mark_object(eParserError); - rb_gc_register_mark_object(eNestingError); - rb_define_alloc_func(cParser, cJSON_parser_s_allocate); - rb_define_method(cParser, "initialize", cParser_initialize, -1); - rb_define_method(cParser, "parse", cParser_parse, 0); - rb_define_method(cParser, "source", cParser_source, 0); - - CNaN = rb_const_get(mJSON, rb_intern("NaN")); - rb_gc_register_mark_object(CNaN); - - CInfinity = rb_const_get(mJSON, rb_intern("Infinity")); - rb_gc_register_mark_object(CInfinity); - - CMinusInfinity = rb_const_get(mJSON, rb_intern("MinusInfinity")); - rb_gc_register_mark_object(CMinusInfinity); - - i_json_creatable_p = rb_intern("json_creatable?"); - i_json_create = rb_intern("json_create"); - i_create_id = rb_intern("create_id"); - i_create_additions = rb_intern("create_additions"); - i_chr = rb_intern("chr"); - i_max_nesting = rb_intern("max_nesting"); - i_allow_nan = rb_intern("allow_nan"); - i_symbolize_names = rb_intern("symbolize_names"); - i_object_class = rb_intern("object_class"); - i_array_class = rb_intern("array_class"); - i_decimal_class = rb_intern("decimal_class"); - i_match = rb_intern("match"); - i_match_string = rb_intern("match_string"); - i_key_p = rb_intern("key?"); - i_deep_const_get = rb_intern("deep_const_get"); - i_aset = rb_intern("[]="); - i_aref = rb_intern("[]"); - i_leftshift = rb_intern("<<"); - i_new = rb_intern("new"); - i_try_convert = rb_intern("try_convert"); - i_freeze = rb_intern("freeze"); - i_uminus = rb_intern("-@"); +#ifdef HAVE_RB_EXT_RACTOR_SAFE + rb_ext_ractor_safe(true); +#endif + +#undef rb_intern + rb_require("json/common"); + mJSON = rb_define_module("JSON"); + mExt = rb_define_module_under(mJSON, "Ext"); + cParser = rb_define_class_under(mExt, "Parser", rb_cObject); + eParserError = rb_path2class("JSON::ParserError"); + eNestingError = rb_path2class("JSON::NestingError"); + rb_gc_register_mark_object(eParserError); + rb_gc_register_mark_object(eNestingError); + rb_define_alloc_func(cParser, cJSON_parser_s_allocate); + rb_define_method(cParser, "initialize", cParser_initialize, -1); + rb_define_method(cParser, "parse", cParser_parse, 0); + rb_define_method(cParser, "source", cParser_source, 0); + + CNaN = rb_const_get(mJSON, rb_intern("NaN")); + rb_gc_register_mark_object(CNaN); + + CInfinity = rb_const_get(mJSON, rb_intern("Infinity")); + rb_gc_register_mark_object(CInfinity); + + CMinusInfinity = rb_const_get(mJSON, rb_intern("MinusInfinity")); + rb_gc_register_mark_object(CMinusInfinity); + + i_json_creatable_p = rb_intern("json_creatable?"); + i_json_create = rb_intern("json_create"); + i_create_id = rb_intern("create_id"); + i_create_additions = rb_intern("create_additions"); + i_chr = rb_intern("chr"); + i_max_nesting = rb_intern("max_nesting"); + i_allow_nan = rb_intern("allow_nan"); + i_symbolize_names = rb_intern("symbolize_names"); + i_object_class = rb_intern("object_class"); + i_array_class = rb_intern("array_class"); + i_decimal_class = rb_intern("decimal_class"); + i_match = rb_intern("match"); + i_match_string = rb_intern("match_string"); + i_key_p = rb_intern("key?"); + i_deep_const_get = rb_intern("deep_const_get"); + i_aset = rb_intern("[]="); + i_aref = rb_intern("[]"); + i_leftshift = rb_intern("<<"); + i_new = rb_intern("new"); + i_try_convert = rb_intern("try_convert"); + i_freeze = rb_intern("freeze"); + i_uminus = rb_intern("-@"); } /* -* Local variables: -* mode: c -* c-file-style: ruby -* indent-tabs-mode: nil -* End: -*/ + * Local variables: + * mode: c + * c-file-style: ruby + * indent-tabs-mode: nil + * End: + */ diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl index 2dbdc7ef24..af190e7500 100644 --- a/ext/json/parser/parser.rl +++ b/ext/json/parser/parser.rl @@ -229,7 +229,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu if (json->allow_nan) { *result = CInfinity; } else { - rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 8); + rb_enc_raise(EXC_ENCODING eParserError, "unexpected token at '%s'", p - 7); } } action parse_string { @@ -508,7 +508,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int case 'u': if (pe > stringEnd - 4) { if (bufferSize > MAX_STACK_BUFFER_SIZE) { - free(bufferStart); + ruby_xfree(bufferStart); } rb_enc_raise( EXC_ENCODING eParserError, @@ -521,7 +521,7 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int pe++; if (pe > stringEnd - 6) { if (bufferSize > MAX_STACK_BUFFER_SIZE) { - free(bufferStart); + ruby_xfree(bufferStart); } rb_enc_raise( EXC_ENCODING eParserError, @@ -566,13 +566,13 @@ static VALUE json_string_unescape(char *string, char *stringEnd, int intern, int result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart)); } if (bufferSize > MAX_STACK_BUFFER_SIZE) { - free(bufferStart); + ruby_xfree(bufferStart); } # else result = rb_utf8_str_new(bufferStart, (long)(buffer - bufferStart)); if (bufferSize > MAX_STACK_BUFFER_SIZE) { - free(bufferStart); + ruby_xfree(bufferStart); } if (intern) { @@ -691,8 +691,6 @@ static VALUE convert_encoding(VALUE source) * * Creates a new JSON::Ext::Parser instance for the string _source_. * - * Creates a new JSON::Ext::Parser instance for the string _source_. - * * It will be configured by the _opts_ hash. _opts_ can have the following * keys: * @@ -721,98 +719,85 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) if (json->Vsource) { rb_raise(rb_eTypeError, "already initialized instance"); } -#ifdef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH rb_scan_args(argc, argv, "1:", &source, &opts); -#else - rb_scan_args(argc, argv, "11", &source, &opts); -#endif if (!NIL_P(opts)) { -#ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH - opts = rb_convert_type(opts, T_HASH, "Hash", "to_hash"); - if (NIL_P(opts)) { - rb_raise(rb_eArgError, "opts needs to be like a hash"); - } else { -#endif - VALUE tmp = ID2SYM(i_max_nesting); - if (option_given_p(opts, tmp)) { - VALUE max_nesting = rb_hash_aref(opts, tmp); - if (RTEST(max_nesting)) { - Check_Type(max_nesting, T_FIXNUM); - json->max_nesting = FIX2INT(max_nesting); - } else { - json->max_nesting = 0; - } - } else { - json->max_nesting = 100; - } - tmp = ID2SYM(i_allow_nan); - if (option_given_p(opts, tmp)) { - json->allow_nan = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; - } else { - json->allow_nan = 0; - } - tmp = ID2SYM(i_symbolize_names); - if (option_given_p(opts, tmp)) { - json->symbolize_names = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; - } else { - json->symbolize_names = 0; - } - tmp = ID2SYM(i_freeze); - if (option_given_p(opts, tmp)) { - json->freeze = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; - } else { - json->freeze = 0; - } - tmp = ID2SYM(i_create_additions); - if (option_given_p(opts, tmp)) { - json->create_additions = RTEST(rb_hash_aref(opts, tmp)); - } else { - json->create_additions = 0; - } - if (json->symbolize_names && json->create_additions) { - rb_raise(rb_eArgError, - "options :symbolize_names and :create_additions cannot be " - " used in conjunction"); - } - tmp = ID2SYM(i_create_id); - if (option_given_p(opts, tmp)) { - json->create_id = rb_hash_aref(opts, tmp); - } else { - json->create_id = rb_funcall(mJSON, i_create_id, 0); - } - tmp = ID2SYM(i_object_class); - if (option_given_p(opts, tmp)) { - json->object_class = rb_hash_aref(opts, tmp); - } else { - json->object_class = Qnil; - } - tmp = ID2SYM(i_array_class); - if (option_given_p(opts, tmp)) { - json->array_class = rb_hash_aref(opts, tmp); - } else { - json->array_class = Qnil; - } - tmp = ID2SYM(i_decimal_class); - if (option_given_p(opts, tmp)) { - json->decimal_class = rb_hash_aref(opts, tmp); - } else { - json->decimal_class = Qnil; - } - tmp = ID2SYM(i_match_string); - if (option_given_p(opts, tmp)) { - VALUE match_string = rb_hash_aref(opts, tmp); - json->match_string = RTEST(match_string) ? match_string : Qnil; - } else { - json->match_string = Qnil; - } -#ifndef HAVE_RB_SCAN_ARGS_OPTIONAL_HASH - } -#endif + VALUE tmp = ID2SYM(i_max_nesting); + if (option_given_p(opts, tmp)) { + VALUE max_nesting = rb_hash_aref(opts, tmp); + if (RTEST(max_nesting)) { + Check_Type(max_nesting, T_FIXNUM); + json->max_nesting = FIX2INT(max_nesting); + } else { + json->max_nesting = 0; + } + } else { + json->max_nesting = 100; + } + tmp = ID2SYM(i_allow_nan); + if (option_given_p(opts, tmp)) { + json->allow_nan = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; + } else { + json->allow_nan = 0; + } + tmp = ID2SYM(i_symbolize_names); + if (option_given_p(opts, tmp)) { + json->symbolize_names = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; + } else { + json->symbolize_names = 0; + } + tmp = ID2SYM(i_freeze); + if (option_given_p(opts, tmp)) { + json->freeze = RTEST(rb_hash_aref(opts, tmp)) ? 1 : 0; + } else { + json->freeze = 0; + } + tmp = ID2SYM(i_create_additions); + if (option_given_p(opts, tmp)) { + json->create_additions = RTEST(rb_hash_aref(opts, tmp)); + } else { + json->create_additions = 0; + } + if (json->symbolize_names && json->create_additions) { + rb_raise(rb_eArgError, + "options :symbolize_names and :create_additions cannot be " + " used in conjunction"); + } + tmp = ID2SYM(i_create_id); + if (option_given_p(opts, tmp)) { + json->create_id = rb_hash_aref(opts, tmp); + } else { + json->create_id = rb_funcall(mJSON, i_create_id, 0); + } + tmp = ID2SYM(i_object_class); + if (option_given_p(opts, tmp)) { + json->object_class = rb_hash_aref(opts, tmp); + } else { + json->object_class = Qnil; + } + tmp = ID2SYM(i_array_class); + if (option_given_p(opts, tmp)) { + json->array_class = rb_hash_aref(opts, tmp); + } else { + json->array_class = Qnil; + } + tmp = ID2SYM(i_decimal_class); + if (option_given_p(opts, tmp)) { + json->decimal_class = rb_hash_aref(opts, tmp); + } else { + json->decimal_class = Qnil; + } + tmp = ID2SYM(i_match_string); + if (option_given_p(opts, tmp)) { + VALUE match_string = rb_hash_aref(opts, tmp); + json->match_string = RTEST(match_string) ? match_string : Qnil; + } else { + json->match_string = Qnil; + } } else { json->max_nesting = 100; json->allow_nan = 0; json->create_additions = 0; - json->create_id = rb_funcall(mJSON, i_create_id, 0); + json->create_id = Qnil; json->object_class = Qnil; json->array_class = Qnil; json->decimal_class = Qnil; @@ -847,7 +832,7 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self) * * Parses the current JSON text _source_ and returns the complete data * structure as a result. - * It raises JSON::ParseError if fail to parse. + * It raises JSON::ParserError if fail to parse. */ static VALUE cParser_parse(VALUE self) { diff --git a/ext/monitor/depend b/ext/monitor/depend index 3030da71d0..bc7ead0d32 100644 --- a/ext/monitor/depend +++ b/ext/monitor/depend @@ -51,6 +51,7 @@ monitor.o: $(hdrdir)/ruby/internal/attr/noexcept.h monitor.o: $(hdrdir)/ruby/internal/attr/noinline.h monitor.o: $(hdrdir)/ruby/internal/attr/nonnull.h monitor.o: $(hdrdir)/ruby/internal/attr/noreturn.h +monitor.o: $(hdrdir)/ruby/internal/attr/packed_struct.h monitor.o: $(hdrdir)/ruby/internal/attr/pure.h monitor.o: $(hdrdir)/ruby/internal/attr/restrict.h monitor.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -110,7 +111,6 @@ monitor.o: $(hdrdir)/ruby/internal/intern/enumerator.h monitor.o: $(hdrdir)/ruby/internal/intern/error.h monitor.o: $(hdrdir)/ruby/internal/intern/eval.h monitor.o: $(hdrdir)/ruby/internal/intern/file.h -monitor.o: $(hdrdir)/ruby/internal/intern/gc.h monitor.o: $(hdrdir)/ruby/internal/intern/hash.h monitor.o: $(hdrdir)/ruby/internal/intern/io.h monitor.o: $(hdrdir)/ruby/internal/intern/load.h @@ -141,12 +141,12 @@ monitor.o: $(hdrdir)/ruby/internal/memory.h monitor.o: $(hdrdir)/ruby/internal/method.h monitor.o: $(hdrdir)/ruby/internal/module.h monitor.o: $(hdrdir)/ruby/internal/newobj.h -monitor.o: $(hdrdir)/ruby/internal/rgengc.h monitor.o: $(hdrdir)/ruby/internal/scan_args.h monitor.o: $(hdrdir)/ruby/internal/special_consts.h monitor.o: $(hdrdir)/ruby/internal/static_assert.h monitor.o: $(hdrdir)/ruby/internal/stdalign.h monitor.o: $(hdrdir)/ruby/internal/stdbool.h +monitor.o: $(hdrdir)/ruby/internal/stdckdint.h monitor.o: $(hdrdir)/ruby/internal/symbol.h monitor.o: $(hdrdir)/ruby/internal/value.h monitor.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/monitor/lib/monitor.rb b/ext/monitor/lib/monitor.rb index 11c5ac17d9..31d6d2b3c4 100644 --- a/ext/monitor/lib/monitor.rb +++ b/ext/monitor/lib/monitor.rb @@ -7,17 +7,19 @@ # You can freely distribute/modify this library. # +require 'monitor.so' + # # In concurrent programming, a monitor is an object or module intended to be -# used safely by more than one thread. The defining characteristic of a -# monitor is that its methods are executed with mutual exclusion. That is, at +# used safely by more than one thread. The defining characteristic of a +# monitor is that its methods are executed with mutual exclusion. That is, at # each point in time, at most one thread may be executing any of its methods. # This mutual exclusion greatly simplifies reasoning about the implementation # of monitors compared to reasoning about parallel code that updates a data # structure. # # You can read more about the general principles on the Wikipedia page for -# Monitors[https://en.wikipedia.org/wiki/Monitor_%28synchronization%29] +# Monitors[https://en.wikipedia.org/wiki/Monitor_%28synchronization%29]. # # == Examples # @@ -48,7 +50,7 @@ # end # # The consumer thread waits for the producer thread to push a line to buf -# while <tt>buf.empty?</tt>. The producer thread (main thread) reads a +# while <tt>buf.empty?</tt>. The producer thread (main thread) reads a # line from ARGF and pushes it into buf then calls <tt>empty_cond.signal</tt> # to notify the consumer thread of new data. # @@ -86,9 +88,6 @@ # This Class is implemented as subclass of Array which includes the # MonitorMixin module. # - -require 'monitor.so' - module MonitorMixin # # FIXME: This isn't documented in Nutshell. diff --git a/ext/monitor/monitor.c b/ext/monitor/monitor.c index 10209cf2aa..86613f6ade 100644 --- a/ext/monitor/monitor.c +++ b/ext/monitor/monitor.c @@ -102,7 +102,7 @@ monitor_exit(VALUE monitor) struct rb_monitor *mc = monitor_ptr(monitor); - if (mc->count <= 0) rb_bug("monitor_exit: count:%d\n", (int)mc->count); + if (mc->count <= 0) rb_bug("monitor_exit: count:%d", (int)mc->count); mc->count--; if (mc->count == 0) { diff --git a/ext/nkf/depend b/ext/nkf/depend deleted file mode 100644 index 9e2f468ba1..0000000000 --- a/ext/nkf/depend +++ /dev/null @@ -1,182 +0,0 @@ -# BSD make needs "nkf.o: nkf.c" dependency BEFORE "nkf.o: nkf-utf8/nkf.c". -# It seems BSD make searches the target for implicit rule in dependencies at first. -nkf.o: nkf.c - -# AUTOGENERATED DEPENDENCIES START -nkf.o: $(RUBY_EXTCONF_H) -nkf.o: $(arch_hdrdir)/ruby/config.h -nkf.o: $(hdrdir)/ruby/assert.h -nkf.o: $(hdrdir)/ruby/backward.h -nkf.o: $(hdrdir)/ruby/backward/2/assume.h -nkf.o: $(hdrdir)/ruby/backward/2/attributes.h -nkf.o: $(hdrdir)/ruby/backward/2/bool.h -nkf.o: $(hdrdir)/ruby/backward/2/inttypes.h -nkf.o: $(hdrdir)/ruby/backward/2/limits.h -nkf.o: $(hdrdir)/ruby/backward/2/long_long.h -nkf.o: $(hdrdir)/ruby/backward/2/stdalign.h -nkf.o: $(hdrdir)/ruby/backward/2/stdarg.h -nkf.o: $(hdrdir)/ruby/defines.h -nkf.o: $(hdrdir)/ruby/encoding.h -nkf.o: $(hdrdir)/ruby/intern.h -nkf.o: $(hdrdir)/ruby/internal/abi.h -nkf.o: $(hdrdir)/ruby/internal/anyargs.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/char.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/double.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/int.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/long.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/short.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h -nkf.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h -nkf.o: $(hdrdir)/ruby/internal/assume.h -nkf.o: $(hdrdir)/ruby/internal/attr/alloc_size.h -nkf.o: $(hdrdir)/ruby/internal/attr/artificial.h -nkf.o: $(hdrdir)/ruby/internal/attr/cold.h -nkf.o: $(hdrdir)/ruby/internal/attr/const.h -nkf.o: $(hdrdir)/ruby/internal/attr/constexpr.h -nkf.o: $(hdrdir)/ruby/internal/attr/deprecated.h -nkf.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h -nkf.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h -nkf.o: $(hdrdir)/ruby/internal/attr/error.h -nkf.o: $(hdrdir)/ruby/internal/attr/flag_enum.h -nkf.o: $(hdrdir)/ruby/internal/attr/forceinline.h -nkf.o: $(hdrdir)/ruby/internal/attr/format.h -nkf.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h -nkf.o: $(hdrdir)/ruby/internal/attr/noalias.h -nkf.o: $(hdrdir)/ruby/internal/attr/nodiscard.h -nkf.o: $(hdrdir)/ruby/internal/attr/noexcept.h -nkf.o: $(hdrdir)/ruby/internal/attr/noinline.h -nkf.o: $(hdrdir)/ruby/internal/attr/nonnull.h -nkf.o: $(hdrdir)/ruby/internal/attr/noreturn.h -nkf.o: $(hdrdir)/ruby/internal/attr/pure.h -nkf.o: $(hdrdir)/ruby/internal/attr/restrict.h -nkf.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h -nkf.o: $(hdrdir)/ruby/internal/attr/warning.h -nkf.o: $(hdrdir)/ruby/internal/attr/weakref.h -nkf.o: $(hdrdir)/ruby/internal/cast.h -nkf.o: $(hdrdir)/ruby/internal/compiler_is.h -nkf.o: $(hdrdir)/ruby/internal/compiler_is/apple.h -nkf.o: $(hdrdir)/ruby/internal/compiler_is/clang.h -nkf.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h -nkf.o: $(hdrdir)/ruby/internal/compiler_is/intel.h -nkf.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h -nkf.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h -nkf.o: $(hdrdir)/ruby/internal/compiler_since.h -nkf.o: $(hdrdir)/ruby/internal/config.h -nkf.o: $(hdrdir)/ruby/internal/constant_p.h -nkf.o: $(hdrdir)/ruby/internal/core.h -nkf.o: $(hdrdir)/ruby/internal/core/rarray.h -nkf.o: $(hdrdir)/ruby/internal/core/rbasic.h -nkf.o: $(hdrdir)/ruby/internal/core/rbignum.h -nkf.o: $(hdrdir)/ruby/internal/core/rclass.h -nkf.o: $(hdrdir)/ruby/internal/core/rdata.h -nkf.o: $(hdrdir)/ruby/internal/core/rfile.h -nkf.o: $(hdrdir)/ruby/internal/core/rhash.h -nkf.o: $(hdrdir)/ruby/internal/core/robject.h -nkf.o: $(hdrdir)/ruby/internal/core/rregexp.h -nkf.o: $(hdrdir)/ruby/internal/core/rstring.h -nkf.o: $(hdrdir)/ruby/internal/core/rstruct.h -nkf.o: $(hdrdir)/ruby/internal/core/rtypeddata.h -nkf.o: $(hdrdir)/ruby/internal/ctype.h -nkf.o: $(hdrdir)/ruby/internal/dllexport.h -nkf.o: $(hdrdir)/ruby/internal/dosish.h -nkf.o: $(hdrdir)/ruby/internal/encoding/coderange.h -nkf.o: $(hdrdir)/ruby/internal/encoding/ctype.h -nkf.o: $(hdrdir)/ruby/internal/encoding/encoding.h -nkf.o: $(hdrdir)/ruby/internal/encoding/pathname.h -nkf.o: $(hdrdir)/ruby/internal/encoding/re.h -nkf.o: $(hdrdir)/ruby/internal/encoding/sprintf.h -nkf.o: $(hdrdir)/ruby/internal/encoding/string.h -nkf.o: $(hdrdir)/ruby/internal/encoding/symbol.h -nkf.o: $(hdrdir)/ruby/internal/encoding/transcode.h -nkf.o: $(hdrdir)/ruby/internal/error.h -nkf.o: $(hdrdir)/ruby/internal/eval.h -nkf.o: $(hdrdir)/ruby/internal/event.h -nkf.o: $(hdrdir)/ruby/internal/fl_type.h -nkf.o: $(hdrdir)/ruby/internal/gc.h -nkf.o: $(hdrdir)/ruby/internal/glob.h -nkf.o: $(hdrdir)/ruby/internal/globals.h -nkf.o: $(hdrdir)/ruby/internal/has/attribute.h -nkf.o: $(hdrdir)/ruby/internal/has/builtin.h -nkf.o: $(hdrdir)/ruby/internal/has/c_attribute.h -nkf.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h -nkf.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h -nkf.o: $(hdrdir)/ruby/internal/has/extension.h -nkf.o: $(hdrdir)/ruby/internal/has/feature.h -nkf.o: $(hdrdir)/ruby/internal/has/warning.h -nkf.o: $(hdrdir)/ruby/internal/intern/array.h -nkf.o: $(hdrdir)/ruby/internal/intern/bignum.h -nkf.o: $(hdrdir)/ruby/internal/intern/class.h -nkf.o: $(hdrdir)/ruby/internal/intern/compar.h -nkf.o: $(hdrdir)/ruby/internal/intern/complex.h -nkf.o: $(hdrdir)/ruby/internal/intern/cont.h -nkf.o: $(hdrdir)/ruby/internal/intern/dir.h -nkf.o: $(hdrdir)/ruby/internal/intern/enum.h -nkf.o: $(hdrdir)/ruby/internal/intern/enumerator.h -nkf.o: $(hdrdir)/ruby/internal/intern/error.h -nkf.o: $(hdrdir)/ruby/internal/intern/eval.h -nkf.o: $(hdrdir)/ruby/internal/intern/file.h -nkf.o: $(hdrdir)/ruby/internal/intern/gc.h -nkf.o: $(hdrdir)/ruby/internal/intern/hash.h -nkf.o: $(hdrdir)/ruby/internal/intern/io.h -nkf.o: $(hdrdir)/ruby/internal/intern/load.h -nkf.o: $(hdrdir)/ruby/internal/intern/marshal.h -nkf.o: $(hdrdir)/ruby/internal/intern/numeric.h -nkf.o: $(hdrdir)/ruby/internal/intern/object.h -nkf.o: $(hdrdir)/ruby/internal/intern/parse.h -nkf.o: $(hdrdir)/ruby/internal/intern/proc.h -nkf.o: $(hdrdir)/ruby/internal/intern/process.h -nkf.o: $(hdrdir)/ruby/internal/intern/random.h -nkf.o: $(hdrdir)/ruby/internal/intern/range.h -nkf.o: $(hdrdir)/ruby/internal/intern/rational.h -nkf.o: $(hdrdir)/ruby/internal/intern/re.h -nkf.o: $(hdrdir)/ruby/internal/intern/ruby.h -nkf.o: $(hdrdir)/ruby/internal/intern/select.h -nkf.o: $(hdrdir)/ruby/internal/intern/select/largesize.h -nkf.o: $(hdrdir)/ruby/internal/intern/signal.h -nkf.o: $(hdrdir)/ruby/internal/intern/sprintf.h -nkf.o: $(hdrdir)/ruby/internal/intern/string.h -nkf.o: $(hdrdir)/ruby/internal/intern/struct.h -nkf.o: $(hdrdir)/ruby/internal/intern/thread.h -nkf.o: $(hdrdir)/ruby/internal/intern/time.h -nkf.o: $(hdrdir)/ruby/internal/intern/variable.h -nkf.o: $(hdrdir)/ruby/internal/intern/vm.h -nkf.o: $(hdrdir)/ruby/internal/interpreter.h -nkf.o: $(hdrdir)/ruby/internal/iterator.h -nkf.o: $(hdrdir)/ruby/internal/memory.h -nkf.o: $(hdrdir)/ruby/internal/method.h -nkf.o: $(hdrdir)/ruby/internal/module.h -nkf.o: $(hdrdir)/ruby/internal/newobj.h -nkf.o: $(hdrdir)/ruby/internal/rgengc.h -nkf.o: $(hdrdir)/ruby/internal/scan_args.h -nkf.o: $(hdrdir)/ruby/internal/special_consts.h -nkf.o: $(hdrdir)/ruby/internal/static_assert.h -nkf.o: $(hdrdir)/ruby/internal/stdalign.h -nkf.o: $(hdrdir)/ruby/internal/stdbool.h -nkf.o: $(hdrdir)/ruby/internal/symbol.h -nkf.o: $(hdrdir)/ruby/internal/value.h -nkf.o: $(hdrdir)/ruby/internal/value_type.h -nkf.o: $(hdrdir)/ruby/internal/variable.h -nkf.o: $(hdrdir)/ruby/internal/warning_push.h -nkf.o: $(hdrdir)/ruby/internal/xmalloc.h -nkf.o: $(hdrdir)/ruby/missing.h -nkf.o: $(hdrdir)/ruby/onigmo.h -nkf.o: $(hdrdir)/ruby/oniguruma.h -nkf.o: $(hdrdir)/ruby/ruby.h -nkf.o: $(hdrdir)/ruby/st.h -nkf.o: $(hdrdir)/ruby/subst.h -nkf.o: nkf-utf8/config.h -nkf.o: nkf-utf8/nkf.c -nkf.o: nkf-utf8/nkf.h -nkf.o: nkf-utf8/utf8tbl.c -nkf.o: nkf-utf8/utf8tbl.h -nkf.o: nkf.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ext/nkf/extconf.rb b/ext/nkf/extconf.rb deleted file mode 100644 index f41f6b11dc..0000000000 --- a/ext/nkf/extconf.rb +++ /dev/null @@ -1,3 +0,0 @@ -# frozen_string_literal: false -require 'mkmf' -create_makefile('nkf') diff --git a/ext/nkf/lib/kconv.rb b/ext/nkf/lib/kconv.rb deleted file mode 100644 index f52b755288..0000000000 --- a/ext/nkf/lib/kconv.rb +++ /dev/null @@ -1,283 +0,0 @@ -# frozen_string_literal: false -# -# kconv.rb - Kanji Converter. -# -# $Id$ -# -# ---- -# -# kconv.rb implements the Kconv class for Kanji Converter. Additionally, -# some methods in String classes are added to allow easy conversion. -# - -require 'nkf' - -# -# Kanji Converter for Ruby. -# -module Kconv - # - # Public Constants - # - - #Constant of Encoding - - # Auto-Detect - AUTO = NKF::AUTO - # ISO-2022-JP - JIS = NKF::JIS - # EUC-JP - EUC = NKF::EUC - # Shift_JIS - SJIS = NKF::SJIS - # BINARY - BINARY = NKF::BINARY - # NOCONV - NOCONV = NKF::NOCONV - # ASCII - ASCII = NKF::ASCII - # UTF-8 - UTF8 = NKF::UTF8 - # UTF-16 - UTF16 = NKF::UTF16 - # UTF-32 - UTF32 = NKF::UTF32 - # UNKNOWN - UNKNOWN = NKF::UNKNOWN - - # - # Public Methods - # - - # call-seq: - # Kconv.kconv(str, to_enc, from_enc=nil) - # - # Convert <code>str</code> to <code>to_enc</code>. - # <code>to_enc</code> and <code>from_enc</code> are given as constants of Kconv or Encoding objects. - def kconv(str, to_enc, from_enc=nil) - opt = '' - opt += ' --ic=' + from_enc.to_s if from_enc - opt += ' --oc=' + to_enc.to_s if to_enc - - ::NKF::nkf(opt, str) - end - module_function :kconv - - # - # Encode to - # - - # call-seq: - # Kconv.tojis(str) => string - # - # Convert <code>str</code> to ISO-2022-JP - def tojis(str) - kconv(str, JIS) - end - module_function :tojis - - # call-seq: - # Kconv.toeuc(str) => string - # - # Convert <code>str</code> to EUC-JP - def toeuc(str) - kconv(str, EUC) - end - module_function :toeuc - - # call-seq: - # Kconv.tosjis(str) => string - # - # Convert <code>str</code> to Shift_JIS - def tosjis(str) - kconv(str, SJIS) - end - module_function :tosjis - - # call-seq: - # Kconv.toutf8(str) => string - # - # Convert <code>str</code> to UTF-8 - def toutf8(str) - kconv(str, UTF8) - end - module_function :toutf8 - - # call-seq: - # Kconv.toutf16(str) => string - # - # Convert <code>str</code> to UTF-16 - def toutf16(str) - kconv(str, UTF16) - end - module_function :toutf16 - - # call-seq: - # Kconv.toutf32(str) => string - # - # Convert <code>str</code> to UTF-32 - def toutf32(str) - kconv(str, UTF32) - end - module_function :toutf32 - - # call-seq: - # Kconv.tolocale => string - # - # Convert <code>self</code> to locale encoding - def tolocale(str) - kconv(str, Encoding.locale_charmap) - end - module_function :tolocale - - # - # guess - # - - # call-seq: - # Kconv.guess(str) => encoding - # - # Guess input encoding by NKF.guess - def guess(str) - ::NKF::guess(str) - end - module_function :guess - - # - # isEncoding - # - - # call-seq: - # Kconv.iseuc(str) => true or false - # - # Returns whether input encoding is EUC-JP or not. - # - # *Note* don't expect this return value is MatchData. - def iseuc(str) - str.dup.force_encoding(EUC).valid_encoding? - end - module_function :iseuc - - # call-seq: - # Kconv.issjis(str) => true or false - # - # Returns whether input encoding is Shift_JIS or not. - def issjis(str) - str.dup.force_encoding(SJIS).valid_encoding? - end - module_function :issjis - - # call-seq: - # Kconv.isjis(str) => true or false - # - # Returns whether input encoding is ISO-2022-JP or not. - def isjis(str) - /\A [\t\n\r\x20-\x7E]* - (?: - (?:\x1b \x28 I [\x21-\x7E]* - |\x1b \x28 J [\x21-\x7E]* - |\x1b \x24 @ (?:[\x21-\x7E]{2})* - |\x1b \x24 B (?:[\x21-\x7E]{2})* - |\x1b \x24 \x28 D (?:[\x21-\x7E]{2})* - )* - \x1b \x28 B [\t\n\r\x20-\x7E]* - )* - \z/nox =~ str.dup.force_encoding('BINARY') ? true : false - end - module_function :isjis - - # call-seq: - # Kconv.isutf8(str) => true or false - # - # Returns whether input encoding is UTF-8 or not. - def isutf8(str) - str.dup.force_encoding(UTF8).valid_encoding? - end - module_function :isutf8 -end - -class String - # call-seq: - # String#kconv(to_enc, from_enc) - # - # Convert <code>self</code> to <code>to_enc</code>. - # <code>to_enc</code> and <code>from_enc</code> are given as constants of Kconv or Encoding objects. - def kconv(to_enc, from_enc=nil) - from_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0] - Kconv::kconv(self, to_enc, from_enc) - end - - # - # to Encoding - # - - # call-seq: - # String#tojis => string - # - # Convert <code>self</code> to ISO-2022-JP - def tojis; Kconv.tojis(self) end - - # call-seq: - # String#toeuc => string - # - # Convert <code>self</code> to EUC-JP - def toeuc; Kconv.toeuc(self) end - - # call-seq: - # String#tosjis => string - # - # Convert <code>self</code> to Shift_JIS - def tosjis; Kconv.tosjis(self) end - - # call-seq: - # String#toutf8 => string - # - # Convert <code>self</code> to UTF-8 - def toutf8; Kconv.toutf8(self) end - - # call-seq: - # String#toutf16 => string - # - # Convert <code>self</code> to UTF-16 - def toutf16; Kconv.toutf16(self) end - - # call-seq: - # String#toutf32 => string - # - # Convert <code>self</code> to UTF-32 - def toutf32; Kconv.toutf32(self) end - - # call-seq: - # String#tolocale => string - # - # Convert <code>self</code> to locale encoding - def tolocale; Kconv.tolocale(self) end - - # - # is Encoding - # - - # call-seq: - # String#iseuc => true or false - # - # Returns whether <code>self</code>'s encoding is EUC-JP or not. - def iseuc; Kconv.iseuc(self) end - - # call-seq: - # String#issjis => true or false - # - # Returns whether <code>self</code>'s encoding is Shift_JIS or not. - def issjis; Kconv.issjis(self) end - - # call-seq: - # String#isjis => true or false - # - # Returns whether <code>self</code>'s encoding is ISO-2022-JP or not. - def isjis; Kconv.isjis(self) end - - # call-seq: - # String#isutf8 => true or false - # - # Returns whether <code>self</code>'s encoding is UTF-8 or not. - def isutf8; Kconv.isutf8(self) end -end diff --git a/ext/nkf/nkf-utf8/config.h b/ext/nkf/nkf-utf8/config.h deleted file mode 100644 index 36898c0b4b..0000000000 --- a/ext/nkf/nkf-utf8/config.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _CONFIG_H_ -#define _CONFIG_H_ - -/* UTF8 input and output */ -#define UTF8_INPUT_ENABLE -#define UTF8_OUTPUT_ENABLE - -/* invert characters invalid in Shift_JIS to CP932 */ -#define SHIFTJIS_CP932 - -/* fix input encoding when given by option */ -#define INPUT_CODE_FIX - -/* --overwrite option */ -/* by Satoru Takabayashi <ccsatoru@vega.aichi-u.ac.jp> */ -#define OVERWRITE - -/* --cap-input, --url-input option */ -#define INPUT_OPTION - -/* --numchar-input option */ -#define NUMCHAR_OPTION - -/* --debug, --no-output option */ -#define CHECK_OPTION - -/* JIS X0212 */ -#define X0212_ENABLE - -/* --exec-in, --exec-out option - * require pipe, fork, execvp and so on. - * please undef this on MS-DOS, MinGW - * this is still buggy around child process - */ -/* #define EXEC_IO */ - -/* Unicode Normalization */ -#define UNICODE_NORMALIZATION - -/* - * Select Default Output Encoding - * - */ - -/* #define DEFAULT_CODE_JIS */ -/* #define DEFAULT_CODE_SJIS */ -/* #define DEFAULT_CODE_WINDOWS_31J */ -/* #define DEFAULT_CODE_EUC */ -/* #define DEFAULT_CODE_UTF8 */ - -#endif /* _CONFIG_H_ */ diff --git a/ext/nkf/nkf-utf8/nkf.c b/ext/nkf/nkf-utf8/nkf.c deleted file mode 100644 index 6888a43918..0000000000 --- a/ext/nkf/nkf-utf8/nkf.c +++ /dev/null @@ -1,7205 +0,0 @@ -/* - * Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA). - * Copyright (c) 1996-2018, 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 - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * - * 3. This notice may not be removed or altered from any source distribution. - */ -#define NKF_VERSION "2.1.5" -#define NKF_RELEASE_DATE "2018-12-15" -#define COPY_RIGHT \ - "Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \ - "Copyright (C) 1996-2018, The nkf Project." - -#include "config.h" -#include "nkf.h" -#include "utf8tbl.h" -#ifdef __WIN32__ -#include <windows.h> -#include <locale.h> -#endif -#if defined(__OS2__) -# define INCL_DOS -# define INCL_DOSERRORS -# include <os2.h> -#endif -#include <assert.h> - - -/* state of output_mode and input_mode - - c2 0 means ASCII - JIS_X_0201_1976_K - ISO_8859_1 - JIS_X_0208 - EOF all termination - c1 32bit data - - */ - -/* MIME ENCODE */ - -#define FIXED_MIME 7 -#define STRICT_MIME 8 - -/* byte order */ -enum byte_order { - ENDIAN_BIG = 1, - ENDIAN_LITTLE = 2, - ENDIAN_2143 = 3, - ENDIAN_3412 = 4 -}; - -/* ASCII CODE */ - -#define BS 0x08 -#define TAB 0x09 -#define LF 0x0a -#define CR 0x0d -#define ESC 0x1b -#define SP 0x20 -#define DEL 0x7f -#define SI 0x0f -#define SO 0x0e -#define SS2 0x8e -#define SS3 0x8f -#define CRLF 0x0D0A - - -/* encodings */ - -enum nkf_encodings { - ASCII, - ISO_8859_1, - ISO_2022_JP, - CP50220, - CP50221, - CP50222, - ISO_2022_JP_1, - ISO_2022_JP_3, - ISO_2022_JP_2004, - SHIFT_JIS, - WINDOWS_31J, - CP10001, - EUC_JP, - EUCJP_NKF, - CP51932, - EUCJP_MS, - EUCJP_ASCII, - SHIFT_JISX0213, - SHIFT_JIS_2004, - EUC_JISX0213, - EUC_JIS_2004, - UTF_8, - UTF_8N, - UTF_8_BOM, - UTF8_MAC, - UTF_16, - UTF_16BE, - UTF_16BE_BOM, - UTF_16LE, - UTF_16LE_BOM, - UTF_32, - UTF_32BE, - UTF_32BE_BOM, - UTF_32LE, - UTF_32LE_BOM, - BINARY, - NKF_ENCODING_TABLE_SIZE, - JIS_X_0201_1976_K = 0x1013, /* I */ /* JIS C 6220-1969 */ - /* JIS_X_0201_1976_R = 0x1014, */ /* J */ /* JIS C 6220-1969 */ - /* JIS_X_0208_1978 = 0x1040, */ /* @ */ /* JIS C 6226-1978 */ - /* JIS_X_0208_1983 = 0x1087, */ /* B */ /* JIS C 6226-1983 */ - JIS_X_0208 = 0x1168, /* @B */ - JIS_X_0212 = 0x1159, /* D */ - /* JIS_X_0213_2000_1 = 0x1228, */ /* O */ - JIS_X_0213_2 = 0x1229, /* P */ - JIS_X_0213_1 = 0x1233 /* Q */ -}; - -static nkf_char s_iconv(nkf_char c2, nkf_char c1, nkf_char c0); -static nkf_char e_iconv(nkf_char c2, nkf_char c1, nkf_char c0); -static nkf_char w_iconv(nkf_char c2, nkf_char c1, nkf_char c0); -static nkf_char w_iconv16(nkf_char c2, nkf_char c1, nkf_char c0); -static nkf_char w_iconv32(nkf_char c2, nkf_char c1, nkf_char c0); -static void j_oconv(nkf_char c2, nkf_char c1); -static void s_oconv(nkf_char c2, nkf_char c1); -static void e_oconv(nkf_char c2, nkf_char c1); -static void w_oconv(nkf_char c2, nkf_char c1); -static void w_oconv16(nkf_char c2, nkf_char c1); -static void w_oconv32(nkf_char c2, nkf_char c1); - -typedef const struct { - const char *name; - nkf_char (*iconv)(nkf_char c2, nkf_char c1, nkf_char c0); - void (*oconv)(nkf_char c2, nkf_char c1); -} nkf_native_encoding; - -nkf_native_encoding NkfEncodingASCII = { "ASCII", e_iconv, e_oconv }; -nkf_native_encoding NkfEncodingISO_2022_JP = { "ISO-2022-JP", e_iconv, j_oconv }; -nkf_native_encoding NkfEncodingShift_JIS = { "Shift_JIS", s_iconv, s_oconv }; -nkf_native_encoding NkfEncodingEUC_JP = { "EUC-JP", e_iconv, e_oconv }; -nkf_native_encoding NkfEncodingUTF_8 = { "UTF-8", w_iconv, w_oconv }; -nkf_native_encoding NkfEncodingUTF_16 = { "UTF-16", w_iconv16, w_oconv16 }; -nkf_native_encoding NkfEncodingUTF_32 = { "UTF-32", w_iconv32, w_oconv32 }; - -typedef const struct { - int id; - const char *name; - nkf_native_encoding *base_encoding; -} nkf_encoding; - -nkf_encoding nkf_encoding_table[] = { - {ASCII, "US-ASCII", &NkfEncodingASCII}, - {ISO_8859_1, "ISO-8859-1", &NkfEncodingASCII}, - {ISO_2022_JP, "ISO-2022-JP", &NkfEncodingISO_2022_JP}, - {CP50220, "CP50220", &NkfEncodingISO_2022_JP}, - {CP50221, "CP50221", &NkfEncodingISO_2022_JP}, - {CP50222, "CP50222", &NkfEncodingISO_2022_JP}, - {ISO_2022_JP_1, "ISO-2022-JP-1", &NkfEncodingISO_2022_JP}, - {ISO_2022_JP_3, "ISO-2022-JP-3", &NkfEncodingISO_2022_JP}, - {ISO_2022_JP_2004, "ISO-2022-JP-2004", &NkfEncodingISO_2022_JP}, - {SHIFT_JIS, "Shift_JIS", &NkfEncodingShift_JIS}, - {WINDOWS_31J, "Windows-31J", &NkfEncodingShift_JIS}, - {CP10001, "CP10001", &NkfEncodingShift_JIS}, - {EUC_JP, "EUC-JP", &NkfEncodingEUC_JP}, - {EUCJP_NKF, "eucJP-nkf", &NkfEncodingEUC_JP}, - {CP51932, "CP51932", &NkfEncodingEUC_JP}, - {EUCJP_MS, "eucJP-MS", &NkfEncodingEUC_JP}, - {EUCJP_ASCII, "eucJP-ASCII", &NkfEncodingEUC_JP}, - {SHIFT_JISX0213, "Shift_JISX0213", &NkfEncodingShift_JIS}, - {SHIFT_JIS_2004, "Shift_JIS-2004", &NkfEncodingShift_JIS}, - {EUC_JISX0213, "EUC-JISX0213", &NkfEncodingEUC_JP}, - {EUC_JIS_2004, "EUC-JIS-2004", &NkfEncodingEUC_JP}, - {UTF_8, "UTF-8", &NkfEncodingUTF_8}, - {UTF_8N, "UTF-8N", &NkfEncodingUTF_8}, - {UTF_8_BOM, "UTF-8-BOM", &NkfEncodingUTF_8}, - {UTF8_MAC, "UTF8-MAC", &NkfEncodingUTF_8}, - {UTF_16, "UTF-16", &NkfEncodingUTF_16}, - {UTF_16BE, "UTF-16BE", &NkfEncodingUTF_16}, - {UTF_16BE_BOM, "UTF-16BE-BOM", &NkfEncodingUTF_16}, - {UTF_16LE, "UTF-16LE", &NkfEncodingUTF_16}, - {UTF_16LE_BOM, "UTF-16LE-BOM", &NkfEncodingUTF_16}, - {UTF_32, "UTF-32", &NkfEncodingUTF_32}, - {UTF_32BE, "UTF-32BE", &NkfEncodingUTF_32}, - {UTF_32BE_BOM, "UTF-32BE-BOM", &NkfEncodingUTF_32}, - {UTF_32LE, "UTF-32LE", &NkfEncodingUTF_32}, - {UTF_32LE_BOM, "UTF-32LE-BOM", &NkfEncodingUTF_32}, - {BINARY, "BINARY", &NkfEncodingASCII}, - {-1, NULL, NULL} -}; - -static const struct { - const char *name; - int id; -} encoding_name_to_id_table[] = { - {"US-ASCII", ASCII}, - {"ASCII", ASCII}, - {"646", ASCII}, - {"ROMAN8", ASCII}, - {"ISO-2022-JP", ISO_2022_JP}, - {"ISO2022JP-CP932", CP50220}, - {"CP50220", CP50220}, - {"CP50221", CP50221}, - {"CSISO2022JP", CP50221}, - {"CP50222", CP50222}, - {"ISO-2022-JP-1", ISO_2022_JP_1}, - {"ISO-2022-JP-3", ISO_2022_JP_3}, - {"ISO-2022-JP-2004", ISO_2022_JP_2004}, - {"SHIFT_JIS", SHIFT_JIS}, - {"SJIS", SHIFT_JIS}, - {"MS_Kanji", SHIFT_JIS}, - {"PCK", SHIFT_JIS}, - {"WINDOWS-31J", WINDOWS_31J}, - {"CSWINDOWS31J", WINDOWS_31J}, - {"CP932", WINDOWS_31J}, - {"MS932", WINDOWS_31J}, - {"CP10001", CP10001}, - {"EUCJP", EUC_JP}, - {"EUC-JP", EUC_JP}, - {"EUCJP-NKF", EUCJP_NKF}, - {"CP51932", CP51932}, - {"EUC-JP-MS", EUCJP_MS}, - {"EUCJP-MS", EUCJP_MS}, - {"EUCJPMS", EUCJP_MS}, - {"EUC-JP-ASCII", EUCJP_ASCII}, - {"EUCJP-ASCII", EUCJP_ASCII}, - {"SHIFT_JISX0213", SHIFT_JISX0213}, - {"SHIFT_JIS-2004", SHIFT_JIS_2004}, - {"EUC-JISX0213", EUC_JISX0213}, - {"EUC-JIS-2004", EUC_JIS_2004}, - {"UTF-8", UTF_8}, - {"UTF-8N", UTF_8N}, - {"UTF-8-BOM", UTF_8_BOM}, - {"UTF8-MAC", UTF8_MAC}, - {"UTF-8-MAC", UTF8_MAC}, - {"UTF-16", UTF_16}, - {"UTF-16BE", UTF_16BE}, - {"UTF-16BE-BOM", UTF_16BE_BOM}, - {"UTF-16LE", UTF_16LE}, - {"UTF-16LE-BOM", UTF_16LE_BOM}, - {"UTF-32", UTF_32}, - {"UTF-32BE", UTF_32BE}, - {"UTF-32BE-BOM", UTF_32BE_BOM}, - {"UTF-32LE", UTF_32LE}, - {"UTF-32LE-BOM", UTF_32LE_BOM}, - {"BINARY", BINARY}, - {NULL, -1} -}; - -#if defined(DEFAULT_CODE_JIS) -#define DEFAULT_ENCIDX ISO_2022_JP -#elif defined(DEFAULT_CODE_SJIS) -#define DEFAULT_ENCIDX SHIFT_JIS -#elif defined(DEFAULT_CODE_WINDOWS_31J) -#define DEFAULT_ENCIDX WINDOWS_31J -#elif defined(DEFAULT_CODE_EUC) -#define DEFAULT_ENCIDX EUC_JP -#elif defined(DEFAULT_CODE_UTF8) -#define DEFAULT_ENCIDX UTF_8 -#endif - - -#define is_alnum(c) \ - (('a'<=c && c<='z')||('A'<= c && c<='Z')||('0'<=c && c<='9')) - -/* I don't trust portablity of toupper */ -#define nkf_toupper(c) (('a'<=c && c<='z')?(c-('a'-'A')):c) -#define nkf_isoctal(c) ('0'<=c && c<='7') -#define nkf_isdigit(c) ('0'<=c && c<='9') -#define nkf_isxdigit(c) (nkf_isdigit(c) || ('a'<=c && c<='f') || ('A'<=c && c <= 'F')) -#define nkf_isblank(c) (c == SP || c == TAB) -#define nkf_isspace(c) (nkf_isblank(c) || c == CR || c == LF) -#define nkf_isalpha(c) (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) -#define nkf_isalnum(c) (nkf_isdigit(c) || nkf_isalpha(c)) -#define nkf_isprint(c) (SP<=c && c<='~') -#define nkf_isgraph(c) ('!'<=c && c<='~') -#define hex2bin(c) (('0'<=c&&c<='9') ? (c-'0') : \ - ('A'<=c&&c<='F') ? (c-'A'+10) : \ - ('a'<=c&&c<='f') ? (c-'a'+10) : 0) -#define bin2hex(c) ("0123456789ABCDEF"[c&15]) -#define is_eucg3(c2) (((unsigned short)c2 >> 8) == SS3) -#define nkf_noescape_mime(c) ((c == CR) || (c == LF) || \ - ((c > SP) && (c < DEL) && (c != '?') && (c != '=') && (c != '_') \ - && (c != '(') && (c != ')') && (c != '.') && (c != 0x22))) - -#define is_ibmext_in_sjis(c2) (CP932_TABLE_BEGIN <= c2 && c2 <= CP932_TABLE_END) -#define nkf_byte_jisx0201_katakana_p(c) (SP <= c && c <= 0x5F) - -#define HOLD_SIZE 1024 -#if defined(INT_IS_SHORT) -#define IOBUF_SIZE 2048 -#else -#define IOBUF_SIZE 16384 -#endif - -#define DEFAULT_J 'B' -#define DEFAULT_R 'B' - - -#define GETA1 0x22 -#define GETA2 0x2e - - -/* MIME preprocessor */ - -#ifdef EASYWIN /*Easy Win */ -extern POINT _BufferSize; -#endif - -struct input_code{ - const char *name; - nkf_char stat; - nkf_char score; - nkf_char index; - nkf_char buf[3]; - void (*status_func)(struct input_code *, nkf_char); - nkf_char (*iconv_func)(nkf_char c2, nkf_char c1, nkf_char c0); - int _file_stat; -}; - -static const char *input_codename = NULL; /* NULL: unestablished, "": BINARY */ -static nkf_encoding *input_encoding = NULL; -static nkf_encoding *output_encoding = NULL; - -#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE) -/* UCS Mapping - * 0: Shift_JIS, eucJP-ascii - * 1: eucJP-ms - * 2: CP932, CP51932 - * 3: CP10001 - */ -#define UCS_MAP_ASCII 0 -#define UCS_MAP_MS 1 -#define UCS_MAP_CP932 2 -#define UCS_MAP_CP10001 3 -static int ms_ucs_map_f = UCS_MAP_ASCII; -#endif -#ifdef UTF8_INPUT_ENABLE -/* no NEC special, NEC-selected IBM extended and IBM extended characters */ -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); -#endif -#ifdef UTF8_OUTPUT_ENABLE -static int output_bom_f = FALSE; -static int output_endian = ENDIAN_BIG; -#endif - -static void std_putc(nkf_char c); -static nkf_char std_getc(FILE *f); -static nkf_char std_ungetc(nkf_char c,FILE *f); - -static nkf_char broken_getc(FILE *f); -static nkf_char broken_ungetc(nkf_char c,FILE *f); - -static nkf_char mime_getc(FILE *f); - -static void mime_putc(nkf_char c); - -/* buffers */ - -#if !defined(PERL_XS) && !defined(WIN32DLL) -static unsigned char stdibuf[IOBUF_SIZE]; -static unsigned char stdobuf[IOBUF_SIZE]; -#endif - -#define NKF_UNSPECIFIED (-TRUE) - -/* flags */ -static int unbuf_f = FALSE; -static int estab_f = FALSE; -static int nop_f = FALSE; -static int binmode_f = TRUE; /* binary mode */ -static int rot_f = FALSE; /* rot14/43 mode */ -static int hira_f = FALSE; /* hira/kata henkan */ -static int alpha_f = FALSE; /* convert JIx0208 alphbet to ASCII */ -static int mime_f = MIME_DECODE_DEFAULT; /* convert MIME B base64 or Q */ -static int mime_decode_f = FALSE; /* mime decode is explicitly on */ -static int mimebuf_f = FALSE; /* MIME buffered input */ -static int broken_f = FALSE; /* convert ESC-less broken JIS */ -static int iso8859_f = FALSE; /* ISO8859 through */ -static int mimeout_f = FALSE; /* base64 mode */ -static int x0201_f = NKF_UNSPECIFIED; /* convert JIS X 0201 */ -static int iso2022jp_f = FALSE; /* replace non ISO-2022-JP with GETA */ - -#ifdef UNICODE_NORMALIZATION -static int nfc_f = FALSE; -static nkf_char (*i_nfc_getc)(FILE *) = std_getc; /* input of ugetc */ -static nkf_char (*i_nfc_ungetc)(nkf_char c ,FILE *f) = std_ungetc; -#endif - -#ifdef INPUT_OPTION -static int cap_f = FALSE; -static nkf_char (*i_cgetc)(FILE *) = std_getc; /* input of cgetc */ -static nkf_char (*i_cungetc)(nkf_char c ,FILE *f) = std_ungetc; - -static int url_f = FALSE; -static nkf_char (*i_ugetc)(FILE *) = std_getc; /* input of ugetc */ -static nkf_char (*i_uungetc)(nkf_char c ,FILE *f) = std_ungetc; -#endif - -#define PREFIX_EUCG3 NKF_INT32_C(0x8F00) -#define CLASS_MASK NKF_INT32_C(0xFF000000) -#define CLASS_UNICODE NKF_INT32_C(0x01000000) -#define VALUE_MASK NKF_INT32_C(0x00FFFFFF) -#define UNICODE_BMP_MAX NKF_INT32_C(0x0000FFFF) -#define UNICODE_MAX NKF_INT32_C(0x0010FFFF) -#define nkf_char_euc3_new(c) ((c) | PREFIX_EUCG3) -#define nkf_char_unicode_new(c) ((c) | CLASS_UNICODE) -#define nkf_char_unicode_p(c) ((c & CLASS_MASK) == CLASS_UNICODE) -#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 */ -static nkf_char (*i_nungetc)(nkf_char c ,FILE *f) = std_ungetc; -#endif - -#ifdef CHECK_OPTION -static int noout_f = FALSE; -static void no_putc(nkf_char c); -static int debug_f = FALSE; -static void debug(const char *str); -static nkf_char (*iconv_for_check)(nkf_char c2,nkf_char c1,nkf_char c0) = 0; -#endif - -static int guess_f = 0; /* 0: OFF, 1: ON, 2: VERBOSE */ -static void set_input_codename(const char *codename); - -#ifdef EXEC_IO -static int exec_f = 0; -#endif - -#ifdef SHIFTJIS_CP932 -/* invert IBM extended characters to others */ -static int cp51932_f = FALSE; - -/* invert NEC-selected IBM extended characters to IBM extended characters */ -static int cp932inv_f = TRUE; - -/* static nkf_char cp932_conv(nkf_char c2, nkf_char c1); */ -#endif /* SHIFTJIS_CP932 */ - -static int x0212_f = FALSE; -static int x0213_f = FALSE; - -static unsigned char prefix_table[256]; - -static void e_status(struct input_code *, nkf_char); -static void s_status(struct input_code *, nkf_char); - -struct input_code input_code_list[] = { - {"EUC-JP", 0, 0, 0, {0, 0, 0}, e_status, e_iconv, 0}, - {"Shift_JIS", 0, 0, 0, {0, 0, 0}, s_status, s_iconv, 0}, -#ifdef UTF8_INPUT_ENABLE - {"UTF-8", 0, 0, 0, {0, 0, 0}, w_status, w_iconv, 0}, - {"UTF-16", 0, 0, 0, {0, 0, 0}, NULL, w_iconv16, 0}, - {"UTF-32", 0, 0, 0, {0, 0, 0}, NULL, w_iconv32, 0}, -#endif - {NULL, 0, 0, 0, {0, 0, 0}, NULL, NULL, 0} -}; - -static int mimeout_mode = 0; /* 0, -1, 'Q', 'B', 1, 2 */ -static int base64_count = 0; - -/* X0208 -> ASCII converter */ - -/* fold parameter */ -static int f_line = 0; /* chars in line */ -static int f_prev = 0; -static int fold_preserve_f = FALSE; /* preserve new lines */ -static int fold_f = FALSE; -static int fold_len = 0; - -/* options */ -static unsigned char kanji_intro = DEFAULT_J; -static unsigned char ascii_intro = DEFAULT_R; - -/* Folding */ - -#define FOLD_MARGIN 10 -#define DEFAULT_FOLD 60 - -static int fold_margin = FOLD_MARGIN; - -/* process default */ - -static nkf_char -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); - return 0; /* LINT */ -} - -static void -no_connection(nkf_char c2, nkf_char c1) -{ - no_connection2(c2,c1,0); -} - -static nkf_char (*iconv)(nkf_char c2,nkf_char c1,nkf_char c0) = no_connection2; -static void (*oconv)(nkf_char c2,nkf_char c1) = no_connection; - -static void (*o_zconv)(nkf_char c2,nkf_char c1) = no_connection; -static void (*o_fconv)(nkf_char c2,nkf_char c1) = no_connection; -static void (*o_eol_conv)(nkf_char c2,nkf_char c1) = no_connection; -static void (*o_rot_conv)(nkf_char c2,nkf_char c1) = no_connection; -static void (*o_hira_conv)(nkf_char c2,nkf_char c1) = no_connection; -static void (*o_base64conv)(nkf_char c2,nkf_char c1) = no_connection; -static void (*o_iso2022jp_check_conv)(nkf_char c2,nkf_char c1) = no_connection; - -/* static redirections */ - -static void (*o_putc)(nkf_char c) = std_putc; - -static nkf_char (*i_getc)(FILE *f) = std_getc; /* general input */ -static nkf_char (*i_ungetc)(nkf_char c,FILE *f) =std_ungetc; - -static nkf_char (*i_bgetc)(FILE *) = std_getc; /* input of mgetc */ -static nkf_char (*i_bungetc)(nkf_char c ,FILE *f) = std_ungetc; - -static void (*o_mputc)(nkf_char c) = std_putc ; /* output of mputc */ - -static nkf_char (*i_mgetc)(FILE *) = std_getc; /* input of mgetc */ -static nkf_char (*i_mungetc)(nkf_char c ,FILE *f) = std_ungetc; - -/* for strict mime */ -static nkf_char (*i_mgetc_buf)(FILE *) = std_getc; /* input of mgetc_buf */ -static nkf_char (*i_mungetc_buf)(nkf_char c,FILE *f) = std_ungetc; - -/* Global states */ -static int output_mode = ASCII; /* output kanji mode */ -static int input_mode = ASCII; /* input kanji mode */ -static int mime_decode_mode = FALSE; /* MIME mode B base64, Q hex */ - -/* X0201 / X0208 conversion tables */ - -/* X0201 kana conversion table */ -/* 90-9F A0-DF */ -static const unsigned char cv[]= { - 0x21,0x21,0x21,0x23,0x21,0x56,0x21,0x57, - 0x21,0x22,0x21,0x26,0x25,0x72,0x25,0x21, - 0x25,0x23,0x25,0x25,0x25,0x27,0x25,0x29, - 0x25,0x63,0x25,0x65,0x25,0x67,0x25,0x43, - 0x21,0x3c,0x25,0x22,0x25,0x24,0x25,0x26, - 0x25,0x28,0x25,0x2a,0x25,0x2b,0x25,0x2d, - 0x25,0x2f,0x25,0x31,0x25,0x33,0x25,0x35, - 0x25,0x37,0x25,0x39,0x25,0x3b,0x25,0x3d, - 0x25,0x3f,0x25,0x41,0x25,0x44,0x25,0x46, - 0x25,0x48,0x25,0x4a,0x25,0x4b,0x25,0x4c, - 0x25,0x4d,0x25,0x4e,0x25,0x4f,0x25,0x52, - 0x25,0x55,0x25,0x58,0x25,0x5b,0x25,0x5e, - 0x25,0x5f,0x25,0x60,0x25,0x61,0x25,0x62, - 0x25,0x64,0x25,0x66,0x25,0x68,0x25,0x69, - 0x25,0x6a,0x25,0x6b,0x25,0x6c,0x25,0x6d, - 0x25,0x6f,0x25,0x73,0x21,0x2b,0x21,0x2c, - 0x00,0x00}; - - -/* X0201 kana conversion table for dakuten */ -/* 90-9F A0-DF */ -static const unsigned char dv[]= { - 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,0x74, - 0x00,0x00,0x00,0x00,0x25,0x2c,0x25,0x2e, - 0x25,0x30,0x25,0x32,0x25,0x34,0x25,0x36, - 0x25,0x38,0x25,0x3a,0x25,0x3c,0x25,0x3e, - 0x25,0x40,0x25,0x42,0x25,0x45,0x25,0x47, - 0x25,0x49,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x25,0x50,0x25,0x53, - 0x25,0x56,0x25,0x59,0x25,0x5c,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}; - -/* X0201 kana conversion table for han-dakuten */ -/* 90-9F A0-DF */ -static const unsigned char ev[]= { - 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, - 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,0x51,0x25,0x54, - 0x25,0x57,0x25,0x5a,0x25,0x5d,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}; - -/* X0201 kana to X0213 conversion table for han-dakuten */ -/* 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 */ -static const unsigned char fv[] = { - - 0x00,0x00,0x00,0x00,0x2c,0x2e,0x00,0x3a, - 0x3b,0x3f,0x21,0x00,0x00,0x27,0x60,0x00, - 0x5e,0x00,0x5f,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x2f, - 0x5c,0x00,0x00,0x7c,0x00,0x00,0x60,0x27, - 0x22,0x22,0x28,0x29,0x00,0x00,0x5b,0x5d, - 0x7b,0x7d,0x3c,0x3e,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x2b,0x2d,0x00,0x00, - 0x00,0x3d,0x00,0x3c,0x3e,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x24,0x00,0x00,0x25,0x23,0x26,0x2a,0x40, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -} ; - - - -static int option_mode = 0; -static int file_out_f = FALSE; -#ifdef OVERWRITE -static int overwrite_f = FALSE; -static int preserve_time_f = FALSE; -static int backup_f = FALSE; -static char *backup_suffix = ""; -#endif - -static int eolmode_f = 0; /* CR, LF, CRLF */ -static int input_eol = 0; /* 0: unestablished, EOF: MIXED */ -static nkf_char prev_cr = 0; /* CR or 0 */ -#ifdef EASYWIN /*Easy Win */ -static int end_check; -#endif /*Easy Win */ - -static void * -nkf_xmalloc(size_t size) -{ - void *ptr; - - if (size == 0) size = 1; - - ptr = malloc(size); - if (ptr == NULL) { - perror("can't malloc"); - exit(EXIT_FAILURE); - } - - return ptr; -} - -static void * -nkf_xrealloc(void *ptr, size_t size) -{ - if (size == 0) size = 1; - - ptr = realloc(ptr, size); - if (ptr == NULL) { - perror("can't realloc"); - exit(EXIT_FAILURE); - } - - return ptr; -} - -#define nkf_xfree(ptr) free(ptr) - -static int -nkf_str_caseeql(const char *src, const char *target) -{ - int i; - for (i = 0; src[i] && target[i]; i++) { - if (nkf_toupper(src[i]) != nkf_toupper(target[i])) return FALSE; - } - if (src[i] || target[i]) return FALSE; - else return TRUE; -} - -static nkf_encoding* -nkf_enc_from_index(int idx) -{ - if (idx < 0 || NKF_ENCODING_TABLE_SIZE <= idx) { - return 0; - } - return &nkf_encoding_table[idx]; -} - -static int -nkf_enc_find_index(const char *name) -{ - int i; - if (name[0] == 'X' && *(name+1) == '-') name += 2; - for (i = 0; encoding_name_to_id_table[i].id >= 0; i++) { - if (nkf_str_caseeql(encoding_name_to_id_table[i].name, name)) { - return encoding_name_to_id_table[i].id; - } - } - return -1; -} - -static nkf_encoding* -nkf_enc_find(const char *name) -{ - int idx = -1; - idx = nkf_enc_find_index(name); - if (idx < 0) return 0; - return nkf_enc_from_index(idx); -} - -#define nkf_enc_name(enc) (enc)->name -#define nkf_enc_to_index(enc) (enc)->id -#define nkf_enc_to_base_encoding(enc) (enc)->base_encoding -#define nkf_enc_to_iconv(enc) nkf_enc_to_base_encoding(enc)->iconv -#define nkf_enc_to_oconv(enc) nkf_enc_to_base_encoding(enc)->oconv -#define nkf_enc_asciicompat(enc) (\ - nkf_enc_to_base_encoding(enc) == &NkfEncodingASCII ||\ - nkf_enc_to_base_encoding(enc) == &NkfEncodingISO_2022_JP) -#define nkf_enc_unicode_p(enc) (\ - nkf_enc_to_base_encoding(enc) == &NkfEncodingUTF_8 ||\ - nkf_enc_to_base_encoding(enc) == &NkfEncodingUTF_16 ||\ - nkf_enc_to_base_encoding(enc) == &NkfEncodingUTF_32) -#define nkf_enc_cp5022x_p(enc) (\ - nkf_enc_to_index(enc) == CP50220 ||\ - nkf_enc_to_index(enc) == CP50221 ||\ - nkf_enc_to_index(enc) == CP50222) - -#ifdef DEFAULT_CODE_LOCALE -static const char* -nkf_locale_charmap(void) -{ -#ifdef HAVE_LANGINFO_H - return nl_langinfo(CODESET); -#elif defined(__WIN32__) - static char buf[16]; - sprintf(buf, "CP%d", GetACP()); - return buf; -#elif defined(__OS2__) -# if defined(INT_IS_SHORT) - /* OS/2 1.x */ - return NULL; -# else - /* OS/2 32bit */ - static char buf[16]; - ULONG ulCP[1], ulncp; - DosQueryCp(sizeof(ulCP), ulCP, &ulncp); - if (ulCP[0] == 932 || ulCP[0] == 943) - strcpy(buf, "Shift_JIS"); - else - sprintf(buf, "CP%lu", ulCP[0]); - return buf; -# endif -#endif - return NULL; -} - -static nkf_encoding* -nkf_locale_encoding(void) -{ - nkf_encoding *enc = 0; - const char *encname = nkf_locale_charmap(); - if (encname) - enc = nkf_enc_find(encname); - return enc; -} -#endif /* DEFAULT_CODE_LOCALE */ - -static nkf_encoding* -nkf_utf8_encoding(void) -{ - return &nkf_encoding_table[UTF_8]; -} - -static nkf_encoding* -nkf_default_encoding(void) -{ - nkf_encoding *enc = 0; -#ifdef DEFAULT_CODE_LOCALE - enc = nkf_locale_encoding(); -#elif defined(DEFAULT_ENCIDX) - enc = nkf_enc_from_index(DEFAULT_ENCIDX); -#endif - if (!enc) enc = nkf_utf8_encoding(); - return enc; -} - -typedef struct { - long capa; - long len; - nkf_char *ptr; -} nkf_buf_t; - -static nkf_buf_t * -nkf_buf_new(int length) -{ - nkf_buf_t *buf = nkf_xmalloc(sizeof(nkf_buf_t)); - buf->ptr = nkf_xmalloc(sizeof(nkf_char) * length); - buf->capa = length; - buf->len = 0; - return buf; -} - -#if 0 -static void -nkf_buf_dispose(nkf_buf_t *buf) -{ - nkf_xfree(buf->ptr); - nkf_xfree(buf); -} -#endif - -#define nkf_buf_length(buf) ((buf)->len) -#define nkf_buf_empty_p(buf) ((buf)->len == 0) - -static nkf_char -nkf_buf_at(nkf_buf_t *buf, int index) -{ - assert(index <= buf->len); - return buf->ptr[index]; -} - -static void -nkf_buf_clear(nkf_buf_t *buf) -{ - buf->len = 0; -} - -static void -nkf_buf_push(nkf_buf_t *buf, nkf_char c) -{ - if (buf->capa <= buf->len) { - exit(EXIT_FAILURE); - } - buf->ptr[buf->len++] = c; -} - -static nkf_char -nkf_buf_pop(nkf_buf_t *buf) -{ - assert(!nkf_buf_empty_p(buf)); - return buf->ptr[--buf->len]; -} - -/* Normalization Form C */ -#ifndef PERL_XS -#ifdef WIN32DLL -#define fprintf dllprintf -#endif - -static void -version(void) -{ - fprintf(HELP_OUTPUT,"Network Kanji Filter Version " NKF_VERSION " (" NKF_RELEASE_DATE ") \n" COPY_RIGHT "\n"); -} - -static void -usage(void) -{ - fprintf(HELP_OUTPUT, - "Usage: nkf -[flags] [--] [in file] .. [out file for -O flag]\n" -#ifdef UTF8_OUTPUT_ENABLE - " j/s/e/w Specify output encoding ISO-2022-JP, Shift_JIS, EUC-JP\n" - " UTF options is -w[8[0],{16,32}[{B,L}[0]]]\n" -#else -#endif -#ifdef UTF8_INPUT_ENABLE - " J/S/E/W Specify input encoding ISO-2022-JP, Shift_JIS, EUC-JP\n" - " UTF option is -W[8,[16,32][B,L]]\n" -#else - " J/S/E Specify output encoding ISO-2022-JP, Shift_JIS, EUC-JP\n" -#endif - ); - fprintf(HELP_OUTPUT, - " m[BQSN0] MIME decode [B:base64,Q:quoted,S:strict,N:nonstrict,0:no decode]\n" - " M[BQ] MIME encode [B:base64 Q:quoted]\n" - " f/F Folding: -f60 or -f or -f60-10 (fold margin 10) F preserve nl\n" - ); - fprintf(HELP_OUTPUT, - " Z[0-4] Default/0: Convert JISX0208 Alphabet to ASCII\n" - " 1: Kankaku to one space 2: to two spaces 3: HTML Entity\n" - " 4: JISX0208 Katakana to JISX0201 Katakana\n" - " X,x Convert Halfwidth Katakana to Fullwidth or preserve it\n" - ); - fprintf(HELP_OUTPUT, - " O Output to File (DEFAULT 'nkf.out')\n" - " L[uwm] Line mode u:LF w:CRLF m:CR (DEFAULT noconversion)\n" - ); - fprintf(HELP_OUTPUT, - " --ic=<encoding> Specify the input encoding\n" - " --oc=<encoding> Specify the output encoding\n" - " --hiragana --katakana Hiragana/Katakana Conversion\n" - " --katakana-hiragana Converts each other\n" - ); - fprintf(HELP_OUTPUT, -#ifdef INPUT_OPTION - " --{cap, url}-input Convert hex after ':' or '%%'\n" -#endif -#ifdef NUMCHAR_OPTION - " --numchar-input Convert Unicode Character Reference\n" -#endif -#ifdef UTF8_INPUT_ENABLE - " --fb-{skip, html, xml, perl, java, subchar}\n" - " Specify unassigned character's replacement\n" -#endif - ); - fprintf(HELP_OUTPUT, -#ifdef OVERWRITE - " --in-place[=SUF] Overwrite original files\n" - " --overwrite[=SUF] Preserve timestamp of original files\n" -#endif - " -g --guess Guess the input code\n" - " -v --version Print the version\n" - " --help/-V Print this help / configuration\n" - ); - version(); -} - -static void -show_configuration(void) -{ - fprintf(HELP_OUTPUT, - "Summary of my nkf " NKF_VERSION " (" NKF_RELEASE_DATE ") configuration:\n" - " Compile-time options:\n" - " Compiled at: " __DATE__ " " __TIME__ "\n" - ); - fprintf(HELP_OUTPUT, - " Default output encoding: " -#ifdef DEFAULT_CODE_LOCALE - "LOCALE (%s)\n", nkf_enc_name(nkf_default_encoding()) -#elif defined(DEFAULT_ENCIDX) - "CONFIG (%s)\n", nkf_enc_name(nkf_default_encoding()) -#else - "NONE\n" -#endif - ); - fprintf(HELP_OUTPUT, - " Default output end of line: " -#if DEFAULT_NEWLINE == CR - "CR" -#elif DEFAULT_NEWLINE == CRLF - "CRLF" -#else - "LF" -#endif - "\n" - " Decode MIME encoded string: " -#if MIME_DECODE_DEFAULT - "ON" -#else - "OFF" -#endif - "\n" - " Convert JIS X 0201 Katakana: " -#if X0201_DEFAULT - "ON" -#else - "OFF" -#endif - "\n" - " --help, --version output: " -#if HELP_OUTPUT_HELP_OUTPUT - "HELP_OUTPUT" -#else - "STDOUT" -#endif - "\n"); -} -#endif /*PERL_XS*/ - -#ifdef OVERWRITE -static char* -get_backup_filename(const char *suffix, const char *filename) -{ - char *backup_filename; - int asterisk_count = 0; - int i, j; - int filename_length = strlen(filename); - - for(i = 0; suffix[i]; i++){ - if(suffix[i] == '*') asterisk_count++; - } - - if(asterisk_count){ - backup_filename = nkf_xmalloc(strlen(suffix) + (asterisk_count * (filename_length - 1)) + 1); - for(i = 0, j = 0; suffix[i];){ - if(suffix[i] == '*'){ - backup_filename[j] = '\0'; - strncat(backup_filename, filename, filename_length); - i++; - j += filename_length; - }else{ - backup_filename[j++] = suffix[i++]; - } - } - backup_filename[j] = '\0'; - }else{ - j = filename_length + strlen(suffix); - backup_filename = nkf_xmalloc(j + 1); - strcpy(backup_filename, filename); - strcat(backup_filename, suffix); - backup_filename[j] = '\0'; - } - return backup_filename; -} -#endif - -#ifdef UTF8_INPUT_ENABLE -static void -nkf_each_char_to_hex(void (*f)(nkf_char c2,nkf_char c1), nkf_char c) -{ - int shift = 20; - c &= VALUE_MASK; - while(shift >= 0){ - if(c >= NKF_INT32_C(1)<<shift){ - while(shift >= 0){ - (*f)(0, bin2hex(c>>shift)); - shift -= 4; - } - }else{ - shift -= 4; - } - } - return; -} - -static void -encode_fallback_html(nkf_char c) -{ - (*oconv)(0, '&'); - (*oconv)(0, '#'); - c &= VALUE_MASK; - if(c >= NKF_INT32_C(1000000)) - (*oconv)(0, 0x30+(c/NKF_INT32_C(1000000))%10); - if(c >= NKF_INT32_C(100000)) - (*oconv)(0, 0x30+(c/NKF_INT32_C(100000) )%10); - if(c >= 10000) - (*oconv)(0, 0x30+(c/10000 )%10); - if(c >= 1000) - (*oconv)(0, 0x30+(c/1000 )%10); - if(c >= 100) - (*oconv)(0, 0x30+(c/100 )%10); - if(c >= 10) - (*oconv)(0, 0x30+(c/10 )%10); - if(c >= 0) - (*oconv)(0, 0x30+ c %10); - (*oconv)(0, ';'); - return; -} - -static void -encode_fallback_xml(nkf_char c) -{ - (*oconv)(0, '&'); - (*oconv)(0, '#'); - (*oconv)(0, 'x'); - nkf_each_char_to_hex(oconv, c); - (*oconv)(0, ';'); - return; -} - -static void -encode_fallback_java(nkf_char c) -{ - (*oconv)(0, '\\'); - c &= VALUE_MASK; - if(!nkf_char_unicode_bmp_p(c)){ - int high = (c >> 10) + NKF_INT32_C(0xD7C0); /* high surrogate */ - int low = (c & 0x3FF) + NKF_INT32_C(0xDC00); /* low surrogate */ - (*oconv)(0, 'u'); - (*oconv)(0, bin2hex(high>>12)); - (*oconv)(0, bin2hex(high>> 8)); - (*oconv)(0, bin2hex(high>> 4)); - (*oconv)(0, bin2hex(high )); - (*oconv)(0, '\\'); - (*oconv)(0, 'u'); - (*oconv)(0, bin2hex(low>>12)); - (*oconv)(0, bin2hex(low>> 8)); - (*oconv)(0, bin2hex(low>> 4)); - (*oconv)(0, bin2hex(low )); - }else{ - (*oconv)(0, 'u'); - (*oconv)(0, bin2hex(c>>12)); - (*oconv)(0, bin2hex(c>> 8)); - (*oconv)(0, bin2hex(c>> 4)); - (*oconv)(0, bin2hex(c )); - } - return; -} - -static void -encode_fallback_perl(nkf_char c) -{ - (*oconv)(0, '\\'); - (*oconv)(0, 'x'); - (*oconv)(0, '{'); - nkf_each_char_to_hex(oconv, c); - (*oconv)(0, '}'); - return; -} - -static void -encode_fallback_subchar(nkf_char c) -{ - c = unicode_subchar; - (*oconv)((c>>8)&0xFF, c&0xFF); - return; -} -#endif - -static const struct { - const char *name; - const char *alias; -} long_option[] = { - {"ic=", ""}, - {"oc=", ""}, - {"base64","jMB"}, - {"euc","e"}, - {"euc-input","E"}, - {"fj","jm"}, - {"help",""}, - {"jis","j"}, - {"jis-input","J"}, - {"mac","sLm"}, - {"mime","jM"}, - {"mime-input","m"}, - {"msdos","sLw"}, - {"sjis","s"}, - {"sjis-input","S"}, - {"unix","eLu"}, - {"version","v"}, - {"windows","sLw"}, - {"hiragana","h1"}, - {"katakana","h2"}, - {"katakana-hiragana","h3"}, - {"guess=", ""}, - {"guess", "g2"}, - {"cp932", ""}, - {"no-cp932", ""}, -#ifdef X0212_ENABLE - {"x0212", ""}, -#endif -#ifdef UTF8_OUTPUT_ENABLE - {"utf8", "w"}, - {"utf16", "w16"}, - {"ms-ucs-map", ""}, - {"fb-skip", ""}, - {"fb-html", ""}, - {"fb-xml", ""}, - {"fb-perl", ""}, - {"fb-java", ""}, - {"fb-subchar", ""}, - {"fb-subchar=", ""}, -#endif -#ifdef UTF8_INPUT_ENABLE - {"utf8-input", "W"}, - {"utf16-input", "W16"}, - {"no-cp932ext", ""}, - {"no-best-fit-chars",""}, -#endif -#ifdef UNICODE_NORMALIZATION - {"utf8mac-input", ""}, -#endif -#ifdef OVERWRITE - {"overwrite", ""}, - {"overwrite=", ""}, - {"in-place", ""}, - {"in-place=", ""}, -#endif -#ifdef INPUT_OPTION - {"cap-input", ""}, - {"url-input", ""}, -#endif -#ifdef NUMCHAR_OPTION - {"numchar-input", ""}, -#endif -#ifdef CHECK_OPTION - {"no-output", ""}, - {"debug", ""}, -#endif -#ifdef SHIFTJIS_CP932 - {"cp932inv", ""}, -#endif -#ifdef EXEC_IO - {"exec-in", ""}, - {"exec-out", ""}, -#endif - {"prefix=", ""}, -}; - -static void -set_input_encoding(nkf_encoding *enc) -{ - switch (nkf_enc_to_index(enc)) { - case ISO_8859_1: - iso8859_f = TRUE; - break; - case CP50221: - case CP50222: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ - case CP50220: -#ifdef SHIFTJIS_CP932 - cp51932_f = TRUE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP932; -#endif - break; - case ISO_2022_JP_1: - x0212_f = TRUE; - break; - case ISO_2022_JP_3: - x0212_f = TRUE; - x0213_f = TRUE; - break; - case ISO_2022_JP_2004: - x0212_f = TRUE; - x0213_f = TRUE; - break; - case SHIFT_JIS: - break; - case WINDOWS_31J: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ -#ifdef SHIFTJIS_CP932 - cp51932_f = TRUE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP932; -#endif - break; - break; - case CP10001: -#ifdef SHIFTJIS_CP932 - cp51932_f = TRUE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP10001; -#endif - break; - case EUC_JP: - break; - case EUCJP_NKF: - break; - case CP51932: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ -#ifdef SHIFTJIS_CP932 - cp51932_f = TRUE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP932; -#endif - break; - case EUCJP_MS: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ -#ifdef SHIFTJIS_CP932 - cp51932_f = FALSE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_MS; -#endif - break; - case EUCJP_ASCII: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ -#ifdef SHIFTJIS_CP932 - cp51932_f = FALSE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_ASCII; -#endif - break; - case SHIFT_JISX0213: - case SHIFT_JIS_2004: - x0213_f = TRUE; -#ifdef SHIFTJIS_CP932 - cp51932_f = FALSE; - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif - break; - case EUC_JISX0213: - case EUC_JIS_2004: - x0213_f = TRUE; -#ifdef SHIFTJIS_CP932 - cp51932_f = FALSE; -#endif - break; -#ifdef UTF8_INPUT_ENABLE -#ifdef UNICODE_NORMALIZATION - case UTF8_MAC: - nfc_f = TRUE; - break; -#endif - case UTF_16: - case UTF_16BE: - case UTF_16BE_BOM: - input_endian = ENDIAN_BIG; - break; - case UTF_16LE: - case UTF_16LE_BOM: - input_endian = ENDIAN_LITTLE; - break; - case UTF_32: - case UTF_32BE: - case UTF_32BE_BOM: - input_endian = ENDIAN_BIG; - break; - case UTF_32LE: - case UTF_32LE_BOM: - input_endian = ENDIAN_LITTLE; - break; -#endif - } -} - -static void -set_output_encoding(nkf_encoding *enc) -{ - switch (nkf_enc_to_index(enc)) { - case CP50220: -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP932; -#endif - break; - case CP50221: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP932; -#endif - break; - case ISO_2022_JP: -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif - break; - case ISO_2022_JP_1: - x0212_f = TRUE; -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif - break; - case ISO_2022_JP_3: - case ISO_2022_JP_2004: - x0212_f = TRUE; - x0213_f = TRUE; -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif - break; - case SHIFT_JIS: - break; - case WINDOWS_31J: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP932; -#endif - break; - case CP10001: -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP10001; -#endif - break; - case EUC_JP: - x0212_f = TRUE; -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_ASCII; -#endif - break; - case EUCJP_NKF: - x0212_f = FALSE; -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_ASCII; -#endif - break; - case CP51932: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP932; -#endif - break; - case EUCJP_MS: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ - x0212_f = TRUE; -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_MS; -#endif - break; - case EUCJP_ASCII: - if (x0201_f == NKF_UNSPECIFIED) x0201_f = FALSE; /* -x specified implicitly */ - x0212_f = TRUE; -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_ASCII; -#endif - break; - case SHIFT_JISX0213: - case SHIFT_JIS_2004: - x0213_f = TRUE; -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif - break; - case EUC_JISX0213: - case EUC_JIS_2004: - x0212_f = TRUE; - x0213_f = TRUE; -#ifdef SHIFTJIS_CP932 - if (cp932inv_f == TRUE) cp932inv_f = FALSE; -#endif - break; -#ifdef UTF8_OUTPUT_ENABLE - case UTF_8_BOM: - output_bom_f = TRUE; - break; - case UTF_16: - case UTF_16BE_BOM: - output_bom_f = TRUE; - break; - case UTF_16LE: - output_endian = ENDIAN_LITTLE; - output_bom_f = FALSE; - break; - case UTF_16LE_BOM: - output_endian = ENDIAN_LITTLE; - output_bom_f = TRUE; - break; - case UTF_32: - case UTF_32BE_BOM: - output_bom_f = TRUE; - break; - case UTF_32LE: - output_endian = ENDIAN_LITTLE; - output_bom_f = FALSE; - break; - case UTF_32LE_BOM: - output_endian = ENDIAN_LITTLE; - output_bom_f = TRUE; - break; -#endif - } -} - -static struct input_code* -find_inputcode_byfunc(nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0)) -{ - if (iconv_func){ - struct input_code *p = input_code_list; - while (p->name){ - if (iconv_func == p->iconv_func){ - return p; - } - p++; - } - } - return 0; -} - -static void -set_iconv(nkf_char f, nkf_char (*iconv_func)(nkf_char c2,nkf_char c1,nkf_char c0)) -{ -#ifdef INPUT_CODE_FIX - if (f || !input_encoding) -#endif - if (estab_f != f){ - estab_f = f; - } - - if (iconv_func -#ifdef INPUT_CODE_FIX - && (f == -TRUE || !input_encoding) /* -TRUE means "FORCE" */ -#endif - ){ - iconv = iconv_func; - } -#ifdef CHECK_OPTION - if (estab_f && iconv_for_check != iconv){ - struct input_code *p = find_inputcode_byfunc(iconv); - if (p){ - set_input_codename(p->name); - debug(p->name); - } - iconv_for_check = iconv; - } -#endif -} - -#ifdef X0212_ENABLE -static nkf_char -x0212_shift(nkf_char c) -{ - nkf_char ret = c; - c &= 0x7f; - if (is_eucg3(ret)){ - if (0x75 <= c && c <= 0x7f){ - ret = c + (0x109 - 0x75); - } - }else{ - if (0x75 <= c && c <= 0x7f){ - ret = c + (0x113 - 0x75); - } - } - return ret; -} - - -static nkf_char -x0212_unshift(nkf_char c) -{ - nkf_char ret = c; - if (0x7f <= c && c <= 0x88){ - ret = c + (0x75 - 0x7f); - }else if (0x89 <= c && c <= 0x92){ - ret = PREFIX_EUCG3 | 0x80 | (c + (0x75 - 0x89)); - } - return ret; -} -#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 && 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); - return 0; - }else if(0x6E <= ndx && ndx <= 0x7E){ - if (p2) *p2 = ((ndx - 1) >> 1) + 0xbe; - if (p1) *p1 = c1 + ((ndx & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e); - return 0; - } - return 1; - } -#ifdef X0212_ENABLE - else if(nkf_isgraph(ndx)){ - nkf_char val = 0; - const unsigned short *ptr; - ptr = x0212_shiftjis[ndx - 0x21]; - if (ptr){ - val = ptr[(c1 & 0x7f) - 0x21]; - } - if (val){ - c2 = val >> 8; - c1 = val & 0xff; - if (p2) *p2 = c2; - if (p1) *p1 = c1; - return 0; - } - c2 = x0212_shift(c2); - } -#endif /* X0212_ENABLE */ - } - if(0x7F < c2) return 1; - if (p2) *p2 = ((c2 - 1) >> 1) + ((c2 <= 0x5e) ? 0x71 : 0xb1); - if (p1) *p1 = c1 + ((c2 & 1) ? ((c1 < 0x60) ? 0x1f : 0x20) : 0x7e); - return 0; -} - -static nkf_char -s2e_conv(nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1) -{ -#if defined(SHIFTJIS_CP932) || defined(X0212_ENABLE) - nkf_char val; -#endif - 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 && !x0213_f && is_ibmext_in_sjis(c2)){ - val = shiftjis_cp932[c2 - CP932_TABLE_BEGIN][c1 - 0x40]; - if (val){ - c2 = val >> 8; - c1 = val & 0xff; - } - } - if (cp932inv_f - && CP932INV_TABLE_BEGIN <= c2 && c2 <= CP932INV_TABLE_END){ - val = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40]; - if (val){ - c2 = val >> 8; - c1 = val & 0xff; - } - } -#endif /* SHIFTJIS_CP932 */ -#ifdef X0212_ENABLE - if (!x0213_f && is_ibmext_in_sjis(c2)){ - val = shiftjis_x0212[c2 - 0xfa][c1 - 0x40]; - if (val){ - if (val > 0x7FFF){ - c2 = PREFIX_EUCG3 | ((val >> 8) & 0x7f); - c1 = val & 0xff; - }else{ - c2 = val >> 8; - c1 = val & 0xff; - } - if (p2) *p2 = c2; - if (p1) *p1 = c1; - return 0; - } - } -#endif - if(c2 >= 0x80){ - if(x0213_f && c2 >= 0xF0){ - if(c2 <= 0xF3 || (c2 == 0xF4 && c1 < 0x9F)){ /* k=1, 3<=k<=5, k=8, 12<=k<=15 */ - c2 = PREFIX_EUCG3 | 0x20 | shift_jisx0213_s1a3_table[c2 - 0xF0][0x9E < c1]; - }else{ /* 78<=k<=94 */ - c2 = PREFIX_EUCG3 | (c2 * 2 - 0x17B); - if (0x9E < c1) c2++; - } - }else{ -#define SJ0162 0x00e1 /* 01 - 62 ku offset */ -#define SJ6394 0x0161 /* 63 - 94 ku offset */ - c2 = c2 + c2 - ((c2 <= 0x9F) ? SJ0162 : SJ6394); - if (0x9E < c1) c2++; - } - if (c1 < 0x9F) - c1 = c1 - ((c1 > DEL) ? SP : 0x1F); - else { - c1 = c1 - 0x7E; - } - } - -#ifdef X0212_ENABLE - c2 = x0212_unshift(c2); -#endif - if (p2) *p2 = c2; - if (p1) *p1 = c1; - return 0; -} - -#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE) -static void -nkf_unicode_to_utf8(nkf_char val, nkf_char *p1, nkf_char *p2, nkf_char *p3, nkf_char *p4) -{ - val &= VALUE_MASK; - if (val < 0x80){ - *p1 = val; - *p2 = 0; - *p3 = 0; - *p4 = 0; - }else if (val < 0x800){ - *p1 = 0xc0 | (val >> 6); - *p2 = 0x80 | (val & 0x3f); - *p3 = 0; - *p4 = 0; - } else if (nkf_char_unicode_bmp_p(val)) { - *p1 = 0xe0 | (val >> 12); - *p2 = 0x80 | ((val >> 6) & 0x3f); - *p3 = 0x80 | ( val & 0x3f); - *p4 = 0; - } else if (nkf_char_unicode_value_p(val)) { - *p1 = 0xf0 | (val >> 18); - *p2 = 0x80 | ((val >> 12) & 0x3f); - *p3 = 0x80 | ((val >> 6) & 0x3f); - *p4 = 0x80 | ( val & 0x3f); - } else { - *p1 = 0; - *p2 = 0; - *p3 = 0; - *p4 = 0; - } -} - -static nkf_char -nkf_utf8_to_unicode(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4) -{ - nkf_char wc; - if (c1 <= 0x7F) { - /* single byte */ - wc = c1; - } - else if (c1 <= 0xC1) { - /* trail byte or invalid */ - return -1; - } - else if (c1 <= 0xDF) { - /* 2 bytes */ - wc = (c1 & 0x1F) << 6; - wc |= (c2 & 0x3F); - } - else if (c1 <= 0xEF) { - /* 3 bytes */ - wc = (c1 & 0x0F) << 12; - wc |= (c2 & 0x3F) << 6; - wc |= (c3 & 0x3F); - } - else if (c2 <= 0xF4) { - /* 4 bytes */ - wc = (c1 & 0x0F) << 18; - wc |= (c2 & 0x3F) << 12; - wc |= (c3 & 0x3F) << 6; - wc |= (c4 & 0x3F); - } - else { - return -1; - } - return wc; -} -#endif - -#ifdef UTF8_INPUT_ENABLE -static int -unicode_to_jis_common2(nkf_char c1, nkf_char c0, - const unsigned short *const *pp, nkf_char psize, - nkf_char *p2, nkf_char *p1) -{ - nkf_char c2; - const unsigned short *p; - unsigned short val; - - if (pp == 0) return 1; - - c1 -= 0x80; - if (c1 < 0 || psize <= c1) return 1; - p = pp[c1]; - if (p == 0) return 1; - - c0 -= 0x80; - if (c0 < 0 || sizeof_utf8_to_euc_C2 <= c0) return 1; - val = p[c0]; - if (val == 0) return 1; - if (no_cp932ext_f && ( - (val>>8) == 0x2D || /* NEC special characters */ - val > NKF_INT32_C(0xF300) /* IBM extended characters */ - )) return 1; - - c2 = val >> 8; - if (val > 0x7FFF){ - c2 &= 0x7f; - c2 |= PREFIX_EUCG3; - } - if (c2 == SO) c2 = JIS_X_0201_1976_K; - c1 = val & 0xFF; - if (p2) *p2 = c2; - if (p1) *p1 = c1; - return 0; -} - -static int -unicode_to_jis_common(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1) -{ - const unsigned short *const *pp; - const unsigned short *const *const *ppp; - static const char no_best_fit_chars_table_C2[] = - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 2, 1, 1, 2, - 0, 0, 1, 1, 0, 1, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1}; - static const char no_best_fit_chars_table_C2_ms[] = - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0}; - static const char no_best_fit_chars_table_932_C2[] = - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0}; - static const char no_best_fit_chars_table_932_C3[] = - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1}; - nkf_char ret = 0; - - if(c2 < 0x80){ - *p2 = 0; - *p1 = c2; - }else if(c2 < 0xe0){ - if(no_best_fit_chars_f){ - if(ms_ucs_map_f == UCS_MAP_CP932){ - switch(c2){ - case 0xC2: - if(no_best_fit_chars_table_932_C2[c1&0x3F]) return 1; - break; - case 0xC3: - if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1; - break; - } - }else if(!cp932inv_f){ - switch(c2){ - case 0xC2: - if(no_best_fit_chars_table_C2[c1&0x3F]) return 1; - break; - case 0xC3: - if(no_best_fit_chars_table_932_C3[c1&0x3F]) return 1; - break; - } - }else if(ms_ucs_map_f == UCS_MAP_MS){ - if(c2 == 0xC2 && no_best_fit_chars_table_C2_ms[c1&0x3F]) return 1; - }else if(ms_ucs_map_f == UCS_MAP_CP10001){ - switch(c2){ - case 0xC2: - switch(c1){ - case 0xA2: - case 0xA3: - case 0xA5: - case 0xA6: - case 0xAC: - case 0xAF: - case 0xB8: - return 1; - } - break; - } - } - } - pp = - 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){ - if(no_best_fit_chars_f){ - if(ms_ucs_map_f == UCS_MAP_CP932){ - if(c2 == 0xE3 && c1 == 0x82 && c0 == 0x94) return 1; - }else if(ms_ucs_map_f == UCS_MAP_MS){ - switch(c2){ - case 0xE2: - switch(c1){ - case 0x80: - if(c0 == 0x94 || c0 == 0x96 || c0 == 0xBE) return 1; - break; - case 0x88: - if(c0 == 0x92) return 1; - break; - } - break; - case 0xE3: - if(c1 == 0x80 || c0 == 0x9C) return 1; - break; - } - }else if(ms_ucs_map_f == UCS_MAP_CP10001){ - switch(c2){ - case 0xE3: - switch(c1){ - case 0x82: - if(c0 == 0x94) return 1; - break; - case 0x83: - if(c0 == 0xBB) return 1; - break; - } - break; - } - }else{ - switch(c2){ - case 0xE2: - switch(c1){ - case 0x80: - if(c0 == 0x95) return 1; - break; - case 0x88: - if(c0 == 0xA5) return 1; - break; - } - break; - case 0xEF: - switch(c1){ - case 0xBC: - if(c0 == 0x8D) return 1; - break; - case 0xBD: - if(c0 == 0x9E && !cp932inv_f) return 1; - break; - case 0xBF: - if(0xA0 <= c0 && c0 <= 0xA5) return 1; - break; - } - break; - } - } - } - ppp = - 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; -#ifdef SHIFTJIS_CP932 - if (!ret&& is_eucg3(*p2)) { - if (cp932inv_f) { - if (encode_fallback) ret = 1; - } - else { - nkf_char s2, s1; - if (e2s_conv(*p2, *p1, &s2, &s1) == 0) { - s2e_conv(s2, s1, p2, p1); - }else{ - ret = 1; - } - } - } -#endif - return ret; -} - -#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) -{ - const unsigned short *p; - - if (c2 == JIS_X_0201_1976_K) { - if (ms_ucs_map_f == UCS_MAP_CP10001) { - switch (c1) { - case 0x20: - return 0xA0; - case 0x7D: - return 0xA9; - } - } - p = euc_to_utf8_1byte; -#ifdef X0212_ENABLE - } else if (is_eucg3(c2)){ - if(ms_ucs_map_f == UCS_MAP_ASCII&& c2 == NKF_INT32_C(0x8F22) && c1 == 0x43){ - return 0xA6; - } - c2 = (c2&0x7f) - 0x21; - if (0<=c2 && c2<sizeof_euc_to_utf8_2bytes) - p = - x0213_f ? x0212_to_utf8_2bytes_x0213[c2] : - x0212_to_utf8_2bytes[c2]; - else - return 0; -#endif - } else { - c2 &= 0x7f; - 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]; - else - return 0; - } - if (!p) return 0; - c1 = (c1 & 0x7f) - 0x21; - 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 - -static nkf_char -w2e_conv(nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1) -{ - nkf_char ret = 0; - - if (!c1){ - *p2 = 0; - *p1 = c2; - }else if (0xc0 <= c2 && c2 <= 0xef) { - ret = unicode_to_jis_common(c2, c1, c0, p2, p1); -#ifdef NUMCHAR_OPTION - if (ret > 0){ - if (p2) *p2 = 0; - if (p1) *p1 = nkf_char_unicode_new(nkf_utf8_to_unicode(c2, c1, c0, 0)); - ret = 0; - } -#endif - } - return ret; -} - -#ifdef UTF8_INPUT_ENABLE -static nkf_char -w16e_conv(nkf_char val, nkf_char *p2, nkf_char *p1) -{ - nkf_char c1, c2, c3, c4; - nkf_char ret = 0; - val &= VALUE_MASK; - if (val < 0x80) { - *p2 = 0; - *p1 = val; - } - else if (nkf_char_unicode_bmp_p(val)){ - nkf_unicode_to_utf8(val, &c1, &c2, &c3, &c4); - ret = unicode_to_jis_common(c1, c2, c3, p2, p1); - if (ret > 0){ - *p2 = 0; - *p1 = nkf_char_unicode_new(val); - ret = 0; - } - } - 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); - } - return ret; -} -#endif - -static nkf_char -e_iconv(nkf_char c2, nkf_char c1, nkf_char c0) -{ - if (c2 == JIS_X_0201_1976_K || c2 == SS2){ - if (iso2022jp_f && !x0201_f) { - c2 = GETA1; c1 = GETA2; - } else { - c2 = JIS_X_0201_1976_K; - c1 &= 0x7f; - } -#ifdef X0212_ENABLE - }else if (c2 == 0x8f){ - if (c0 == 0){ - return -1; - } - if (!cp51932_f && !x0213_f && 0xF5 <= c1 && c1 <= 0xFE && 0xA1 <= c0 && c0 <= 0xFE) { - /* encoding is eucJP-ms, so invert to Unicode Private User Area */ - c1 = nkf_char_unicode_new((c1 - 0xF5) * 94 + c0 - 0xA1 + 0xE3AC); - c2 = 0; - } else { - c2 = (c2 << 8) | (c1 & 0x7f); - c1 = c0 & 0x7f; -#ifdef SHIFTJIS_CP932 - if (cp51932_f){ - nkf_char s2, s1; - if (e2s_conv(c2, c1, &s2, &s1) == 0){ - s2e_conv(s2, s1, &c2, &c1); - if (c2 < 0x100){ - c1 &= 0x7f; - c2 &= 0x7f; - } - } - } -#endif /* SHIFTJIS_CP932 */ - } -#endif /* X0212_ENABLE */ - } else if ((c2 == EOF) || (c2 == 0) || c2 < SP || c2 == ISO_8859_1) { - /* NOP */ - } else { - if (!cp51932_f && ms_ucs_map_f && 0xF5 <= c2 && c2 <= 0xFE && 0xA1 <= c1 && c1 <= 0xFE) { - /* encoding is eucJP-ms, so invert to Unicode Private User Area */ - c1 = nkf_char_unicode_new((c2 - 0xF5) * 94 + c1 - 0xA1 + 0xE000); - c2 = 0; - } else { - c1 &= 0x7f; - c2 &= 0x7f; -#ifdef SHIFTJIS_CP932 - if (cp51932_f && 0x79 <= c2 && c2 <= 0x7c){ - nkf_char s2, s1; - if (e2s_conv(c2, c1, &s2, &s1) == 0){ - s2e_conv(s2, s1, &c2, &c1); - if (c2 < 0x100){ - c1 &= 0x7f; - c2 &= 0x7f; - } - } - } -#endif /* SHIFTJIS_CP932 */ - } - } - (*oconv)(c2, c1); - return 0; -} - -static nkf_char -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) { - c2 = GETA1; c1 = GETA2; - } else { - c1 &= 0x7f; - } - } else if ((c2 == EOF) || (c2 == 0) || c2 < SP) { - /* NOP */ - } else if (!x0213_f && 0xF0 <= c2 && c2 <= 0xF9 && 0x40 <= c1 && c1 <= 0xFC) { - /* CP932 UDC */ - if(c1 == 0x7F) return 0; - c1 = nkf_char_unicode_new((c2 - 0xF0) * 188 + (c1 - 0x40 - (0x7E < c1)) + 0xE000); - c2 = 0; - } else { - nkf_char ret = s2e_conv(c2, c1, &c2, &c1); - if (ret) return ret; - } - (*oconv)(c2, c1); - 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) -{ - nkf_char ret = 0, c4 = 0; - static const char w_iconv_utf8_1st_byte[] = - { /* 0xC0 - 0xFF */ - 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 33, 33, - 40, 41, 41, 41, 42, 43, 43, 43, 50, 50, 50, 50, 60, 60, 70, 70}; - - if (c3 > 0xFF) { - c4 = c3 & 0xFF; - c3 >>= 8; - } - - if (c1 < 0 || 0xff < c1) { - }else if (c1 == 0) { /* 0 : 1 byte*/ - c3 = 0; - } else if ((c1 & 0xC0) == 0x80) { /* 0x80-0xbf : trail byte */ - return 0; - } else{ - switch (w_iconv_utf8_1st_byte[c1 - 0xC0]) { - case 21: - if (c2 < 0x80 || 0xBF < c2) return 0; - break; - case 30: - if (c3 == 0) return -1; - if (c2 < 0xA0 || 0xBF < c2 || (c3 & 0xC0) != 0x80) - return 0; - break; - case 31: - case 33: - if (c3 == 0) return -1; - if ((c2 & 0xC0) != 0x80 || (c3 & 0xC0) != 0x80) - return 0; - break; - case 32: - if (c3 == 0) return -1; - if (c2 < 0x80 || 0x9F < c2 || (c3 & 0xC0) != 0x80) - return 0; - break; - case 40: - if (c3 == 0) return -2; - if (c2 < 0x90 || 0xBF < c2 || (c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80) - return 0; - break; - case 41: - if (c3 == 0) return -2; - if (c2 < 0x80 || 0xBF < c2 || (c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80) - return 0; - break; - case 42: - if (c3 == 0) return -2; - if (c2 < 0x80 || 0x8F < c2 || (c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80) - return 0; - break; - default: - return 0; - break; - } - } - if (c1 == 0 || c1 == EOF){ - } else if ((c1 & 0xf8) == 0xf0) { /* 4 bytes */ - 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){ - (*oconv)(c1, c2); - } - 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, int nocombine) -{ - nkf_char c1, c2; - int ret = 0; - - if (wc < 0x80) { - c2 = 0; - c1 = wc; - }else if ((wc>>11) == 27) { - /* 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) { - c2 = 0; - c1 = nkf_char_unicode_new(wc); - } else { - return NKF_ICONV_INVALID_CODE_RANGE; - } - (*oconv)(c2, c1); - 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 -static size_t -nkf_iconv_utf_16(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4) -{ - nkf_char wc; - - if (c1 == EOF) { - (*oconv)(EOF, 0); - return 0; - } - - if (input_endian == ENDIAN_BIG) { - if (0xD8 <= c1 && c1 <= 0xDB) { - if (0xDC <= c3 && c3 <= 0xDF) { - wc = UTF16_TO_UTF32(c1 << 8 | c2, c3 << 8 | c4); - } else return NKF_ICONV_NEED_TWO_MORE_BYTES; - } else { - wc = c1 << 8 | c2; - } - } else { - if (0xD8 <= c2 && c2 <= 0xDB) { - if (0xDC <= c4 && c4 <= 0xDF) { - wc = UTF16_TO_UTF32(c2 << 8 | c1, c4 << 8 | c3); - } else return NKF_ICONV_NEED_TWO_MORE_BYTES; - } else { - wc = c2 << 8 | c1; - } - } - - 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, 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, ARG_UNUSED nkf_char c0) -{ - (*oconv)(c2, c1); - return 32; /* different from w_iconv16 */ -} - -static nkf_char -utf32_to_nkf_char(nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4) -{ - nkf_char wc; - - switch(input_endian){ - case ENDIAN_BIG: - wc = c2 << 16 | c3 << 8 | c4; - break; - case ENDIAN_LITTLE: - wc = c3 << 16 | c2 << 8 | c1; - break; - case ENDIAN_2143: - wc = c1 << 16 | c4 << 8 | c3; - break; - case ENDIAN_3412: - wc = c4 << 16 | c1 << 8 | c2; - break; - 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, 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 - -#define output_ascii_escape_sequence(mode) do { \ - if (output_mode != ASCII && output_mode != ISO_8859_1) { \ - (*o_putc)(ESC); \ - (*o_putc)('('); \ - (*o_putc)(ascii_intro); \ - output_mode = mode; \ - } \ - } while (0) - -static void -output_escape_sequence(int mode) -{ - if (output_mode == mode) - return; - switch(mode) { - case ISO_8859_1: - (*o_putc)(ESC); - (*o_putc)('.'); - (*o_putc)('A'); - break; - case JIS_X_0201_1976_K: - (*o_putc)(ESC); - (*o_putc)('('); - (*o_putc)('I'); - break; - case JIS_X_0208: - (*o_putc)(ESC); - (*o_putc)('$'); - (*o_putc)(kanji_intro); - break; - case JIS_X_0212: - (*o_putc)(ESC); - (*o_putc)('$'); - (*o_putc)('('); - (*o_putc)('D'); - break; - case JIS_X_0213_1: - (*o_putc)(ESC); - (*o_putc)('$'); - (*o_putc)('('); - (*o_putc)('Q'); - break; - case JIS_X_0213_2: - (*o_putc)(ESC); - (*o_putc)('$'); - (*o_putc)('('); - (*o_putc)('P'); - break; - } - output_mode = mode; -} - -static void -j_oconv(nkf_char c2, nkf_char c1) -{ -#ifdef NUMCHAR_OPTION - if (c2 == 0 && nkf_char_unicode_p(c1)){ - w16e_conv(c1, &c2, &c1); - if (c2 == 0 && nkf_char_unicode_p(c1)){ - c2 = c1 & VALUE_MASK; - if (ms_ucs_map_f && 0xE000 <= c2 && c2 <= 0xE757) { - /* CP5022x UDC */ - c1 &= 0xFFF; - c2 = 0x7F + c1 / 94; - c1 = 0x21 + c1 % 94; - } else { - if (encode_fallback) (*encode_fallback)(c1); - return; - } - } - } -#endif - if (c2 == 0) { - output_ascii_escape_sequence(ASCII); - (*o_putc)(c1); - } - else if (c2 == EOF) { - output_ascii_escape_sequence(ASCII); - (*o_putc)(EOF); - } - else if (c2 == ISO_8859_1) { - output_ascii_escape_sequence(ISO_8859_1); - (*o_putc)(c1|0x80); - } - else if (c2 == JIS_X_0201_1976_K) { - output_escape_sequence(JIS_X_0201_1976_K); - (*o_putc)(c1); -#ifdef X0212_ENABLE - } else if (is_eucg3(c2)){ - output_escape_sequence(x0213_f ? JIS_X_0213_2 : JIS_X_0212); - (*o_putc)(c2 & 0x7f); - (*o_putc)(c1); -#endif - } else { - if(ms_ucs_map_f - ? c2<0x20 || 0x92<c2 || c1<0x20 || 0x7e<c1 - : c2<0x20 || 0x7e<c2 || c1<0x20 || 0x7e<c1) return; - output_escape_sequence(x0213_f ? JIS_X_0213_1 : JIS_X_0208); - (*o_putc)(c2); - (*o_putc)(c1); - } -} - -static void -e_oconv(nkf_char c2, nkf_char c1) -{ - if (c2 == 0 && nkf_char_unicode_p(c1)){ - w16e_conv(c1, &c2, &c1); - if (c2 == 0 && nkf_char_unicode_p(c1)){ - c2 = c1 & VALUE_MASK; - if (x0212_f && 0xE000 <= c2 && c2 <= 0xE757) { - /* eucJP-ms UDC */ - c1 &= 0xFFF; - c2 = c1 / 94; - c2 += c2 < 10 ? 0x75 : 0x8FEB; - c1 = 0x21 + c1 % 94; - if (is_eucg3(c2)){ - (*o_putc)(0x8f); - (*o_putc)((c2 & 0x7f) | 0x080); - (*o_putc)(c1 | 0x080); - }else{ - (*o_putc)((c2 & 0x7f) | 0x080); - (*o_putc)(c1 | 0x080); - } - return; - } else { - if (encode_fallback) (*encode_fallback)(c1); - return; - } - } - } - - if (c2 == EOF) { - (*o_putc)(EOF); - } else if (c2 == 0) { - output_mode = ASCII; - (*o_putc)(c1); - } else if (c2 == JIS_X_0201_1976_K) { - output_mode = EUC_JP; - (*o_putc)(SS2); (*o_putc)(c1|0x80); - } else if (c2 == ISO_8859_1) { - output_mode = ISO_8859_1; - (*o_putc)(c1 | 0x080); -#ifdef X0212_ENABLE - } else if (is_eucg3(c2)){ - output_mode = EUC_JP; -#ifdef SHIFTJIS_CP932 - if (!cp932inv_f){ - nkf_char s2, s1; - if (e2s_conv(c2, c1, &s2, &s1) == 0){ - s2e_conv(s2, s1, &c2, &c1); - } - } -#endif - if (c2 == 0) { - output_mode = ASCII; - (*o_putc)(c1); - }else if (is_eucg3(c2)){ - if (x0212_f){ - (*o_putc)(0x8f); - (*o_putc)((c2 & 0x7f) | 0x080); - (*o_putc)(c1 | 0x080); - } - }else{ - (*o_putc)((c2 & 0x7f) | 0x080); - (*o_putc)(c1 | 0x080); - } -#endif - } else { - if (!nkf_isgraph(c1) || !nkf_isgraph(c2)) { - set_iconv(FALSE, 0); - return; /* too late to rescue this char */ - } - output_mode = EUC_JP; - (*o_putc)(c2 | 0x080); - (*o_putc)(c1 | 0x080); - } -} - -static void -s_oconv(nkf_char c2, nkf_char c1) -{ -#ifdef NUMCHAR_OPTION - if (c2 == 0 && nkf_char_unicode_p(c1)){ - w16e_conv(c1, &c2, &c1); - if (c2 == 0 && nkf_char_unicode_p(c1)){ - c2 = c1 & VALUE_MASK; - if (!x0213_f && 0xE000 <= c2 && c2 <= 0xE757) { - /* CP932 UDC */ - c1 &= 0xFFF; - c2 = c1 / 188 + (cp932inv_f ? 0xF0 : 0xEB); - c1 = c1 % 188; - c1 += 0x40 + (c1 > 0x3e); - (*o_putc)(c2); - (*o_putc)(c1); - return; - } else { - if(encode_fallback)(*encode_fallback)(c1); - return; - } - } - } -#endif - if (c2 == EOF) { - (*o_putc)(EOF); - return; - } else if (c2 == 0) { - output_mode = ASCII; - (*o_putc)(c1); - } else if (c2 == JIS_X_0201_1976_K) { - output_mode = SHIFT_JIS; - (*o_putc)(c1|0x80); - } else if (c2 == ISO_8859_1) { - output_mode = ISO_8859_1; - (*o_putc)(c1 | 0x080); -#ifdef X0212_ENABLE - } else if (is_eucg3(c2)){ - output_mode = SHIFT_JIS; - if (e2s_conv(c2, c1, &c2, &c1) == 0){ - (*o_putc)(c2); - (*o_putc)(c1); - } -#endif - } else { - if (!nkf_isprint(c1) || !nkf_isprint(c2)) { - set_iconv(FALSE, 0); - return; /* too late to rescue this char */ - } - output_mode = SHIFT_JIS; - e2s_conv(c2, c1, &c2, &c1); - -#ifdef SHIFTJIS_CP932 - if (cp932inv_f - && CP932INV_TABLE_BEGIN <= c2 && c2 <= CP932INV_TABLE_END){ - nkf_char c = cp932inv[c2 - CP932INV_TABLE_BEGIN][c1 - 0x40]; - if (c){ - c2 = c >> 8; - c1 = c & 0xff; - } - } -#endif /* SHIFTJIS_CP932 */ - - (*o_putc)(c2); - if (prefix_table[(unsigned char)c1]){ - (*o_putc)(prefix_table[(unsigned char)c1]); - } - (*o_putc)(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, val2; - - if (output_bom_f) { - output_bom_f = FALSE; - (*o_putc)('\357'); - (*o_putc)('\273'); - (*o_putc)('\277'); - } - - if (c2 == EOF) { - (*o_putc)(EOF); - return; - } - - if (c2 == 0 && nkf_char_unicode_p(c1)){ - val = c1 & VALUE_MASK; - OUTPUT_UTF8(val); - return; - } - - if (c2 == 0) { - (*o_putc)(c1); - } else { - val = e2w_conv(c2, c1); - if (val){ - 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; - OUTPUT_UTF16_BYTES(0xFF, 0xFE); - } - - if (c2 == EOF) { - (*o_putc)(EOF); - return; - } - - if (c2 == 0 && nkf_char_unicode_p(c1)) { - OUTPUT_UTF16(c1); - } else if (c2) { - nkf_char val, val2; - val = e2w_conv(c2, c1); - if (!val) return; - 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) -{ - if (output_bom_f) { - output_bom_f = FALSE; - if (output_endian == ENDIAN_LITTLE){ - (*o_putc)(0xFF); - (*o_putc)(0xFE); - (*o_putc)(0); - (*o_putc)(0); - }else{ - (*o_putc)(0); - (*o_putc)(0); - (*o_putc)(0xFE); - (*o_putc)(0xFF); - } - } - - if (c2 == EOF) { - (*o_putc)(EOF); - return; - } - - if (c2 == ISO_8859_1) { - c1 |= 0x80; - } else if (c2 == 0 && nkf_char_unicode_p(c1)) { - c1 &= VALUE_MASK; - } else if (c2) { - 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 - -#define SCORE_L2 (1) /* Kanji Level 2 */ -#define SCORE_KANA (SCORE_L2 << 1) /* Halfwidth Katakana */ -#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_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 */ - -#define SCORE_INIT (SCORE_iMIME) - -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_X0213, -}; - -static const nkf_char score_table_F0[] = { - SCORE_L2, SCORE_L2, SCORE_L2, SCORE_L2, - SCORE_L2, SCORE_DEPEND, SCORE_X0213, SCORE_X0213, - SCORE_DEPEND, SCORE_DEPEND, SCORE_CP932, SCORE_CP932, - 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 -set_code_score(struct input_code *ptr, nkf_char score) -{ - if (ptr){ - ptr->score |= score; - } -} - -static void -clr_code_score(struct input_code *ptr, nkf_char score) -{ - if (ptr){ - ptr->score &= ~score; - } -} - -static void -code_score(struct input_code *ptr) -{ - nkf_char c2 = ptr->buf[0]; - nkf_char c1 = ptr->buf[1]; - if (c2 < 0){ - set_code_score(ptr, SCORE_ERROR); - }else if (c2 == SS2){ - set_code_score(ptr, SCORE_KANA); - }else if (c2 == 0x8f){ - 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); -#endif - }else if ((c2 & 0x70) == 0x20){ - set_code_score(ptr, score_table_A0[c2 & 0x0f]); - }else if ((c2 & 0x70) == 0x70){ - set_code_score(ptr, score_table_F0[c2 & 0x0f]); - }else if ((c2 & 0x70) >= 0x50){ - set_code_score(ptr, SCORE_L2); - } -} - -static void -status_disable(struct input_code *ptr) -{ - ptr->stat = -1; - ptr->buf[0] = -1; - code_score(ptr); - if (iconv == ptr->iconv_func) set_iconv(FALSE, 0); -} - -static void -status_push_ch(struct input_code *ptr, nkf_char c) -{ - ptr->buf[ptr->index++] = c; -} - -static void -status_clear(struct input_code *ptr) -{ - ptr->stat = 0; - ptr->index = 0; -} - -static void -status_reset(struct input_code *ptr) -{ - status_clear(ptr); - ptr->score = SCORE_INIT; -} - -static void -status_reinit(struct input_code *ptr) -{ - status_reset(ptr); - ptr->_file_stat = 0; -} - -static void -status_check(struct input_code *ptr, nkf_char c) -{ - if (c <= DEL && estab_f){ - status_reset(ptr); - } -} - -static void -s_status(struct input_code *ptr, nkf_char c) -{ - switch(ptr->stat){ - case -1: - status_check(ptr, c); - break; - case 0: - if (c <= DEL){ - break; - }else if (nkf_char_unicode_p(c)){ - break; - }else if (0xa1 <= c && c <= 0xdf){ - status_push_ch(ptr, SS2); - status_push_ch(ptr, c); - code_score(ptr); - status_clear(ptr); - }else if ((0x81 <= c && c < 0xa0) || (0xe0 <= c && c <= 0xea)){ - ptr->stat = 1; - status_push_ch(ptr, c); - }else if (0xed <= c && c <= 0xee){ - ptr->stat = 3; - status_push_ch(ptr, c); -#ifdef SHIFTJIS_CP932 - }else if (is_ibmext_in_sjis(c)){ - ptr->stat = 2; - status_push_ch(ptr, c); -#endif /* SHIFTJIS_CP932 */ -#ifdef X0212_ENABLE - }else if (0xf0 <= c && c <= 0xfc){ - ptr->stat = 1; - status_push_ch(ptr, c); -#endif /* X0212_ENABLE */ - }else{ - status_disable(ptr); - } - break; - case 1: - if ((0x40 <= c && c <= 0x7e) || (0x80 <= c && c <= 0xfc)){ - status_push_ch(ptr, c); - s2e_conv(ptr->buf[0], ptr->buf[1], &ptr->buf[0], &ptr->buf[1]); - code_score(ptr); - status_clear(ptr); - }else{ - status_disable(ptr); - } - break; - case 2: -#ifdef SHIFTJIS_CP932 - if ((0x40 <= c && c <= 0x7e) || (0x80 <= c && c <= 0xfc)) { - status_push_ch(ptr, c); - if (s2e_conv(ptr->buf[0], ptr->buf[1], &ptr->buf[0], &ptr->buf[1]) == 0) { - set_code_score(ptr, SCORE_CP932); - status_clear(ptr); - break; - } - } -#endif /* SHIFTJIS_CP932 */ - status_disable(ptr); - break; - case 3: - if ((0x40 <= c && c <= 0x7e) || (0x80 <= c && c <= 0xfc)){ - status_push_ch(ptr, c); - s2e_conv(ptr->buf[0], ptr->buf[1], &ptr->buf[0], &ptr->buf[1]); - set_code_score(ptr, SCORE_CP932); - status_clear(ptr); - }else{ - status_disable(ptr); - } - break; - } -} - -static void -e_status(struct input_code *ptr, nkf_char c) -{ - switch (ptr->stat){ - case -1: - status_check(ptr, c); - break; - case 0: - if (c <= DEL){ - break; - }else if (nkf_char_unicode_p(c)){ - break; - }else if (SS2 == c || (0xa1 <= c && c <= 0xfe)){ - ptr->stat = 1; - status_push_ch(ptr, c); -#ifdef X0212_ENABLE - }else if (0x8f == c){ - ptr->stat = 2; - status_push_ch(ptr, c); -#endif /* X0212_ENABLE */ - }else{ - status_disable(ptr); - } - break; - case 1: - if (0xa1 <= c && c <= 0xfe){ - status_push_ch(ptr, c); - code_score(ptr); - status_clear(ptr); - }else{ - status_disable(ptr); - } - break; -#ifdef X0212_ENABLE - case 2: - if (0xa1 <= c && c <= 0xfe){ - ptr->stat = 1; - status_push_ch(ptr, c); - }else{ - status_disable(ptr); - } -#endif /* X0212_ENABLE */ - } -} - -#ifdef UTF8_INPUT_ENABLE -static void -w_status(struct input_code *ptr, nkf_char c) -{ - switch (ptr->stat){ - case -1: - status_check(ptr, c); - break; - case 0: - if (c <= DEL){ - break; - }else if (nkf_char_unicode_p(c)){ - break; - }else if (0xc0 <= c && c <= 0xdf){ - ptr->stat = 1; - status_push_ch(ptr, c); - }else if (0xe0 <= c && c <= 0xef){ - ptr->stat = 2; - status_push_ch(ptr, c); - }else if (0xf0 <= c && c <= 0xf4){ - ptr->stat = 3; - status_push_ch(ptr, c); - }else{ - status_disable(ptr); - } - break; - case 1: - case 2: - if (0x80 <= c && c <= 0xbf){ - status_push_ch(ptr, c); - if (ptr->index > ptr->stat){ - int bom = (ptr->buf[0] == 0xef && ptr->buf[1] == 0xbb - && ptr->buf[2] == 0xbf); - w2e_conv(ptr->buf[0], ptr->buf[1], ptr->buf[2], - &ptr->buf[0], &ptr->buf[1]); - if (!bom){ - code_score(ptr); - } - status_clear(ptr); - } - }else{ - status_disable(ptr); - } - break; - case 3: - if (0x80 <= c && c <= 0xbf){ - if (ptr->index < ptr->stat){ - status_push_ch(ptr, c); - } else { - status_clear(ptr); - } - }else{ - status_disable(ptr); - } - break; - } -} -#endif - -static void -code_status(nkf_char c) -{ - int action_flag = 1; - struct input_code *result = 0; - struct input_code *p = input_code_list; - while (p->name){ - if (!p->status_func) { - ++p; - continue; - } - if (!p->status_func) - continue; - (p->status_func)(p, c); - if (p->stat > 0){ - action_flag = 0; - }else if(p->stat == 0){ - if (result){ - action_flag = 0; - }else{ - result = p; - } - } - ++p; - } - - if (action_flag){ - if (result && !estab_f){ - set_iconv(TRUE, result->iconv_func); - }else if (c <= DEL){ - struct input_code *ptr = input_code_list; - while (ptr->name){ - status_reset(ptr); - ++ptr; - } - } - } -} - -typedef struct { - nkf_buf_t *std_gc_buf; - nkf_char broken_state; - nkf_buf_t *broken_buf; - nkf_char mimeout_state; - nkf_buf_t *nfc_buf; -} nkf_state_t; - -static nkf_state_t *nkf_state = NULL; - -#define STD_GC_BUFSIZE (256) - -static void -nkf_state_init(void) -{ - if (nkf_state) { - nkf_buf_clear(nkf_state->std_gc_buf); - nkf_buf_clear(nkf_state->broken_buf); - nkf_buf_clear(nkf_state->nfc_buf); - } - else { - nkf_state = nkf_xmalloc(sizeof(nkf_state_t)); - nkf_state->std_gc_buf = nkf_buf_new(STD_GC_BUFSIZE); - nkf_state->broken_buf = nkf_buf_new(3); - nkf_state->nfc_buf = nkf_buf_new(9); - } - nkf_state->broken_state = 0; - nkf_state->mimeout_state = 0; -} - -#ifndef WIN32DLL -static nkf_char -std_getc(FILE *f) -{ - if (!nkf_buf_empty_p(nkf_state->std_gc_buf)){ - return nkf_buf_pop(nkf_state->std_gc_buf); - } - return getc(f); -} -#endif /*WIN32DLL*/ - -static nkf_char -std_ungetc(nkf_char c, ARG_UNUSED FILE *f) -{ - nkf_buf_push(nkf_state->std_gc_buf, c); - return c; -} - -#ifndef WIN32DLL -static void -std_putc(nkf_char c) -{ - if(c!=EOF) - putchar(c); -} -#endif /*WIN32DLL*/ - -static nkf_char hold_buf[HOLD_SIZE*2]; -static int hold_count = 0; -static nkf_char -push_hold_buf(nkf_char c2) -{ - if (hold_count >= HOLD_SIZE*2) - return (EOF); - hold_buf[hold_count++] = c2; - return ((hold_count >= HOLD_SIZE*2) ? EOF : hold_count); -} - -static int -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 */ - /** it must NOT be written in JIS7 */ - /** and it must be after 2 byte 8bit code */ - - hold_count = 0; - push_hold_buf(c1); - push_hold_buf(c2); - - while ((c2 = (*i_getc)(f)) != EOF) { - if (c2 == ESC){ - (*i_ungetc)(c2,f); - break; - } - code_status(c2); - if (push_hold_buf(c2) == EOF || estab_f) { - break; - } - } - - if (!estab_f) { - struct input_code *p = input_code_list; - struct input_code *result = p; - if (c2 == EOF) { - code_status(c2); - } - while (p->name) { - if (p->status_func && p->score < result->score) { - result = p; - } - p++; - } - set_iconv(TRUE, result->iconv_func); - } - - - /** now, - ** 1) EOF is detected, or - ** 2) Code is established, or - ** 3) Buffer is FULL (but last word is pushed) - ** - ** in 1) and 3) cases, we continue to use - ** Kanji codes by oconv and leave estab_f unchanged. - **/ - - ret = c2; - hold_index = 0; - while (hold_index < hold_count){ - c1 = hold_buf[hold_index++]; - if (nkf_char_unicode_p(c1)) { - (*oconv)(0, c1); - continue; - } - else if (c1 <= DEL){ - (*iconv)(0, c1, 0); - continue; - }else if (iconv == s_iconv && 0xa1 <= c1 && c1 <= 0xdf){ - (*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){ - c4 = EOF; - break; - } - code_status(c2); - } - c3 = 0; - switch ((*iconv)(c1, c2, 0)) { /* can be EUC/SJIS/UTF-8 */ - case -2: - /* 4 bytes UTF-8 */ - if (hold_index < hold_count){ - c3 = hold_buf[hold_index++]; - } else if ((c3 = (*i_getc)(f)) == EOF) { - ret = EOF; - break; - } - code_status(c3); - if (hold_index < hold_count){ - c4 = hold_buf[hold_index++]; - } else if ((c4 = (*i_getc)(f)) == EOF) { - c3 = ret = EOF; - break; - } - 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); - } - 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; - } - return ret; -} - -/* - * Check and Ignore BOM - */ -static void -check_bom(FILE *f) -{ - int c2; - input_bom_f = FALSE; - switch(c2 = (*i_getc)(f)){ - case 0x00: - if((c2 = (*i_getc)(f)) == 0x00){ - if((c2 = (*i_getc)(f)) == 0xFE){ - if((c2 = (*i_getc)(f)) == 0xFF){ - if(!input_encoding){ - set_iconv(TRUE, w_iconv32); - } - if (iconv == w_iconv32) { - input_bom_f = TRUE; - input_endian = ENDIAN_BIG; - return; - } - (*i_ungetc)(0xFF,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0xFE,f); - }else if(c2 == 0xFF){ - if((c2 = (*i_getc)(f)) == 0xFE){ - if(!input_encoding){ - set_iconv(TRUE, w_iconv32); - } - if (iconv == w_iconv32) { - input_endian = ENDIAN_2143; - return; - } - (*i_ungetc)(0xFF,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0xFF,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0x00,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0x00,f); - break; - case 0xEF: - if((c2 = (*i_getc)(f)) == 0xBB){ - if((c2 = (*i_getc)(f)) == 0xBF){ - if(!input_encoding){ - set_iconv(TRUE, w_iconv); - } - if (iconv == w_iconv) { - input_bom_f = TRUE; - return; - } - (*i_ungetc)(0xBF,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0xBB,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0xEF,f); - break; - case 0xFE: - if((c2 = (*i_getc)(f)) == 0xFF){ - if((c2 = (*i_getc)(f)) == 0x00){ - if((c2 = (*i_getc)(f)) == 0x00){ - if(!input_encoding){ - set_iconv(TRUE, w_iconv32); - } - if (iconv == w_iconv32) { - input_endian = ENDIAN_3412; - return; - } - (*i_ungetc)(0x00,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0x00,f); - }else (*i_ungetc)(c2,f); - if(!input_encoding){ - set_iconv(TRUE, w_iconv16); - } - if (iconv == w_iconv16) { - input_endian = ENDIAN_BIG; - input_bom_f = TRUE; - return; - } - (*i_ungetc)(0xFF,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0xFE,f); - break; - case 0xFF: - if((c2 = (*i_getc)(f)) == 0xFE){ - if((c2 = (*i_getc)(f)) == 0x00){ - if((c2 = (*i_getc)(f)) == 0x00){ - if(!input_encoding){ - set_iconv(TRUE, w_iconv32); - } - if (iconv == w_iconv32) { - input_endian = ENDIAN_LITTLE; - input_bom_f = TRUE; - return; - } - (*i_ungetc)(0x00,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0x00,f); - }else (*i_ungetc)(c2,f); - if(!input_encoding){ - set_iconv(TRUE, w_iconv16); - } - if (iconv == w_iconv16) { - input_endian = ENDIAN_LITTLE; - input_bom_f = TRUE; - return; - } - (*i_ungetc)(0xFE,f); - }else (*i_ungetc)(c2,f); - (*i_ungetc)(0xFF,f); - break; - default: - (*i_ungetc)(c2,f); - break; - } -} - -static nkf_char -broken_getc(FILE *f) -{ - nkf_char c, c1; - - if (!nkf_buf_empty_p(nkf_state->broken_buf)) { - return nkf_buf_pop(nkf_state->broken_buf); - } - c = (*i_bgetc)(f); - if (c=='$' && nkf_state->broken_state != ESC - && (input_mode == ASCII || input_mode == JIS_X_0201_1976_K)) { - c1= (*i_bgetc)(f); - nkf_state->broken_state = 0; - if (c1=='@'|| c1=='B') { - nkf_buf_push(nkf_state->broken_buf, c1); - nkf_buf_push(nkf_state->broken_buf, c); - return ESC; - } else { - (*i_bungetc)(c1,f); - return c; - } - } else if (c=='(' && nkf_state->broken_state != ESC - && (input_mode == JIS_X_0208 || input_mode == JIS_X_0201_1976_K)) { - c1= (*i_bgetc)(f); - nkf_state->broken_state = 0; - if (c1=='J'|| c1=='B') { - nkf_buf_push(nkf_state->broken_buf, c1); - nkf_buf_push(nkf_state->broken_buf, c); - return ESC; - } else { - (*i_bungetc)(c1,f); - return c; - } - } else { - nkf_state->broken_state = c; - return c; - } -} - -static nkf_char -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); - return c; -} - -static void -eol_conv(nkf_char c2, nkf_char c1) -{ - if (guess_f && input_eol != EOF) { - if (c2 == 0 && c1 == LF) { - if (!input_eol) input_eol = prev_cr ? CRLF : LF; - else if (input_eol != (prev_cr ? CRLF : LF)) input_eol = EOF; - } else if (c2 == 0 && c1 == CR && input_eol == LF) input_eol = EOF; - else if (!prev_cr); - else if (!input_eol) input_eol = CR; - else if (input_eol != CR) input_eol = EOF; - } - if (prev_cr || (c2 == 0 && c1 == LF)) { - prev_cr = 0; - if (eolmode_f != LF) (*o_eol_conv)(0, CR); - if (eolmode_f != CR) (*o_eol_conv)(0, LF); - } - if (c2 == 0 && c1 == CR) prev_cr = CR; - else if (c2 != 0 || c1 != LF) (*o_eol_conv)(c2, c1); -} - -static void -put_newline(void (*func)(nkf_char)) -{ - switch (eolmode_f ? eolmode_f : DEFAULT_NEWLINE) { - case CRLF: - (*func)(0x0D); - (*func)(0x0A); - break; - case CR: - (*func)(0x0D); - break; - case LF: - (*func)(0x0A); - break; - } -} - -static void -oconv_newline(void (*func)(nkf_char, nkf_char)) -{ - switch (eolmode_f ? eolmode_f : DEFAULT_NEWLINE) { - case CRLF: - (*func)(0, 0x0D); - (*func)(0, 0x0A); - break; - case CR: - (*func)(0, 0x0D); - break; - case LF: - (*func)(0, 0x0A); - break; - } -} - -/* - Return value of fold_conv() - - LF add newline and output char - CR add newline and output nothing - SP space - 0 skip - 1 (or else) normal output - - fold state in prev (previous character) - - >0x80 Japanese (X0208/X0201) - <0x80 ASCII - LF new line - SP space - - This fold algorithm does not preserve heading space in a line. - This is the main difference from fmt. - */ - -#define char_size(c2,c1) (c2?2:1) - -static void -fold_conv(nkf_char c2, nkf_char c1) -{ - nkf_char prev0; - nkf_char fold_state; - - if (c1== CR && !fold_preserve_f) { - fold_state=0; /* ignore cr */ - }else if (c1== LF&&f_prev==CR && fold_preserve_f) { - f_prev = LF; - fold_state=0; /* ignore cr */ - } else if (c1== BS) { - if (f_line>0) f_line--; - fold_state = 1; - } else if (c2==EOF && f_line != 0) { /* close open last line */ - fold_state = LF; - } else if ((c1==LF && !fold_preserve_f) - || ((c1==CR||(c1==LF&&f_prev!=CR)) - && fold_preserve_f)) { - /* new line */ - if (fold_preserve_f) { - f_prev = c1; - f_line = 0; - fold_state = CR; - } else if ((f_prev == c1) - || (f_prev == LF) - ) { /* duplicate newline */ - if (f_line) { - f_line = 0; - fold_state = LF; /* output two newline */ - } else { - f_line = 0; - fold_state = 1; - } - } else { - if (f_prev&0x80) { /* Japanese? */ - f_prev = c1; - fold_state = 0; /* ignore given single newline */ - } else if (f_prev==SP) { - fold_state = 0; - } else { - f_prev = c1; - if (++f_line<=fold_len) - fold_state = SP; - else { - f_line = 0; - fold_state = CR; /* fold and output nothing */ - } - } - } - } else if (c1=='\f') { - f_prev = LF; - f_line = 0; - fold_state = LF; /* output newline and clear */ - } else if ((c2==0 && nkf_isblank(c1)) || (c2 == '!' && c1 == '!')) { - /* X0208 kankaku or ascii space */ - if (f_prev == SP) { - fold_state = 0; /* remove duplicate spaces */ - } else { - f_prev = SP; - if (++f_line<=fold_len) - fold_state = SP; /* output ASCII space only */ - else { - f_prev = SP; f_line = 0; - fold_state = CR; /* fold and output nothing */ - } - } - } else { - prev0 = f_prev; /* we still need this one... , but almost done */ - f_prev = c1; - if (c2 || c2 == JIS_X_0201_1976_K) - f_prev |= 0x80; /* this is Japanese */ - f_line += c2 == JIS_X_0201_1976_K ? 1: char_size(c2,c1); - if (f_line<=fold_len) { /* normal case */ - fold_state = 1; - } else { - if (f_line>fold_len+fold_margin) { /* too many kinsoku suspension */ - f_line = char_size(c2,c1); - fold_state = LF; /* We can't wait, do fold now */ - } else if (c2 == JIS_X_0201_1976_K) { - /* simple kinsoku rules return 1 means no folding */ - if (c1==(0xde&0x7f)) fold_state = 1; /* $B!+(B*/ - else if (c1==(0xdf&0x7f)) fold_state = 1; /* $B!,(B*/ - else if (c1==(0xa4&0x7f)) fold_state = 1; /* $B!#(B*/ - else if (c1==(0xa3&0x7f)) fold_state = 1; /* $B!$(B*/ - else if (c1==(0xa1&0x7f)) fold_state = 1; /* $B!W(B*/ - else if (c1==(0xb0&0x7f)) fold_state = 1; /* - */ - else if (SP<=c1 && c1<=(0xdf&0x7f)) { /* X0201 */ - f_line = 1; - fold_state = LF;/* add one new f_line before this character */ - } else { - f_line = 1; - fold_state = LF;/* add one new f_line before this character */ - } - } else if (c2==0) { - /* kinsoku point in ASCII */ - if ( c1==')'|| /* { [ ( */ - c1==']'|| - c1=='}'|| - c1=='.'|| - c1==','|| - c1=='!'|| - c1=='?'|| - c1=='/'|| - c1==':'|| - c1==';') { - fold_state = 1; - /* just after special */ - } else if (!is_alnum(prev0)) { - f_line = char_size(c2,c1); - fold_state = LF; - } else if ((prev0==SP) || /* ignored new f_line */ - (prev0==LF)|| /* ignored new f_line */ - (prev0&0x80)) { /* X0208 - ASCII */ - f_line = char_size(c2,c1); - fold_state = LF;/* add one new f_line before this character */ - } else { - fold_state = 1; /* default no fold in ASCII */ - } - } else { - if (c2=='!') { - if (c1=='"') fold_state = 1; /* $B!"(B */ - else if (c1=='#') fold_state = 1; /* $B!#(B */ - else if (c1=='W') fold_state = 1; /* $B!W(B */ - else if (c1=='K') fold_state = 1; /* $B!K(B */ - else if (c1=='$') fold_state = 1; /* $B!$(B */ - else if (c1=='%') fold_state = 1; /* $B!%(B */ - else if (c1=='\'') fold_state = 1; /* $B!\(B */ - else if (c1=='(') fold_state = 1; /* $B!((B */ - else if (c1==')') fold_state = 1; /* $B!)(B */ - else if (c1=='*') fold_state = 1; /* $B!*(B */ - else if (c1=='+') fold_state = 1; /* $B!+(B */ - else if (c1==',') fold_state = 1; /* $B!,(B */ - /* default no fold in kinsoku */ - else { - fold_state = LF; - f_line = char_size(c2,c1); - /* add one new f_line before this character */ - } - } else { - f_line = char_size(c2,c1); - fold_state = LF; - /* add one new f_line before this character */ - } - } - } - } - /* terminator process */ - switch(fold_state) { - case LF: - oconv_newline(o_fconv); - (*o_fconv)(c2,c1); - break; - case 0: - return; - case CR: - oconv_newline(o_fconv); - break; - case TAB: - case SP: - (*o_fconv)(0,SP); - break; - default: - (*o_fconv)(c2,c1); - } -} - -static nkf_char z_prev2=0,z_prev1=0; - -static void -z_conv(nkf_char c2, nkf_char c1) -{ - - /* if (c2) c1 &= 0x7f; assertion */ - - if (c2 == JIS_X_0201_1976_K && (c1 == 0x20 || c1 == 0x7D || c1 == 0x7E)) { - (*o_zconv)(c2,c1); - return; - } - - if (x0201_f) { - if (z_prev2 == JIS_X_0201_1976_K) { - if (c2 == JIS_X_0201_1976_K) { - if (c1 == (0xde&0x7f)) { /* $BByE@(B */ - z_prev2 = 0; - (*o_zconv)(dv[(z_prev1-SP)*2], dv[(z_prev1-SP)*2+1]); - return; - } else if (c1 == (0xdf&0x7f) && ev[(z_prev1-SP)*2]) { /* $BH>ByE@(B */ - 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] || (x0213_f && ev_x0213[(c1-SP)*2])) { - /* wait for $BByE@(B or $BH>ByE@(B */ - z_prev1 = c1; - z_prev2 = c2; - return; - } else { - (*o_zconv)(cv[(c1-SP)*2], cv[(c1-SP)*2+1]); - return; - } - } - } - - if (c2 == EOF) { - (*o_zconv)(c2, c1); - return; - } - - if (alpha_f&1 && c2 == 0x23) { - /* JISX0208 Alphabet */ - c2 = 0; - } else if (c2 == 0x21) { - /* JISX0208 Kigou */ - if (0x21==c1) { - if (alpha_f&2) { - c2 = 0; - c1 = SP; - } else if (alpha_f&4) { - (*o_zconv)(0, SP); - (*o_zconv)(0, SP); - return; - } - } else if (alpha_f&1 && 0x20<c1 && c1<0x7f && fv[c1-0x20]) { - c2 = 0; - c1 = fv[c1-0x20]; - } - } - - if (alpha_f&8 && c2 == 0) { - /* HTML Entity */ - const char *entity = 0; - switch (c1){ - case '>': entity = ">"; break; - case '<': entity = "<"; break; - case '\"': entity = """; break; - case '&': entity = "&"; break; - } - if (entity){ - while (*entity) (*o_zconv)(0, *entity++); - return; - } - } - - if (alpha_f & 16) { - /* JIS X 0208 Katakana to JIS X 0201 Katakana */ - if (c2 == 0x21) { - nkf_char c = 0; - switch (c1) { - case 0x23: - /* U+3002 (0x8142) Ideographic Full Stop -> U+FF61 (0xA1) Halfwidth Ideographic Full Stop */ - c = 0xA1; - break; - case 0x56: - /* U+300C (0x8175) Left Corner Bracket -> U+FF62 (0xA2) Halfwidth Left Corner Bracket */ - c = 0xA2; - break; - case 0x57: - /* U+300D (0x8176) Right Corner Bracket -> U+FF63 (0xA3) Halfwidth Right Corner Bracket */ - c = 0xA3; - break; - case 0x22: - /* U+3001 (0x8141) Ideographic Comma -> U+FF64 (0xA4) Halfwidth Ideographic Comma */ - c = 0xA4; - break; - case 0x26: - /* U+30FB (0x8145) Katakana Middle Dot -> U+FF65 (0xA5) Halfwidth Katakana Middle Dot */ - c = 0xA5; - break; - case 0x3C: - /* U+30FC (0x815B) Katakana-Hiragana Prolonged Sound Mark -> U+FF70 (0xB0) Halfwidth Katakana-Hiragana Prolonged Sound Mark */ - c = 0xB0; - break; - case 0x2B: - /* U+309B (0x814A) Katakana-Hiragana Voiced Sound Mark -> U+FF9E (0xDE) Halfwidth Katakana Voiced Sound Mark */ - c = 0xDE; - break; - case 0x2C: - /* U+309C (0x814B) Katakana-Hiragana Semi-Voiced Sound Mark -> U+FF9F (0xDF) Halfwidth Katakana Semi-Voiced Sound Mark */ - c = 0xDF; - break; - } - if (c) { - (*o_zconv)(JIS_X_0201_1976_K, c); - return; - } - } else if (c2 == 0x25) { - /* JISX0208 Katakana */ - static const int fullwidth_to_halfwidth[] = - { - 0x0000, 0x2700, 0x3100, 0x2800, 0x3200, 0x2900, 0x3300, 0x2A00, - 0x3400, 0x2B00, 0x3500, 0x3600, 0x365E, 0x3700, 0x375E, 0x3800, - 0x385E, 0x3900, 0x395E, 0x3A00, 0x3A5E, 0x3B00, 0x3B5E, 0x3C00, - 0x3C5E, 0x3D00, 0x3D5E, 0x3E00, 0x3E5E, 0x3F00, 0x3F5E, 0x4000, - 0x405E, 0x4100, 0x415E, 0x2F00, 0x4200, 0x425E, 0x4300, 0x435E, - 0x4400, 0x445E, 0x4500, 0x4600, 0x4700, 0x4800, 0x4900, 0x4A00, - 0x4A5E, 0x4A5F, 0x4B00, 0x4B5E, 0x4B5F, 0x4C00, 0x4C5E, 0x4C5F, - 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, 0x365F, - 0x375F, 0x385F, 0x395F, 0x3A5F, 0x3E5F, 0x425F, 0x445F, 0x0000 - }; - if (fullwidth_to_halfwidth[c1-0x20]){ - c2 = fullwidth_to_halfwidth[c1-0x20]; - (*o_zconv)(JIS_X_0201_1976_K, c2>>8); - if (c2 & 0xFF) { - (*o_zconv)(JIS_X_0201_1976_K, c2&0xFF); - } - 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); -} - - -#define rot13(c) ( \ - ( c < 'A') ? c: \ - (c <= 'M') ? (c + 13): \ - (c <= 'Z') ? (c - 13): \ - (c < 'a') ? (c): \ - (c <= 'm') ? (c + 13): \ - (c <= 'z') ? (c - 13): \ - (c) \ - ) - -#define rot47(c) ( \ - ( c < '!') ? c: \ - ( c <= 'O') ? (c + 47) : \ - ( c <= '~') ? (c - 47) : \ - c \ - ) - -static void -rot_conv(nkf_char c2, nkf_char c1) -{ - if (c2 == 0 || c2 == JIS_X_0201_1976_K || c2 == ISO_8859_1) { - c1 = rot13(c1); - } else if (c2) { - c1 = rot47(c1); - c2 = rot47(c2); - } - (*o_rot_conv)(c2,c1); -} - -static void -hira_conv(nkf_char c2, nkf_char c1) -{ - if (hira_f & 1) { - if (c2 == 0x25) { - if (0x20 < c1 && c1 < 0x74) { - c2 = 0x24; - (*o_hira_conv)(c2,c1); - return; - } else if (c1 == 0x74 && nkf_enc_unicode_p(output_encoding)) { - c2 = 0; - c1 = nkf_char_unicode_new(0x3094); - (*o_hira_conv)(c2,c1); - return; - } - } else if (c2 == 0x21 && (c1 == 0x33 || c1 == 0x34)) { - c1 += 2; - (*o_hira_conv)(c2,c1); - return; - } - } - if (hira_f & 2) { - if (c2 == 0 && c1 == nkf_char_unicode_new(0x3094)) { - c2 = 0x25; - c1 = 0x74; - } else if (c2 == 0x24 && 0x20 < c1 && c1 < 0x74) { - c2 = 0x25; - } else if (c2 == 0x21 && (c1 == 0x35 || c1 == 0x36)) { - c1 -= 2; - } - } - (*o_hira_conv)(c2,c1); -} - - -static void -iso2022jp_check_conv(nkf_char c2, nkf_char c1) -{ -#define RANGE_NUM_MAX 18 - static const nkf_char range[RANGE_NUM_MAX][2] = { - {0x222f, 0x2239,}, - {0x2242, 0x2249,}, - {0x2251, 0x225b,}, - {0x226b, 0x2271,}, - {0x227a, 0x227d,}, - {0x2321, 0x232f,}, - {0x233a, 0x2340,}, - {0x235b, 0x2360,}, - {0x237b, 0x237e,}, - {0x2474, 0x247e,}, - {0x2577, 0x257e,}, - {0x2639, 0x2640,}, - {0x2659, 0x267e,}, - {0x2742, 0x2750,}, - {0x2772, 0x277e,}, - {0x2841, 0x287e,}, - {0x4f54, 0x4f7e,}, - {0x7425, 0x747e}, - }; - nkf_char i; - nkf_char start, end, c; - - if(c2 >= 0x00 && c2 <= 0x20 && c1 >= 0x7f && c1 <= 0xff) { - c2 = GETA1; - c1 = GETA2; - } - if((c2 >= 0x29 && c2 <= 0x2f) || (c2 >= 0x75 && c2 <= 0x7e)) { - c2 = GETA1; - c1 = GETA2; - } - - for (i = 0; i < RANGE_NUM_MAX; i++) { - start = range[i][0]; - end = range[i][1]; - c = (c2 << 8) + c1; - if (c >= start && c <= end) { - c2 = GETA1; - c1 = GETA2; - } - } - (*o_iso2022jp_check_conv)(c2,c1); -} - - -/* This converts =?ISO-2022-JP?B?HOGE HOGE?= */ - -static const unsigned char *mime_pattern[] = { - (const unsigned char *)"\075?EUC-JP?B?", - (const unsigned char *)"\075?SHIFT_JIS?B?", - (const unsigned char *)"\075?ISO-8859-1?Q?", - (const unsigned char *)"\075?ISO-8859-1?B?", - (const unsigned char *)"\075?ISO-2022-JP?B?", - (const unsigned char *)"\075?ISO-2022-JP?B?", - (const unsigned char *)"\075?ISO-2022-JP?Q?", -#if defined(UTF8_INPUT_ENABLE) - (const unsigned char *)"\075?UTF-8?B?", - (const unsigned char *)"\075?UTF-8?Q?", -#endif - (const unsigned char *)"\075?US-ASCII?Q?", - NULL -}; - - -/* $B3:Ev$9$k%3!<%I$NM%@hEY$r>e$2$k$?$a$NL\0u(B */ -static nkf_char (*const mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0) = { - e_iconv, s_iconv, 0, 0, 0, 0, 0, -#if defined(UTF8_INPUT_ENABLE) - w_iconv, w_iconv, -#endif - 0, -}; - -static const nkf_char mime_encode[] = { - EUC_JP, SHIFT_JIS, ISO_8859_1, ISO_8859_1, JIS_X_0208, JIS_X_0201_1976_K, JIS_X_0201_1976_K, -#if defined(UTF8_INPUT_ENABLE) - UTF_8, UTF_8, -#endif - ASCII, - 0 -}; - -static const nkf_char mime_encode_method[] = { - 'B', 'B','Q', 'B', 'B', 'B', 'Q', -#if defined(UTF8_INPUT_ENABLE) - 'B', 'Q', -#endif - 'Q', - 0 -}; - - -/* MIME preprocessor fifo */ - -#define MIME_BUF_SIZE (1024) /* 2^n ring buffer */ -#define MIME_BUF_MASK (MIME_BUF_SIZE-1) -#define mime_input_buf(n) mime_input_state.buf[(n)&MIME_BUF_MASK] -static struct { - unsigned char buf[MIME_BUF_SIZE]; - unsigned int top; - unsigned int last; /* decoded */ - unsigned int input; /* undecoded */ -} mime_input_state; -static nkf_char (*mime_iconv_back)(nkf_char c2,nkf_char c1,nkf_char c0) = NULL; - -#define MAXRECOVER 20 - -static void -mime_input_buf_unshift(nkf_char c) -{ - mime_input_buf(--mime_input_state.top) = (unsigned char)c; -} - -static nkf_char -mime_ungetc(nkf_char c, ARG_UNUSED FILE *f) -{ - mime_input_buf_unshift(c); - return c; -} - -static nkf_char -mime_ungetc_buf(nkf_char c, FILE *f) -{ - if (mimebuf_f) - (*i_mungetc_buf)(c,f); - else - mime_input_buf(--mime_input_state.input) = (unsigned char)c; - return c; -} - -static nkf_char -mime_getc_buf(FILE *f) -{ - /* we don't keep eof of mime_input_buf, because it contains ?= as - a terminator. It was checked in mime_integrity. */ - return ((mimebuf_f)? - (*i_mgetc_buf)(f):mime_input_buf(mime_input_state.input++)); -} - -static void -switch_mime_getc(void) -{ - if (i_getc!=mime_getc) { - i_mgetc = i_getc; i_getc = mime_getc; - i_mungetc = i_ungetc; i_ungetc = mime_ungetc; - if(mime_f==STRICT_MIME) { - i_mgetc_buf = i_mgetc; i_mgetc = mime_getc_buf; - i_mungetc_buf = i_mungetc; i_mungetc = mime_ungetc_buf; - } - } -} - -static void -unswitch_mime_getc(void) -{ - if(mime_f==STRICT_MIME) { - i_mgetc = i_mgetc_buf; - i_mungetc = i_mungetc_buf; - } - i_getc = i_mgetc; - i_ungetc = i_mungetc; - if(mime_iconv_back)set_iconv(FALSE, mime_iconv_back); - mime_iconv_back = NULL; -} - -static nkf_char -mime_integrity(FILE *f, const unsigned char *p) -{ - nkf_char c,d; - unsigned int q; - /* In buffered mode, read until =? or NL or buffer full - */ - mime_input_state.input = mime_input_state.top; - mime_input_state.last = mime_input_state.top; - - while(*p) mime_input_buf(mime_input_state.input++) = *p++; - d = 0; - q = mime_input_state.input; - while((c=(*i_getc)(f))!=EOF) { - if (((mime_input_state.input-mime_input_state.top)&MIME_BUF_MASK)==0) { - break; /* buffer full */ - } - if (c=='=' && d=='?') { - /* checked. skip header, start decode */ - mime_input_buf(mime_input_state.input++) = (unsigned char)c; - /* mime_last_input = mime_input_state.input; */ - mime_input_state.input = q; - switch_mime_getc(); - return 1; - } - if (!( (c=='+'||c=='/'|| c=='=' || c=='?' || is_alnum(c)))) - break; - /* Should we check length mod 4? */ - mime_input_buf(mime_input_state.input++) = (unsigned char)c; - d=c; - } - /* In case of Incomplete MIME, no MIME decode */ - mime_input_buf(mime_input_state.input++) = (unsigned char)c; - mime_input_state.last = mime_input_state.input; /* point undecoded buffer */ - mime_decode_mode = 1; /* no decode on mime_input_buf last in mime_getc */ - switch_mime_getc(); /* anyway we need buffered getc */ - return 1; -} - -static nkf_char -mime_begin_strict(FILE *f) -{ - nkf_char c1 = 0; - int i,j,k; - const unsigned char *p,*q; - nkf_char r[MAXRECOVER]; /* recovery buffer, max mime pattern length */ - - mime_decode_mode = FALSE; - /* =? has been checked */ - j = 0; - p = mime_pattern[j]; - r[0]='='; r[1]='?'; - - for(i=2;p[i]>SP;i++) { /* start at =? */ - if (((r[i] = c1 = (*i_getc)(f))==EOF) || nkf_toupper(c1) != p[i]) { - /* pattern fails, try next one */ - q = p; - while (mime_pattern[++j]) { - p = mime_pattern[j]; - for(k=2;k<i;k++) /* assume length(p) > i */ - if (p[k]!=q[k]) break; - if (k==i && nkf_toupper(c1)==p[k]) break; - } - p = mime_pattern[j]; - if (p) continue; /* found next one, continue */ - /* all fails, output from recovery buffer */ - (*i_ungetc)(c1,f); - for(j=0;j<i;j++) { - (*oconv)(0,r[j]); - } - return c1; - } - } - mime_decode_mode = p[i-2]; - - mime_iconv_back = iconv; - set_iconv(FALSE, mime_priority_func[j]); - clr_code_score(find_inputcode_byfunc(mime_priority_func[j]), SCORE_iMIME); - - if (mime_decode_mode=='B') { - mimebuf_f = unbuf_f; - if (!unbuf_f) { - /* do MIME integrity check */ - return mime_integrity(f,mime_pattern[j]); - } - } - switch_mime_getc(); - mimebuf_f = TRUE; - return c1; -} - -static nkf_char -mime_begin(FILE *f) -{ - nkf_char c1 = 0; - int i,k; - - /* In NONSTRICT mode, only =? is checked. In case of failure, we */ - /* re-read and convert again from mime_buffer. */ - - /* =? has been checked */ - k = mime_input_state.last; - mime_input_buf(mime_input_state.last++)='='; mime_input_buf(mime_input_state.last++)='?'; - for(i=2;i<MAXRECOVER;i++) { /* start at =? */ - /* We accept any character type even if it is breaked by new lines */ - c1 = (*i_getc)(f); mime_input_buf(mime_input_state.last++) = (unsigned char)c1; - if (c1==LF||c1==SP||c1==CR|| - c1=='-'||c1=='_'||is_alnum(c1)) continue; - if (c1=='=') { - /* Failed. But this could be another MIME preemble */ - (*i_ungetc)(c1,f); - mime_input_state.last--; - break; - } - if (c1!='?') break; - else { - /* c1=='?' */ - c1 = (*i_getc)(f); mime_input_buf(mime_input_state.last++) = (unsigned char)c1; - if (!(++i<MAXRECOVER) || c1==EOF) break; - if (c1=='b'||c1=='B') { - mime_decode_mode = 'B'; - } else if (c1=='q'||c1=='Q') { - mime_decode_mode = 'Q'; - } else { - break; - } - c1 = (*i_getc)(f); mime_input_buf(mime_input_state.last++) = (unsigned char)c1; - if (!(++i<MAXRECOVER) || c1==EOF) break; - if (c1!='?') { - mime_decode_mode = FALSE; - } - break; - } - } - switch_mime_getc(); - if (!mime_decode_mode) { - /* false MIME premble, restart from mime_buffer */ - mime_decode_mode = 1; /* no decode, but read from the mime_buffer */ - /* Since we are in MIME mode until buffer becomes empty, */ - /* we never go into mime_begin again for a while. */ - return c1; - } - /* discard mime preemble, and goto MIME mode */ - mime_input_state.last = k; - /* do no MIME integrity check */ - return c1; /* used only for checking EOF */ -} - -#ifdef CHECK_OPTION -static void -no_putc(ARG_UNUSED nkf_char c) -{ - ; -} - -static void -debug(const char *str) -{ - if (debug_f){ - fprintf(stderr, "%s\n", str ? str : "NULL"); - } -} -#endif - -static void -set_input_codename(const char *codename) -{ - if (!input_codename) { - input_codename = codename; - } else if (strcmp(codename, input_codename) != 0) { - input_codename = ""; - } -} - -static const char* -get_guessed_code(void) -{ - if (input_codename && !*input_codename) { - input_codename = "BINARY"; - } else { - struct input_code *p = find_inputcode_byfunc(iconv); - if (!input_codename) { - input_codename = "ASCII"; - } else if (strcmp(input_codename, "Shift_JIS") == 0) { - if (p->score & (SCORE_DEPEND|SCORE_CP932)) - input_codename = "CP932"; - } else if (strcmp(input_codename, "EUC-JP") == 0) { - 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"; - } else if (strcmp(input_codename, "ISO-2022-JP") == 0) { - if (p->score & (SCORE_KANA)) - input_codename = "CP50221"; - else if (p->score & (SCORE_DEPEND|SCORE_CP932)) - input_codename = "CP50220"; - } - } - return input_codename; -} - -#if !defined(PERL_XS) && !defined(WIN32DLL) -static void -print_guessed_code(char *filename) -{ - if (filename != NULL) printf("%s: ", filename); - if (input_codename && !*input_codename) { - printf("BINARY\n"); - } else { - input_codename = get_guessed_code(); - if (guess_f == 1) { - printf("%s\n", input_codename); - } else { - 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)" : - input_eol == EOF ? " (MIXED NL)" : - ""); - } - } -} -#endif /*WIN32DLL*/ - -#ifdef INPUT_OPTION - -static nkf_char -hex_getc(nkf_char ch, FILE *f, nkf_char (*g)(FILE *f), nkf_char (*u)(nkf_char c, FILE *f)) -{ - nkf_char c1, c2, c3; - c1 = (*g)(f); - if (c1 != ch){ - return c1; - } - c2 = (*g)(f); - if (!nkf_isxdigit(c2)){ - (*u)(c2, f); - return c1; - } - c3 = (*g)(f); - if (!nkf_isxdigit(c3)){ - (*u)(c2, f); - (*u)(c3, f); - return c1; - } - return (hex2bin(c2) << 4) | hex2bin(c3); -} - -static nkf_char -cap_getc(FILE *f) -{ - return hex_getc(':', f, i_cgetc, i_cungetc); -} - -static nkf_char -cap_ungetc(nkf_char c, FILE *f) -{ - return (*i_cungetc)(c, f); -} - -static nkf_char -url_getc(FILE *f) -{ - return hex_getc('%', f, i_ugetc, i_uungetc); -} - -static nkf_char -url_ungetc(nkf_char c, FILE *f) -{ - return (*i_uungetc)(c, f); -} -#endif - -#ifdef NUMCHAR_OPTION -static nkf_char -numchar_getc(FILE *f) -{ - nkf_char (*g)(FILE *) = i_ngetc; - nkf_char (*u)(nkf_char c ,FILE *f) = i_nungetc; - int i = 0, j; - nkf_char buf[12]; - nkf_char c = -1; - - buf[i] = (*g)(f); - if (buf[i] == '&'){ - buf[++i] = (*g)(f); - if (buf[i] == '#'){ - c = 0; - buf[++i] = (*g)(f); - if (buf[i] == 'x' || buf[i] == 'X'){ - for (j = 0; j < 7; j++){ - buf[++i] = (*g)(f); - if (!nkf_isxdigit(buf[i])){ - if (buf[i] != ';'){ - c = -1; - } - break; - } - c <<= 4; - c |= hex2bin(buf[i]); - } - }else{ - for (j = 0; j < 8; j++){ - if (j){ - buf[++i] = (*g)(f); - } - if (!nkf_isdigit(buf[i])){ - if (buf[i] != ';'){ - c = -1; - } - break; - } - c *= 10; - c += hex2bin(buf[i]); - } - } - } - } - if (c != -1){ - return nkf_char_unicode_new(c); - } - while (i > 0){ - (*u)(buf[i], f); - --i; - } - return buf[0]; -} - -static nkf_char -numchar_ungetc(nkf_char c, FILE *f) -{ - return (*i_nungetc)(c, f); -} -#endif - -#ifdef UNICODE_NORMALIZATION - -static nkf_char -nfc_getc(FILE *f) -{ - nkf_char (*g)(FILE *f) = i_nfc_getc; - nkf_char (*u)(nkf_char c ,FILE *f) = i_nfc_ungetc; - nkf_buf_t *buf = nkf_state->nfc_buf; - const unsigned char *array; - int lower=0, upper=NORMALIZATION_TABLE_LENGTH-1; - nkf_char c = (*g)(f); - - if (c == EOF || c > 0xFF || (c & 0xc0) == 0x80) return c; - - nkf_buf_push(buf, c); - do { - while (lower <= upper) { - int mid = (lower+upper) / 2; - int len; - array = normalization_table[mid].nfd; - for (len=0; len < NORMALIZATION_TABLE_NFD_LENGTH && array[len]; len++) { - if (len >= nkf_buf_length(buf)) { - c = (*g)(f); - if (c == EOF) { - len = 0; - lower = 1, upper = 0; - break; - } - nkf_buf_push(buf, c); - } - if (array[len] != nkf_buf_at(buf, len)) { - if (array[len] < nkf_buf_at(buf, len)) lower = mid + 1; - else upper = mid - 1; - len = 0; - break; - } - } - if (len > 0) { - int i; - array = normalization_table[mid].nfc; - nkf_buf_clear(buf); - for (i=0; i < NORMALIZATION_TABLE_NFC_LENGTH && array[i]; i++) - nkf_buf_push(buf, array[i]); - break; - } - } - } while (lower <= upper); - - while (nkf_buf_length(buf) > 1) (*u)(nkf_buf_pop(buf), f); - c = nkf_buf_pop(buf); - - return c; -} - -static nkf_char -nfc_ungetc(nkf_char c, FILE *f) -{ - return (*i_nfc_ungetc)(c, f); -} -#endif /* UNICODE_NORMALIZATION */ - - -static nkf_char -base64decode(nkf_char c) -{ - int i; - if (c > '@') { - if (c < '[') { - i = c - 'A'; /* A..Z 0-25 */ - } else if (c == '_') { - i = '?' /* 63 */ ; /* _ 63 */ - } else { - i = c - 'G' /* - 'a' + 26 */ ; /* a..z 26-51 */ - } - } else if (c > '/') { - i = c - '0' + '4' /* - '0' + 52 */ ; /* 0..9 52-61 */ - } else if (c == '+' || c == '-') { - i = '>' /* 62 */ ; /* + and - 62 */ - } else { - i = '?' /* 63 */ ; /* / 63 */ - } - return (i); -} - -static nkf_char -mime_getc(FILE *f) -{ - nkf_char c1, c2, c3, c4, cc; - nkf_char t1, t2, t3, t4, mode, exit_mode; - nkf_char lwsp_count; - char *lwsp_buf; - char *lwsp_buf_new; - nkf_char lwsp_size = 128; - - if (mime_input_state.top != mime_input_state.last) { /* Something is in FIFO */ - return mime_input_buf(mime_input_state.top++); - } - if (mime_decode_mode==1 ||mime_decode_mode==FALSE) { - mime_decode_mode=FALSE; - unswitch_mime_getc(); - return (*i_getc)(f); - } - - if (mimebuf_f == FIXED_MIME) - exit_mode = mime_decode_mode; - else - exit_mode = FALSE; - if (mime_decode_mode == 'Q') { - if ((c1 = (*i_mgetc)(f)) == EOF) return (EOF); - restart_mime_q: - if (c1=='_' && mimebuf_f != FIXED_MIME) return SP; - if (c1<=SP || DEL<=c1) { - mime_decode_mode = exit_mode; /* prepare for quit */ - return c1; - } - if (c1!='=' && (c1!='?' || mimebuf_f == FIXED_MIME)) { - return c1; - } - - mime_decode_mode = exit_mode; /* prepare for quit */ - if ((c2 = (*i_mgetc)(f)) == EOF) return (EOF); - if (c1=='?'&&c2=='=' && mimebuf_f != FIXED_MIME) { - /* end Q encoding */ - input_mode = exit_mode; - lwsp_count = 0; - lwsp_buf = nkf_xmalloc((lwsp_size+5)*sizeof(char)); - while ((c1=(*i_getc)(f))!=EOF) { - switch (c1) { - case LF: - case CR: - if (c1==LF) { - if ((c1=(*i_getc)(f))!=EOF && nkf_isblank(c1)) { - i_ungetc(SP,f); - continue; - } else { - i_ungetc(c1,f); - } - c1 = LF; - } else { - if ((c1=(*i_getc)(f))!=EOF && c1 == LF) { - if ((c1=(*i_getc)(f))!=EOF && nkf_isblank(c1)) { - i_ungetc(SP,f); - continue; - } else { - i_ungetc(c1,f); - } - i_ungetc(LF,f); - } else { - i_ungetc(c1,f); - } - c1 = CR; - } - break; - case SP: - case TAB: - lwsp_buf[lwsp_count] = (unsigned char)c1; - if (lwsp_count++>lwsp_size){ - lwsp_size <<= 1; - lwsp_buf_new = nkf_xrealloc(lwsp_buf, (lwsp_size+5)*sizeof(char)); - lwsp_buf = lwsp_buf_new; - } - continue; - } - break; - } - if (lwsp_count > 0 && (c1 != '=' || (lwsp_buf[lwsp_count-1] != SP && lwsp_buf[lwsp_count-1] != TAB))) { - i_ungetc(c1,f); - for(lwsp_count--;lwsp_count>0;lwsp_count--) - i_ungetc(lwsp_buf[lwsp_count],f); - c1 = lwsp_buf[0]; - } - nkf_xfree(lwsp_buf); - return c1; - } - if (c1=='='&&c2<SP) { /* this is soft wrap */ - while((c1 = (*i_mgetc)(f)) <=SP) { - if (c1 == EOF) return (EOF); - } - mime_decode_mode = 'Q'; /* still in MIME */ - goto restart_mime_q; - } - if (c1=='?') { - mime_decode_mode = 'Q'; /* still in MIME */ - (*i_mungetc)(c2,f); - return c1; - } - if ((c3 = (*i_mgetc)(f)) == EOF) return (EOF); - if (c2<=SP) return c2; - mime_decode_mode = 'Q'; /* still in MIME */ - return ((hex2bin(c2)<<4) + hex2bin(c3)); - } - - if (mime_decode_mode != 'B') { - mime_decode_mode = FALSE; - return (*i_mgetc)(f); - } - - - /* Base64 encoding */ - /* - MIME allows line break in the middle of - Base64, but we are very pessimistic in decoding - in unbuf mode because MIME encoded code may broken by - less or editor's control sequence (such as ESC-[-K in unbuffered - mode. ignore incomplete MIME. - */ - mode = mime_decode_mode; - mime_decode_mode = exit_mode; /* prepare for quit */ - - while ((c1 = (*i_mgetc)(f))<=SP) { - if (c1==EOF) - return (EOF); - } - mime_c2_retry: - if ((c2 = (*i_mgetc)(f))<=SP) { - if (c2==EOF) - return (EOF); - if (mime_f != STRICT_MIME) goto mime_c2_retry; - if (mimebuf_f!=FIXED_MIME) input_mode = ASCII; - return c2; - } - if ((c1 == '?') && (c2 == '=')) { - input_mode = ASCII; - lwsp_count = 0; - lwsp_buf = nkf_xmalloc((lwsp_size+5)*sizeof(char)); - while ((c1=(*i_getc)(f))!=EOF) { - switch (c1) { - case LF: - case CR: - if (c1==LF) { - if ((c1=(*i_getc)(f))!=EOF && nkf_isblank(c1)) { - i_ungetc(SP,f); - continue; - } else { - i_ungetc(c1,f); - } - c1 = LF; - } else { - if ((c1=(*i_getc)(f))!=EOF) { - if (c1==SP) { - i_ungetc(SP,f); - continue; - } else if ((c1=(*i_getc)(f))!=EOF && nkf_isblank(c1)) { - i_ungetc(SP,f); - continue; - } else { - i_ungetc(c1,f); - } - i_ungetc(LF,f); - } else { - i_ungetc(c1,f); - } - c1 = CR; - } - break; - case SP: - case TAB: - lwsp_buf[lwsp_count] = (unsigned char)c1; - if (lwsp_count++>lwsp_size){ - lwsp_size <<= 1; - lwsp_buf_new = nkf_xrealloc(lwsp_buf, (lwsp_size+5)*sizeof(char)); - lwsp_buf = lwsp_buf_new; - } - continue; - } - break; - } - if (lwsp_count > 0 && (c1 != '=' || (lwsp_buf[lwsp_count-1] != SP && lwsp_buf[lwsp_count-1] != TAB))) { - i_ungetc(c1,f); - for(lwsp_count--;lwsp_count>0;lwsp_count--) - i_ungetc(lwsp_buf[lwsp_count],f); - c1 = lwsp_buf[0]; - } - nkf_xfree(lwsp_buf); - return c1; - } - mime_c3_retry: - if ((c3 = (*i_mgetc)(f))<=SP) { - if (c3==EOF) - return (EOF); - if (mime_f != STRICT_MIME) goto mime_c3_retry; - if (mimebuf_f!=FIXED_MIME) input_mode = ASCII; - return c3; - } - mime_c4_retry: - if ((c4 = (*i_mgetc)(f))<=SP) { - if (c4==EOF) - return (EOF); - if (mime_f != STRICT_MIME) goto mime_c4_retry; - if (mimebuf_f!=FIXED_MIME) input_mode = ASCII; - return c4; - } - - mime_decode_mode = mode; /* still in MIME sigh... */ - - /* BASE 64 decoding */ - - t1 = 0x3f & base64decode(c1); - t2 = 0x3f & base64decode(c2); - t3 = 0x3f & base64decode(c3); - t4 = 0x3f & base64decode(c4); - cc = ((t1 << 2) & 0x0fc) | ((t2 >> 4) & 0x03); - if (c2 != '=') { - mime_input_buf(mime_input_state.last++) = (unsigned char)cc; - cc = ((t2 << 4) & 0x0f0) | ((t3 >> 2) & 0x0f); - if (c3 != '=') { - mime_input_buf(mime_input_state.last++) = (unsigned char)cc; - cc = ((t3 << 6) & 0x0c0) | (t4 & 0x3f); - if (c4 != '=') - mime_input_buf(mime_input_state.last++) = (unsigned char)cc; - } - } else { - return c1; - } - return mime_input_buf(mime_input_state.top++); -} - -static const char basis_64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -#define MIMEOUT_BUF_LENGTH 74 -static struct { - unsigned char buf[MIMEOUT_BUF_LENGTH+1]; - int count; -} mimeout_state; - -/*nkf_char mime_lastchar2, mime_lastchar1;*/ - -static void -open_mime(nkf_char mode) -{ - const unsigned char *p; - int i; - int j; - p = mime_pattern[0]; - for(i=0;mime_pattern[i];i++) { - if (mode == mime_encode[i]) { - p = mime_pattern[i]; - break; - } - } - mimeout_mode = mime_encode_method[i]; - i = 0; - if (base64_count>45) { - if (mimeout_state.count>0 && nkf_isblank(mimeout_state.buf[i])){ - (*o_mputc)(mimeout_state.buf[i]); - i++; - } - put_newline(o_mputc); - (*o_mputc)(SP); - base64_count = 1; - if (mimeout_state.count>0 && nkf_isspace(mimeout_state.buf[i])) { - i++; - } - } - for (;i<mimeout_state.count;i++) { - if (nkf_isspace(mimeout_state.buf[i])) { - (*o_mputc)(mimeout_state.buf[i]); - base64_count ++; - } else { - break; - } - } - while(*p) { - (*o_mputc)(*p++); - base64_count ++; - } - j = mimeout_state.count; - mimeout_state.count = 0; - for (;i<j;i++) { - mime_putc(mimeout_state.buf[i]); - } -} - -static void -mime_prechar(nkf_char c2, nkf_char c1) -{ - if (mimeout_mode > 0){ - if (c2 == EOF){ - if (base64_count + mimeout_state.count/3*4> 73){ - (*o_base64conv)(EOF,0); - oconv_newline(o_base64conv); - (*o_base64conv)(0,SP); - base64_count = 1; - } - } else { - if ((c2 != 0 || c1 > DEL) && base64_count + mimeout_state.count/3*4> 66) { - (*o_base64conv)(EOF,0); - oconv_newline(o_base64conv); - (*o_base64conv)(0,SP); - base64_count = 1; - mimeout_mode = -1; - } - } - } else if (c2) { - if (c2 != EOF && base64_count + mimeout_state.count/3*4> 60) { - mimeout_mode = (output_mode==ASCII ||output_mode == ISO_8859_1) ? 'Q' : 'B'; - open_mime(output_mode); - (*o_base64conv)(EOF,0); - oconv_newline(o_base64conv); - (*o_base64conv)(0,SP); - base64_count = 1; - mimeout_mode = -1; - } - } -} - -static void -close_mime(void) -{ - (*o_mputc)('?'); - (*o_mputc)('='); - base64_count += 2; - mimeout_mode = 0; -} - -static void -eof_mime(void) -{ - switch(mimeout_mode) { - case 'Q': - case 'B': - break; - case 2: - (*o_mputc)(basis_64[((nkf_state->mimeout_state & 0x3)<< 4)]); - (*o_mputc)('='); - (*o_mputc)('='); - base64_count += 3; - break; - case 1: - (*o_mputc)(basis_64[((nkf_state->mimeout_state & 0xF) << 2)]); - (*o_mputc)('='); - base64_count += 2; - break; - } - if (mimeout_mode > 0) { - if (mimeout_f!=FIXED_MIME) { - close_mime(); - } else if (mimeout_mode != 'Q') - mimeout_mode = 'B'; - } -} - -static void -mimeout_addchar(nkf_char c) -{ - switch(mimeout_mode) { - case 'Q': - if (c==CR||c==LF) { - (*o_mputc)(c); - base64_count = 0; - } else if(!nkf_isalnum(c)) { - (*o_mputc)('='); - (*o_mputc)(bin2hex(((c>>4)&0xf))); - (*o_mputc)(bin2hex((c&0xf))); - base64_count += 3; - } else { - (*o_mputc)(c); - base64_count++; - } - break; - case 'B': - nkf_state->mimeout_state=c; - (*o_mputc)(basis_64[c>>2]); - mimeout_mode=2; - base64_count ++; - break; - case 2: - (*o_mputc)(basis_64[((nkf_state->mimeout_state & 0x3)<< 4) | ((c & 0xF0) >> 4)]); - nkf_state->mimeout_state=c; - mimeout_mode=1; - base64_count ++; - break; - case 1: - (*o_mputc)(basis_64[((nkf_state->mimeout_state & 0xF) << 2) | ((c & 0xC0) >>6)]); - (*o_mputc)(basis_64[c & 0x3F]); - mimeout_mode='B'; - base64_count += 2; - break; - default: - (*o_mputc)(c); - base64_count++; - break; - } -} - -static void -mime_putc(nkf_char c) -{ - int i, j; - nkf_char lastchar; - - if (mimeout_f == FIXED_MIME){ - if (mimeout_mode == 'Q'){ - if (base64_count > 71){ - if (c!=CR && c!=LF) { - (*o_mputc)('='); - put_newline(o_mputc); - } - base64_count = 0; - } - }else{ - if (base64_count > 71){ - eof_mime(); - put_newline(o_mputc); - base64_count = 0; - } - if (c == EOF) { /* c==EOF */ - eof_mime(); - } - } - if (c != EOF) { /* c==EOF */ - mimeout_addchar(c); - } - return; - } - - /* mimeout_f != FIXED_MIME */ - - if (c == EOF) { /* c==EOF */ - if (mimeout_mode == -1 && mimeout_state.count > 1) open_mime(output_mode); - j = mimeout_state.count; - mimeout_state.count = 0; - i = 0; - if (mimeout_mode > 0) { - if (!nkf_isblank(mimeout_state.buf[j-1])) { - for (;i<j;i++) { - if (nkf_isspace(mimeout_state.buf[i]) && base64_count < 71){ - break; - } - mimeout_addchar(mimeout_state.buf[i]); - } - eof_mime(); - for (;i<j;i++) { - mimeout_addchar(mimeout_state.buf[i]); - } - } else { - for (;i<j;i++) { - mimeout_addchar(mimeout_state.buf[i]); - } - eof_mime(); - } - } else { - for (;i<j;i++) { - mimeout_addchar(mimeout_state.buf[i]); - } - } - return; - } - - if (mimeout_state.count > 0){ - lastchar = mimeout_state.buf[mimeout_state.count - 1]; - }else{ - lastchar = -1; - } - - if (mimeout_mode=='Q') { - if (c <= DEL && (output_mode==ASCII ||output_mode == ISO_8859_1)) { - if (c == CR || c == LF) { - close_mime(); - (*o_mputc)(c); - base64_count = 0; - return; - } else if (c <= SP) { - close_mime(); - if (base64_count > 70) { - put_newline(o_mputc); - base64_count = 0; - } - if (!nkf_isblank(c)) { - (*o_mputc)(SP); - base64_count++; - } - } else { - if (base64_count > 70) { - close_mime(); - put_newline(o_mputc); - (*o_mputc)(SP); - base64_count = 1; - open_mime(output_mode); - } - if (!nkf_noescape_mime(c)) { - mimeout_addchar(c); - return; - } - } - if (c != 0x1B) { - (*o_mputc)(c); - base64_count++; - return; - } - } - } - - if (mimeout_mode <= 0) { - if (c <= DEL && (output_mode==ASCII || output_mode == ISO_8859_1 || - output_mode == UTF_8)) { - if (nkf_isspace(c)) { - int flag = 0; - if (mimeout_mode == -1) { - flag = 1; - } - if (c==CR || c==LF) { - if (flag) { - open_mime(output_mode); - output_mode = 0; - } else { - base64_count = 0; - } - } - for (i=0;i<mimeout_state.count;i++) { - (*o_mputc)(mimeout_state.buf[i]); - if (mimeout_state.buf[i] == CR || mimeout_state.buf[i] == LF){ - base64_count = 0; - }else{ - base64_count++; - } - } - if (flag) { - eof_mime(); - base64_count = 0; - mimeout_mode = 0; - } - mimeout_state.buf[0] = (char)c; - mimeout_state.count = 1; - }else{ - if (base64_count > 1 - && base64_count + mimeout_state.count > 76 - && mimeout_state.buf[0] != CR && mimeout_state.buf[0] != LF){ - static const char *str = "boundary=\""; - static int len = 10; - i = 0; - - for (; i < mimeout_state.count - len; ++i) { - if (!strncmp((char *)(mimeout_state.buf+i), str, len)) { - i += len - 2; - break; - } - } - - if (i == 0 || i == mimeout_state.count - len) { - put_newline(o_mputc); - base64_count = 0; - if (!nkf_isspace(mimeout_state.buf[0])){ - (*o_mputc)(SP); - base64_count++; - } - } - else { - int j; - for (j = 0; j <= i; ++j) { - (*o_mputc)(mimeout_state.buf[j]); - } - put_newline(o_mputc); - base64_count = 1; - for (; j <= mimeout_state.count; ++j) { - mimeout_state.buf[j - i] = mimeout_state.buf[j]; - } - mimeout_state.count -= i; - } - } - mimeout_state.buf[mimeout_state.count++] = (char)c; - if (mimeout_state.count>MIMEOUT_BUF_LENGTH) { - open_mime(output_mode); - } - } - return; - }else{ - if (lastchar==CR || lastchar == LF){ - for (i=0;i<mimeout_state.count;i++) { - (*o_mputc)(mimeout_state.buf[i]); - } - base64_count = 0; - mimeout_state.count = 0; - } - if (lastchar==SP) { - for (i=0;i<mimeout_state.count-1;i++) { - (*o_mputc)(mimeout_state.buf[i]); - base64_count++; - } - mimeout_state.buf[0] = SP; - mimeout_state.count = 1; - } - open_mime(output_mode); - } - }else{ - /* mimeout_mode == 'B', 1, 2 */ - if (c <= DEL && (output_mode==ASCII || output_mode == ISO_8859_1 || - output_mode == UTF_8)) { - if (lastchar == CR || lastchar == LF){ - if (nkf_isblank(c)) { - for (i=0;i<mimeout_state.count;i++) { - mimeout_addchar(mimeout_state.buf[i]); - } - mimeout_state.count = 0; - } else { - eof_mime(); - for (i=0;i<mimeout_state.count;i++) { - (*o_mputc)(mimeout_state.buf[i]); - } - base64_count = 0; - mimeout_state.count = 0; - } - mimeout_state.buf[mimeout_state.count++] = (char)c; - return; - } - if (nkf_isspace(c)) { - for (i=0;i<mimeout_state.count;i++) { - if (SP<mimeout_state.buf[i] && mimeout_state.buf[i]<DEL) { - eof_mime(); - for (i=0;i<mimeout_state.count;i++) { - (*o_mputc)(mimeout_state.buf[i]); - base64_count++; - } - mimeout_state.count = 0; - } - } - mimeout_state.buf[mimeout_state.count++] = (char)c; - if (mimeout_state.count>MIMEOUT_BUF_LENGTH) { - eof_mime(); - for (j=0;j<mimeout_state.count;j++) { - (*o_mputc)(mimeout_state.buf[j]); - base64_count++; - } - mimeout_state.count = 0; - } - return; - } - if (mimeout_state.count>0 && SP<c && c!='=') { - mimeout_state.buf[mimeout_state.count++] = (char)c; - if (mimeout_state.count>MIMEOUT_BUF_LENGTH) { - j = mimeout_state.count; - mimeout_state.count = 0; - for (i=0;i<j;i++) { - mimeout_addchar(mimeout_state.buf[i]); - } - } - return; - } - } - } - if (mimeout_state.count>0) { - j = mimeout_state.count; - mimeout_state.count = 0; - for (i=0;i<j;i++) { - if (mimeout_state.buf[i]==CR || mimeout_state.buf[i]==LF) - break; - mimeout_addchar(mimeout_state.buf[i]); - } - if (i<j) { - eof_mime(); - base64_count=0; - for (;i<j;i++) { - (*o_mputc)(mimeout_state.buf[i]); - } - open_mime(output_mode); - } - } - mimeout_addchar(c); -} - -static void -base64_conv(nkf_char c2, nkf_char c1) -{ - mime_prechar(c2, c1); - (*o_base64conv)(c2,c1); -} - -#ifdef HAVE_ICONV_H -typedef struct nkf_iconv_t { - iconv_t cd; - char *input_buffer; - size_t input_buffer_size; - char *output_buffer; - size_t output_buffer_size; -}; - -static nkf_iconv_t -nkf_iconv_new(char *tocode, char *fromcode) -{ - nkf_iconv_t converter; - - converter->input_buffer_size = IOBUF_SIZE; - converter->input_buffer = nkf_xmalloc(converter->input_buffer_size); - converter->output_buffer_size = IOBUF_SIZE * 2; - converter->output_buffer = nkf_xmalloc(converter->output_buffer_size); - converter->cd = iconv_open(tocode, fromcode); - if (converter->cd == (iconv_t)-1) - { - switch (errno) { - case EINVAL: - perror(fprintf("iconv doesn't support %s to %s conversion.", fromcode, tocode)); - return -1; - default: - perror("can't iconv_open"); - } - } -} - -static size_t -nkf_iconv_convert(nkf_iconv_t *converter, FILE *input) -{ - size_t invalid = (size_t)0; - char *input_buffer = converter->input_buffer; - size_t input_length = (size_t)0; - char *output_buffer = converter->output_buffer; - size_t output_length = converter->output_buffer_size; - int c; - - do { - if (c != EOF) { - while ((c = (*i_getc)(f)) != EOF) { - input_buffer[input_length++] = c; - if (input_length < converter->input_buffer_size) break; - } - } - - size_t ret = iconv(converter->cd, &input_buffer, &input_length, &output_buffer, &output_length); - while (output_length-- > 0) { - (*o_putc)(output_buffer[converter->output_buffer_size-output_length]); - } - if (ret == (size_t) - 1) { - switch (errno) { - case EINVAL: - if (input_buffer != converter->input_buffer) - memmove(converter->input_buffer, input_buffer, input_length); - break; - case E2BIG: - converter->output_buffer_size *= 2; - output_buffer = realloc(converter->outbuf, converter->output_buffer_size); - if (output_buffer == NULL) { - perror("can't realloc"); - return -1; - } - converter->output_buffer = output_buffer; - break; - default: - perror("can't iconv"); - return -1; - } - } else { - invalid += ret; - } - } while (1); - - return invalid; -} - - -static void -nkf_iconv_close(nkf_iconv_t *convert) -{ - nkf_xfree(converter->inbuf); - nkf_xfree(converter->outbuf); - iconv_close(converter->cd); -} -#endif - - -static void -reinit(void) -{ - { - struct input_code *p = input_code_list; - while (p->name){ - status_reinit(p++); - } - } - unbuf_f = FALSE; - estab_f = FALSE; - nop_f = FALSE; - binmode_f = TRUE; - rot_f = FALSE; - hira_f = FALSE; - alpha_f = FALSE; - mime_f = MIME_DECODE_DEFAULT; - mime_decode_f = FALSE; - mimebuf_f = FALSE; - broken_f = FALSE; - iso8859_f = FALSE; - mimeout_f = FALSE; - x0201_f = NKF_UNSPECIFIED; - iso2022jp_f = FALSE; -#if defined(UTF8_INPUT_ENABLE) || defined(UTF8_OUTPUT_ENABLE) - ms_ucs_map_f = UCS_MAP_ASCII; -#endif -#ifdef UTF8_INPUT_ENABLE - no_cp932ext_f = FALSE; - no_best_fit_chars_f = FALSE; - encode_fallback = NULL; - unicode_subchar = '?'; - input_endian = ENDIAN_BIG; -#endif -#ifdef UTF8_OUTPUT_ENABLE - output_bom_f = FALSE; - output_endian = ENDIAN_BIG; -#endif -#ifdef UNICODE_NORMALIZATION - nfc_f = FALSE; -#endif -#ifdef INPUT_OPTION - cap_f = FALSE; - url_f = FALSE; - numchar_f = FALSE; -#endif -#ifdef CHECK_OPTION - noout_f = FALSE; - debug_f = FALSE; -#endif - guess_f = 0; -#ifdef EXEC_IO - exec_f = 0; -#endif -#ifdef SHIFTJIS_CP932 - cp51932_f = TRUE; - cp932inv_f = TRUE; -#endif -#ifdef X0212_ENABLE - x0212_f = FALSE; - x0213_f = FALSE; -#endif - { - int i; - for (i = 0; i < 256; i++){ - prefix_table[i] = 0; - } - } - hold_count = 0; - mimeout_state.count = 0; - mimeout_mode = 0; - base64_count = 0; - f_line = 0; - f_prev = 0; - fold_preserve_f = FALSE; - fold_f = FALSE; - fold_len = 0; - kanji_intro = DEFAULT_J; - ascii_intro = DEFAULT_R; - fold_margin = FOLD_MARGIN; - o_zconv = no_connection; - o_fconv = no_connection; - o_eol_conv = no_connection; - o_rot_conv = no_connection; - o_hira_conv = no_connection; - o_base64conv = no_connection; - o_iso2022jp_check_conv = no_connection; - o_putc = std_putc; - i_getc = std_getc; - i_ungetc = std_ungetc; - i_bgetc = std_getc; - i_bungetc = std_ungetc; - o_mputc = std_putc; - i_mgetc = std_getc; - i_mungetc = std_ungetc; - i_mgetc_buf = std_getc; - i_mungetc_buf = std_ungetc; - output_mode = ASCII; - input_mode = ASCII; - mime_decode_mode = FALSE; - file_out_f = FALSE; - eolmode_f = 0; - input_eol = 0; - prev_cr = 0; - option_mode = 0; - z_prev2=0,z_prev1=0; -#ifdef CHECK_OPTION - iconv_for_check = 0; -#endif - input_codename = NULL; - input_encoding = NULL; - output_encoding = NULL; - nkf_state_init(); -#ifdef WIN32DLL - reinitdll(); -#endif /*WIN32DLL*/ -} - -static int -module_connection(void) -{ - if (input_encoding) set_input_encoding(input_encoding); - if (!output_encoding) { - output_encoding = nkf_default_encoding(); - } - if (!output_encoding) { - if (noout_f || guess_f) output_encoding = nkf_enc_from_index(ISO_2022_JP); - else return -1; - } - set_output_encoding(output_encoding); - oconv = nkf_enc_to_oconv(output_encoding); - o_putc = std_putc; - if (nkf_enc_unicode_p(output_encoding)) - output_mode = UTF_8; - - if (x0201_f == NKF_UNSPECIFIED) { - x0201_f = X0201_DEFAULT; - } - - /* replace continuation module, from output side */ - - /* output redirection */ -#ifdef CHECK_OPTION - if (noout_f || guess_f){ - o_putc = no_putc; - } -#endif - if (mimeout_f) { - o_mputc = o_putc; - o_putc = mime_putc; - if (mimeout_f == TRUE) { - o_base64conv = oconv; oconv = base64_conv; - } - /* base64_count = 0; */ - } - - if (eolmode_f || guess_f) { - o_eol_conv = oconv; oconv = eol_conv; - } - if (rot_f) { - o_rot_conv = oconv; oconv = rot_conv; - } - if (iso2022jp_f) { - o_iso2022jp_check_conv = oconv; oconv = iso2022jp_check_conv; - } - if (hira_f) { - o_hira_conv = oconv; oconv = hira_conv; - } - if (fold_f) { - o_fconv = oconv; oconv = fold_conv; - f_line = 0; - } - if (alpha_f || x0201_f) { - o_zconv = oconv; oconv = z_conv; - } - - i_getc = std_getc; - i_ungetc = std_ungetc; - /* input redirection */ -#ifdef INPUT_OPTION - if (cap_f){ - i_cgetc = i_getc; i_getc = cap_getc; - i_cungetc = i_ungetc; i_ungetc= cap_ungetc; - } - if (url_f){ - i_ugetc = i_getc; i_getc = url_getc; - i_uungetc = i_ungetc; i_ungetc= url_ungetc; - } -#endif -#ifdef NUMCHAR_OPTION - if (numchar_f){ - i_ngetc = i_getc; i_getc = numchar_getc; - i_nungetc = i_ungetc; i_ungetc= numchar_ungetc; - } -#endif -#ifdef UNICODE_NORMALIZATION - if (nfc_f){ - i_nfc_getc = i_getc; i_getc = nfc_getc; - i_nfc_ungetc = i_ungetc; i_ungetc= nfc_ungetc; - } -#endif - if (mime_f && mimebuf_f==FIXED_MIME) { - i_mgetc = i_getc; i_getc = mime_getc; - i_mungetc = i_ungetc; i_ungetc = mime_ungetc; - } - if (broken_f & 1) { - i_bgetc = i_getc; i_getc = broken_getc; - i_bungetc = i_ungetc; i_ungetc = broken_ungetc; - } - if (input_encoding) { - set_iconv(-TRUE, nkf_enc_to_iconv(input_encoding)); - } else { - set_iconv(FALSE, e_iconv); - } - - { - struct input_code *p = input_code_list; - while (p->name){ - status_reinit(p++); - } - } - return 0; -} - -/* - Conversion main loop. Code detection only. - */ - -#if !defined(PERL_XS) && !defined(WIN32DLL) -static nkf_char -noconvert(FILE *f) -{ - nkf_char c; - - if (nop_f == 2) - module_connection(); - while ((c = (*i_getc)(f)) != EOF) - (*o_putc)(c); - (*o_putc)(EOF); - return 1; -} -#endif - -#define NEXT continue /* no output, get next */ -#define SKIP c2=0;continue /* no output, get next */ -#define MORE c2=c1;continue /* need one more byte */ -#define SEND (void)0 /* output c1 and c2, get next */ -#define LAST break /* end of loop, go closing */ -#define set_input_mode(mode) do { \ - input_mode = mode; \ - shift_mode = 0; \ - set_input_codename("ISO-2022-JP"); \ - debug("ISO-2022-JP"); \ -} while (0) - -static int -kanji_convert(FILE *f) -{ - nkf_char c1=0, c2=0, c3=0, c4=0; - int shift_mode = 0; /* 0, 1, 2, 3 */ - int g2 = 0; - int is_8bit = FALSE; - - if (input_encoding && !nkf_enc_asciicompat(input_encoding)) { - is_8bit = TRUE; - } - - input_mode = ASCII; - output_mode = ASCII; - - if (module_connection() < 0) { -#if !defined(PERL_XS) && !defined(WIN32DLL) - fprintf(stderr, "no output encoding given\n"); -#endif - return -1; - } - check_bom(f); - -#ifdef UTF8_INPUT_ENABLE - if(iconv == w_iconv32){ - while ((c1 = (*i_getc)(f)) != EOF && - (c2 = (*i_getc)(f)) != EOF && - (c3 = (*i_getc)(f)) != EOF && - (c4 = (*i_getc)(f)) != EOF) { - 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) { - 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; - } -#endif - - while ((c1 = (*i_getc)(f)) != EOF) { -#ifdef INPUT_CODE_FIX - if (!input_encoding) -#endif - code_status(c1); - if (c2) { - /* second byte */ - 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 */ - /* It is still ambiguous */ - if (h_conv(f, c2, c1)==EOF) { - LAST; - } - else { - SKIP; - } - } - else { - /* in case of already established */ - if (c1 < 0x40) { - /* ignore bogus code */ - SKIP; - } else { - SEND; - } - } - } - else { - /* 2nd byte of 7 bit code or SJIS */ - SEND; - } - } - else if (nkf_char_unicode_p(c1)) { - (*oconv)(0, c1); - NEXT; - } - else { - /* first byte */ - if (input_mode == JIS_X_0208 && DEL <= c1 && c1 < 0x92) { - /* CP5022x */ - MORE; - }else if (input_codename && input_codename[0] == 'I' && - 0xA1 <= c1 && c1 <= 0xDF) { - /* JIS X 0201 Katakana in 8bit JIS */ - c2 = JIS_X_0201_1976_K; - c1 &= 0x7f; - SEND; - } else if (c1 > DEL) { - /* 8 bit code */ - if (!estab_f && !iso8859_f) { - /* not established yet */ - MORE; - } else { /* estab_f==TRUE */ - if (iso8859_f) { - c2 = ISO_8859_1; - c1 &= 0x7f; - SEND; - } - else if ((iconv == s_iconv && 0xA0 <= c1 && c1 <= 0xDF) || - (ms_ucs_map_f == UCS_MAP_CP10001 && (c1 == 0xFD || c1 == 0xFE))) { - /* JIS X 0201 */ - c2 = JIS_X_0201_1976_K; - c1 &= 0x7f; - SEND; - } - else { - /* already established */ - MORE; - } - } - } else if (SP < c1 && c1 < DEL) { - /* in case of Roman characters */ - if (shift_mode) { - /* output 1 shifted byte */ - if (iso8859_f) { - c2 = ISO_8859_1; - SEND; - } else if (nkf_byte_jisx0201_katakana_p(c1)){ - /* output 1 shifted byte */ - c2 = JIS_X_0201_1976_K; - SEND; - } else { - /* look like bogus code */ - SKIP; - } - } else if (input_mode == JIS_X_0208 || input_mode == JIS_X_0212 || - input_mode == JIS_X_0213_1 || input_mode == JIS_X_0213_2) { - /* in case of Kanji shifted */ - MORE; - } else if (c1 == '=' && mime_f && !mime_decode_mode) { - /* Check MIME code */ - if ((c1 = (*i_getc)(f)) == EOF) { - (*oconv)(0, '='); - LAST; - } else if (c1 == '?') { - /* =? is mime conversion start sequence */ - if(mime_f == STRICT_MIME) { - /* check in real detail */ - if (mime_begin_strict(f) == EOF) - LAST; - SKIP; - } else if (mime_begin(f) == EOF) - LAST; - SKIP; - } else { - (*oconv)(0, '='); - (*i_ungetc)(c1,f); - SKIP; - } - } else { - /* normal ASCII code */ - SEND; - } - } else if (c1 == SI && (!is_8bit || mime_decode_mode)) { - shift_mode = 0; - SKIP; - } else if (c1 == SO && (!is_8bit || mime_decode_mode)) { - shift_mode = 1; - SKIP; - } else if (c1 == ESC && (!is_8bit || mime_decode_mode)) { - if ((c1 = (*i_getc)(f)) == EOF) { - (*oconv)(0, ESC); - LAST; - } - else if (c1 == '&') { - /* IRR */ - if ((c1 = (*i_getc)(f)) == EOF) { - LAST; - } else { - SKIP; - } - } - else if (c1 == '$') { - /* GZDMx */ - if ((c1 = (*i_getc)(f)) == EOF) { - /* don't send bogus code - (*oconv)(0, ESC); - (*oconv)(0, '$'); */ - LAST; - } else if (c1 == '@' || c1 == 'B') { - /* JIS X 0208 */ - set_input_mode(JIS_X_0208); - SKIP; - } else if (c1 == '(') { - /* GZDM4 */ - if ((c1 = (*i_getc)(f)) == EOF) { - /* don't send bogus code - (*oconv)(0, ESC); - (*oconv)(0, '$'); - (*oconv)(0, '('); - */ - LAST; - } else if (c1 == '@'|| c1 == 'B') { - /* JIS X 0208 */ - set_input_mode(JIS_X_0208); - SKIP; -#ifdef X0212_ENABLE - } else if (c1 == 'D'){ - set_input_mode(JIS_X_0212); - SKIP; -#endif /* X0212_ENABLE */ - } else if (c1 == 'O' || c1 == 'Q'){ - set_input_mode(JIS_X_0213_1); - SKIP; - } else if (c1 == 'P'){ - set_input_mode(JIS_X_0213_2); - SKIP; - } else { - /* could be some special code */ - (*oconv)(0, ESC); - (*oconv)(0, '$'); - (*oconv)(0, '('); - (*oconv)(0, c1); - SKIP; - } - } else if (broken_f&0x2) { - /* accept any ESC-(-x as broken code ... */ - input_mode = JIS_X_0208; - shift_mode = 0; - SKIP; - } else { - (*oconv)(0, ESC); - (*oconv)(0, '$'); - (*oconv)(0, c1); - SKIP; - } - } else if (c1 == '(') { - /* GZD4 */ - if ((c1 = (*i_getc)(f)) == EOF) { - /* don't send bogus code - (*oconv)(0, ESC); - (*oconv)(0, '('); */ - LAST; - } - 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') { - /* ISO-646IRV:1983 or JIS X 0201 Roman or JUNET */ - set_input_mode(ASCII); - SKIP; - } - else if (broken_f&0x2) { - set_input_mode(ASCII); - SKIP; - } - else { - (*oconv)(0, ESC); - (*oconv)(0, '('); - SEND; - } - } - else if (c1 == '.') { - /* G2D6 */ - if ((c1 = (*i_getc)(f)) == EOF) { - LAST; - } - else if (c1 == 'A') { - /* ISO-8859-1 */ - g2 = ISO_8859_1; - SKIP; - } - else { - (*oconv)(0, ESC); - (*oconv)(0, '.'); - SEND; - } - } - else if (c1 == 'N') { - /* SS2 */ - c1 = (*i_getc)(f); - if (g2 == ISO_8859_1) { - c2 = ISO_8859_1; - SEND; - }else{ - (*i_ungetc)(c1, f); - /* lonely ESC */ - (*oconv)(0, ESC); - SEND; - } - } - else { - i_ungetc(c1,f); - /* lonely ESC */ - (*oconv)(0, ESC); - SKIP; - } - } else if (c1 == ESC && iconv == s_iconv) { - /* ESC in Shift_JIS */ - if ((c1 = (*i_getc)(f)) == EOF) { - (*oconv)(0, ESC); - LAST; - } else if (c1 == '$') { - /* J-PHONE emoji */ - if ((c1 = (*i_getc)(f)) == EOF) { - LAST; - } else if (('E' <= c1 && c1 <= 'G') || - ('O' <= c1 && c1 <= 'Q')) { - /* - NUM : 0 1 2 3 4 5 - BYTE: G E F O P Q - C%7 : 1 6 0 2 3 4 - C%7 : 0 1 2 3 4 5 6 - NUM : 2 0 3 4 5 X 1 - */ - static const nkf_char jphone_emoji_first_table[7] = - {0xE1E0, 0xDFE0, 0xE2E0, 0xE3E0, 0xE4E0, 0xDFE0, 0xE0E0}; - c3 = nkf_char_unicode_new(jphone_emoji_first_table[c1 % 7]); - if ((c1 = (*i_getc)(f)) == EOF) LAST; - while (SP <= c1 && c1 <= 'z') { - (*oconv)(0, c1 + c3); - if ((c1 = (*i_getc)(f)) == EOF) LAST; - } - SKIP; - } - else { - (*oconv)(0, ESC); - (*oconv)(0, '$'); - SEND; - } - } - else { - i_ungetc(c1,f); - /* lonely ESC */ - (*oconv)(0, ESC); - SKIP; - } - } else if (c1 == LF || c1 == CR) { - if (broken_f&4) { - input_mode = ASCII; set_iconv(FALSE, 0); - SEND; - } else if (mime_decode_f && !mime_decode_mode){ - if (c1 == LF) { - if ((c1=(*i_getc)(f))!=EOF && c1 == SP) { - i_ungetc(SP,f); - continue; - } else { - i_ungetc(c1,f); - } - c1 = LF; - SEND; - } else { /* if (c1 == CR)*/ - if ((c1=(*i_getc)(f))!=EOF) { - if (c1==SP) { - i_ungetc(SP,f); - continue; - } else if (c1 == LF && (c1=(*i_getc)(f))!=EOF && c1 == SP) { - i_ungetc(SP,f); - continue; - } else { - i_ungetc(c1,f); - } - i_ungetc(LF,f); - } else { - i_ungetc(c1,f); - } - c1 = CR; - SEND; - } - } - } else - SEND; - } - /* send: */ - switch(input_mode){ - case ASCII: - switch ((*iconv)(c2, c1, 0)) { /* can be EUC / SJIS / UTF-8 */ - case -2: - /* 4 bytes UTF-8 */ - if ((c3 = (*i_getc)(f)) != EOF) { - code_status(c3); - c3 <<= 8; - if ((c4 = (*i_getc)(f)) != EOF) { - code_status(c4); - (*iconv)(c2, c1, c3|c4); - } - } - 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); - 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; - } - break; - case JIS_X_0208: - case JIS_X_0213_1: - if (ms_ucs_map_f && - 0x7F <= c2 && c2 <= 0x92 && - 0x21 <= c1 && c1 <= 0x7E) { - /* CP932 UDC */ - c1 = nkf_char_unicode_new((c2 - 0x7F) * 94 + c1 - 0x21 + 0xE000); - c2 = 0; - } - (*oconv)(c2, c1); /* this is JIS, not SJIS/EUC case */ - break; -#ifdef X0212_ENABLE - case JIS_X_0212: - (*oconv)(PREFIX_EUCG3 | c2, c1); - break; -#endif /* X0212_ENABLE */ - case JIS_X_0213_2: - (*oconv)(PREFIX_EUCG3 | c2, c1); - break; - default: - (*oconv)(input_mode, c1); /* other special case */ - } - - c2 = 0; - c3 = 0; - continue; - /* goto next_word */ - } - -finished: - /* epilogue */ - (*iconv)(EOF, 0, 0); - if (!input_codename) - { - if (is_8bit) { - struct input_code *p = input_code_list; - struct input_code *result = p; - while (p->name){ - if (p->score < result->score) result = p; - ++p; - } - set_input_codename(result->name); -#ifdef CHECK_OPTION - debug(result->name); -#endif - } - } - return 0; -} - -/* - * int options(unsigned char *cp) - * - * return values: - * 0: success - * -1: ArgumentError - */ -static int -options(unsigned char *cp) -{ - nkf_char i, j; - unsigned char *p; - unsigned char *cp_back = NULL; - nkf_encoding *enc; - - if (option_mode==1) - return 0; - while(*cp && *cp++!='-'); - while (*cp || cp_back) { - if(!*cp){ - cp = cp_back; - cp_back = NULL; - continue; - } - p = 0; - switch (*cp++) { - case '-': /* literal options */ - if (!*cp || *cp == SP) { /* ignore the rest of arguments */ - option_mode = 1; - return 0; - } - for (i=0;i<(int)(sizeof(long_option)/sizeof(long_option[0]));i++) { - p = (unsigned char *)long_option[i].name; - for (j=0;*p && *p != '=' && *p == cp[j];p++, j++); - if (*p == cp[j] || cp[j] == SP){ - p = &cp[j] + 1; - break; - } - p = 0; - } - if (p == 0) { -#if !defined(PERL_XS) && !defined(WIN32DLL) - fprintf(stderr, "unknown long option: --%s\n", cp); -#endif - return -1; - } - while(*cp && *cp != SP && cp++); - if (long_option[i].alias[0]){ - cp_back = cp; - cp = (unsigned char *)long_option[i].alias; - }else{ -#ifndef PERL_XS - if (strcmp(long_option[i].name, "help") == 0){ - usage(); - exit(EXIT_SUCCESS); - } -#endif - if (strcmp(long_option[i].name, "ic=") == 0){ - enc = nkf_enc_find((char *)p); - if (!enc) continue; - input_encoding = enc; - continue; - } - if (strcmp(long_option[i].name, "oc=") == 0){ - enc = nkf_enc_find((char *)p); - /* if (enc <= 0) continue; */ - if (!enc) continue; - output_encoding = enc; - continue; - } - if (strcmp(long_option[i].name, "guess=") == 0){ - if (p[0] == '0' || p[0] == '1') { - guess_f = 1; - } else { - guess_f = 2; - } - continue; - } -#ifdef OVERWRITE - if (strcmp(long_option[i].name, "overwrite") == 0){ - file_out_f = TRUE; - overwrite_f = TRUE; - preserve_time_f = TRUE; - continue; - } - if (strcmp(long_option[i].name, "overwrite=") == 0){ - file_out_f = TRUE; - overwrite_f = TRUE; - preserve_time_f = TRUE; - backup_f = TRUE; - backup_suffix = (char *)p; - continue; - } - if (strcmp(long_option[i].name, "in-place") == 0){ - file_out_f = TRUE; - overwrite_f = TRUE; - preserve_time_f = FALSE; - continue; - } - if (strcmp(long_option[i].name, "in-place=") == 0){ - file_out_f = TRUE; - overwrite_f = TRUE; - preserve_time_f = FALSE; - backup_f = TRUE; - backup_suffix = (char *)p; - continue; - } -#endif -#ifdef INPUT_OPTION - if (strcmp(long_option[i].name, "cap-input") == 0){ - cap_f = TRUE; - continue; - } - if (strcmp(long_option[i].name, "url-input") == 0){ - url_f = TRUE; - continue; - } -#endif -#ifdef NUMCHAR_OPTION - if (strcmp(long_option[i].name, "numchar-input") == 0){ - numchar_f = TRUE; - continue; - } -#endif -#ifdef CHECK_OPTION - if (strcmp(long_option[i].name, "no-output") == 0){ - noout_f = TRUE; - continue; - } - if (strcmp(long_option[i].name, "debug") == 0){ - debug_f = TRUE; - continue; - } -#endif - if (strcmp(long_option[i].name, "cp932") == 0){ -#ifdef SHIFTJIS_CP932 - cp51932_f = TRUE; - cp932inv_f = -TRUE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_CP932; -#endif - continue; - } - if (strcmp(long_option[i].name, "no-cp932") == 0){ -#ifdef SHIFTJIS_CP932 - cp51932_f = FALSE; - cp932inv_f = FALSE; -#endif -#ifdef UTF8_OUTPUT_ENABLE - ms_ucs_map_f = UCS_MAP_ASCII; -#endif - continue; - } -#ifdef SHIFTJIS_CP932 - if (strcmp(long_option[i].name, "cp932inv") == 0){ - cp932inv_f = -TRUE; - continue; - } -#endif - -#ifdef X0212_ENABLE - if (strcmp(long_option[i].name, "x0212") == 0){ - x0212_f = TRUE; - continue; - } -#endif - -#ifdef EXEC_IO - if (strcmp(long_option[i].name, "exec-in") == 0){ - exec_f = 1; - return 0; - } - if (strcmp(long_option[i].name, "exec-out") == 0){ - exec_f = -1; - return 0; - } -#endif -#if defined(UTF8_OUTPUT_ENABLE) && defined(UTF8_INPUT_ENABLE) - if (strcmp(long_option[i].name, "no-cp932ext") == 0){ - no_cp932ext_f = TRUE; - continue; - } - if (strcmp(long_option[i].name, "no-best-fit-chars") == 0){ - no_best_fit_chars_f = TRUE; - continue; - } - if (strcmp(long_option[i].name, "fb-skip") == 0){ - encode_fallback = NULL; - continue; - } - if (strcmp(long_option[i].name, "fb-html") == 0){ - encode_fallback = encode_fallback_html; - continue; - } - if (strcmp(long_option[i].name, "fb-xml") == 0){ - encode_fallback = encode_fallback_xml; - continue; - } - if (strcmp(long_option[i].name, "fb-java") == 0){ - encode_fallback = encode_fallback_java; - continue; - } - if (strcmp(long_option[i].name, "fb-perl") == 0){ - encode_fallback = encode_fallback_perl; - continue; - } - if (strcmp(long_option[i].name, "fb-subchar") == 0){ - encode_fallback = encode_fallback_subchar; - continue; - } - if (strcmp(long_option[i].name, "fb-subchar=") == 0){ - encode_fallback = encode_fallback_subchar; - unicode_subchar = 0; - if (p[0] != '0'){ - /* decimal number */ - for (i = 0; i < 7 && nkf_isdigit(p[i]); i++){ - unicode_subchar *= 10; - unicode_subchar += hex2bin(p[i]); - } - }else if(p[1] == 'x' || p[1] == 'X'){ - /* hexadecimal number */ - for (i = 2; i < 8 && nkf_isxdigit(p[i]); i++){ - unicode_subchar <<= 4; - unicode_subchar |= hex2bin(p[i]); - } - }else{ - /* octal number */ - for (i = 1; i < 8 && nkf_isoctal(p[i]); i++){ - unicode_subchar *= 8; - unicode_subchar += hex2bin(p[i]); - } - } - w16e_conv(unicode_subchar, &i, &j); - unicode_subchar = i<<8 | j; - continue; - } -#endif -#ifdef UTF8_OUTPUT_ENABLE - if (strcmp(long_option[i].name, "ms-ucs-map") == 0){ - ms_ucs_map_f = UCS_MAP_MS; - continue; - } -#endif -#ifdef UNICODE_NORMALIZATION - if (strcmp(long_option[i].name, "utf8mac-input") == 0){ - nfc_f = TRUE; - continue; - } -#endif - if (strcmp(long_option[i].name, "prefix=") == 0){ - if (nkf_isgraph(p[0])){ - for (i = 1; nkf_isgraph(p[i]); i++){ - prefix_table[p[i]] = p[0]; - } - } - continue; - } -#if !defined(PERL_XS) && !defined(WIN32DLL) - fprintf(stderr, "unsupported long option: --%s\n", long_option[i].name); -#endif - return -1; - } - continue; - case 'b': /* buffered mode */ - unbuf_f = FALSE; - continue; - case 'u': /* non bufferd mode */ - unbuf_f = TRUE; - continue; - case 't': /* transparent mode */ - if (*cp=='1') { - /* alias of -t */ - cp++; - nop_f = TRUE; - } else if (*cp=='2') { - /* - * -t with put/get - * - * nkf -t2MB hoge.bin | nkf -t2mB | diff -s - hoge.bin - * - */ - cp++; - nop_f = 2; - } else - nop_f = TRUE; - continue; - case 'j': /* JIS output */ - case 'n': - output_encoding = nkf_enc_from_index(ISO_2022_JP); - continue; - case 'e': /* AT&T EUC output */ - output_encoding = nkf_enc_from_index(EUCJP_NKF); - continue; - case 's': /* SJIS output */ - output_encoding = nkf_enc_from_index(SHIFT_JIS); - continue; - case 'l': /* ISO8859 Latin-1 support, no conversion */ - iso8859_f = TRUE; /* Only compatible with ISO-2022-JP */ - input_encoding = nkf_enc_from_index(ISO_8859_1); - continue; - case 'i': /* Kanji IN ESC-$-@/B */ - if (*cp=='@'||*cp=='B') - kanji_intro = *cp++; - continue; - case 'o': /* ASCII IN ESC-(-J/B/H */ - /* ESC ( H was used in initial JUNET messages */ - if (*cp=='J'||*cp=='B'||*cp=='H') - ascii_intro = *cp++; - continue; - case 'h': - /* - bit:1 katakana->hiragana - bit:2 hiragana->katakana - */ - if ('9'>= *cp && *cp>='0') - hira_f |= (*cp++ -'0'); - else - hira_f |= 1; - continue; - case 'r': - rot_f = TRUE; - continue; -#if defined(MSDOS) || defined(__OS2__) - case 'T': - binmode_f = FALSE; - continue; -#endif -#ifndef PERL_XS - case 'V': - show_configuration(); - exit(EXIT_SUCCESS); - break; - case 'v': - version(); - exit(EXIT_SUCCESS); - break; -#endif -#ifdef UTF8_OUTPUT_ENABLE - case 'w': /* UTF-{8,16,32} output */ - if (cp[0] == '8') { - cp++; - if (cp[0] == '0'){ - cp++; - output_encoding = nkf_enc_from_index(UTF_8N); - } else { - output_bom_f = TRUE; - output_encoding = nkf_enc_from_index(UTF_8_BOM); - } - } else { - int enc_idx; - if ('1'== cp[0] && '6'==cp[1]) { - cp += 2; - enc_idx = UTF_16; - } else if ('3'== cp[0] && '2'==cp[1]) { - cp += 2; - enc_idx = UTF_32; - } else { - output_encoding = nkf_enc_from_index(UTF_8); - continue; - } - if (cp[0]=='L') { - cp++; - output_endian = ENDIAN_LITTLE; - output_bom_f = TRUE; - } else if (cp[0] == 'B') { - cp++; - output_bom_f = TRUE; - } - if (cp[0] == '0'){ - output_bom_f = FALSE; - cp++; - enc_idx = enc_idx == UTF_16 - ? (output_endian == ENDIAN_LITTLE ? UTF_16LE : UTF_16BE) - : (output_endian == ENDIAN_LITTLE ? UTF_32LE : UTF_32BE); - } else { - enc_idx = enc_idx == UTF_16 - ? (output_endian == ENDIAN_LITTLE ? UTF_16LE_BOM : UTF_16BE_BOM) - : (output_endian == ENDIAN_LITTLE ? UTF_32LE_BOM : UTF_32BE_BOM); - } - output_encoding = nkf_enc_from_index(enc_idx); - } - continue; -#endif -#ifdef UTF8_INPUT_ENABLE - case 'W': /* UTF input */ - if (cp[0] == '8') { - cp++; - input_encoding = nkf_enc_from_index(UTF_8); - }else{ - int enc_idx; - if ('1'== cp[0] && '6'==cp[1]) { - cp += 2; - input_endian = ENDIAN_BIG; - enc_idx = UTF_16; - } else if ('3'== cp[0] && '2'==cp[1]) { - cp += 2; - input_endian = ENDIAN_BIG; - enc_idx = UTF_32; - } else { - input_encoding = nkf_enc_from_index(UTF_8); - continue; - } - if (cp[0]=='L') { - cp++; - input_endian = ENDIAN_LITTLE; - } else if (cp[0] == 'B') { - cp++; - input_endian = ENDIAN_BIG; - } - enc_idx = (enc_idx == UTF_16 - ? (input_endian == ENDIAN_LITTLE ? UTF_16LE : UTF_16BE) - : (input_endian == ENDIAN_LITTLE ? UTF_32LE : UTF_32BE)); - input_encoding = nkf_enc_from_index(enc_idx); - } - continue; -#endif - /* Input code assumption */ - case 'J': /* ISO-2022-JP input */ - input_encoding = nkf_enc_from_index(ISO_2022_JP); - continue; - case 'E': /* EUC-JP input */ - input_encoding = nkf_enc_from_index(EUCJP_NKF); - continue; - case 'S': /* Shift_JIS input */ - input_encoding = nkf_enc_from_index(SHIFT_JIS); - continue; - case 'Z': /* Convert X0208 alphabet to ascii */ - /* alpha_f - bit:0 Convert JIS X 0208 Alphabet to ASCII - bit:1 Convert Kankaku to one space - bit:2 Convert Kankaku to two spaces - bit:3 Convert HTML Entity - bit:4 Convert JIS X 0208 Katakana to JIS X 0201 Katakana - */ - while ('0'<= *cp && *cp <='4') { - alpha_f |= 1 << (*cp++ - '0'); - } - alpha_f |= 1; - continue; - case 'x': /* Convert X0201 kana to X0208 or X0201 Conversion */ - x0201_f = FALSE; /* No X0201->X0208 conversion */ - /* accept X0201 - ESC-(-I in JIS, EUC, MS Kanji - SI/SO in JIS, EUC, MS Kanji - SS2 in EUC, JIS, not in MS Kanji - MS Kanji (0xa0-0xdf) - output X0201 - ESC-(-I in JIS (0x20-0x5f) - SS2 in EUC (0xa0-0xdf) - 0xa0-0xd in MS Kanji (0xa0-0xdf) - */ - continue; - case 'X': /* Convert X0201 kana to X0208 */ - x0201_f = TRUE; - continue; - case 'F': /* prserve new lines */ - fold_preserve_f = TRUE; - case 'f': /* folding -f60 or -f */ - fold_f = TRUE; - fold_len = 0; - while('0'<= *cp && *cp <='9') { /* we don't use atoi here */ - fold_len *= 10; - fold_len += *cp++ - '0'; - } - if (!(0<fold_len && fold_len<BUFSIZ)) - fold_len = DEFAULT_FOLD; - if (*cp=='-') { - fold_margin = 0; - cp++; - while('0'<= *cp && *cp <='9') { /* we don't use atoi here */ - fold_margin *= 10; - fold_margin += *cp++ - '0'; - } - } - continue; - case 'm': /* MIME support */ - /* mime_decode_f = TRUE; */ /* this has too large side effects... */ - if (*cp=='B'||*cp=='Q') { - mime_decode_mode = *cp++; - mimebuf_f = FIXED_MIME; - } else if (*cp=='N') { - mime_f = TRUE; cp++; - } else if (*cp=='S') { - mime_f = STRICT_MIME; cp++; - } else if (*cp=='0') { - mime_decode_f = FALSE; - mime_f = FALSE; cp++; - } else { - mime_f = STRICT_MIME; - } - continue; - case 'M': /* MIME output */ - if (*cp=='B') { - mimeout_mode = 'B'; - mimeout_f = FIXED_MIME; cp++; - } else if (*cp=='Q') { - mimeout_mode = 'Q'; - mimeout_f = FIXED_MIME; cp++; - } else { - mimeout_f = TRUE; - } - continue; - case 'B': /* Broken JIS support */ - /* bit:0 no ESC JIS - bit:1 allow any x on ESC-(-x or ESC-$-x - bit:2 reset to ascii on NL - */ - if ('9'>= *cp && *cp>='0') - broken_f |= 1<<(*cp++ -'0'); - else - broken_f |= TRUE; - continue; -#ifndef PERL_XS - case 'O':/* for Output file */ - file_out_f = TRUE; - continue; -#endif - case 'c':/* add cr code */ - eolmode_f = CRLF; - continue; - case 'd':/* delete cr code */ - eolmode_f = LF; - continue; - case 'I': /* ISO-2022-JP output */ - iso2022jp_f = TRUE; - continue; - case 'L': /* line mode */ - if (*cp=='u') { /* unix */ - eolmode_f = LF; cp++; - } else if (*cp=='m') { /* mac */ - eolmode_f = CR; cp++; - } else if (*cp=='w') { /* windows */ - eolmode_f = CRLF; cp++; - } else if (*cp=='0') { /* no conversion */ - eolmode_f = 0; cp++; - } - continue; -#ifndef PERL_XS - case 'g': - if ('2' <= *cp && *cp <= '9') { - guess_f = 2; - cp++; - } else if (*cp == '0' || *cp == '1') { - guess_f = 1; - cp++; - } else { - guess_f = 1; - } - continue; -#endif - case SP: - /* module multiple options in a string are allowed for Perl module */ - while(*cp && *cp++!='-'); - continue; - default: -#if !defined(PERL_XS) && !defined(WIN32DLL) - fprintf(stderr, "unknown option: -%c\n", *(cp-1)); -#endif - /* bogus option but ignored */ - return -1; - } - } - return 0; -} - -#ifdef WIN32DLL -#include "nkf32dll.c" -#elif defined(PERL_XS) -#else /* WIN32DLL */ -int -main(int argc, char **argv) -{ - FILE *fin; - unsigned char *cp; - - char *outfname = NULL; - char *origfname; - -#ifdef EASYWIN /*Easy Win */ - _BufferSize.y = 400;/*Set Scroll Buffer Size*/ -#endif -#ifdef DEFAULT_CODE_LOCALE - setlocale(LC_CTYPE, ""); -#endif - nkf_state_init(); - - for (argc--,argv++; (argc > 0) && **argv == '-'; argc--, argv++) { - cp = (unsigned char *)*argv; - options(cp); -#ifdef EXEC_IO - if (exec_f){ - int fds[2], pid; - if (pipe(fds) < 0 || (pid = fork()) < 0){ - abort(); - } - if (pid == 0){ - if (exec_f > 0){ - close(fds[0]); - dup2(fds[1], 1); - }else{ - close(fds[1]); - dup2(fds[0], 0); - } - execvp(argv[1], &argv[1]); - } - if (exec_f > 0){ - close(fds[1]); - dup2(fds[0], 0); - }else{ - close(fds[0]); - dup2(fds[1], 1); - } - argc = 0; - break; - } -#endif - } - - if (guess_f) { -#ifdef CHECK_OPTION - int debug_f_back = debug_f; -#endif -#ifdef EXEC_IO - int exec_f_back = exec_f; -#endif -#ifdef X0212_ENABLE - int x0212_f_back = x0212_f; -#endif - int x0213_f_back = x0213_f; - int guess_f_back = guess_f; - reinit(); - guess_f = guess_f_back; - mime_f = FALSE; -#ifdef CHECK_OPTION - debug_f = debug_f_back; -#endif -#ifdef EXEC_IO - exec_f = exec_f_back; -#endif - x0212_f = x0212_f_back; - x0213_f = x0213_f_back; - } - - if (binmode_f == TRUE) -#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__)) - if (freopen("","wb",stdout) == NULL) - return (-1); -#else - setbinmode(stdout); -#endif - - if (unbuf_f) - setbuf(stdout, (char *) NULL); - else - setvbuffer(stdout, (char *) stdobuf, IOBUF_SIZE); - - if (argc == 0) { - if (binmode_f == TRUE) -#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__)) - if (freopen("","rb",stdin) == NULL) return (-1); -#else - setbinmode(stdin); -#endif - setvbuffer(stdin, (char *) stdibuf, IOBUF_SIZE); - if (nop_f) - noconvert(stdin); - else { - kanji_convert(stdin); - if (guess_f) print_guessed_code(NULL); - } - } else { - int nfiles = argc; - int is_argument_error = FALSE; - while (argc--) { - input_codename = NULL; - input_eol = 0; -#ifdef CHECK_OPTION - iconv_for_check = 0; -#endif - if ((fin = fopen((origfname = *argv++), "r")) == NULL) { - perror(*(argv-1)); - is_argument_error = TRUE; - continue; - } else { -#ifdef OVERWRITE - int fd = 0; - int fd_backup = 0; -#endif - - /* reopen file for stdout */ - if (file_out_f == TRUE) { -#ifdef OVERWRITE - if (overwrite_f){ - outfname = nkf_xmalloc(strlen(origfname) - + strlen(".nkftmpXXXXXX") - + 1); - strcpy(outfname, origfname); -#ifdef MSDOS - { - int i; - for (i = strlen(outfname); i; --i){ - if (outfname[i - 1] == '/' - || outfname[i - 1] == '\\'){ - break; - } - } - outfname[i] = '\0'; - } - strcat(outfname, "ntXXXXXX"); - mktemp(outfname); - fd = open(outfname, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, - S_IREAD | S_IWRITE); -#else - strcat(outfname, ".nkftmpXXXXXX"); - fd = mkstemp(outfname); -#endif - if (fd < 0 - || (fd_backup = dup(fileno(stdout))) < 0 - || dup2(fd, fileno(stdout)) < 0 - ){ - perror(origfname); - return -1; - } - }else -#endif - if(argc == 1) { - outfname = *argv++; - argc--; - } else { - outfname = "nkf.out"; - } - - if(freopen(outfname, "w", stdout) == NULL) { - perror (outfname); - return (-1); - } - if (binmode_f == TRUE) { -#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__)) - if (freopen("","wb",stdout) == NULL) - return (-1); -#else - setbinmode(stdout); -#endif - } - } - if (binmode_f == TRUE) -#if defined(__OS2__) && (defined(__IBMC__) || defined(__IBMCPP__)) - if (freopen("","rb",fin) == NULL) - return (-1); -#else - setbinmode(fin); -#endif - setvbuffer(fin, (char *) stdibuf, IOBUF_SIZE); - if (nop_f) - noconvert(fin); - else { - char *filename = NULL; - kanji_convert(fin); - if (nfiles > 1) filename = origfname; - if (guess_f) print_guessed_code(filename); - } - fclose(fin); -#ifdef OVERWRITE - if (overwrite_f) { - struct stat sb; -#if defined(MSDOS) && !defined(__MINGW32__) && !defined(__WIN32__) && !defined(__WATCOMC__) && !defined(__EMX__) && !defined(__OS2__) && !defined(__DJGPP__) - time_t tb[2]; -#else - struct utimbuf tb; -#endif - - fflush(stdout); - close(fd); - if (dup2(fd_backup, fileno(stdout)) < 0){ - perror("dup2"); - } - if (stat(origfname, &sb)) { - fprintf(stderr, "Can't stat %s\n", origfname); - } - /* $B%Q!<%_%C%7%g%s$rI|85(B */ - if (chmod(outfname, sb.st_mode)) { - fprintf(stderr, "Can't set permission %s\n", outfname); - } - - /* $B%?%$%`%9%?%s%W$rI|85(B */ - if(preserve_time_f){ -#if defined(MSDOS) && !defined(__MINGW32__) && !defined(__WIN32__) && !defined(__WATCOMC__) && !defined(__EMX__) && !defined(__OS2__) && !defined(__DJGPP__) - tb[0] = tb[1] = sb.st_mtime; - if (utime(outfname, tb)) { - fprintf(stderr, "Can't set timestamp %s\n", outfname); - } -#else - tb.actime = sb.st_atime; - tb.modtime = sb.st_mtime; - if (utime(outfname, &tb)) { - fprintf(stderr, "Can't set timestamp %s\n", outfname); - } -#endif - } - if(backup_f){ - char *backup_filename = get_backup_filename(backup_suffix, origfname); -#ifdef MSDOS - unlink(backup_filename); -#endif - if (rename(origfname, backup_filename)) { - perror(backup_filename); - fprintf(stderr, "Can't rename %s to %s\n", - origfname, backup_filename); - } - nkf_xfree(backup_filename); - }else{ -#ifdef MSDOS - if (unlink(origfname)){ - perror(origfname); - } -#endif - } - if (rename(outfname, origfname)) { - perror(origfname); - fprintf(stderr, "Can't rename %s to %s\n", - outfname, origfname); - } - nkf_xfree(outfname); - } -#endif - } - } - if (is_argument_error) - return(-1); - } -#ifdef EASYWIN /*Easy Win */ - if (file_out_f == FALSE) - scanf("%d",&end_check); - else - fclose(stdout); -#else /* for Other OS */ - if (file_out_f == TRUE) - fclose(stdout); -#endif /*Easy Win */ - return (0); -} -#endif /* WIN32DLL */ diff --git a/ext/nkf/nkf-utf8/nkf.h b/ext/nkf/nkf-utf8/nkf.h deleted file mode 100644 index b3a520da54..0000000000 --- a/ext/nkf/nkf-utf8/nkf.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * - * nkf.h - Header file for nkf - * - */ - -#ifndef NKF_H -#define NKF_H - -/* Wrapper of configurations */ - -#ifndef MIME_DECODE_DEFAULT -#define MIME_DECODE_DEFAULT STRICT_MIME -#endif -#ifndef X0201_DEFAULT -#define X0201_DEFAULT TRUE -#endif - -#if defined(DEFAULT_NEWLINE) && DEFAULT_NEWLINE == 0x0D0A -#elif defined(DEFAULT_NEWLINE) && DEFAULT_NEWLINE == 0x0D -#else -#define DEFAULT_NEWLINE 0x0A -#endif -#ifdef HELP_OUTPUT_STDERR -#define HELP_OUTPUT stderr -#else -#define HELP_OUTPUT stdout -#endif - - -/* Compatibility definitions */ - -#ifdef nkf_char -#elif defined(INT_IS_SHORT) -typedef long nkf_char; -#define NKF_INT32_C(n) (n##L) -#else -typedef int nkf_char; -#define NKF_INT32_C(n) (n) -#endif - -#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || (defined(__WATCOMC__) && defined(__386__) && !defined(__LINUX__)) || defined(__MINGW32__) || defined(__EMX__) || defined(__MSDOS__) || defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)) && !defined(MSDOS) -#define MSDOS -#if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__) -#define __WIN32__ -#endif -#endif - -#ifdef PERL_XS -#undef OVERWRITE -#endif - -#ifndef PERL_XS -#include <stdio.h> -#endif - -#include <stdlib.h> -#include <string.h> - -#if defined(MSDOS) || defined(__OS2__) -#include <fcntl.h> -#include <io.h> -#if defined(_MSC_VER) || defined(__WATCOMC__) -#define mktemp _mktemp -#endif -#endif - -#ifdef MSDOS -#ifdef LSI_C -#define setbinmode(fp) fsetbin(fp) -#elif defined(__DJGPP__) -#include <libc/dosio.h> -void setbinmode(FILE *fp) -{ - /* we do not use libc's setmode(), which changes COOKED/RAW mode in device. */ - int fd, m; - fd = fileno(fp); - m = (__file_handle_modes[fd] & (~O_TEXT)) | O_BINARY; - __file_handle_set(fd, m); -} -#else /* Microsoft C, Turbo C */ -#define setbinmode(fp) setmode(fileno(fp), O_BINARY) -#endif -#else /* UNIX */ -#define setbinmode(fp) (void)(fp) -#endif - -#ifdef _IOFBF /* SysV and MSDOS, Windows */ -#define setvbuffer(fp, buf, size) setvbuf(fp, buf, _IOFBF, size) -#else /* BSD */ -#define setvbuffer(fp, buf, size) setbuffer(fp, buf, size) -#endif - -/*Borland C++ 4.5 EasyWin*/ -#if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__) /*Easy Win */ -#define EASYWIN -#ifndef __WIN16__ -#define __WIN16__ -#endif -#include <windows.h> -#endif - -#ifdef OVERWRITE -/* added by satoru@isoternet.org */ -#if defined(__EMX__) -#include <sys/types.h> -#endif -#include <sys/stat.h> -#if !defined(MSDOS) || defined(__DJGPP__) /* UNIX, djgpp */ -#include <unistd.h> -#if defined(__WATCOMC__) -#include <sys/utime.h> -#else -#include <utime.h> -#endif -#else /* defined(MSDOS) */ -#ifdef __WIN32__ -#ifdef __BORLANDC__ /* BCC32 */ -#include <utime.h> -#else /* !defined(__BORLANDC__) */ -#include <sys/utime.h> -#endif /* (__BORLANDC__) */ -#else /* !defined(__WIN32__) */ -#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__OS2__) || defined(__EMX__) || defined(__IBMC__) || defined(__IBMCPP__) /* VC++, MinGW, Watcom, emx+gcc, IBM VAC++ */ -#include <sys/utime.h> -#elif defined(__TURBOC__) /* BCC */ -#include <utime.h> -#elif defined(LSI_C) /* LSI C */ -#endif /* (__WIN32__) */ -#endif -#endif -#endif - -#if !defined(DEFAULT_CODE_JIS) && !defined(DEFAULT_CODE_SJIS) && \ - !defined(DEFAULT_CODE_WINDOWS_31J) && !defined(DEFAULT_CODE_EUC) && \ - !defined(DEFAULT_CODE_UTF8) && !defined(DEFAULT_CODE_LOCALE) -#define DEFAULT_CODE_LOCALE -#endif - -#ifdef DEFAULT_CODE_LOCALE - -#if defined(__WIN32__) /* not win32 should be posix */ -# ifndef HAVE_LOCALE_H -# define HAVE_LOCALE_H -# endif -#elif defined(__OS2__) -# undef HAVE_LANGINFO_H /* We do not use kLIBC's langinfo. */ -# ifndef HAVE_LOCALE_H -# define HAVE_LOCALE_H -# endif -#elif defined(MSDOS) -# 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 -# endif -# ifndef HAVE_LOCALE_H -# define HAVE_LOCALE_H -# endif -#endif - -#ifdef HAVE_LANGINFO_H -#include <langinfo.h> -#endif -#ifdef HAVE_LOCALE_H -#include <locale.h> -#endif - -#endif /* DEFAULT_CODE_LOCALE */ - -#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 - -#endif /* NKF_H */ diff --git a/ext/nkf/nkf-utf8/utf8tbl.c b/ext/nkf/nkf-utf8/utf8tbl.c deleted file mode 100644 index a31e4e7805..0000000000 --- a/ext/nkf/nkf-utf8/utf8tbl.c +++ /dev/null @@ -1,14638 +0,0 @@ -/* - * utf8tbl.c - Conversion Table for nkf - * - */ - -#include "config.h" -#include "utf8tbl.h" - -#ifdef UTF8_OUTPUT_ENABLE -static const unsigned short euc_to_utf8_A1[] = { - 0x3000, 0x3001, 0x3002, 0xFF0C, 0xFF0E, 0x30FB, 0xFF1A, - 0xFF1B, 0xFF1F, 0xFF01, 0x309B, 0x309C, 0x00B4, 0xFF40, 0x00A8, - 0xFF3E, 0x203E, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003, - 0x4EDD, 0x3005, 0x3006, 0x3007, 0x30FC, 0x2014, 0x2010, 0xFF0F, - 0xFF3C, 0x301C, 0x2016, 0xFF5C, 0x2026, 0x2025, 0x2018, 0x2019, - 0x201C, 0x201D, 0xFF08, 0xFF09, 0x3014, 0x3015, 0xFF3B, 0xFF3D, - 0xFF5B, 0xFF5D, 0x3008, 0x3009, 0x300A, 0x300B, 0x300C, 0x300D, - 0x300E, 0x300F, 0x3010, 0x3011, 0xFF0B, 0x2212, 0x00B1, 0x00D7, - 0x00F7, 0xFF1D, 0x2260, 0xFF1C, 0xFF1E, 0x2266, 0x2267, 0x221E, - 0x2234, 0x2642, 0x2640, 0x00B0, 0x2032, 0x2033, 0x2103, 0x00A5, - 0xFF04, 0x00A2, 0x00A3, 0xFF05, 0xFF03, 0xFF06, 0xFF0A, 0xFF20, - 0x00A7, 0x2606, 0x2605, 0x25CB, 0x25CF, 0x25CE, 0x25C7, -}; - -/* Microsoft UCS Mapping Compatible */ -static const unsigned short euc_to_utf8_A1_ms[] = { - 0x3000, 0x3001, 0x3002, 0xFF0C, 0xFF0E, 0x30FB, 0xFF1A, - 0xFF1B, 0xFF1F, 0xFF01, 0x309B, 0x309C, 0x00B4, 0xFF40, 0x00A8, - 0xFF3E, 0xFFE3, 0xFF3F, 0x30FD, 0x30FE, 0x309D, 0x309E, 0x3003, - 0x4EDD, 0x3005, 0x3006, 0x3007, 0x30FC, 0x2015, 0x2010, 0xFF0F, - 0xFF3C, 0xFF5E, 0x2225, 0xFF5C, 0x2026, 0x2025, 0x2018, 0x2019, - 0x201C, 0x201D, 0xFF08, 0xFF09, 0x3014, 0x3015, 0xFF3B, 0xFF3D, - 0xFF5B, 0xFF5D, 0x3008, 0x3009, 0x300A, 0x300B, 0x300C, 0x300D, - 0x300E, 0x300F, 0x3010, 0x3011, 0xFF0B, 0xFF0D, 0x00B1, 0x00D7, - 0x00F7, 0xFF1D, 0x2260, 0xFF1C, 0xFF1E, 0x2266, 0x2267, 0x221E, - 0x2234, 0x2642, 0x2640, 0x00B0, 0x2032, 0x2033, 0x2103, 0xFFE5, - 0xFF04, 0xFFE0, 0xFFE1, 0xFF05, 0xFF03, 0xFF06, 0xFF0A, 0xFF20, - 0x00A7, 0x2606, 0x2605, 0x25CB, 0x25CF, 0x25CE, 0x25C7, -}; -static const unsigned short euc_to_utf8_A2[] = { - 0x25C6, 0x25A1, 0x25A0, 0x25B3, 0x25B2, 0x25BD, 0x25BC, - 0x203B, 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2208, 0x220B, 0x2286, 0x2287, 0x2282, 0x2283, - 0x222A, 0x2229, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2227, 0x2228, 0x00AC, 0x21D2, 0x21D4, 0x2200, - 0x2203, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x2220, 0x22A5, 0x2312, 0x2202, - 0x2207, 0x2261, 0x2252, 0x226A, 0x226B, 0x221A, 0x223D, 0x221D, - 0x2235, 0x222B, 0x222C, 0, 0, 0, 0, 0, - 0, 0, 0x212B, 0x2030, 0x266F, 0x266D, 0x266A, 0x2020, - 0x2021, 0x00B6, 0, 0, 0, 0, 0x25EF, -}; - -/* Microsoft UCS Mapping Compatible */ -static const unsigned short euc_to_utf8_A2_ms[] = { - 0x25C6, 0x25A1, 0x25A0, 0x25B3, 0x25B2, 0x25BD, 0x25BC, - 0x203B, 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2208, 0x220B, 0x2286, 0x2287, 0x2282, 0x2283, - 0x222A, 0x2229, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2227, 0x2228, 0xFFE2, 0x21D2, 0x21D4, 0x2200, - 0x2203, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x2220, 0x22A5, 0x2312, 0x2202, - 0x2207, 0x2261, 0x2252, 0x226A, 0x226B, 0x221A, 0x223D, 0x221D, - 0x2235, 0x222B, 0x222C, 0, 0, 0, 0, 0, - 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, - 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, - 0xFF18, 0xFF19, 0, 0, 0, 0, 0, 0, - 0, 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, 0, 0, 0, 0, 0, - 0, 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, 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, - 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, 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, - 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, 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, - 0x03A0, 0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, - 0x03A9, 0, 0, 0, 0, 0, 0, 0, - 0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, - 0x03C9, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 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, - 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, - 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, - 0x042E, 0x042F, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 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, 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, - 0x251B, 0x2517, 0x2523, 0x2533, 0x252B, 0x253B, 0x254B, 0x2520, - 0x252F, 0x2528, 0x2537, 0x253F, 0x251D, 0x2530, 0x2525, 0x2538, - 0x2542, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 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, - 0x246F, 0x2470, 0x2471, 0x2472, 0x2473, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0x2474, - 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247A, 0x247B, 0x247C, - 0x247D, 0x247E, 0x247F, 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, - 0x2485, 0x2486, 0x2487, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x2776, 0x2777, 0x2778, - 0x2779, 0x277A, 0x277B, 0x277C, 0x277D, 0x277E, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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, - 0, 0, 0, 0, 0, 0x2170, 0x2171, 0x2172, - 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x217A, - 0x217B, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x249C, 0x249D, 0x249E, - 0x249F, 0x24A0, 0x24A1, 0x24A2, 0x24A3, 0x24A4, 0x24A5, 0x24A6, - 0x24A7, 0x24A8, 0x24A9, 0x24AA, 0x24AB, 0x24AC, 0x24AD, 0x24AE, - 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, - 0x3397, 0x2113, 0x3398, 0x33B3, 0x33B2, 0x33B1, 0x33B0, 0x2109, - 0x33D4, 0x33CB, 0x3390, 0x3385, 0x3386, 0x3387, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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, - 0, 0, 0, 0, 0, 0x3020, 0x260E, 0x3004, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x261E, 0x261C, 0x261D, 0x261F, 0x21C6, 0x21C4, 0x21C5, - 0, 0x21E8, 0x21E6, 0x21E7, 0x21E9, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 euc_to_utf8_AC_mac[] = { - 0x2664, 0x2667, 0x2661, 0x2662, 0x2660, 0x2663, 0x2665, - 0x2666, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x3020, 0x260E, 0x3004, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x261E, 0x261C, 0x261D, 0x261F, 0x21C6, 0x21C4, 0x21C5, - 0, 0x21E8, 0x21E6, 0x21E7, 0x21E9, 0x2192, 0x2190, 0x2191, - 0x2193, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 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, - 0x246F, 0x2470, 0x2471, 0x2472, 0x2473, 0x2160, 0x2161, 0x2162, - 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0, - 0x3349, 0x3314, 0x3322, 0x334D, 0x3318, 0x3327, 0x3303, 0x3336, - 0x3351, 0x3357, 0x330D, 0x3326, 0x3323, 0x332B, 0x334A, 0x333B, - 0x339C, 0x339D, 0x339E, 0x338E, 0x338F, 0x33C4, 0x33A1, 0, - 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, 0, 0x3299, -}; -static const unsigned short euc_to_utf8_AD_mac[] = { - 0x65E5, 0x6708, 0x706B, 0x6C34, 0x6728, 0x91D1, 0x571F, - 0x796D, 0x795D, 0x81EA, 0x81F3, 0x3239, 0x547C, 0x3231, 0x8CC7, - 0x540D, 0x3232, 0x5B66, 0x8CA1, 0x793E, 0x7279, 0x76E3, 0x4F01, - 0x5354, 0x52B4, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0, - 0x3349, 0x3314, 0x3322, 0x334D, 0x3318, 0x3327, 0x3303, 0x3336, - 0x3351, 0x3357, 0x330D, 0x3326, 0x3323, 0x332B, 0x334A, 0x333B, - 0x339C, 0x339D, 0x339E, 0x338E, 0x338F, 0x33C4, 0x33A1, 0, - 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, 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, - 0x3339, 0x3357, 0x330D, 0x3342, 0x3323, 0x3326, 0x333B, 0x332B, - 0, 0, 0, 0, 0, 0, 0, 0x3300, - 0x331E, 0x332A, 0x3331, 0x3347, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0x337E, - 0x337D, 0x337C, 0x337B, 0, 0, 0, 0, 0, - 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, - 0, 0, 0, 0, 0, 0x301D, 0x301F, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x3094, 0, 0x30F7, 0x30F8, 0x30F9, 0x30FA, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 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, - 0x65ED, 0x8466, 0x82A6, 0x9BF5, 0x6893, 0x5727, 0x65A1, 0x6271, - 0x5B9B, 0x59D0, 0x867B, 0x98F4, 0x7D62, 0x7DBE, 0x9B8E, 0x6216, - 0x7C9F, 0x88B7, 0x5B89, 0x5EB5, 0x6309, 0x6697, 0x6848, 0x95C7, - 0x978D, 0x674F, 0x4EE5, 0x4F0A, 0x4F4D, 0x4F9D, 0x5049, 0x56F2, - 0x5937, 0x59D4, 0x5A01, 0x5C09, 0x60DF, 0x610F, 0x6170, 0x6613, - 0x6905, 0x70BA, 0x754F, 0x7570, 0x79FB, 0x7DAD, 0x7DEF, 0x80C3, - 0x840E, 0x8863, 0x8B02, 0x9055, 0x907A, 0x533B, 0x4E95, 0x4EA5, - 0x57DF, 0x80B2, 0x90C1, 0x78EF, 0x4E00, 0x58F1, 0x6EA2, 0x9038, - 0x7A32, 0x8328, 0x828B, 0x9C2F, 0x5141, 0x5370, 0x54BD, 0x54E1, - 0x56E0, 0x59FB, 0x5F15, 0x98F2, 0x6DEB, 0x80E4, 0x852D, -}; -static const unsigned short euc_to_utf8_B1[] = { - 0x9662, 0x9670, 0x96A0, 0x97FB, 0x540B, 0x53F3, 0x5B87, - 0x70CF, 0x7FBD, 0x8FC2, 0x96E8, 0x536F, 0x9D5C, 0x7ABA, 0x4E11, - 0x7893, 0x81FC, 0x6E26, 0x5618, 0x5504, 0x6B1D, 0x851A, 0x9C3B, - 0x59E5, 0x53A9, 0x6D66, 0x74DC, 0x958F, 0x5642, 0x4E91, 0x904B, - 0x96F2, 0x834F, 0x990C, 0x53E1, 0x55B6, 0x5B30, 0x5F71, 0x6620, - 0x66F3, 0x6804, 0x6C38, 0x6CF3, 0x6D29, 0x745B, 0x76C8, 0x7A4E, - 0x9834, 0x82F1, 0x885B, 0x8A60, 0x92ED, 0x6DB2, 0x75AB, 0x76CA, - 0x99C5, 0x60A6, 0x8B01, 0x8D8A, 0x95B2, 0x698E, 0x53AD, 0x5186, - 0x5712, 0x5830, 0x5944, 0x5BB4, 0x5EF6, 0x6028, 0x63A9, 0x63F4, - 0x6CBF, 0x6F14, 0x708E, 0x7114, 0x7159, 0x71D5, 0x733F, 0x7E01, - 0x8276, 0x82D1, 0x8597, 0x9060, 0x925B, 0x9D1B, 0x5869, 0x65BC, - 0x6C5A, 0x7525, 0x51F9, 0x592E, 0x5965, 0x5F80, 0x5FDC, -}; -static const unsigned short euc_to_utf8_B2[] = { - 0x62BC, 0x65FA, 0x6A2A, 0x6B27, 0x6BB4, 0x738B, 0x7FC1, - 0x8956, 0x9D2C, 0x9D0E, 0x9EC4, 0x5CA1, 0x6C96, 0x837B, 0x5104, - 0x5C4B, 0x61B6, 0x81C6, 0x6876, 0x7261, 0x4E59, 0x4FFA, 0x5378, - 0x6069, 0x6E29, 0x7A4F, 0x97F3, 0x4E0B, 0x5316, 0x4EEE, 0x4F55, - 0x4F3D, 0x4FA1, 0x4F73, 0x52A0, 0x53EF, 0x5609, 0x590F, 0x5AC1, - 0x5BB6, 0x5BE1, 0x79D1, 0x6687, 0x679C, 0x67B6, 0x6B4C, 0x6CB3, - 0x706B, 0x73C2, 0x798D, 0x79BE, 0x7A3C, 0x7B87, 0x82B1, 0x82DB, - 0x8304, 0x8377, 0x83EF, 0x83D3, 0x8766, 0x8AB2, 0x5629, 0x8CA8, - 0x8FE6, 0x904E, 0x971E, 0x868A, 0x4FC4, 0x5CE8, 0x6211, 0x7259, - 0x753B, 0x81E5, 0x82BD, 0x86FE, 0x8CC0, 0x96C5, 0x9913, 0x99D5, - 0x4ECB, 0x4F1A, 0x89E3, 0x56DE, 0x584A, 0x58CA, 0x5EFB, 0x5FEB, - 0x602A, 0x6094, 0x6062, 0x61D0, 0x6212, 0x62D0, 0x6539, -}; -static const unsigned short euc_to_utf8_B3[] = { - 0x9B41, 0x6666, 0x68B0, 0x6D77, 0x7070, 0x754C, 0x7686, - 0x7D75, 0x82A5, 0x87F9, 0x958B, 0x968E, 0x8C9D, 0x51F1, 0x52BE, - 0x5916, 0x54B3, 0x5BB3, 0x5D16, 0x6168, 0x6982, 0x6DAF, 0x788D, - 0x84CB, 0x8857, 0x8A72, 0x93A7, 0x9AB8, 0x6D6C, 0x99A8, 0x86D9, - 0x57A3, 0x67FF, 0x86CE, 0x920E, 0x5283, 0x5687, 0x5404, 0x5ED3, - 0x62E1, 0x64B9, 0x683C, 0x6838, 0x6BBB, 0x7372, 0x78BA, 0x7A6B, - 0x899A, 0x89D2, 0x8D6B, 0x8F03, 0x90ED, 0x95A3, 0x9694, 0x9769, - 0x5B66, 0x5CB3, 0x697D, 0x984D, 0x984E, 0x639B, 0x7B20, 0x6A2B, - 0x6A7F, 0x68B6, 0x9C0D, 0x6F5F, 0x5272, 0x559D, 0x6070, 0x62EC, - 0x6D3B, 0x6E07, 0x6ED1, 0x845B, 0x8910, 0x8F44, 0x4E14, 0x9C39, - 0x53F6, 0x691B, 0x6A3A, 0x9784, 0x682A, 0x515C, 0x7AC3, 0x84B2, - 0x91DC, 0x938C, 0x565B, 0x9D28, 0x6822, 0x8305, 0x8431, -}; -static const unsigned short euc_to_utf8_B4[] = { - 0x7CA5, 0x5208, 0x82C5, 0x74E6, 0x4E7E, 0x4F83, 0x51A0, - 0x5BD2, 0x520A, 0x52D8, 0x52E7, 0x5DFB, 0x559A, 0x582A, 0x59E6, - 0x5B8C, 0x5B98, 0x5BDB, 0x5E72, 0x5E79, 0x60A3, 0x611F, 0x6163, - 0x61BE, 0x63DB, 0x6562, 0x67D1, 0x6853, 0x68FA, 0x6B3E, 0x6B53, - 0x6C57, 0x6F22, 0x6F97, 0x6F45, 0x74B0, 0x7518, 0x76E3, 0x770B, - 0x7AFF, 0x7BA1, 0x7C21, 0x7DE9, 0x7F36, 0x7FF0, 0x809D, 0x8266, - 0x839E, 0x89B3, 0x8ACC, 0x8CAB, 0x9084, 0x9451, 0x9593, 0x9591, - 0x95A2, 0x9665, 0x97D3, 0x9928, 0x8218, 0x4E38, 0x542B, 0x5CB8, - 0x5DCC, 0x73A9, 0x764C, 0x773C, 0x5CA9, 0x7FEB, 0x8D0B, 0x96C1, - 0x9811, 0x9854, 0x9858, 0x4F01, 0x4F0E, 0x5371, 0x559C, 0x5668, - 0x57FA, 0x5947, 0x5B09, 0x5BC4, 0x5C90, 0x5E0C, 0x5E7E, 0x5FCC, - 0x63EE, 0x673A, 0x65D7, 0x65E2, 0x671F, 0x68CB, 0x68C4, -}; -static const unsigned short euc_to_utf8_B5[] = { - 0x6A5F, 0x5E30, 0x6BC5, 0x6C17, 0x6C7D, 0x757F, 0x7948, - 0x5B63, 0x7A00, 0x7D00, 0x5FBD, 0x898F, 0x8A18, 0x8CB4, 0x8D77, - 0x8ECC, 0x8F1D, 0x98E2, 0x9A0E, 0x9B3C, 0x4E80, 0x507D, 0x5100, - 0x5993, 0x5B9C, 0x622F, 0x6280, 0x64EC, 0x6B3A, 0x72A0, 0x7591, - 0x7947, 0x7FA9, 0x87FB, 0x8ABC, 0x8B70, 0x63AC, 0x83CA, 0x97A0, - 0x5409, 0x5403, 0x55AB, 0x6854, 0x6A58, 0x8A70, 0x7827, 0x6775, - 0x9ECD, 0x5374, 0x5BA2, 0x811A, 0x8650, 0x9006, 0x4E18, 0x4E45, - 0x4EC7, 0x4F11, 0x53CA, 0x5438, 0x5BAE, 0x5F13, 0x6025, 0x6551, - 0x673D, 0x6C42, 0x6C72, 0x6CE3, 0x7078, 0x7403, 0x7A76, 0x7AAE, - 0x7B08, 0x7D1A, 0x7CFE, 0x7D66, 0x65E7, 0x725B, 0x53BB, 0x5C45, - 0x5DE8, 0x62D2, 0x62E0, 0x6319, 0x6E20, 0x865A, 0x8A31, 0x8DDD, - 0x92F8, 0x6F01, 0x79A6, 0x9B5A, 0x4EA8, 0x4EAB, 0x4EAC, -}; -static const unsigned short euc_to_utf8_B6[] = { - 0x4F9B, 0x4FA0, 0x50D1, 0x5147, 0x7AF6, 0x5171, 0x51F6, - 0x5354, 0x5321, 0x537F, 0x53EB, 0x55AC, 0x5883, 0x5CE1, 0x5F37, - 0x5F4A, 0x602F, 0x6050, 0x606D, 0x631F, 0x6559, 0x6A4B, 0x6CC1, - 0x72C2, 0x72ED, 0x77EF, 0x80F8, 0x8105, 0x8208, 0x854E, 0x90F7, - 0x93E1, 0x97FF, 0x9957, 0x9A5A, 0x4EF0, 0x51DD, 0x5C2D, 0x6681, - 0x696D, 0x5C40, 0x66F2, 0x6975, 0x7389, 0x6850, 0x7C81, 0x50C5, - 0x52E4, 0x5747, 0x5DFE, 0x9326, 0x65A4, 0x6B23, 0x6B3D, 0x7434, - 0x7981, 0x79BD, 0x7B4B, 0x7DCA, 0x82B9, 0x83CC, 0x887F, 0x895F, - 0x8B39, 0x8FD1, 0x91D1, 0x541F, 0x9280, 0x4E5D, 0x5036, 0x53E5, - 0x533A, 0x72D7, 0x7396, 0x77E9, 0x82E6, 0x8EAF, 0x99C6, 0x99C8, - 0x99D2, 0x5177, 0x611A, 0x865E, 0x55B0, 0x7A7A, 0x5076, 0x5BD3, - 0x9047, 0x9685, 0x4E32, 0x6ADB, 0x91E7, 0x5C51, 0x5C48, -}; -static const unsigned short euc_to_utf8_B7[] = { - 0x6398, 0x7A9F, 0x6C93, 0x9774, 0x8F61, 0x7AAA, 0x718A, - 0x9688, 0x7C82, 0x6817, 0x7E70, 0x6851, 0x936C, 0x52F2, 0x541B, - 0x85AB, 0x8A13, 0x7FA4, 0x8ECD, 0x90E1, 0x5366, 0x8888, 0x7941, - 0x4FC2, 0x50BE, 0x5211, 0x5144, 0x5553, 0x572D, 0x73EA, 0x578B, - 0x5951, 0x5F62, 0x5F84, 0x6075, 0x6176, 0x6167, 0x61A9, 0x63B2, - 0x643A, 0x656C, 0x666F, 0x6842, 0x6E13, 0x7566, 0x7A3D, 0x7CFB, - 0x7D4C, 0x7D99, 0x7E4B, 0x7F6B, 0x830E, 0x834A, 0x86CD, 0x8A08, - 0x8A63, 0x8B66, 0x8EFD, 0x981A, 0x9D8F, 0x82B8, 0x8FCE, 0x9BE8, - 0x5287, 0x621F, 0x6483, 0x6FC0, 0x9699, 0x6841, 0x5091, 0x6B20, - 0x6C7A, 0x6F54, 0x7A74, 0x7D50, 0x8840, 0x8A23, 0x6708, 0x4EF6, - 0x5039, 0x5026, 0x5065, 0x517C, 0x5238, 0x5263, 0x55A7, 0x570F, - 0x5805, 0x5ACC, 0x5EFA, 0x61B2, 0x61F8, 0x62F3, 0x6372, -}; -static const unsigned short euc_to_utf8_B8[] = { - 0x691C, 0x6A29, 0x727D, 0x72AC, 0x732E, 0x7814, 0x786F, - 0x7D79, 0x770C, 0x80A9, 0x898B, 0x8B19, 0x8CE2, 0x8ED2, 0x9063, - 0x9375, 0x967A, 0x9855, 0x9A13, 0x9E78, 0x5143, 0x539F, 0x53B3, - 0x5E7B, 0x5F26, 0x6E1B, 0x6E90, 0x7384, 0x73FE, 0x7D43, 0x8237, - 0x8A00, 0x8AFA, 0x9650, 0x4E4E, 0x500B, 0x53E4, 0x547C, 0x56FA, - 0x59D1, 0x5B64, 0x5DF1, 0x5EAB, 0x5F27, 0x6238, 0x6545, 0x67AF, - 0x6E56, 0x72D0, 0x7CCA, 0x88B4, 0x80A1, 0x80E1, 0x83F0, 0x864E, - 0x8A87, 0x8DE8, 0x9237, 0x96C7, 0x9867, 0x9F13, 0x4E94, 0x4E92, - 0x4F0D, 0x5348, 0x5449, 0x543E, 0x5A2F, 0x5F8C, 0x5FA1, 0x609F, - 0x68A7, 0x6A8E, 0x745A, 0x7881, 0x8A9E, 0x8AA4, 0x8B77, 0x9190, - 0x4E5E, 0x9BC9, 0x4EA4, 0x4F7C, 0x4FAF, 0x5019, 0x5016, 0x5149, - 0x516C, 0x529F, 0x52B9, 0x52FE, 0x539A, 0x53E3, 0x5411, -}; -static const unsigned short euc_to_utf8_B9[] = { - 0x540E, 0x5589, 0x5751, 0x57A2, 0x597D, 0x5B54, 0x5B5D, - 0x5B8F, 0x5DE5, 0x5DE7, 0x5DF7, 0x5E78, 0x5E83, 0x5E9A, 0x5EB7, - 0x5F18, 0x6052, 0x614C, 0x6297, 0x62D8, 0x63A7, 0x653B, 0x6602, - 0x6643, 0x66F4, 0x676D, 0x6821, 0x6897, 0x69CB, 0x6C5F, 0x6D2A, - 0x6D69, 0x6E2F, 0x6E9D, 0x7532, 0x7687, 0x786C, 0x7A3F, 0x7CE0, - 0x7D05, 0x7D18, 0x7D5E, 0x7DB1, 0x8015, 0x8003, 0x80AF, 0x80B1, - 0x8154, 0x818F, 0x822A, 0x8352, 0x884C, 0x8861, 0x8B1B, 0x8CA2, - 0x8CFC, 0x90CA, 0x9175, 0x9271, 0x783F, 0x92FC, 0x95A4, 0x964D, - 0x9805, 0x9999, 0x9AD8, 0x9D3B, 0x525B, 0x52AB, 0x53F7, 0x5408, - 0x58D5, 0x62F7, 0x6FE0, 0x8C6A, 0x8F5F, 0x9EB9, 0x514B, 0x523B, - 0x544A, 0x56FD, 0x7A40, 0x9177, 0x9D60, 0x9ED2, 0x7344, 0x6F09, - 0x8170, 0x7511, 0x5FFD, 0x60DA, 0x9AA8, 0x72DB, 0x8FBC, -}; -static const unsigned short euc_to_utf8_BA[] = { - 0x6B64, 0x9803, 0x4ECA, 0x56F0, 0x5764, 0x58BE, 0x5A5A, - 0x6068, 0x61C7, 0x660F, 0x6606, 0x6839, 0x68B1, 0x6DF7, 0x75D5, - 0x7D3A, 0x826E, 0x9B42, 0x4E9B, 0x4F50, 0x53C9, 0x5506, 0x5D6F, - 0x5DE6, 0x5DEE, 0x67FB, 0x6C99, 0x7473, 0x7802, 0x8A50, 0x9396, - 0x88DF, 0x5750, 0x5EA7, 0x632B, 0x50B5, 0x50AC, 0x518D, 0x6700, - 0x54C9, 0x585E, 0x59BB, 0x5BB0, 0x5F69, 0x624D, 0x63A1, 0x683D, - 0x6B73, 0x6E08, 0x707D, 0x91C7, 0x7280, 0x7815, 0x7826, 0x796D, - 0x658E, 0x7D30, 0x83DC, 0x88C1, 0x8F09, 0x969B, 0x5264, 0x5728, - 0x6750, 0x7F6A, 0x8CA1, 0x51B4, 0x5742, 0x962A, 0x583A, 0x698A, - 0x80B4, 0x54B2, 0x5D0E, 0x57FC, 0x7895, 0x9DFA, 0x4F5C, 0x524A, - 0x548B, 0x643E, 0x6628, 0x6714, 0x67F5, 0x7A84, 0x7B56, 0x7D22, - 0x932F, 0x685C, 0x9BAD, 0x7B39, 0x5319, 0x518A, 0x5237, -}; -static const unsigned short euc_to_utf8_BB[] = { - 0x5BDF, 0x62F6, 0x64AE, 0x64E6, 0x672D, 0x6BBA, 0x85A9, - 0x96D1, 0x7690, 0x9BD6, 0x634C, 0x9306, 0x9BAB, 0x76BF, 0x6652, - 0x4E09, 0x5098, 0x53C2, 0x5C71, 0x60E8, 0x6492, 0x6563, 0x685F, - 0x71E6, 0x73CA, 0x7523, 0x7B97, 0x7E82, 0x8695, 0x8B83, 0x8CDB, - 0x9178, 0x9910, 0x65AC, 0x66AB, 0x6B8B, 0x4ED5, 0x4ED4, 0x4F3A, - 0x4F7F, 0x523A, 0x53F8, 0x53F2, 0x55E3, 0x56DB, 0x58EB, 0x59CB, - 0x59C9, 0x59FF, 0x5B50, 0x5C4D, 0x5E02, 0x5E2B, 0x5FD7, 0x601D, - 0x6307, 0x652F, 0x5B5C, 0x65AF, 0x65BD, 0x65E8, 0x679D, 0x6B62, - 0x6B7B, 0x6C0F, 0x7345, 0x7949, 0x79C1, 0x7CF8, 0x7D19, 0x7D2B, - 0x80A2, 0x8102, 0x81F3, 0x8996, 0x8A5E, 0x8A69, 0x8A66, 0x8A8C, - 0x8AEE, 0x8CC7, 0x8CDC, 0x96CC, 0x98FC, 0x6B6F, 0x4E8B, 0x4F3C, - 0x4F8D, 0x5150, 0x5B57, 0x5BFA, 0x6148, 0x6301, 0x6642, -}; -static const unsigned short euc_to_utf8_BC[] = { - 0x6B21, 0x6ECB, 0x6CBB, 0x723E, 0x74BD, 0x75D4, 0x78C1, - 0x793A, 0x800C, 0x8033, 0x81EA, 0x8494, 0x8F9E, 0x6C50, 0x9E7F, - 0x5F0F, 0x8B58, 0x9D2B, 0x7AFA, 0x8EF8, 0x5B8D, 0x96EB, 0x4E03, - 0x53F1, 0x57F7, 0x5931, 0x5AC9, 0x5BA4, 0x6089, 0x6E7F, 0x6F06, - 0x75BE, 0x8CEA, 0x5B9F, 0x8500, 0x7BE0, 0x5072, 0x67F4, 0x829D, - 0x5C61, 0x854A, 0x7E1E, 0x820E, 0x5199, 0x5C04, 0x6368, 0x8D66, - 0x659C, 0x716E, 0x793E, 0x7D17, 0x8005, 0x8B1D, 0x8ECA, 0x906E, - 0x86C7, 0x90AA, 0x501F, 0x52FA, 0x5C3A, 0x6753, 0x707C, 0x7235, - 0x914C, 0x91C8, 0x932B, 0x82E5, 0x5BC2, 0x5F31, 0x60F9, 0x4E3B, - 0x53D6, 0x5B88, 0x624B, 0x6731, 0x6B8A, 0x72E9, 0x73E0, 0x7A2E, - 0x816B, 0x8DA3, 0x9152, 0x9996, 0x5112, 0x53D7, 0x546A, 0x5BFF, - 0x6388, 0x6A39, 0x7DAC, 0x9700, 0x56DA, 0x53CE, 0x5468, -}; -static const unsigned short euc_to_utf8_BD[] = { - 0x5B97, 0x5C31, 0x5DDE, 0x4FEE, 0x6101, 0x62FE, 0x6D32, - 0x79C0, 0x79CB, 0x7D42, 0x7E4D, 0x7FD2, 0x81ED, 0x821F, 0x8490, - 0x8846, 0x8972, 0x8B90, 0x8E74, 0x8F2F, 0x9031, 0x914B, 0x916C, - 0x96C6, 0x919C, 0x4EC0, 0x4F4F, 0x5145, 0x5341, 0x5F93, 0x620E, - 0x67D4, 0x6C41, 0x6E0B, 0x7363, 0x7E26, 0x91CD, 0x9283, 0x53D4, - 0x5919, 0x5BBF, 0x6DD1, 0x795D, 0x7E2E, 0x7C9B, 0x587E, 0x719F, - 0x51FA, 0x8853, 0x8FF0, 0x4FCA, 0x5CFB, 0x6625, 0x77AC, 0x7AE3, - 0x821C, 0x99FF, 0x51C6, 0x5FAA, 0x65EC, 0x696F, 0x6B89, 0x6DF3, - 0x6E96, 0x6F64, 0x76FE, 0x7D14, 0x5DE1, 0x9075, 0x9187, 0x9806, - 0x51E6, 0x521D, 0x6240, 0x6691, 0x66D9, 0x6E1A, 0x5EB6, 0x7DD2, - 0x7F72, 0x66F8, 0x85AF, 0x85F7, 0x8AF8, 0x52A9, 0x53D9, 0x5973, - 0x5E8F, 0x5F90, 0x6055, 0x92E4, 0x9664, 0x50B7, 0x511F, -}; -static const unsigned short euc_to_utf8_BE[] = { - 0x52DD, 0x5320, 0x5347, 0x53EC, 0x54E8, 0x5546, 0x5531, - 0x5617, 0x5968, 0x59BE, 0x5A3C, 0x5BB5, 0x5C06, 0x5C0F, 0x5C11, - 0x5C1A, 0x5E84, 0x5E8A, 0x5EE0, 0x5F70, 0x627F, 0x6284, 0x62DB, - 0x638C, 0x6377, 0x6607, 0x660C, 0x662D, 0x6676, 0x677E, 0x68A2, - 0x6A1F, 0x6A35, 0x6CBC, 0x6D88, 0x6E09, 0x6E58, 0x713C, 0x7126, - 0x7167, 0x75C7, 0x7701, 0x785D, 0x7901, 0x7965, 0x79F0, 0x7AE0, - 0x7B11, 0x7CA7, 0x7D39, 0x8096, 0x83D6, 0x848B, 0x8549, 0x885D, - 0x88F3, 0x8A1F, 0x8A3C, 0x8A54, 0x8A73, 0x8C61, 0x8CDE, 0x91A4, - 0x9266, 0x937E, 0x9418, 0x969C, 0x9798, 0x4E0A, 0x4E08, 0x4E1E, - 0x4E57, 0x5197, 0x5270, 0x57CE, 0x5834, 0x58CC, 0x5B22, 0x5E38, - 0x60C5, 0x64FE, 0x6761, 0x6756, 0x6D44, 0x72B6, 0x7573, 0x7A63, - 0x84B8, 0x8B72, 0x91B8, 0x9320, 0x5631, 0x57F4, 0x98FE, -}; -static const unsigned short euc_to_utf8_BF[] = { - 0x62ED, 0x690D, 0x6B96, 0x71ED, 0x7E54, 0x8077, 0x8272, - 0x89E6, 0x98DF, 0x8755, 0x8FB1, 0x5C3B, 0x4F38, 0x4FE1, 0x4FB5, - 0x5507, 0x5A20, 0x5BDD, 0x5BE9, 0x5FC3, 0x614E, 0x632F, 0x65B0, - 0x664B, 0x68EE, 0x699B, 0x6D78, 0x6DF1, 0x7533, 0x75B9, 0x771F, - 0x795E, 0x79E6, 0x7D33, 0x81E3, 0x82AF, 0x85AA, 0x89AA, 0x8A3A, - 0x8EAB, 0x8F9B, 0x9032, 0x91DD, 0x9707, 0x4EBA, 0x4EC1, 0x5203, - 0x5875, 0x58EC, 0x5C0B, 0x751A, 0x5C3D, 0x814E, 0x8A0A, 0x8FC5, - 0x9663, 0x976D, 0x7B25, 0x8ACF, 0x9808, 0x9162, 0x56F3, 0x53A8, - 0x9017, 0x5439, 0x5782, 0x5E25, 0x63A8, 0x6C34, 0x708A, 0x7761, - 0x7C8B, 0x7FE0, 0x8870, 0x9042, 0x9154, 0x9310, 0x9318, 0x968F, - 0x745E, 0x9AC4, 0x5D07, 0x5D69, 0x6570, 0x67A2, 0x8DA8, 0x96DB, - 0x636E, 0x6749, 0x6919, 0x83C5, 0x9817, 0x96C0, 0x88FE, -}; -static const unsigned short euc_to_utf8_C0[] = { - 0x6F84, 0x647A, 0x5BF8, 0x4E16, 0x702C, 0x755D, 0x662F, - 0x51C4, 0x5236, 0x52E2, 0x59D3, 0x5F81, 0x6027, 0x6210, 0x653F, - 0x6574, 0x661F, 0x6674, 0x68F2, 0x6816, 0x6B63, 0x6E05, 0x7272, - 0x751F, 0x76DB, 0x7CBE, 0x8056, 0x58F0, 0x88FD, 0x897F, 0x8AA0, - 0x8A93, 0x8ACB, 0x901D, 0x9192, 0x9752, 0x9759, 0x6589, 0x7A0E, - 0x8106, 0x96BB, 0x5E2D, 0x60DC, 0x621A, 0x65A5, 0x6614, 0x6790, - 0x77F3, 0x7A4D, 0x7C4D, 0x7E3E, 0x810A, 0x8CAC, 0x8D64, 0x8DE1, - 0x8E5F, 0x78A9, 0x5207, 0x62D9, 0x63A5, 0x6442, 0x6298, 0x8A2D, - 0x7A83, 0x7BC0, 0x8AAC, 0x96EA, 0x7D76, 0x820C, 0x8749, 0x4ED9, - 0x5148, 0x5343, 0x5360, 0x5BA3, 0x5C02, 0x5C16, 0x5DDD, 0x6226, - 0x6247, 0x64B0, 0x6813, 0x6834, 0x6CC9, 0x6D45, 0x6D17, 0x67D3, - 0x6F5C, 0x714E, 0x717D, 0x65CB, 0x7A7F, 0x7BAD, 0x7DDA, -}; -static const unsigned short euc_to_utf8_C1[] = { - 0x7E4A, 0x7FA8, 0x817A, 0x821B, 0x8239, 0x85A6, 0x8A6E, - 0x8CCE, 0x8DF5, 0x9078, 0x9077, 0x92AD, 0x9291, 0x9583, 0x9BAE, - 0x524D, 0x5584, 0x6F38, 0x7136, 0x5168, 0x7985, 0x7E55, 0x81B3, - 0x7CCE, 0x564C, 0x5851, 0x5CA8, 0x63AA, 0x66FE, 0x66FD, 0x695A, - 0x72D9, 0x758F, 0x758E, 0x790E, 0x7956, 0x79DF, 0x7C97, 0x7D20, - 0x7D44, 0x8607, 0x8A34, 0x963B, 0x9061, 0x9F20, 0x50E7, 0x5275, - 0x53CC, 0x53E2, 0x5009, 0x55AA, 0x58EE, 0x594F, 0x723D, 0x5B8B, - 0x5C64, 0x531D, 0x60E3, 0x60F3, 0x635C, 0x6383, 0x633F, 0x63BB, - 0x64CD, 0x65E9, 0x66F9, 0x5DE3, 0x69CD, 0x69FD, 0x6F15, 0x71E5, - 0x4E89, 0x75E9, 0x76F8, 0x7A93, 0x7CDF, 0x7DCF, 0x7D9C, 0x8061, - 0x8349, 0x8358, 0x846C, 0x84BC, 0x85FB, 0x88C5, 0x8D70, 0x9001, - 0x906D, 0x9397, 0x971C, 0x9A12, 0x50CF, 0x5897, 0x618E, -}; -static const unsigned short euc_to_utf8_C2[] = { - 0x81D3, 0x8535, 0x8D08, 0x9020, 0x4FC3, 0x5074, 0x5247, - 0x5373, 0x606F, 0x6349, 0x675F, 0x6E2C, 0x8DB3, 0x901F, 0x4FD7, - 0x5C5E, 0x8CCA, 0x65CF, 0x7D9A, 0x5352, 0x8896, 0x5176, 0x63C3, - 0x5B58, 0x5B6B, 0x5C0A, 0x640D, 0x6751, 0x905C, 0x4ED6, 0x591A, - 0x592A, 0x6C70, 0x8A51, 0x553E, 0x5815, 0x59A5, 0x60F0, 0x6253, - 0x67C1, 0x8235, 0x6955, 0x9640, 0x99C4, 0x9A28, 0x4F53, 0x5806, - 0x5BFE, 0x8010, 0x5CB1, 0x5E2F, 0x5F85, 0x6020, 0x614B, 0x6234, - 0x66FF, 0x6CF0, 0x6EDE, 0x80CE, 0x817F, 0x82D4, 0x888B, 0x8CB8, - 0x9000, 0x902E, 0x968A, 0x9EDB, 0x9BDB, 0x4EE3, 0x53F0, 0x5927, - 0x7B2C, 0x918D, 0x984C, 0x9DF9, 0x6EDD, 0x7027, 0x5353, 0x5544, - 0x5B85, 0x6258, 0x629E, 0x62D3, 0x6CA2, 0x6FEF, 0x7422, 0x8A17, - 0x9438, 0x6FC1, 0x8AFE, 0x8338, 0x51E7, 0x86F8, 0x53EA, -}; -static const unsigned short euc_to_utf8_C3[] = { - 0x53E9, 0x4F46, 0x9054, 0x8FB0, 0x596A, 0x8131, 0x5DFD, - 0x7AEA, 0x8FBF, 0x68DA, 0x8C37, 0x72F8, 0x9C48, 0x6A3D, 0x8AB0, - 0x4E39, 0x5358, 0x5606, 0x5766, 0x62C5, 0x63A2, 0x65E6, 0x6B4E, - 0x6DE1, 0x6E5B, 0x70AD, 0x77ED, 0x7AEF, 0x7BAA, 0x7DBB, 0x803D, - 0x80C6, 0x86CB, 0x8A95, 0x935B, 0x56E3, 0x58C7, 0x5F3E, 0x65AD, - 0x6696, 0x6A80, 0x6BB5, 0x7537, 0x8AC7, 0x5024, 0x77E5, 0x5730, - 0x5F1B, 0x6065, 0x667A, 0x6C60, 0x75F4, 0x7A1A, 0x7F6E, 0x81F4, - 0x8718, 0x9045, 0x99B3, 0x7BC9, 0x755C, 0x7AF9, 0x7B51, 0x84C4, - 0x9010, 0x79E9, 0x7A92, 0x8336, 0x5AE1, 0x7740, 0x4E2D, 0x4EF2, - 0x5B99, 0x5FE0, 0x62BD, 0x663C, 0x67F1, 0x6CE8, 0x866B, 0x8877, - 0x8A3B, 0x914E, 0x92F3, 0x99D0, 0x6A17, 0x7026, 0x732A, 0x82E7, - 0x8457, 0x8CAF, 0x4E01, 0x5146, 0x51CB, 0x558B, 0x5BF5, -}; -static const unsigned short euc_to_utf8_C4[] = { - 0x5E16, 0x5E33, 0x5E81, 0x5F14, 0x5F35, 0x5F6B, 0x5FB4, - 0x61F2, 0x6311, 0x66A2, 0x671D, 0x6F6E, 0x7252, 0x753A, 0x773A, - 0x8074, 0x8139, 0x8178, 0x8776, 0x8ABF, 0x8ADC, 0x8D85, 0x8DF3, - 0x929A, 0x9577, 0x9802, 0x9CE5, 0x52C5, 0x6357, 0x76F4, 0x6715, - 0x6C88, 0x73CD, 0x8CC3, 0x93AE, 0x9673, 0x6D25, 0x589C, 0x690E, - 0x69CC, 0x8FFD, 0x939A, 0x75DB, 0x901A, 0x585A, 0x6802, 0x63B4, - 0x69FB, 0x4F43, 0x6F2C, 0x67D8, 0x8FBB, 0x8526, 0x7DB4, 0x9354, - 0x693F, 0x6F70, 0x576A, 0x58F7, 0x5B2C, 0x7D2C, 0x722A, 0x540A, - 0x91E3, 0x9DB4, 0x4EAD, 0x4F4E, 0x505C, 0x5075, 0x5243, 0x8C9E, - 0x5448, 0x5824, 0x5B9A, 0x5E1D, 0x5E95, 0x5EAD, 0x5EF7, 0x5F1F, - 0x608C, 0x62B5, 0x633A, 0x63D0, 0x68AF, 0x6C40, 0x7887, 0x798E, - 0x7A0B, 0x7DE0, 0x8247, 0x8A02, 0x8AE6, 0x8E44, 0x9013, -}; -static const unsigned short euc_to_utf8_C5[] = { - 0x90B8, 0x912D, 0x91D8, 0x9F0E, 0x6CE5, 0x6458, 0x64E2, - 0x6575, 0x6EF4, 0x7684, 0x7B1B, 0x9069, 0x93D1, 0x6EBA, 0x54F2, - 0x5FB9, 0x64A4, 0x8F4D, 0x8FED, 0x9244, 0x5178, 0x586B, 0x5929, - 0x5C55, 0x5E97, 0x6DFB, 0x7E8F, 0x751C, 0x8CBC, 0x8EE2, 0x985B, - 0x70B9, 0x4F1D, 0x6BBF, 0x6FB1, 0x7530, 0x96FB, 0x514E, 0x5410, - 0x5835, 0x5857, 0x59AC, 0x5C60, 0x5F92, 0x6597, 0x675C, 0x6E21, - 0x767B, 0x83DF, 0x8CED, 0x9014, 0x90FD, 0x934D, 0x7825, 0x783A, - 0x52AA, 0x5EA6, 0x571F, 0x5974, 0x6012, 0x5012, 0x515A, 0x51AC, - 0x51CD, 0x5200, 0x5510, 0x5854, 0x5858, 0x5957, 0x5B95, 0x5CF6, - 0x5D8B, 0x60BC, 0x6295, 0x642D, 0x6771, 0x6843, 0x68BC, 0x68DF, - 0x76D7, 0x6DD8, 0x6E6F, 0x6D9B, 0x706F, 0x71C8, 0x5F53, 0x75D8, - 0x7977, 0x7B49, 0x7B54, 0x7B52, 0x7CD6, 0x7D71, 0x5230, -}; -static const unsigned short euc_to_utf8_C6[] = { - 0x8463, 0x8569, 0x85E4, 0x8A0E, 0x8B04, 0x8C46, 0x8E0F, - 0x9003, 0x900F, 0x9419, 0x9676, 0x982D, 0x9A30, 0x95D8, 0x50CD, - 0x52D5, 0x540C, 0x5802, 0x5C0E, 0x61A7, 0x649E, 0x6D1E, 0x77B3, - 0x7AE5, 0x80F4, 0x8404, 0x9053, 0x9285, 0x5CE0, 0x9D07, 0x533F, - 0x5F97, 0x5FB3, 0x6D9C, 0x7279, 0x7763, 0x79BF, 0x7BE4, 0x6BD2, - 0x72EC, 0x8AAD, 0x6803, 0x6A61, 0x51F8, 0x7A81, 0x6934, 0x5C4A, - 0x9CF6, 0x82EB, 0x5BC5, 0x9149, 0x701E, 0x5678, 0x5C6F, 0x60C7, - 0x6566, 0x6C8C, 0x8C5A, 0x9041, 0x9813, 0x5451, 0x66C7, 0x920D, - 0x5948, 0x90A3, 0x5185, 0x4E4D, 0x51EA, 0x8599, 0x8B0E, 0x7058, - 0x637A, 0x934B, 0x6962, 0x99B4, 0x7E04, 0x7577, 0x5357, 0x6960, - 0x8EDF, 0x96E3, 0x6C5D, 0x4E8C, 0x5C3C, 0x5F10, 0x8FE9, 0x5302, - 0x8CD1, 0x8089, 0x8679, 0x5EFF, 0x65E5, 0x4E73, 0x5165, -}; -static const unsigned short euc_to_utf8_C7[] = { - 0x5982, 0x5C3F, 0x97EE, 0x4EFB, 0x598A, 0x5FCD, 0x8A8D, - 0x6FE1, 0x79B0, 0x7962, 0x5BE7, 0x8471, 0x732B, 0x71B1, 0x5E74, - 0x5FF5, 0x637B, 0x649A, 0x71C3, 0x7C98, 0x4E43, 0x5EFC, 0x4E4B, - 0x57DC, 0x56A2, 0x60A9, 0x6FC3, 0x7D0D, 0x80FD, 0x8133, 0x81BF, - 0x8FB2, 0x8997, 0x86A4, 0x5DF4, 0x628A, 0x64AD, 0x8987, 0x6777, - 0x6CE2, 0x6D3E, 0x7436, 0x7834, 0x5A46, 0x7F75, 0x82AD, 0x99AC, - 0x4FF3, 0x5EC3, 0x62DD, 0x6392, 0x6557, 0x676F, 0x76C3, 0x724C, - 0x80CC, 0x80BA, 0x8F29, 0x914D, 0x500D, 0x57F9, 0x5A92, 0x6885, - 0x6973, 0x7164, 0x72FD, 0x8CB7, 0x58F2, 0x8CE0, 0x966A, 0x9019, - 0x877F, 0x79E4, 0x77E7, 0x8429, 0x4F2F, 0x5265, 0x535A, 0x62CD, - 0x67CF, 0x6CCA, 0x767D, 0x7B94, 0x7C95, 0x8236, 0x8584, 0x8FEB, - 0x66DD, 0x6F20, 0x7206, 0x7E1B, 0x83AB, 0x99C1, 0x9EA6, -}; -static const unsigned short euc_to_utf8_C8[] = { - 0x51FD, 0x7BB1, 0x7872, 0x7BB8, 0x8087, 0x7B48, 0x6AE8, - 0x5E61, 0x808C, 0x7551, 0x7560, 0x516B, 0x9262, 0x6E8C, 0x767A, - 0x9197, 0x9AEA, 0x4F10, 0x7F70, 0x629C, 0x7B4F, 0x95A5, 0x9CE9, - 0x567A, 0x5859, 0x86E4, 0x96BC, 0x4F34, 0x5224, 0x534A, 0x53CD, - 0x53DB, 0x5E06, 0x642C, 0x6591, 0x677F, 0x6C3E, 0x6C4E, 0x7248, - 0x72AF, 0x73ED, 0x7554, 0x7E41, 0x822C, 0x85E9, 0x8CA9, 0x7BC4, - 0x91C6, 0x7169, 0x9812, 0x98EF, 0x633D, 0x6669, 0x756A, 0x76E4, - 0x78D0, 0x8543, 0x86EE, 0x532A, 0x5351, 0x5426, 0x5983, 0x5E87, - 0x5F7C, 0x60B2, 0x6249, 0x6279, 0x62AB, 0x6590, 0x6BD4, 0x6CCC, - 0x75B2, 0x76AE, 0x7891, 0x79D8, 0x7DCB, 0x7F77, 0x80A5, 0x88AB, - 0x8AB9, 0x8CBB, 0x907F, 0x975E, 0x98DB, 0x6A0B, 0x7C38, 0x5099, - 0x5C3E, 0x5FAE, 0x6787, 0x6BD8, 0x7435, 0x7709, 0x7F8E, -}; -static const unsigned short euc_to_utf8_C9[] = { - 0x9F3B, 0x67CA, 0x7A17, 0x5339, 0x758B, 0x9AED, 0x5F66, - 0x819D, 0x83F1, 0x8098, 0x5F3C, 0x5FC5, 0x7562, 0x7B46, 0x903C, - 0x6867, 0x59EB, 0x5A9B, 0x7D10, 0x767E, 0x8B2C, 0x4FF5, 0x5F6A, - 0x6A19, 0x6C37, 0x6F02, 0x74E2, 0x7968, 0x8868, 0x8A55, 0x8C79, - 0x5EDF, 0x63CF, 0x75C5, 0x79D2, 0x82D7, 0x9328, 0x92F2, 0x849C, - 0x86ED, 0x9C2D, 0x54C1, 0x5F6C, 0x658C, 0x6D5C, 0x7015, 0x8CA7, - 0x8CD3, 0x983B, 0x654F, 0x74F6, 0x4E0D, 0x4ED8, 0x57E0, 0x592B, - 0x5A66, 0x5BCC, 0x51A8, 0x5E03, 0x5E9C, 0x6016, 0x6276, 0x6577, - 0x65A7, 0x666E, 0x6D6E, 0x7236, 0x7B26, 0x8150, 0x819A, 0x8299, - 0x8B5C, 0x8CA0, 0x8CE6, 0x8D74, 0x961C, 0x9644, 0x4FAE, 0x64AB, - 0x6B66, 0x821E, 0x8461, 0x856A, 0x90E8, 0x5C01, 0x6953, 0x98A8, - 0x847A, 0x8557, 0x4F0F, 0x526F, 0x5FA9, 0x5E45, 0x670D, -}; -static const unsigned short euc_to_utf8_CA[] = { - 0x798F, 0x8179, 0x8907, 0x8986, 0x6DF5, 0x5F17, 0x6255, - 0x6CB8, 0x4ECF, 0x7269, 0x9B92, 0x5206, 0x543B, 0x5674, 0x58B3, - 0x61A4, 0x626E, 0x711A, 0x596E, 0x7C89, 0x7CDE, 0x7D1B, 0x96F0, - 0x6587, 0x805E, 0x4E19, 0x4F75, 0x5175, 0x5840, 0x5E63, 0x5E73, - 0x5F0A, 0x67C4, 0x4E26, 0x853D, 0x9589, 0x965B, 0x7C73, 0x9801, - 0x50FB, 0x58C1, 0x7656, 0x78A7, 0x5225, 0x77A5, 0x8511, 0x7B86, - 0x504F, 0x5909, 0x7247, 0x7BC7, 0x7DE8, 0x8FBA, 0x8FD4, 0x904D, - 0x4FBF, 0x52C9, 0x5A29, 0x5F01, 0x97AD, 0x4FDD, 0x8217, 0x92EA, - 0x5703, 0x6355, 0x6B69, 0x752B, 0x88DC, 0x8F14, 0x7A42, 0x52DF, - 0x5893, 0x6155, 0x620A, 0x66AE, 0x6BCD, 0x7C3F, 0x83E9, 0x5023, - 0x4FF8, 0x5305, 0x5446, 0x5831, 0x5949, 0x5B9D, 0x5CF0, 0x5CEF, - 0x5D29, 0x5E96, 0x62B1, 0x6367, 0x653E, 0x65B9, 0x670B, -}; -static const unsigned short euc_to_utf8_CB[] = { - 0x6CD5, 0x6CE1, 0x70F9, 0x7832, 0x7E2B, 0x80DE, 0x82B3, - 0x840C, 0x84EC, 0x8702, 0x8912, 0x8A2A, 0x8C4A, 0x90A6, 0x92D2, - 0x98FD, 0x9CF3, 0x9D6C, 0x4E4F, 0x4EA1, 0x508D, 0x5256, 0x574A, - 0x59A8, 0x5E3D, 0x5FD8, 0x5FD9, 0x623F, 0x66B4, 0x671B, 0x67D0, - 0x68D2, 0x5192, 0x7D21, 0x80AA, 0x81A8, 0x8B00, 0x8C8C, 0x8CBF, - 0x927E, 0x9632, 0x5420, 0x982C, 0x5317, 0x50D5, 0x535C, 0x58A8, - 0x64B2, 0x6734, 0x7267, 0x7766, 0x7A46, 0x91E6, 0x52C3, 0x6CA1, - 0x6B86, 0x5800, 0x5E4C, 0x5954, 0x672C, 0x7FFB, 0x51E1, 0x76C6, - 0x6469, 0x78E8, 0x9B54, 0x9EBB, 0x57CB, 0x59B9, 0x6627, 0x679A, - 0x6BCE, 0x54E9, 0x69D9, 0x5E55, 0x819C, 0x6795, 0x9BAA, 0x67FE, - 0x9C52, 0x685D, 0x4EA6, 0x4FE3, 0x53C8, 0x62B9, 0x672B, 0x6CAB, - 0x8FC4, 0x4FAD, 0x7E6D, 0x9EBF, 0x4E07, 0x6162, 0x6E80, -}; -static const unsigned short euc_to_utf8_CC[] = { - 0x6F2B, 0x8513, 0x5473, 0x672A, 0x9B45, 0x5DF3, 0x7B95, - 0x5CAC, 0x5BC6, 0x871C, 0x6E4A, 0x84D1, 0x7A14, 0x8108, 0x5999, - 0x7C8D, 0x6C11, 0x7720, 0x52D9, 0x5922, 0x7121, 0x725F, 0x77DB, - 0x9727, 0x9D61, 0x690B, 0x5A7F, 0x5A18, 0x51A5, 0x540D, 0x547D, - 0x660E, 0x76DF, 0x8FF7, 0x9298, 0x9CF4, 0x59EA, 0x725D, 0x6EC5, - 0x514D, 0x68C9, 0x7DBF, 0x7DEC, 0x9762, 0x9EBA, 0x6478, 0x6A21, - 0x8302, 0x5984, 0x5B5F, 0x6BDB, 0x731B, 0x76F2, 0x7DB2, 0x8017, - 0x8499, 0x5132, 0x6728, 0x9ED9, 0x76EE, 0x6762, 0x52FF, 0x9905, - 0x5C24, 0x623B, 0x7C7E, 0x8CB0, 0x554F, 0x60B6, 0x7D0B, 0x9580, - 0x5301, 0x4E5F, 0x51B6, 0x591C, 0x723A, 0x8036, 0x91CE, 0x5F25, - 0x77E2, 0x5384, 0x5F79, 0x7D04, 0x85AC, 0x8A33, 0x8E8D, 0x9756, - 0x67F3, 0x85AE, 0x9453, 0x6109, 0x6108, 0x6CB9, 0x7652, -}; -static const unsigned short euc_to_utf8_CD[] = { - 0x8AED, 0x8F38, 0x552F, 0x4F51, 0x512A, 0x52C7, 0x53CB, - 0x5BA5, 0x5E7D, 0x60A0, 0x6182, 0x63D6, 0x6709, 0x67DA, 0x6E67, - 0x6D8C, 0x7336, 0x7337, 0x7531, 0x7950, 0x88D5, 0x8A98, 0x904A, - 0x9091, 0x90F5, 0x96C4, 0x878D, 0x5915, 0x4E88, 0x4F59, 0x4E0E, - 0x8A89, 0x8F3F, 0x9810, 0x50AD, 0x5E7C, 0x5996, 0x5BB9, 0x5EB8, - 0x63DA, 0x63FA, 0x64C1, 0x66DC, 0x694A, 0x69D8, 0x6D0B, 0x6EB6, - 0x7194, 0x7528, 0x7AAF, 0x7F8A, 0x8000, 0x8449, 0x84C9, 0x8981, - 0x8B21, 0x8E0A, 0x9065, 0x967D, 0x990A, 0x617E, 0x6291, 0x6B32, - 0x6C83, 0x6D74, 0x7FCC, 0x7FFC, 0x6DC0, 0x7F85, 0x87BA, 0x88F8, - 0x6765, 0x83B1, 0x983C, 0x96F7, 0x6D1B, 0x7D61, 0x843D, 0x916A, - 0x4E71, 0x5375, 0x5D50, 0x6B04, 0x6FEB, 0x85CD, 0x862D, 0x89A7, - 0x5229, 0x540F, 0x5C65, 0x674E, 0x68A8, 0x7406, 0x7483, -}; -static const unsigned short euc_to_utf8_CE[] = { - 0x75E2, 0x88CF, 0x88E1, 0x91CC, 0x96E2, 0x9678, 0x5F8B, - 0x7387, 0x7ACB, 0x844E, 0x63A0, 0x7565, 0x5289, 0x6D41, 0x6E9C, - 0x7409, 0x7559, 0x786B, 0x7C92, 0x9686, 0x7ADC, 0x9F8D, 0x4FB6, - 0x616E, 0x65C5, 0x865C, 0x4E86, 0x4EAE, 0x50DA, 0x4E21, 0x51CC, - 0x5BEE, 0x6599, 0x6881, 0x6DBC, 0x731F, 0x7642, 0x77AD, 0x7A1C, - 0x7CE7, 0x826F, 0x8AD2, 0x907C, 0x91CF, 0x9675, 0x9818, 0x529B, - 0x7DD1, 0x502B, 0x5398, 0x6797, 0x6DCB, 0x71D0, 0x7433, 0x81E8, - 0x8F2A, 0x96A3, 0x9C57, 0x9E9F, 0x7460, 0x5841, 0x6D99, 0x7D2F, - 0x985E, 0x4EE4, 0x4F36, 0x4F8B, 0x51B7, 0x52B1, 0x5DBA, 0x601C, - 0x73B2, 0x793C, 0x82D3, 0x9234, 0x96B7, 0x96F6, 0x970A, 0x9E97, - 0x9F62, 0x66A6, 0x6B74, 0x5217, 0x52A3, 0x70C8, 0x88C2, 0x5EC9, - 0x604B, 0x6190, 0x6F23, 0x7149, 0x7C3E, 0x7DF4, 0x806F, -}; -static const unsigned short euc_to_utf8_CF[] = { - 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 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, - 0x8212, 0x5F0D, 0x4E8E, 0x4E9E, 0x4E9F, 0x4EA0, 0x4EA2, 0x4EB0, - 0x4EB3, 0x4EB6, 0x4ECE, 0x4ECD, 0x4EC4, 0x4EC6, 0x4EC2, 0x4ED7, - 0x4EDE, 0x4EED, 0x4EDF, 0x4EF7, 0x4F09, 0x4F5A, 0x4F30, 0x4F5B, - 0x4F5D, 0x4F57, 0x4F47, 0x4F76, 0x4F88, 0x4F8F, 0x4F98, 0x4F7B, - 0x4F69, 0x4F70, 0x4F91, 0x4F6F, 0x4F86, 0x4F96, 0x5118, 0x4FD4, - 0x4FDF, 0x4FCE, 0x4FD8, 0x4FDB, 0x4FD1, 0x4FDA, 0x4FD0, 0x4FE4, - 0x4FE5, 0x501A, 0x5028, 0x5014, 0x502A, 0x5025, 0x5005, 0x4F1C, - 0x4FF6, 0x5021, 0x5029, 0x502C, 0x4FFE, 0x4FEF, 0x5011, 0x5006, - 0x5043, 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505A, 0x5056, - 0x506C, 0x5078, 0x5080, 0x509A, 0x5085, 0x50B4, 0x50B2, -}; -static const unsigned short euc_to_utf8_D1[] = { - 0x50C9, 0x50CA, 0x50B3, 0x50C2, 0x50D6, 0x50DE, 0x50E5, - 0x50ED, 0x50E3, 0x50EE, 0x50F9, 0x50F5, 0x5109, 0x5101, 0x5102, - 0x5116, 0x5115, 0x5114, 0x511A, 0x5121, 0x513A, 0x5137, 0x513C, - 0x513B, 0x513F, 0x5140, 0x5152, 0x514C, 0x5154, 0x5162, 0x7AF8, - 0x5169, 0x516A, 0x516E, 0x5180, 0x5182, 0x56D8, 0x518C, 0x5189, - 0x518F, 0x5191, 0x5193, 0x5195, 0x5196, 0x51A4, 0x51A6, 0x51A2, - 0x51A9, 0x51AA, 0x51AB, 0x51B3, 0x51B1, 0x51B2, 0x51B0, 0x51B5, - 0x51BD, 0x51C5, 0x51C9, 0x51DB, 0x51E0, 0x8655, 0x51E9, 0x51ED, - 0x51F0, 0x51F5, 0x51FE, 0x5204, 0x520B, 0x5214, 0x520E, 0x5227, - 0x522A, 0x522E, 0x5233, 0x5239, 0x524F, 0x5244, 0x524B, 0x524C, - 0x525E, 0x5254, 0x526A, 0x5274, 0x5269, 0x5273, 0x527F, 0x527D, - 0x528D, 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8FA8, -}; -static const unsigned short euc_to_utf8_D2[] = { - 0x8FA7, 0x52AC, 0x52AD, 0x52BC, 0x52B5, 0x52C1, 0x52CD, - 0x52D7, 0x52DE, 0x52E3, 0x52E6, 0x98ED, 0x52E0, 0x52F3, 0x52F5, - 0x52F8, 0x52F9, 0x5306, 0x5308, 0x7538, 0x530D, 0x5310, 0x530F, - 0x5315, 0x531A, 0x5323, 0x532F, 0x5331, 0x5333, 0x5338, 0x5340, - 0x5346, 0x5345, 0x4E17, 0x5349, 0x534D, 0x51D6, 0x535E, 0x5369, - 0x536E, 0x5918, 0x537B, 0x5377, 0x5382, 0x5396, 0x53A0, 0x53A6, - 0x53A5, 0x53AE, 0x53B0, 0x53B6, 0x53C3, 0x7C12, 0x96D9, 0x53DF, - 0x66FC, 0x71EE, 0x53EE, 0x53E8, 0x53ED, 0x53FA, 0x5401, 0x543D, - 0x5440, 0x542C, 0x542D, 0x543C, 0x542E, 0x5436, 0x5429, 0x541D, - 0x544E, 0x548F, 0x5475, 0x548E, 0x545F, 0x5471, 0x5477, 0x5470, - 0x5492, 0x547B, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54C7, - 0x54A2, 0x54B8, 0x54A5, 0x54AC, 0x54C4, 0x54C8, 0x54A8, -}; -static const unsigned short euc_to_utf8_D3[] = { - 0x54AB, 0x54C2, 0x54A4, 0x54BE, 0x54BC, 0x54D8, 0x54E5, - 0x54E6, 0x550F, 0x5514, 0x54FD, 0x54EE, 0x54ED, 0x54FA, 0x54E2, - 0x5539, 0x5540, 0x5563, 0x554C, 0x552E, 0x555C, 0x5545, 0x5556, - 0x5557, 0x5538, 0x5533, 0x555D, 0x5599, 0x5580, 0x54AF, 0x558A, - 0x559F, 0x557B, 0x557E, 0x5598, 0x559E, 0x55AE, 0x557C, 0x5583, - 0x55A9, 0x5587, 0x55A8, 0x55DA, 0x55C5, 0x55DF, 0x55C4, 0x55DC, - 0x55E4, 0x55D4, 0x5614, 0x55F7, 0x5616, 0x55FE, 0x55FD, 0x561B, - 0x55F9, 0x564E, 0x5650, 0x71DF, 0x5634, 0x5636, 0x5632, 0x5638, - 0x566B, 0x5664, 0x562F, 0x566C, 0x566A, 0x5686, 0x5680, 0x568A, - 0x56A0, 0x5694, 0x568F, 0x56A5, 0x56AE, 0x56B6, 0x56B4, 0x56C2, - 0x56BC, 0x56C1, 0x56C3, 0x56C0, 0x56C8, 0x56CE, 0x56D1, 0x56D3, - 0x56D7, 0x56EE, 0x56F9, 0x5700, 0x56FF, 0x5704, 0x5709, -}; -static const unsigned short euc_to_utf8_D4[] = { - 0x5708, 0x570B, 0x570D, 0x5713, 0x5718, 0x5716, 0x55C7, - 0x571C, 0x5726, 0x5737, 0x5738, 0x574E, 0x573B, 0x5740, 0x574F, - 0x5769, 0x57C0, 0x5788, 0x5761, 0x577F, 0x5789, 0x5793, 0x57A0, - 0x57B3, 0x57A4, 0x57AA, 0x57B0, 0x57C3, 0x57C6, 0x57D4, 0x57D2, - 0x57D3, 0x580A, 0x57D6, 0x57E3, 0x580B, 0x5819, 0x581D, 0x5872, - 0x5821, 0x5862, 0x584B, 0x5870, 0x6BC0, 0x5852, 0x583D, 0x5879, - 0x5885, 0x58B9, 0x589F, 0x58AB, 0x58BA, 0x58DE, 0x58BB, 0x58B8, - 0x58AE, 0x58C5, 0x58D3, 0x58D1, 0x58D7, 0x58D9, 0x58D8, 0x58E5, - 0x58DC, 0x58E4, 0x58DF, 0x58EF, 0x58FA, 0x58F9, 0x58FB, 0x58FC, - 0x58FD, 0x5902, 0x590A, 0x5910, 0x591B, 0x68A6, 0x5925, 0x592C, - 0x592D, 0x5932, 0x5938, 0x593E, 0x7AD2, 0x5955, 0x5950, 0x594E, - 0x595A, 0x5958, 0x5962, 0x5960, 0x5967, 0x596C, 0x5969, -}; -static const unsigned short euc_to_utf8_D5[] = { - 0x5978, 0x5981, 0x599D, 0x4F5E, 0x4FAB, 0x59A3, 0x59B2, - 0x59C6, 0x59E8, 0x59DC, 0x598D, 0x59D9, 0x59DA, 0x5A25, 0x5A1F, - 0x5A11, 0x5A1C, 0x5A09, 0x5A1A, 0x5A40, 0x5A6C, 0x5A49, 0x5A35, - 0x5A36, 0x5A62, 0x5A6A, 0x5A9A, 0x5ABC, 0x5ABE, 0x5ACB, 0x5AC2, - 0x5ABD, 0x5AE3, 0x5AD7, 0x5AE6, 0x5AE9, 0x5AD6, 0x5AFA, 0x5AFB, - 0x5B0C, 0x5B0B, 0x5B16, 0x5B32, 0x5AD0, 0x5B2A, 0x5B36, 0x5B3E, - 0x5B43, 0x5B45, 0x5B40, 0x5B51, 0x5B55, 0x5B5A, 0x5B5B, 0x5B65, - 0x5B69, 0x5B70, 0x5B73, 0x5B75, 0x5B78, 0x6588, 0x5B7A, 0x5B80, - 0x5B83, 0x5BA6, 0x5BB8, 0x5BC3, 0x5BC7, 0x5BC9, 0x5BD4, 0x5BD0, - 0x5BE4, 0x5BE6, 0x5BE2, 0x5BDE, 0x5BE5, 0x5BEB, 0x5BF0, 0x5BF6, - 0x5BF3, 0x5C05, 0x5C07, 0x5C08, 0x5C0D, 0x5C13, 0x5C20, 0x5C22, - 0x5C28, 0x5C38, 0x5C39, 0x5C41, 0x5C46, 0x5C4E, 0x5C53, -}; -static const unsigned short euc_to_utf8_D6[] = { - 0x5C50, 0x5C4F, 0x5B71, 0x5C6C, 0x5C6E, 0x4E62, 0x5C76, - 0x5C79, 0x5C8C, 0x5C91, 0x5C94, 0x599B, 0x5CAB, 0x5CBB, 0x5CB6, - 0x5CBC, 0x5CB7, 0x5CC5, 0x5CBE, 0x5CC7, 0x5CD9, 0x5CE9, 0x5CFD, - 0x5CFA, 0x5CED, 0x5D8C, 0x5CEA, 0x5D0B, 0x5D15, 0x5D17, 0x5D5C, - 0x5D1F, 0x5D1B, 0x5D11, 0x5D14, 0x5D22, 0x5D1A, 0x5D19, 0x5D18, - 0x5D4C, 0x5D52, 0x5D4E, 0x5D4B, 0x5D6C, 0x5D73, 0x5D76, 0x5D87, - 0x5D84, 0x5D82, 0x5DA2, 0x5D9D, 0x5DAC, 0x5DAE, 0x5DBD, 0x5D90, - 0x5DB7, 0x5DBC, 0x5DC9, 0x5DCD, 0x5DD3, 0x5DD2, 0x5DD6, 0x5DDB, - 0x5DEB, 0x5DF2, 0x5DF5, 0x5E0B, 0x5E1A, 0x5E19, 0x5E11, 0x5E1B, - 0x5E36, 0x5E37, 0x5E44, 0x5E43, 0x5E40, 0x5E4E, 0x5E57, 0x5E54, - 0x5E5F, 0x5E62, 0x5E64, 0x5E47, 0x5E75, 0x5E76, 0x5E7A, 0x9EBC, - 0x5E7F, 0x5EA0, 0x5EC1, 0x5EC2, 0x5EC8, 0x5ED0, 0x5ECF, -}; -static const unsigned short euc_to_utf8_D7[] = { - 0x5ED6, 0x5EE3, 0x5EDD, 0x5EDA, 0x5EDB, 0x5EE2, 0x5EE1, - 0x5EE8, 0x5EE9, 0x5EEC, 0x5EF1, 0x5EF3, 0x5EF0, 0x5EF4, 0x5EF8, - 0x5EFE, 0x5F03, 0x5F09, 0x5F5D, 0x5F5C, 0x5F0B, 0x5F11, 0x5F16, - 0x5F29, 0x5F2D, 0x5F38, 0x5F41, 0x5F48, 0x5F4C, 0x5F4E, 0x5F2F, - 0x5F51, 0x5F56, 0x5F57, 0x5F59, 0x5F61, 0x5F6D, 0x5F73, 0x5F77, - 0x5F83, 0x5F82, 0x5F7F, 0x5F8A, 0x5F88, 0x5F91, 0x5F87, 0x5F9E, - 0x5F99, 0x5F98, 0x5FA0, 0x5FA8, 0x5FAD, 0x5FBC, 0x5FD6, 0x5FFB, - 0x5FE4, 0x5FF8, 0x5FF1, 0x5FDD, 0x60B3, 0x5FFF, 0x6021, 0x6060, - 0x6019, 0x6010, 0x6029, 0x600E, 0x6031, 0x601B, 0x6015, 0x602B, - 0x6026, 0x600F, 0x603A, 0x605A, 0x6041, 0x606A, 0x6077, 0x605F, - 0x604A, 0x6046, 0x604D, 0x6063, 0x6043, 0x6064, 0x6042, 0x606C, - 0x606B, 0x6059, 0x6081, 0x608D, 0x60E7, 0x6083, 0x609A, -}; -static const unsigned short euc_to_utf8_D8[] = { - 0x6084, 0x609B, 0x6096, 0x6097, 0x6092, 0x60A7, 0x608B, - 0x60E1, 0x60B8, 0x60E0, 0x60D3, 0x60B4, 0x5FF0, 0x60BD, 0x60C6, - 0x60B5, 0x60D8, 0x614D, 0x6115, 0x6106, 0x60F6, 0x60F7, 0x6100, - 0x60F4, 0x60FA, 0x6103, 0x6121, 0x60FB, 0x60F1, 0x610D, 0x610E, - 0x6147, 0x613E, 0x6128, 0x6127, 0x614A, 0x613F, 0x613C, 0x612C, - 0x6134, 0x613D, 0x6142, 0x6144, 0x6173, 0x6177, 0x6158, 0x6159, - 0x615A, 0x616B, 0x6174, 0x616F, 0x6165, 0x6171, 0x615F, 0x615D, - 0x6153, 0x6175, 0x6199, 0x6196, 0x6187, 0x61AC, 0x6194, 0x619A, - 0x618A, 0x6191, 0x61AB, 0x61AE, 0x61CC, 0x61CA, 0x61C9, 0x61F7, - 0x61C8, 0x61C3, 0x61C6, 0x61BA, 0x61CB, 0x7F79, 0x61CD, 0x61E6, - 0x61E3, 0x61F6, 0x61FA, 0x61F4, 0x61FF, 0x61FD, 0x61FC, 0x61FE, - 0x6200, 0x6208, 0x6209, 0x620D, 0x620C, 0x6214, 0x621B, -}; -static const unsigned short euc_to_utf8_D9[] = { - 0x621E, 0x6221, 0x622A, 0x622E, 0x6230, 0x6232, 0x6233, - 0x6241, 0x624E, 0x625E, 0x6263, 0x625B, 0x6260, 0x6268, 0x627C, - 0x6282, 0x6289, 0x627E, 0x6292, 0x6293, 0x6296, 0x62D4, 0x6283, - 0x6294, 0x62D7, 0x62D1, 0x62BB, 0x62CF, 0x62FF, 0x62C6, 0x64D4, - 0x62C8, 0x62DC, 0x62CC, 0x62CA, 0x62C2, 0x62C7, 0x629B, 0x62C9, - 0x630C, 0x62EE, 0x62F1, 0x6327, 0x6302, 0x6308, 0x62EF, 0x62F5, - 0x6350, 0x633E, 0x634D, 0x641C, 0x634F, 0x6396, 0x638E, 0x6380, - 0x63AB, 0x6376, 0x63A3, 0x638F, 0x6389, 0x639F, 0x63B5, 0x636B, - 0x6369, 0x63BE, 0x63E9, 0x63C0, 0x63C6, 0x63E3, 0x63C9, 0x63D2, - 0x63F6, 0x63C4, 0x6416, 0x6434, 0x6406, 0x6413, 0x6426, 0x6436, - 0x651D, 0x6417, 0x6428, 0x640F, 0x6467, 0x646F, 0x6476, 0x644E, - 0x652A, 0x6495, 0x6493, 0x64A5, 0x64A9, 0x6488, 0x64BC, -}; -static const unsigned short euc_to_utf8_DA[] = { - 0x64DA, 0x64D2, 0x64C5, 0x64C7, 0x64BB, 0x64D8, 0x64C2, - 0x64F1, 0x64E7, 0x8209, 0x64E0, 0x64E1, 0x62AC, 0x64E3, 0x64EF, - 0x652C, 0x64F6, 0x64F4, 0x64F2, 0x64FA, 0x6500, 0x64FD, 0x6518, - 0x651C, 0x6505, 0x6524, 0x6523, 0x652B, 0x6534, 0x6535, 0x6537, - 0x6536, 0x6538, 0x754B, 0x6548, 0x6556, 0x6555, 0x654D, 0x6558, - 0x655E, 0x655D, 0x6572, 0x6578, 0x6582, 0x6583, 0x8B8A, 0x659B, - 0x659F, 0x65AB, 0x65B7, 0x65C3, 0x65C6, 0x65C1, 0x65C4, 0x65CC, - 0x65D2, 0x65DB, 0x65D9, 0x65E0, 0x65E1, 0x65F1, 0x6772, 0x660A, - 0x6603, 0x65FB, 0x6773, 0x6635, 0x6636, 0x6634, 0x661C, 0x664F, - 0x6644, 0x6649, 0x6641, 0x665E, 0x665D, 0x6664, 0x6667, 0x6668, - 0x665F, 0x6662, 0x6670, 0x6683, 0x6688, 0x668E, 0x6689, 0x6684, - 0x6698, 0x669D, 0x66C1, 0x66B9, 0x66C9, 0x66BE, 0x66BC, -}; -static const unsigned short euc_to_utf8_DB[] = { - 0x66C4, 0x66B8, 0x66D6, 0x66DA, 0x66E0, 0x663F, 0x66E6, - 0x66E9, 0x66F0, 0x66F5, 0x66F7, 0x670F, 0x6716, 0x671E, 0x6726, - 0x6727, 0x9738, 0x672E, 0x673F, 0x6736, 0x6741, 0x6738, 0x6737, - 0x6746, 0x675E, 0x6760, 0x6759, 0x6763, 0x6764, 0x6789, 0x6770, - 0x67A9, 0x677C, 0x676A, 0x678C, 0x678B, 0x67A6, 0x67A1, 0x6785, - 0x67B7, 0x67EF, 0x67B4, 0x67EC, 0x67B3, 0x67E9, 0x67B8, 0x67E4, - 0x67DE, 0x67DD, 0x67E2, 0x67EE, 0x67B9, 0x67CE, 0x67C6, 0x67E7, - 0x6A9C, 0x681E, 0x6846, 0x6829, 0x6840, 0x684D, 0x6832, 0x684E, - 0x68B3, 0x682B, 0x6859, 0x6863, 0x6877, 0x687F, 0x689F, 0x688F, - 0x68AD, 0x6894, 0x689D, 0x689B, 0x6883, 0x6AAE, 0x68B9, 0x6874, - 0x68B5, 0x68A0, 0x68BA, 0x690F, 0x688D, 0x687E, 0x6901, 0x68CA, - 0x6908, 0x68D8, 0x6922, 0x6926, 0x68E1, 0x690C, 0x68CD, -}; -static const unsigned short euc_to_utf8_DC[] = { - 0x68D4, 0x68E7, 0x68D5, 0x6936, 0x6912, 0x6904, 0x68D7, - 0x68E3, 0x6925, 0x68F9, 0x68E0, 0x68EF, 0x6928, 0x692A, 0x691A, - 0x6923, 0x6921, 0x68C6, 0x6979, 0x6977, 0x695C, 0x6978, 0x696B, - 0x6954, 0x697E, 0x696E, 0x6939, 0x6974, 0x693D, 0x6959, 0x6930, - 0x6961, 0x695E, 0x695D, 0x6981, 0x696A, 0x69B2, 0x69AE, 0x69D0, - 0x69BF, 0x69C1, 0x69D3, 0x69BE, 0x69CE, 0x5BE8, 0x69CA, 0x69DD, - 0x69BB, 0x69C3, 0x69A7, 0x6A2E, 0x6991, 0x69A0, 0x699C, 0x6995, - 0x69B4, 0x69DE, 0x69E8, 0x6A02, 0x6A1B, 0x69FF, 0x6B0A, 0x69F9, - 0x69F2, 0x69E7, 0x6A05, 0x69B1, 0x6A1E, 0x69ED, 0x6A14, 0x69EB, - 0x6A0A, 0x6A12, 0x6AC1, 0x6A23, 0x6A13, 0x6A44, 0x6A0C, 0x6A72, - 0x6A36, 0x6A78, 0x6A47, 0x6A62, 0x6A59, 0x6A66, 0x6A48, 0x6A38, - 0x6A22, 0x6A90, 0x6A8D, 0x6AA0, 0x6A84, 0x6AA2, 0x6AA3, -}; -static const unsigned short euc_to_utf8_DD[] = { - 0x6A97, 0x8617, 0x6ABB, 0x6AC3, 0x6AC2, 0x6AB8, 0x6AB3, - 0x6AAC, 0x6ADE, 0x6AD1, 0x6ADF, 0x6AAA, 0x6ADA, 0x6AEA, 0x6AFB, - 0x6B05, 0x8616, 0x6AFA, 0x6B12, 0x6B16, 0x9B31, 0x6B1F, 0x6B38, - 0x6B37, 0x76DC, 0x6B39, 0x98EE, 0x6B47, 0x6B43, 0x6B49, 0x6B50, - 0x6B59, 0x6B54, 0x6B5B, 0x6B5F, 0x6B61, 0x6B78, 0x6B79, 0x6B7F, - 0x6B80, 0x6B84, 0x6B83, 0x6B8D, 0x6B98, 0x6B95, 0x6B9E, 0x6BA4, - 0x6BAA, 0x6BAB, 0x6BAF, 0x6BB2, 0x6BB1, 0x6BB3, 0x6BB7, 0x6BBC, - 0x6BC6, 0x6BCB, 0x6BD3, 0x6BDF, 0x6BEC, 0x6BEB, 0x6BF3, 0x6BEF, - 0x9EBE, 0x6C08, 0x6C13, 0x6C14, 0x6C1B, 0x6C24, 0x6C23, 0x6C5E, - 0x6C55, 0x6C62, 0x6C6A, 0x6C82, 0x6C8D, 0x6C9A, 0x6C81, 0x6C9B, - 0x6C7E, 0x6C68, 0x6C73, 0x6C92, 0x6C90, 0x6CC4, 0x6CF1, 0x6CD3, - 0x6CBD, 0x6CD7, 0x6CC5, 0x6CDD, 0x6CAE, 0x6CB1, 0x6CBE, -}; -static const unsigned short euc_to_utf8_DE[] = { - 0x6CBA, 0x6CDB, 0x6CEF, 0x6CD9, 0x6CEA, 0x6D1F, 0x884D, - 0x6D36, 0x6D2B, 0x6D3D, 0x6D38, 0x6D19, 0x6D35, 0x6D33, 0x6D12, - 0x6D0C, 0x6D63, 0x6D93, 0x6D64, 0x6D5A, 0x6D79, 0x6D59, 0x6D8E, - 0x6D95, 0x6FE4, 0x6D85, 0x6DF9, 0x6E15, 0x6E0A, 0x6DB5, 0x6DC7, - 0x6DE6, 0x6DB8, 0x6DC6, 0x6DEC, 0x6DDE, 0x6DCC, 0x6DE8, 0x6DD2, - 0x6DC5, 0x6DFA, 0x6DD9, 0x6DE4, 0x6DD5, 0x6DEA, 0x6DEE, 0x6E2D, - 0x6E6E, 0x6E2E, 0x6E19, 0x6E72, 0x6E5F, 0x6E3E, 0x6E23, 0x6E6B, - 0x6E2B, 0x6E76, 0x6E4D, 0x6E1F, 0x6E43, 0x6E3A, 0x6E4E, 0x6E24, - 0x6EFF, 0x6E1D, 0x6E38, 0x6E82, 0x6EAA, 0x6E98, 0x6EC9, 0x6EB7, - 0x6ED3, 0x6EBD, 0x6EAF, 0x6EC4, 0x6EB2, 0x6ED4, 0x6ED5, 0x6E8F, - 0x6EA5, 0x6EC2, 0x6E9F, 0x6F41, 0x6F11, 0x704C, 0x6EEC, 0x6EF8, - 0x6EFE, 0x6F3F, 0x6EF2, 0x6F31, 0x6EEF, 0x6F32, 0x6ECC, -}; -static const unsigned short euc_to_utf8_DF[] = { - 0x6F3E, 0x6F13, 0x6EF7, 0x6F86, 0x6F7A, 0x6F78, 0x6F81, - 0x6F80, 0x6F6F, 0x6F5B, 0x6FF3, 0x6F6D, 0x6F82, 0x6F7C, 0x6F58, - 0x6F8E, 0x6F91, 0x6FC2, 0x6F66, 0x6FB3, 0x6FA3, 0x6FA1, 0x6FA4, - 0x6FB9, 0x6FC6, 0x6FAA, 0x6FDF, 0x6FD5, 0x6FEC, 0x6FD4, 0x6FD8, - 0x6FF1, 0x6FEE, 0x6FDB, 0x7009, 0x700B, 0x6FFA, 0x7011, 0x7001, - 0x700F, 0x6FFE, 0x701B, 0x701A, 0x6F74, 0x701D, 0x7018, 0x701F, - 0x7030, 0x703E, 0x7032, 0x7051, 0x7063, 0x7099, 0x7092, 0x70AF, - 0x70F1, 0x70AC, 0x70B8, 0x70B3, 0x70AE, 0x70DF, 0x70CB, 0x70DD, - 0x70D9, 0x7109, 0x70FD, 0x711C, 0x7119, 0x7165, 0x7155, 0x7188, - 0x7166, 0x7162, 0x714C, 0x7156, 0x716C, 0x718F, 0x71FB, 0x7184, - 0x7195, 0x71A8, 0x71AC, 0x71D7, 0x71B9, 0x71BE, 0x71D2, 0x71C9, - 0x71D4, 0x71CE, 0x71E0, 0x71EC, 0x71E7, 0x71F5, 0x71FC, -}; -static const unsigned short euc_to_utf8_E0[] = { - 0x71F9, 0x71FF, 0x720D, 0x7210, 0x721B, 0x7228, 0x722D, - 0x722C, 0x7230, 0x7232, 0x723B, 0x723C, 0x723F, 0x7240, 0x7246, - 0x724B, 0x7258, 0x7274, 0x727E, 0x7282, 0x7281, 0x7287, 0x7292, - 0x7296, 0x72A2, 0x72A7, 0x72B9, 0x72B2, 0x72C3, 0x72C6, 0x72C4, - 0x72CE, 0x72D2, 0x72E2, 0x72E0, 0x72E1, 0x72F9, 0x72F7, 0x500F, - 0x7317, 0x730A, 0x731C, 0x7316, 0x731D, 0x7334, 0x732F, 0x7329, - 0x7325, 0x733E, 0x734E, 0x734F, 0x9ED8, 0x7357, 0x736A, 0x7368, - 0x7370, 0x7378, 0x7375, 0x737B, 0x737A, 0x73C8, 0x73B3, 0x73CE, - 0x73BB, 0x73C0, 0x73E5, 0x73EE, 0x73DE, 0x74A2, 0x7405, 0x746F, - 0x7425, 0x73F8, 0x7432, 0x743A, 0x7455, 0x743F, 0x745F, 0x7459, - 0x7441, 0x745C, 0x7469, 0x7470, 0x7463, 0x746A, 0x7476, 0x747E, - 0x748B, 0x749E, 0x74A7, 0x74CA, 0x74CF, 0x74D4, 0x73F1, -}; -static const unsigned short euc_to_utf8_E1[] = { - 0x74E0, 0x74E3, 0x74E7, 0x74E9, 0x74EE, 0x74F2, 0x74F0, - 0x74F1, 0x74F8, 0x74F7, 0x7504, 0x7503, 0x7505, 0x750C, 0x750E, - 0x750D, 0x7515, 0x7513, 0x751E, 0x7526, 0x752C, 0x753C, 0x7544, - 0x754D, 0x754A, 0x7549, 0x755B, 0x7546, 0x755A, 0x7569, 0x7564, - 0x7567, 0x756B, 0x756D, 0x7578, 0x7576, 0x7586, 0x7587, 0x7574, - 0x758A, 0x7589, 0x7582, 0x7594, 0x759A, 0x759D, 0x75A5, 0x75A3, - 0x75C2, 0x75B3, 0x75C3, 0x75B5, 0x75BD, 0x75B8, 0x75BC, 0x75B1, - 0x75CD, 0x75CA, 0x75D2, 0x75D9, 0x75E3, 0x75DE, 0x75FE, 0x75FF, - 0x75FC, 0x7601, 0x75F0, 0x75FA, 0x75F2, 0x75F3, 0x760B, 0x760D, - 0x7609, 0x761F, 0x7627, 0x7620, 0x7621, 0x7622, 0x7624, 0x7634, - 0x7630, 0x763B, 0x7647, 0x7648, 0x7646, 0x765C, 0x7658, 0x7661, - 0x7662, 0x7668, 0x7669, 0x766A, 0x7667, 0x766C, 0x7670, -}; -static const unsigned short euc_to_utf8_E2[] = { - 0x7672, 0x7676, 0x7678, 0x767C, 0x7680, 0x7683, 0x7688, - 0x768B, 0x768E, 0x7696, 0x7693, 0x7699, 0x769A, 0x76B0, 0x76B4, - 0x76B8, 0x76B9, 0x76BA, 0x76C2, 0x76CD, 0x76D6, 0x76D2, 0x76DE, - 0x76E1, 0x76E5, 0x76E7, 0x76EA, 0x862F, 0x76FB, 0x7708, 0x7707, - 0x7704, 0x7729, 0x7724, 0x771E, 0x7725, 0x7726, 0x771B, 0x7737, - 0x7738, 0x7747, 0x775A, 0x7768, 0x776B, 0x775B, 0x7765, 0x777F, - 0x777E, 0x7779, 0x778E, 0x778B, 0x7791, 0x77A0, 0x779E, 0x77B0, - 0x77B6, 0x77B9, 0x77BF, 0x77BC, 0x77BD, 0x77BB, 0x77C7, 0x77CD, - 0x77D7, 0x77DA, 0x77DC, 0x77E3, 0x77EE, 0x77FC, 0x780C, 0x7812, - 0x7926, 0x7820, 0x792A, 0x7845, 0x788E, 0x7874, 0x7886, 0x787C, - 0x789A, 0x788C, 0x78A3, 0x78B5, 0x78AA, 0x78AF, 0x78D1, 0x78C6, - 0x78CB, 0x78D4, 0x78BE, 0x78BC, 0x78C5, 0x78CA, 0x78EC, -}; -static const unsigned short euc_to_utf8_E3[] = { - 0x78E7, 0x78DA, 0x78FD, 0x78F4, 0x7907, 0x7912, 0x7911, - 0x7919, 0x792C, 0x792B, 0x7940, 0x7960, 0x7957, 0x795F, 0x795A, - 0x7955, 0x7953, 0x797A, 0x797F, 0x798A, 0x799D, 0x79A7, 0x9F4B, - 0x79AA, 0x79AE, 0x79B3, 0x79B9, 0x79BA, 0x79C9, 0x79D5, 0x79E7, - 0x79EC, 0x79E1, 0x79E3, 0x7A08, 0x7A0D, 0x7A18, 0x7A19, 0x7A20, - 0x7A1F, 0x7980, 0x7A31, 0x7A3B, 0x7A3E, 0x7A37, 0x7A43, 0x7A57, - 0x7A49, 0x7A61, 0x7A62, 0x7A69, 0x9F9D, 0x7A70, 0x7A79, 0x7A7D, - 0x7A88, 0x7A97, 0x7A95, 0x7A98, 0x7A96, 0x7AA9, 0x7AC8, 0x7AB0, - 0x7AB6, 0x7AC5, 0x7AC4, 0x7ABF, 0x9083, 0x7AC7, 0x7ACA, 0x7ACD, - 0x7ACF, 0x7AD5, 0x7AD3, 0x7AD9, 0x7ADA, 0x7ADD, 0x7AE1, 0x7AE2, - 0x7AE6, 0x7AED, 0x7AF0, 0x7B02, 0x7B0F, 0x7B0A, 0x7B06, 0x7B33, - 0x7B18, 0x7B19, 0x7B1E, 0x7B35, 0x7B28, 0x7B36, 0x7B50, -}; -static const unsigned short euc_to_utf8_E4[] = { - 0x7B7A, 0x7B04, 0x7B4D, 0x7B0B, 0x7B4C, 0x7B45, 0x7B75, - 0x7B65, 0x7B74, 0x7B67, 0x7B70, 0x7B71, 0x7B6C, 0x7B6E, 0x7B9D, - 0x7B98, 0x7B9F, 0x7B8D, 0x7B9C, 0x7B9A, 0x7B8B, 0x7B92, 0x7B8F, - 0x7B5D, 0x7B99, 0x7BCB, 0x7BC1, 0x7BCC, 0x7BCF, 0x7BB4, 0x7BC6, - 0x7BDD, 0x7BE9, 0x7C11, 0x7C14, 0x7BE6, 0x7BE5, 0x7C60, 0x7C00, - 0x7C07, 0x7C13, 0x7BF3, 0x7BF7, 0x7C17, 0x7C0D, 0x7BF6, 0x7C23, - 0x7C27, 0x7C2A, 0x7C1F, 0x7C37, 0x7C2B, 0x7C3D, 0x7C4C, 0x7C43, - 0x7C54, 0x7C4F, 0x7C40, 0x7C50, 0x7C58, 0x7C5F, 0x7C64, 0x7C56, - 0x7C65, 0x7C6C, 0x7C75, 0x7C83, 0x7C90, 0x7CA4, 0x7CAD, 0x7CA2, - 0x7CAB, 0x7CA1, 0x7CA8, 0x7CB3, 0x7CB2, 0x7CB1, 0x7CAE, 0x7CB9, - 0x7CBD, 0x7CC0, 0x7CC5, 0x7CC2, 0x7CD8, 0x7CD2, 0x7CDC, 0x7CE2, - 0x9B3B, 0x7CEF, 0x7CF2, 0x7CF4, 0x7CF6, 0x7CFA, 0x7D06, -}; -static const unsigned short euc_to_utf8_E5[] = { - 0x7D02, 0x7D1C, 0x7D15, 0x7D0A, 0x7D45, 0x7D4B, 0x7D2E, - 0x7D32, 0x7D3F, 0x7D35, 0x7D46, 0x7D73, 0x7D56, 0x7D4E, 0x7D72, - 0x7D68, 0x7D6E, 0x7D4F, 0x7D63, 0x7D93, 0x7D89, 0x7D5B, 0x7D8F, - 0x7D7D, 0x7D9B, 0x7DBA, 0x7DAE, 0x7DA3, 0x7DB5, 0x7DC7, 0x7DBD, - 0x7DAB, 0x7E3D, 0x7DA2, 0x7DAF, 0x7DDC, 0x7DB8, 0x7D9F, 0x7DB0, - 0x7DD8, 0x7DDD, 0x7DE4, 0x7DDE, 0x7DFB, 0x7DF2, 0x7DE1, 0x7E05, - 0x7E0A, 0x7E23, 0x7E21, 0x7E12, 0x7E31, 0x7E1F, 0x7E09, 0x7E0B, - 0x7E22, 0x7E46, 0x7E66, 0x7E3B, 0x7E35, 0x7E39, 0x7E43, 0x7E37, - 0x7E32, 0x7E3A, 0x7E67, 0x7E5D, 0x7E56, 0x7E5E, 0x7E59, 0x7E5A, - 0x7E79, 0x7E6A, 0x7E69, 0x7E7C, 0x7E7B, 0x7E83, 0x7DD5, 0x7E7D, - 0x8FAE, 0x7E7F, 0x7E88, 0x7E89, 0x7E8C, 0x7E92, 0x7E90, 0x7E93, - 0x7E94, 0x7E96, 0x7E8E, 0x7E9B, 0x7E9C, 0x7F38, 0x7F3A, -}; -static const unsigned short euc_to_utf8_E6[] = { - 0x7F45, 0x7F4C, 0x7F4D, 0x7F4E, 0x7F50, 0x7F51, 0x7F55, - 0x7F54, 0x7F58, 0x7F5F, 0x7F60, 0x7F68, 0x7F69, 0x7F67, 0x7F78, - 0x7F82, 0x7F86, 0x7F83, 0x7F88, 0x7F87, 0x7F8C, 0x7F94, 0x7F9E, - 0x7F9D, 0x7F9A, 0x7FA3, 0x7FAF, 0x7FB2, 0x7FB9, 0x7FAE, 0x7FB6, - 0x7FB8, 0x8B71, 0x7FC5, 0x7FC6, 0x7FCA, 0x7FD5, 0x7FD4, 0x7FE1, - 0x7FE6, 0x7FE9, 0x7FF3, 0x7FF9, 0x98DC, 0x8006, 0x8004, 0x800B, - 0x8012, 0x8018, 0x8019, 0x801C, 0x8021, 0x8028, 0x803F, 0x803B, - 0x804A, 0x8046, 0x8052, 0x8058, 0x805A, 0x805F, 0x8062, 0x8068, - 0x8073, 0x8072, 0x8070, 0x8076, 0x8079, 0x807D, 0x807F, 0x8084, - 0x8086, 0x8085, 0x809B, 0x8093, 0x809A, 0x80AD, 0x5190, 0x80AC, - 0x80DB, 0x80E5, 0x80D9, 0x80DD, 0x80C4, 0x80DA, 0x80D6, 0x8109, - 0x80EF, 0x80F1, 0x811B, 0x8129, 0x8123, 0x812F, 0x814B, -}; -static const unsigned short euc_to_utf8_E7[] = { - 0x968B, 0x8146, 0x813E, 0x8153, 0x8151, 0x80FC, 0x8171, - 0x816E, 0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818A, 0x8180, - 0x8182, 0x81A0, 0x8195, 0x81A4, 0x81A3, 0x815F, 0x8193, 0x81A9, - 0x81B0, 0x81B5, 0x81BE, 0x81B8, 0x81BD, 0x81C0, 0x81C2, 0x81BA, - 0x81C9, 0x81CD, 0x81D1, 0x81D9, 0x81D8, 0x81C8, 0x81DA, 0x81DF, - 0x81E0, 0x81E7, 0x81FA, 0x81FB, 0x81FE, 0x8201, 0x8202, 0x8205, - 0x8207, 0x820A, 0x820D, 0x8210, 0x8216, 0x8229, 0x822B, 0x8238, - 0x8233, 0x8240, 0x8259, 0x8258, 0x825D, 0x825A, 0x825F, 0x8264, - 0x8262, 0x8268, 0x826A, 0x826B, 0x822E, 0x8271, 0x8277, 0x8278, - 0x827E, 0x828D, 0x8292, 0x82AB, 0x829F, 0x82BB, 0x82AC, 0x82E1, - 0x82E3, 0x82DF, 0x82D2, 0x82F4, 0x82F3, 0x82FA, 0x8393, 0x8303, - 0x82FB, 0x82F9, 0x82DE, 0x8306, 0x82DC, 0x8309, 0x82D9, -}; -static const unsigned short euc_to_utf8_E8[] = { - 0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339, - 0x8350, 0x8345, 0x832F, 0x832B, 0x8317, 0x8318, 0x8385, 0x839A, - 0x83AA, 0x839F, 0x83A2, 0x8396, 0x8323, 0x838E, 0x8387, 0x838A, - 0x837C, 0x83B5, 0x8373, 0x8375, 0x83A0, 0x8389, 0x83A8, 0x83F4, - 0x8413, 0x83EB, 0x83CE, 0x83FD, 0x8403, 0x83D8, 0x840B, 0x83C1, - 0x83F7, 0x8407, 0x83E0, 0x83F2, 0x840D, 0x8422, 0x8420, 0x83BD, - 0x8438, 0x8506, 0x83FB, 0x846D, 0x842A, 0x843C, 0x855A, 0x8484, - 0x8477, 0x846B, 0x84AD, 0x846E, 0x8482, 0x8469, 0x8446, 0x842C, - 0x846F, 0x8479, 0x8435, 0x84CA, 0x8462, 0x84B9, 0x84BF, 0x849F, - 0x84D9, 0x84CD, 0x84BB, 0x84DA, 0x84D0, 0x84C1, 0x84C6, 0x84D6, - 0x84A1, 0x8521, 0x84FF, 0x84F4, 0x8517, 0x8518, 0x852C, 0x851F, - 0x8515, 0x8514, 0x84FC, 0x8540, 0x8563, 0x8558, 0x8548, -}; -static const unsigned short euc_to_utf8_E9[] = { - 0x8541, 0x8602, 0x854B, 0x8555, 0x8580, 0x85A4, 0x8588, - 0x8591, 0x858A, 0x85A8, 0x856D, 0x8594, 0x859B, 0x85EA, 0x8587, - 0x859C, 0x8577, 0x857E, 0x8590, 0x85C9, 0x85BA, 0x85CF, 0x85B9, - 0x85D0, 0x85D5, 0x85DD, 0x85E5, 0x85DC, 0x85F9, 0x860A, 0x8613, - 0x860B, 0x85FE, 0x85FA, 0x8606, 0x8622, 0x861A, 0x8630, 0x863F, - 0x864D, 0x4E55, 0x8654, 0x865F, 0x8667, 0x8671, 0x8693, 0x86A3, - 0x86A9, 0x86AA, 0x868B, 0x868C, 0x86B6, 0x86AF, 0x86C4, 0x86C6, - 0x86B0, 0x86C9, 0x8823, 0x86AB, 0x86D4, 0x86DE, 0x86E9, 0x86EC, - 0x86DF, 0x86DB, 0x86EF, 0x8712, 0x8706, 0x8708, 0x8700, 0x8703, - 0x86FB, 0x8711, 0x8709, 0x870D, 0x86F9, 0x870A, 0x8734, 0x873F, - 0x8737, 0x873B, 0x8725, 0x8729, 0x871A, 0x8760, 0x875F, 0x8778, - 0x874C, 0x874E, 0x8774, 0x8757, 0x8768, 0x876E, 0x8759, -}; -static const unsigned short euc_to_utf8_EA[] = { - 0x8753, 0x8763, 0x876A, 0x8805, 0x87A2, 0x879F, 0x8782, - 0x87AF, 0x87CB, 0x87BD, 0x87C0, 0x87D0, 0x96D6, 0x87AB, 0x87C4, - 0x87B3, 0x87C7, 0x87C6, 0x87BB, 0x87EF, 0x87F2, 0x87E0, 0x880F, - 0x880D, 0x87FE, 0x87F6, 0x87F7, 0x880E, 0x87D2, 0x8811, 0x8816, - 0x8815, 0x8822, 0x8821, 0x8831, 0x8836, 0x8839, 0x8827, 0x883B, - 0x8844, 0x8842, 0x8852, 0x8859, 0x885E, 0x8862, 0x886B, 0x8881, - 0x887E, 0x889E, 0x8875, 0x887D, 0x88B5, 0x8872, 0x8882, 0x8897, - 0x8892, 0x88AE, 0x8899, 0x88A2, 0x888D, 0x88A4, 0x88B0, 0x88BF, - 0x88B1, 0x88C3, 0x88C4, 0x88D4, 0x88D8, 0x88D9, 0x88DD, 0x88F9, - 0x8902, 0x88FC, 0x88F4, 0x88E8, 0x88F2, 0x8904, 0x890C, 0x890A, - 0x8913, 0x8943, 0x891E, 0x8925, 0x892A, 0x892B, 0x8941, 0x8944, - 0x893B, 0x8936, 0x8938, 0x894C, 0x891D, 0x8960, 0x895E, -}; -static const unsigned short euc_to_utf8_EB[] = { - 0x8966, 0x8964, 0x896D, 0x896A, 0x896F, 0x8974, 0x8977, - 0x897E, 0x8983, 0x8988, 0x898A, 0x8993, 0x8998, 0x89A1, 0x89A9, - 0x89A6, 0x89AC, 0x89AF, 0x89B2, 0x89BA, 0x89BD, 0x89BF, 0x89C0, - 0x89DA, 0x89DC, 0x89DD, 0x89E7, 0x89F4, 0x89F8, 0x8A03, 0x8A16, - 0x8A10, 0x8A0C, 0x8A1B, 0x8A1D, 0x8A25, 0x8A36, 0x8A41, 0x8A5B, - 0x8A52, 0x8A46, 0x8A48, 0x8A7C, 0x8A6D, 0x8A6C, 0x8A62, 0x8A85, - 0x8A82, 0x8A84, 0x8AA8, 0x8AA1, 0x8A91, 0x8AA5, 0x8AA6, 0x8A9A, - 0x8AA3, 0x8AC4, 0x8ACD, 0x8AC2, 0x8ADA, 0x8AEB, 0x8AF3, 0x8AE7, - 0x8AE4, 0x8AF1, 0x8B14, 0x8AE0, 0x8AE2, 0x8AF7, 0x8ADE, 0x8ADB, - 0x8B0C, 0x8B07, 0x8B1A, 0x8AE1, 0x8B16, 0x8B10, 0x8B17, 0x8B20, - 0x8B33, 0x97AB, 0x8B26, 0x8B2B, 0x8B3E, 0x8B28, 0x8B41, 0x8B4C, - 0x8B4F, 0x8B4E, 0x8B49, 0x8B56, 0x8B5B, 0x8B5A, 0x8B6B, -}; -static const unsigned short euc_to_utf8_EC[] = { - 0x8B5F, 0x8B6C, 0x8B6F, 0x8B74, 0x8B7D, 0x8B80, 0x8B8C, - 0x8B8E, 0x8B92, 0x8B93, 0x8B96, 0x8B99, 0x8B9A, 0x8C3A, 0x8C41, - 0x8C3F, 0x8C48, 0x8C4C, 0x8C4E, 0x8C50, 0x8C55, 0x8C62, 0x8C6C, - 0x8C78, 0x8C7A, 0x8C82, 0x8C89, 0x8C85, 0x8C8A, 0x8C8D, 0x8C8E, - 0x8C94, 0x8C7C, 0x8C98, 0x621D, 0x8CAD, 0x8CAA, 0x8CBD, 0x8CB2, - 0x8CB3, 0x8CAE, 0x8CB6, 0x8CC8, 0x8CC1, 0x8CE4, 0x8CE3, 0x8CDA, - 0x8CFD, 0x8CFA, 0x8CFB, 0x8D04, 0x8D05, 0x8D0A, 0x8D07, 0x8D0F, - 0x8D0D, 0x8D10, 0x9F4E, 0x8D13, 0x8CCD, 0x8D14, 0x8D16, 0x8D67, - 0x8D6D, 0x8D71, 0x8D73, 0x8D81, 0x8D99, 0x8DC2, 0x8DBE, 0x8DBA, - 0x8DCF, 0x8DDA, 0x8DD6, 0x8DCC, 0x8DDB, 0x8DCB, 0x8DEA, 0x8DEB, - 0x8DDF, 0x8DE3, 0x8DFC, 0x8E08, 0x8E09, 0x8DFF, 0x8E1D, 0x8E1E, - 0x8E10, 0x8E1F, 0x8E42, 0x8E35, 0x8E30, 0x8E34, 0x8E4A, -}; -static const unsigned short euc_to_utf8_ED[] = { - 0x8E47, 0x8E49, 0x8E4C, 0x8E50, 0x8E48, 0x8E59, 0x8E64, - 0x8E60, 0x8E2A, 0x8E63, 0x8E55, 0x8E76, 0x8E72, 0x8E7C, 0x8E81, - 0x8E87, 0x8E85, 0x8E84, 0x8E8B, 0x8E8A, 0x8E93, 0x8E91, 0x8E94, - 0x8E99, 0x8EAA, 0x8EA1, 0x8EAC, 0x8EB0, 0x8EC6, 0x8EB1, 0x8EBE, - 0x8EC5, 0x8EC8, 0x8ECB, 0x8EDB, 0x8EE3, 0x8EFC, 0x8EFB, 0x8EEB, - 0x8EFE, 0x8F0A, 0x8F05, 0x8F15, 0x8F12, 0x8F19, 0x8F13, 0x8F1C, - 0x8F1F, 0x8F1B, 0x8F0C, 0x8F26, 0x8F33, 0x8F3B, 0x8F39, 0x8F45, - 0x8F42, 0x8F3E, 0x8F4C, 0x8F49, 0x8F46, 0x8F4E, 0x8F57, 0x8F5C, - 0x8F62, 0x8F63, 0x8F64, 0x8F9C, 0x8F9F, 0x8FA3, 0x8FAD, 0x8FAF, - 0x8FB7, 0x8FDA, 0x8FE5, 0x8FE2, 0x8FEA, 0x8FEF, 0x9087, 0x8FF4, - 0x9005, 0x8FF9, 0x8FFA, 0x9011, 0x9015, 0x9021, 0x900D, 0x901E, - 0x9016, 0x900B, 0x9027, 0x9036, 0x9035, 0x9039, 0x8FF8, -}; -static const unsigned short euc_to_utf8_EE[] = { - 0x904F, 0x9050, 0x9051, 0x9052, 0x900E, 0x9049, 0x903E, - 0x9056, 0x9058, 0x905E, 0x9068, 0x906F, 0x9076, 0x96A8, 0x9072, - 0x9082, 0x907D, 0x9081, 0x9080, 0x908A, 0x9089, 0x908F, 0x90A8, - 0x90AF, 0x90B1, 0x90B5, 0x90E2, 0x90E4, 0x6248, 0x90DB, 0x9102, - 0x9112, 0x9119, 0x9132, 0x9130, 0x914A, 0x9156, 0x9158, 0x9163, - 0x9165, 0x9169, 0x9173, 0x9172, 0x918B, 0x9189, 0x9182, 0x91A2, - 0x91AB, 0x91AF, 0x91AA, 0x91B5, 0x91B4, 0x91BA, 0x91C0, 0x91C1, - 0x91C9, 0x91CB, 0x91D0, 0x91D6, 0x91DF, 0x91E1, 0x91DB, 0x91FC, - 0x91F5, 0x91F6, 0x921E, 0x91FF, 0x9214, 0x922C, 0x9215, 0x9211, - 0x925E, 0x9257, 0x9245, 0x9249, 0x9264, 0x9248, 0x9295, 0x923F, - 0x924B, 0x9250, 0x929C, 0x9296, 0x9293, 0x929B, 0x925A, 0x92CF, - 0x92B9, 0x92B7, 0x92E9, 0x930F, 0x92FA, 0x9344, 0x932E, -}; -static const unsigned short euc_to_utf8_EF[] = { - 0x9319, 0x9322, 0x931A, 0x9323, 0x933A, 0x9335, 0x933B, - 0x935C, 0x9360, 0x937C, 0x936E, 0x9356, 0x93B0, 0x93AC, 0x93AD, - 0x9394, 0x93B9, 0x93D6, 0x93D7, 0x93E8, 0x93E5, 0x93D8, 0x93C3, - 0x93DD, 0x93D0, 0x93C8, 0x93E4, 0x941A, 0x9414, 0x9413, 0x9403, - 0x9407, 0x9410, 0x9436, 0x942B, 0x9435, 0x9421, 0x943A, 0x9441, - 0x9452, 0x9444, 0x945B, 0x9460, 0x9462, 0x945E, 0x946A, 0x9229, - 0x9470, 0x9475, 0x9477, 0x947D, 0x945A, 0x947C, 0x947E, 0x9481, - 0x947F, 0x9582, 0x9587, 0x958A, 0x9594, 0x9596, 0x9598, 0x9599, - 0x95A0, 0x95A8, 0x95A7, 0x95AD, 0x95BC, 0x95BB, 0x95B9, 0x95BE, - 0x95CA, 0x6FF6, 0x95C3, 0x95CD, 0x95CC, 0x95D5, 0x95D4, 0x95D6, - 0x95DC, 0x95E1, 0x95E5, 0x95E2, 0x9621, 0x9628, 0x962E, 0x962F, - 0x9642, 0x964C, 0x964F, 0x964B, 0x9677, 0x965C, 0x965E, -}; -static const unsigned short euc_to_utf8_F0[] = { - 0x965D, 0x965F, 0x9666, 0x9672, 0x966C, 0x968D, 0x9698, - 0x9695, 0x9697, 0x96AA, 0x96A7, 0x96B1, 0x96B2, 0x96B0, 0x96B4, - 0x96B6, 0x96B8, 0x96B9, 0x96CE, 0x96CB, 0x96C9, 0x96CD, 0x894D, - 0x96DC, 0x970D, 0x96D5, 0x96F9, 0x9704, 0x9706, 0x9708, 0x9713, - 0x970E, 0x9711, 0x970F, 0x9716, 0x9719, 0x9724, 0x972A, 0x9730, - 0x9739, 0x973D, 0x973E, 0x9744, 0x9746, 0x9748, 0x9742, 0x9749, - 0x975C, 0x9760, 0x9764, 0x9766, 0x9768, 0x52D2, 0x976B, 0x9771, - 0x9779, 0x9785, 0x977C, 0x9781, 0x977A, 0x9786, 0x978B, 0x978F, - 0x9790, 0x979C, 0x97A8, 0x97A6, 0x97A3, 0x97B3, 0x97B4, 0x97C3, - 0x97C6, 0x97C8, 0x97CB, 0x97DC, 0x97ED, 0x9F4F, 0x97F2, 0x7ADF, - 0x97F6, 0x97F5, 0x980F, 0x980C, 0x9838, 0x9824, 0x9821, 0x9837, - 0x983D, 0x9846, 0x984F, 0x984B, 0x986B, 0x986F, 0x9870, -}; -static const unsigned short euc_to_utf8_F1[] = { - 0x9871, 0x9874, 0x9873, 0x98AA, 0x98AF, 0x98B1, 0x98B6, - 0x98C4, 0x98C3, 0x98C6, 0x98E9, 0x98EB, 0x9903, 0x9909, 0x9912, - 0x9914, 0x9918, 0x9921, 0x991D, 0x991E, 0x9924, 0x9920, 0x992C, - 0x992E, 0x993D, 0x993E, 0x9942, 0x9949, 0x9945, 0x9950, 0x994B, - 0x9951, 0x9952, 0x994C, 0x9955, 0x9997, 0x9998, 0x99A5, 0x99AD, - 0x99AE, 0x99BC, 0x99DF, 0x99DB, 0x99DD, 0x99D8, 0x99D1, 0x99ED, - 0x99EE, 0x99F1, 0x99F2, 0x99FB, 0x99F8, 0x9A01, 0x9A0F, 0x9A05, - 0x99E2, 0x9A19, 0x9A2B, 0x9A37, 0x9A45, 0x9A42, 0x9A40, 0x9A43, - 0x9A3E, 0x9A55, 0x9A4D, 0x9A5B, 0x9A57, 0x9A5F, 0x9A62, 0x9A65, - 0x9A64, 0x9A69, 0x9A6B, 0x9A6A, 0x9AAD, 0x9AB0, 0x9ABC, 0x9AC0, - 0x9ACF, 0x9AD1, 0x9AD3, 0x9AD4, 0x9ADE, 0x9ADF, 0x9AE2, 0x9AE3, - 0x9AE6, 0x9AEF, 0x9AEB, 0x9AEE, 0x9AF4, 0x9AF1, 0x9AF7, -}; -static const unsigned short euc_to_utf8_F2[] = { - 0x9AFB, 0x9B06, 0x9B18, 0x9B1A, 0x9B1F, 0x9B22, 0x9B23, - 0x9B25, 0x9B27, 0x9B28, 0x9B29, 0x9B2A, 0x9B2E, 0x9B2F, 0x9B32, - 0x9B44, 0x9B43, 0x9B4F, 0x9B4D, 0x9B4E, 0x9B51, 0x9B58, 0x9B74, - 0x9B93, 0x9B83, 0x9B91, 0x9B96, 0x9B97, 0x9B9F, 0x9BA0, 0x9BA8, - 0x9BB4, 0x9BC0, 0x9BCA, 0x9BB9, 0x9BC6, 0x9BCF, 0x9BD1, 0x9BD2, - 0x9BE3, 0x9BE2, 0x9BE4, 0x9BD4, 0x9BE1, 0x9C3A, 0x9BF2, 0x9BF1, - 0x9BF0, 0x9C15, 0x9C14, 0x9C09, 0x9C13, 0x9C0C, 0x9C06, 0x9C08, - 0x9C12, 0x9C0A, 0x9C04, 0x9C2E, 0x9C1B, 0x9C25, 0x9C24, 0x9C21, - 0x9C30, 0x9C47, 0x9C32, 0x9C46, 0x9C3E, 0x9C5A, 0x9C60, 0x9C67, - 0x9C76, 0x9C78, 0x9CE7, 0x9CEC, 0x9CF0, 0x9D09, 0x9D08, 0x9CEB, - 0x9D03, 0x9D06, 0x9D2A, 0x9D26, 0x9DAF, 0x9D23, 0x9D1F, 0x9D44, - 0x9D15, 0x9D12, 0x9D41, 0x9D3F, 0x9D3E, 0x9D46, 0x9D48, -}; -static const unsigned short euc_to_utf8_F3[] = { - 0x9D5D, 0x9D5E, 0x9D64, 0x9D51, 0x9D50, 0x9D59, 0x9D72, - 0x9D89, 0x9D87, 0x9DAB, 0x9D6F, 0x9D7A, 0x9D9A, 0x9DA4, 0x9DA9, - 0x9DB2, 0x9DC4, 0x9DC1, 0x9DBB, 0x9DB8, 0x9DBA, 0x9DC6, 0x9DCF, - 0x9DC2, 0x9DD9, 0x9DD3, 0x9DF8, 0x9DE6, 0x9DED, 0x9DEF, 0x9DFD, - 0x9E1A, 0x9E1B, 0x9E1E, 0x9E75, 0x9E79, 0x9E7D, 0x9E81, 0x9E88, - 0x9E8B, 0x9E8C, 0x9E92, 0x9E95, 0x9E91, 0x9E9D, 0x9EA5, 0x9EA9, - 0x9EB8, 0x9EAA, 0x9EAD, 0x9761, 0x9ECC, 0x9ECE, 0x9ECF, 0x9ED0, - 0x9ED4, 0x9EDC, 0x9EDE, 0x9EDD, 0x9EE0, 0x9EE5, 0x9EE8, 0x9EEF, - 0x9EF4, 0x9EF6, 0x9EF7, 0x9EF9, 0x9EFB, 0x9EFC, 0x9EFD, 0x9F07, - 0x9F08, 0x76B7, 0x9F15, 0x9F21, 0x9F2C, 0x9F3E, 0x9F4A, 0x9F52, - 0x9F54, 0x9F63, 0x9F5F, 0x9F60, 0x9F61, 0x9F66, 0x9F67, 0x9F6C, - 0x9F6A, 0x9F77, 0x9F72, 0x9F76, 0x9F95, 0x9F9C, 0x9FA0, -}; -static const unsigned short euc_to_utf8_F4[] = { - 0x582F, 0x69C7, 0x9059, 0x7464, 0x51DC, 0x7199, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 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, - 0, 0, 0xFE33, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFE31, 0, 0, - 0, 0, 0, 0, 0, 0xFE30, 0, 0, - 0, 0, 0xFE35, 0xFE36, 0xFE39, 0xFE3A, 0, 0, - 0xFE37, 0xFE38, 0xFE3F, 0xFE40, 0xFE3D, 0xFE3E, 0xFE41, 0xFE42, - 0xFE43, 0xFE44, 0xFE3B, 0xFE3C, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 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, - 0x4F00, 0x4F03, 0x4F39, 0x4F56, 0x4F92, 0x4F8A, 0x4F9A, 0x4F94, - 0x4FCD, 0x5040, 0x5022, 0x4FFF, 0x501E, 0x5046, 0x5070, 0x5042, - 0x5094, 0x50F4, 0x50D8, 0x514A, 0x5164, 0x519D, 0x51BE, 0x51EC, - 0x5215, 0x529C, 0x52A6, 0x52C0, 0x52DB, 0x5300, 0x5307, 0x5324, - 0x5372, 0x5393, 0x53B2, 0x53DD, 0xFA0E, 0x549C, 0x548A, 0x54A9, - 0x54FF, 0x5586, 0x5759, 0x5765, 0x57AC, 0x57C8, 0x57C7, 0xFA0F, - 0xFA10, 0x589E, 0x58B2, 0x590B, 0x5953, 0x595B, 0x595D, 0x5963, - 0x59A4, 0x59BA, 0x5B56, 0x5BC0, 0x752F, 0x5BD8, 0x5BEC, 0x5C1E, - 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, - 0x6460, 0x649D, 0x64CE, 0x654E, 0x6600, 0x6615, 0x663B, 0x6609, - 0x662E, 0x661E, 0x6624, 0x6665, 0x6657, 0x6659, 0xFA12, 0x6673, - 0x6699, 0x66A0, 0x66B2, 0x66BF, 0x66FA, 0x670E, 0xF929, 0x6766, - 0x67BB, 0x6852, 0x67C0, 0x6801, 0x6844, 0x68CF, 0xFA13, 0x6968, - 0xFA14, 0x6998, 0x69E2, 0x6A30, 0x6A6B, 0x6A46, 0x6A73, 0x6A7E, - 0x6AE2, 0x6AE4, 0x6BD6, 0x6C3F, 0x6C5C, 0x6C86, 0x6C6F, 0x6CDA, - 0x6D04, 0x6D87, 0x6D6F, 0x6D96, 0x6DAC, 0x6DCF, 0x6DF8, 0x6DF2, - 0x6DFC, 0x6E39, 0x6E5C, 0x6E27, 0x6E3C, 0x6EBF, 0x6F88, 0x6FB5, - 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, - 0x7462, 0x7489, 0x749F, 0x7501, 0x756F, 0x7682, 0x769C, 0x769E, - 0x769B, 0x76A6, 0xFA17, 0x7746, 0x52AF, 0x7821, 0x784E, 0x7864, - 0x787A, 0x7930, 0xFA18, 0xFA19, 0xFA1A, 0x7994, 0xFA1B, 0x799B, - 0x7AD1, 0x7AE7, 0xFA1C, 0x7AEB, 0x7B9E, 0xFA1D, 0x7D48, 0x7D5C, - 0x7DB7, 0x7DA0, 0x7DD6, 0x7E52, 0x7F47, 0x7FA1, 0xFA1E, 0x8301, - 0x8362, 0x837F, 0x83C7, 0x83F6, 0x8448, 0x84B4, 0x8553, 0x8559, - 0x856B, 0xFA1F, 0x85B0, 0xFA20, 0xFA21, 0x8807, 0x88F5, 0x8A12, - 0x8A37, 0x8A79, 0x8AA7, 0x8ABE, 0x8ADF, 0xFA22, 0x8AF6, 0x8B53, - 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, - 0x9239, 0x9267, 0x92A7, 0x9277, 0x9278, 0x92E7, 0x92D7, 0x92D9, - 0x92D0, 0xFA27, 0x92D5, 0x92E0, 0x92D3, 0x9325, 0x9321, 0x92FB, - 0xFA28, 0x931E, 0x92FF, 0x931D, 0x9302, 0x9370, 0x9357, 0x93A4, - 0x93C6, 0x93DE, 0x93F8, 0x9431, 0x9445, 0x9448, 0x9592, 0xF9DC, - 0xFA29, 0x969D, 0x96AF, 0x9733, 0x973B, 0x9743, 0x974D, 0x974F, - 0x9751, 0x9755, 0x9857, 0x9865, 0xFA2A, 0xFA2B, 0x9927, 0xFA2C, - 0x999E, 0x9A4E, 0x9AD9, 0x9ADC, 0x9B75, 0x9B72, 0x9B8F, 0x9BB1, - 0x9BBB, 0x9C00, 0x9D70, 0x9D6B, 0xFA2D, 0x9E19, 0x9ED1, 0, - 0, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, - 0x2177, 0x2178, 0x2179, 0xFFE2, 0x00A6, 0xFF07, 0xFF02, -}; - -/* Microsoft UCS Mapping Compatible */ -static const unsigned short euc_to_utf8_FC_ms[] = { - 0x91D7, 0x91DE, 0x91ED, 0x91EE, 0x91E4, 0x91E5, 0x9206, - 0x9210, 0x920A, 0x923A, 0x9240, 0x923C, 0x924E, 0x9259, 0x9251, - 0x9239, 0x9267, 0x92A7, 0x9277, 0x9278, 0x92E7, 0x92D7, 0x92D9, - 0x92D0, 0xFA27, 0x92D5, 0x92E0, 0x92D3, 0x9325, 0x9321, 0x92FB, - 0xFA28, 0x931E, 0x92FF, 0x931D, 0x9302, 0x9370, 0x9357, 0x93A4, - 0x93C6, 0x93DE, 0x93F8, 0x9431, 0x9445, 0x9448, 0x9592, 0xF9DC, - 0xFA29, 0x969D, 0x96AF, 0x9733, 0x973B, 0x9743, 0x974D, 0x974F, - 0x9751, 0x9755, 0x9857, 0x9865, 0xFA2A, 0xFA2B, 0x9927, 0xFA2C, - 0x999E, 0x9A4E, 0x9AD9, 0x9ADC, 0x9B75, 0x9B72, 0x9B8F, 0x9BB1, - 0x9BBB, 0x9C00, 0x9D70, 0x9D6B, 0xFA2D, 0x9E19, 0x9ED1, 0, - 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[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0x02D8, - 0x02C7, 0x00B8, 0x02D9, 0x02DD, 0x00AF, 0x02DB, 0x02DA, 0xFF5E, - 0x0384, 0x0385, 0, 0, 0, 0, 0, 0, - 0, 0, 0x00A1, 0xFFE4, 0x00BF, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x00BA, 0x00AA, 0x00A9, 0x00AE, 0x2122, - 0x00A4, 0x2116, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short euc_to_utf8_8FA6[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x0386, 0x0388, 0x0389, 0x038A, 0x03AA, 0, 0x038C, - 0, 0x038E, 0x03AB, 0, 0x038F, 0, 0, 0, - 0, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03CA, 0x0390, 0x03CC, - 0x03C2, 0x03CD, 0x03CB, 0x03B0, 0x03CE, 0, 0, -}; -static const unsigned short euc_to_utf8_8FA7[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x040E, 0x040F, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x045E, 0x045F, -}; -static const unsigned short euc_to_utf8_8FA9[] = { - 0x00C6, 0x0110, 0, 0x0126, 0, 0x0132, 0, - 0x0141, 0x013F, 0, 0x014A, 0x00D8, 0x0152, 0, 0x0166, - 0x00DE, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x00E6, 0x0111, 0x00F0, 0x0127, 0x0131, 0x0133, 0x0138, - 0x0142, 0x0140, 0x0149, 0x014B, 0x00F8, 0x0153, 0x00DF, 0x0167, - 0x00FE, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 euc_to_utf8_8FAA[] = { - 0x00C1, 0x00C0, 0x00C4, 0x00C2, 0x0102, 0x01CD, 0x0100, - 0x0104, 0x00C5, 0x00C3, 0x0106, 0x0108, 0x010C, 0x00C7, 0x010A, - 0x010E, 0x00C9, 0x00C8, 0x00CB, 0x00CA, 0x011A, 0x0116, 0x0112, - 0x0118, 0, 0x011C, 0x011E, 0x0122, 0x0120, 0x0124, 0x00CD, - 0x00CC, 0x00CF, 0x00CE, 0x01CF, 0x0130, 0x012A, 0x012E, 0x0128, - 0x0134, 0x0136, 0x0139, 0x013D, 0x013B, 0x0143, 0x0147, 0x0145, - 0x00D1, 0x00D3, 0x00D2, 0x00D6, 0x00D4, 0x01D1, 0x0150, 0x014C, - 0x00D5, 0x0154, 0x0158, 0x0156, 0x015A, 0x015C, 0x0160, 0x015E, - 0x0164, 0x0162, 0x00DA, 0x00D9, 0x00DC, 0x00DB, 0x016C, 0x01D3, - 0x0170, 0x016A, 0x0172, 0x016E, 0x0168, 0x01D7, 0x01DB, 0x01D9, - 0x01D5, 0x0174, 0x00DD, 0x0178, 0x0176, 0x0179, 0x017D, 0x017B, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short euc_to_utf8_8FAB[] = { - 0x00E1, 0x00E0, 0x00E4, 0x00E2, 0x0103, 0x01CE, 0x0101, - 0x0105, 0x00E5, 0x00E3, 0x0107, 0x0109, 0x010D, 0x00E7, 0x010B, - 0x010F, 0x00E9, 0x00E8, 0x00EB, 0x00EA, 0x011B, 0x0117, 0x0113, - 0x0119, 0x01F5, 0x011D, 0x011F, 0, 0x0121, 0x0125, 0x00ED, - 0x00EC, 0x00EF, 0x00EE, 0x01D0, 0, 0x012B, 0x012F, 0x0129, - 0x0135, 0x0137, 0x013A, 0x013E, 0x013C, 0x0144, 0x0148, 0x0146, - 0x00F1, 0x00F3, 0x00F2, 0x00F6, 0x00F4, 0x01D2, 0x0151, 0x014D, - 0x00F5, 0x0155, 0x0159, 0x0157, 0x015B, 0x015D, 0x0161, 0x015F, - 0x0165, 0x0163, 0x00FA, 0x00F9, 0x00FC, 0x00FB, 0x016D, 0x01D4, - 0x0171, 0x016B, 0x0173, 0x016F, 0x0169, 0x01D8, 0x01DC, 0x01DA, - 0x01D6, 0x0175, 0x00FD, 0x00FF, 0x0177, 0x017A, 0x017E, 0x017C, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short euc_to_utf8_8FB0[] = { - 0x4E02, 0x4E04, 0x4E05, 0x4E0C, 0x4E12, 0x4E1F, 0x4E23, - 0x4E24, 0x4E28, 0x4E2B, 0x4E2E, 0x4E2F, 0x4E30, 0x4E35, 0x4E40, - 0x4E41, 0x4E44, 0x4E47, 0x4E51, 0x4E5A, 0x4E5C, 0x4E63, 0x4E68, - 0x4E69, 0x4E74, 0x4E75, 0x4E79, 0x4E7F, 0x4E8D, 0x4E96, 0x4E97, - 0x4E9D, 0x4EAF, 0x4EB9, 0x4EC3, 0x4ED0, 0x4EDA, 0x4EDB, 0x4EE0, - 0x4EE1, 0x4EE2, 0x4EE8, 0x4EEF, 0x4EF1, 0x4EF3, 0x4EF5, 0x4EFD, - 0x4EFE, 0x4EFF, 0x4F00, 0x4F02, 0x4F03, 0x4F08, 0x4F0B, 0x4F0C, - 0x4F12, 0x4F15, 0x4F16, 0x4F17, 0x4F19, 0x4F2E, 0x4F31, 0x4F60, - 0x4F33, 0x4F35, 0x4F37, 0x4F39, 0x4F3B, 0x4F3E, 0x4F40, 0x4F42, - 0x4F48, 0x4F49, 0x4F4B, 0x4F4C, 0x4F52, 0x4F54, 0x4F56, 0x4F58, - 0x4F5F, 0x4F63, 0x4F6A, 0x4F6C, 0x4F6E, 0x4F71, 0x4F77, 0x4F78, - 0x4F79, 0x4F7A, 0x4F7D, 0x4F7E, 0x4F81, 0x4F82, 0x4F84, -}; -static const unsigned short euc_to_utf8_8FB1[] = { - 0x4F85, 0x4F89, 0x4F8A, 0x4F8C, 0x4F8E, 0x4F90, 0x4F92, - 0x4F93, 0x4F94, 0x4F97, 0x4F99, 0x4F9A, 0x4F9E, 0x4F9F, 0x4FB2, - 0x4FB7, 0x4FB9, 0x4FBB, 0x4FBC, 0x4FBD, 0x4FBE, 0x4FC0, 0x4FC1, - 0x4FC5, 0x4FC6, 0x4FC8, 0x4FC9, 0x4FCB, 0x4FCC, 0x4FCD, 0x4FCF, - 0x4FD2, 0x4FDC, 0x4FE0, 0x4FE2, 0x4FF0, 0x4FF2, 0x4FFC, 0x4FFD, - 0x4FFF, 0x5000, 0x5001, 0x5004, 0x5007, 0x500A, 0x500C, 0x500E, - 0x5010, 0x5013, 0x5017, 0x5018, 0x501B, 0x501C, 0x501D, 0x501E, - 0x5022, 0x5027, 0x502E, 0x5030, 0x5032, 0x5033, 0x5035, 0x5040, - 0x5041, 0x5042, 0x5045, 0x5046, 0x504A, 0x504C, 0x504E, 0x5051, - 0x5052, 0x5053, 0x5057, 0x5059, 0x505F, 0x5060, 0x5062, 0x5063, - 0x5066, 0x5067, 0x506A, 0x506D, 0x5070, 0x5071, 0x503B, 0x5081, - 0x5083, 0x5084, 0x5086, 0x508A, 0x508E, 0x508F, 0x5090, -}; -static const unsigned short euc_to_utf8_8FB2[] = { - 0x5092, 0x5093, 0x5094, 0x5096, 0x509B, 0x509C, 0x509E, - 0x509F, 0x50A0, 0x50A1, 0x50A2, 0x50AA, 0x50AF, 0x50B0, 0x50B9, - 0x50BA, 0x50BD, 0x50C0, 0x50C3, 0x50C4, 0x50C7, 0x50CC, 0x50CE, - 0x50D0, 0x50D3, 0x50D4, 0x50D8, 0x50DC, 0x50DD, 0x50DF, 0x50E2, - 0x50E4, 0x50E6, 0x50E8, 0x50E9, 0x50EF, 0x50F1, 0x50F6, 0x50FA, - 0x50FE, 0x5103, 0x5106, 0x5107, 0x5108, 0x510B, 0x510C, 0x510D, - 0x510E, 0x50F2, 0x5110, 0x5117, 0x5119, 0x511B, 0x511C, 0x511D, - 0x511E, 0x5123, 0x5127, 0x5128, 0x512C, 0x512D, 0x512F, 0x5131, - 0x5133, 0x5134, 0x5135, 0x5138, 0x5139, 0x5142, 0x514A, 0x514F, - 0x5153, 0x5155, 0x5157, 0x5158, 0x515F, 0x5164, 0x5166, 0x517E, - 0x5183, 0x5184, 0x518B, 0x518E, 0x5198, 0x519D, 0x51A1, 0x51A3, - 0x51AD, 0x51B8, 0x51BA, 0x51BC, 0x51BE, 0x51BF, 0x51C2, -}; -static const unsigned short euc_to_utf8_8FB3[] = { - 0x51C8, 0x51CF, 0x51D1, 0x51D2, 0x51D3, 0x51D5, 0x51D8, - 0x51DE, 0x51E2, 0x51E5, 0x51EE, 0x51F2, 0x51F3, 0x51F4, 0x51F7, - 0x5201, 0x5202, 0x5205, 0x5212, 0x5213, 0x5215, 0x5216, 0x5218, - 0x5222, 0x5228, 0x5231, 0x5232, 0x5235, 0x523C, 0x5245, 0x5249, - 0x5255, 0x5257, 0x5258, 0x525A, 0x525C, 0x525F, 0x5260, 0x5261, - 0x5266, 0x526E, 0x5277, 0x5278, 0x5279, 0x5280, 0x5282, 0x5285, - 0x528A, 0x528C, 0x5293, 0x5295, 0x5296, 0x5297, 0x5298, 0x529A, - 0x529C, 0x52A4, 0x52A5, 0x52A6, 0x52A7, 0x52AF, 0x52B0, 0x52B6, - 0x52B7, 0x52B8, 0x52BA, 0x52BB, 0x52BD, 0x52C0, 0x52C4, 0x52C6, - 0x52C8, 0x52CC, 0x52CF, 0x52D1, 0x52D4, 0x52D6, 0x52DB, 0x52DC, - 0x52E1, 0x52E5, 0x52E8, 0x52E9, 0x52EA, 0x52EC, 0x52F0, 0x52F1, - 0x52F4, 0x52F6, 0x52F7, 0x5300, 0x5303, 0x530A, 0x530B, -}; -static const unsigned short euc_to_utf8_8FB4[] = { - 0x530C, 0x5311, 0x5313, 0x5318, 0x531B, 0x531C, 0x531E, - 0x531F, 0x5325, 0x5327, 0x5328, 0x5329, 0x532B, 0x532C, 0x532D, - 0x5330, 0x5332, 0x5335, 0x533C, 0x533D, 0x533E, 0x5342, 0x534C, - 0x534B, 0x5359, 0x535B, 0x5361, 0x5363, 0x5365, 0x536C, 0x536D, - 0x5372, 0x5379, 0x537E, 0x5383, 0x5387, 0x5388, 0x538E, 0x5393, - 0x5394, 0x5399, 0x539D, 0x53A1, 0x53A4, 0x53AA, 0x53AB, 0x53AF, - 0x53B2, 0x53B4, 0x53B5, 0x53B7, 0x53B8, 0x53BA, 0x53BD, 0x53C0, - 0x53C5, 0x53CF, 0x53D2, 0x53D3, 0x53D5, 0x53DA, 0x53DD, 0x53DE, - 0x53E0, 0x53E6, 0x53E7, 0x53F5, 0x5402, 0x5413, 0x541A, 0x5421, - 0x5427, 0x5428, 0x542A, 0x542F, 0x5431, 0x5434, 0x5435, 0x5443, - 0x5444, 0x5447, 0x544D, 0x544F, 0x545E, 0x5462, 0x5464, 0x5466, - 0x5467, 0x5469, 0x546B, 0x546D, 0x546E, 0x5474, 0x547F, -}; -static const unsigned short euc_to_utf8_8FB5[] = { - 0x5481, 0x5483, 0x5485, 0x5488, 0x5489, 0x548D, 0x5491, - 0x5495, 0x5496, 0x549C, 0x549F, 0x54A1, 0x54A6, 0x54A7, 0x54A9, - 0x54AA, 0x54AD, 0x54AE, 0x54B1, 0x54B7, 0x54B9, 0x54BA, 0x54BB, - 0x54BF, 0x54C6, 0x54CA, 0x54CD, 0x54CE, 0x54E0, 0x54EA, 0x54EC, - 0x54EF, 0x54F6, 0x54FC, 0x54FE, 0x54FF, 0x5500, 0x5501, 0x5505, - 0x5508, 0x5509, 0x550C, 0x550D, 0x550E, 0x5515, 0x552A, 0x552B, - 0x5532, 0x5535, 0x5536, 0x553B, 0x553C, 0x553D, 0x5541, 0x5547, - 0x5549, 0x554A, 0x554D, 0x5550, 0x5551, 0x5558, 0x555A, 0x555B, - 0x555E, 0x5560, 0x5561, 0x5564, 0x5566, 0x557F, 0x5581, 0x5582, - 0x5586, 0x5588, 0x558E, 0x558F, 0x5591, 0x5592, 0x5593, 0x5594, - 0x5597, 0x55A3, 0x55A4, 0x55AD, 0x55B2, 0x55BF, 0x55C1, 0x55C3, - 0x55C6, 0x55C9, 0x55CB, 0x55CC, 0x55CE, 0x55D1, 0x55D2, -}; -static const unsigned short euc_to_utf8_8FB6[] = { - 0x55D3, 0x55D7, 0x55D8, 0x55DB, 0x55DE, 0x55E2, 0x55E9, - 0x55F6, 0x55FF, 0x5605, 0x5608, 0x560A, 0x560D, 0x560E, 0x560F, - 0x5610, 0x5611, 0x5612, 0x5619, 0x562C, 0x5630, 0x5633, 0x5635, - 0x5637, 0x5639, 0x563B, 0x563C, 0x563D, 0x563F, 0x5640, 0x5641, - 0x5643, 0x5644, 0x5646, 0x5649, 0x564B, 0x564D, 0x564F, 0x5654, - 0x565E, 0x5660, 0x5661, 0x5662, 0x5663, 0x5666, 0x5669, 0x566D, - 0x566F, 0x5671, 0x5672, 0x5675, 0x5684, 0x5685, 0x5688, 0x568B, - 0x568C, 0x5695, 0x5699, 0x569A, 0x569D, 0x569E, 0x569F, 0x56A6, - 0x56A7, 0x56A8, 0x56A9, 0x56AB, 0x56AC, 0x56AD, 0x56B1, 0x56B3, - 0x56B7, 0x56BE, 0x56C5, 0x56C9, 0x56CA, 0x56CB, 0x56CF, 0x56D0, - 0x56CC, 0x56CD, 0x56D9, 0x56DC, 0x56DD, 0x56DF, 0x56E1, 0x56E4, - 0x56E5, 0x56E6, 0x56E7, 0x56E8, 0x56F1, 0x56EB, 0x56ED, -}; -static const unsigned short euc_to_utf8_8FB7[] = { - 0x56F6, 0x56F7, 0x5701, 0x5702, 0x5707, 0x570A, 0x570C, - 0x5711, 0x5715, 0x571A, 0x571B, 0x571D, 0x5720, 0x5722, 0x5723, - 0x5724, 0x5725, 0x5729, 0x572A, 0x572C, 0x572E, 0x572F, 0x5733, - 0x5734, 0x573D, 0x573E, 0x573F, 0x5745, 0x5746, 0x574C, 0x574D, - 0x5752, 0x5762, 0x5765, 0x5767, 0x5768, 0x576B, 0x576D, 0x576E, - 0x576F, 0x5770, 0x5771, 0x5773, 0x5774, 0x5775, 0x5777, 0x5779, - 0x577A, 0x577B, 0x577C, 0x577E, 0x5781, 0x5783, 0x578C, 0x5794, - 0x5797, 0x5799, 0x579A, 0x579C, 0x579D, 0x579E, 0x579F, 0x57A1, - 0x5795, 0x57A7, 0x57A8, 0x57A9, 0x57AC, 0x57B8, 0x57BD, 0x57C7, - 0x57C8, 0x57CC, 0x57CF, 0x57D5, 0x57DD, 0x57DE, 0x57E4, 0x57E6, - 0x57E7, 0x57E9, 0x57ED, 0x57F0, 0x57F5, 0x57F6, 0x57F8, 0x57FD, - 0x57FE, 0x57FF, 0x5803, 0x5804, 0x5808, 0x5809, 0x57E1, -}; -static const unsigned short euc_to_utf8_8FB8[] = { - 0x580C, 0x580D, 0x581B, 0x581E, 0x581F, 0x5820, 0x5826, - 0x5827, 0x582D, 0x5832, 0x5839, 0x583F, 0x5849, 0x584C, 0x584D, - 0x584F, 0x5850, 0x5855, 0x585F, 0x5861, 0x5864, 0x5867, 0x5868, - 0x5878, 0x587C, 0x587F, 0x5880, 0x5881, 0x5887, 0x5888, 0x5889, - 0x588A, 0x588C, 0x588D, 0x588F, 0x5890, 0x5894, 0x5896, 0x589D, - 0x58A0, 0x58A1, 0x58A2, 0x58A6, 0x58A9, 0x58B1, 0x58B2, 0x58C4, - 0x58BC, 0x58C2, 0x58C8, 0x58CD, 0x58CE, 0x58D0, 0x58D2, 0x58D4, - 0x58D6, 0x58DA, 0x58DD, 0x58E1, 0x58E2, 0x58E9, 0x58F3, 0x5905, - 0x5906, 0x590B, 0x590C, 0x5912, 0x5913, 0x5914, 0x8641, 0x591D, - 0x5921, 0x5923, 0x5924, 0x5928, 0x592F, 0x5930, 0x5933, 0x5935, - 0x5936, 0x593F, 0x5943, 0x5946, 0x5952, 0x5953, 0x5959, 0x595B, - 0x595D, 0x595E, 0x595F, 0x5961, 0x5963, 0x596B, 0x596D, -}; -static const unsigned short euc_to_utf8_8FB9[] = { - 0x596F, 0x5972, 0x5975, 0x5976, 0x5979, 0x597B, 0x597C, - 0x598B, 0x598C, 0x598E, 0x5992, 0x5995, 0x5997, 0x599F, 0x59A4, - 0x59A7, 0x59AD, 0x59AE, 0x59AF, 0x59B0, 0x59B3, 0x59B7, 0x59BA, - 0x59BC, 0x59C1, 0x59C3, 0x59C4, 0x59C8, 0x59CA, 0x59CD, 0x59D2, - 0x59DD, 0x59DE, 0x59DF, 0x59E3, 0x59E4, 0x59E7, 0x59EE, 0x59EF, - 0x59F1, 0x59F2, 0x59F4, 0x59F7, 0x5A00, 0x5A04, 0x5A0C, 0x5A0D, - 0x5A0E, 0x5A12, 0x5A13, 0x5A1E, 0x5A23, 0x5A24, 0x5A27, 0x5A28, - 0x5A2A, 0x5A2D, 0x5A30, 0x5A44, 0x5A45, 0x5A47, 0x5A48, 0x5A4C, - 0x5A50, 0x5A55, 0x5A5E, 0x5A63, 0x5A65, 0x5A67, 0x5A6D, 0x5A77, - 0x5A7A, 0x5A7B, 0x5A7E, 0x5A8B, 0x5A90, 0x5A93, 0x5A96, 0x5A99, - 0x5A9C, 0x5A9E, 0x5A9F, 0x5AA0, 0x5AA2, 0x5AA7, 0x5AAC, 0x5AB1, - 0x5AB2, 0x5AB3, 0x5AB5, 0x5AB8, 0x5ABA, 0x5ABB, 0x5ABF, -}; -static const unsigned short euc_to_utf8_8FBA[] = { - 0x5AC4, 0x5AC6, 0x5AC8, 0x5ACF, 0x5ADA, 0x5ADC, 0x5AE0, - 0x5AE5, 0x5AEA, 0x5AEE, 0x5AF5, 0x5AF6, 0x5AFD, 0x5B00, 0x5B01, - 0x5B08, 0x5B17, 0x5B34, 0x5B19, 0x5B1B, 0x5B1D, 0x5B21, 0x5B25, - 0x5B2D, 0x5B38, 0x5B41, 0x5B4B, 0x5B4C, 0x5B52, 0x5B56, 0x5B5E, - 0x5B68, 0x5B6E, 0x5B6F, 0x5B7C, 0x5B7D, 0x5B7E, 0x5B7F, 0x5B81, - 0x5B84, 0x5B86, 0x5B8A, 0x5B8E, 0x5B90, 0x5B91, 0x5B93, 0x5B94, - 0x5B96, 0x5BA8, 0x5BA9, 0x5BAC, 0x5BAD, 0x5BAF, 0x5BB1, 0x5BB2, - 0x5BB7, 0x5BBA, 0x5BBC, 0x5BC0, 0x5BC1, 0x5BCD, 0x5BCF, 0x5BD6, - 0x5BD7, 0x5BD8, 0x5BD9, 0x5BDA, 0x5BE0, 0x5BEF, 0x5BF1, 0x5BF4, - 0x5BFD, 0x5C0C, 0x5C17, 0x5C1E, 0x5C1F, 0x5C23, 0x5C26, 0x5C29, - 0x5C2B, 0x5C2C, 0x5C2E, 0x5C30, 0x5C32, 0x5C35, 0x5C36, 0x5C59, - 0x5C5A, 0x5C5C, 0x5C62, 0x5C63, 0x5C67, 0x5C68, 0x5C69, -}; -static const unsigned short euc_to_utf8_8FBB[] = { - 0x5C6D, 0x5C70, 0x5C74, 0x5C75, 0x5C7A, 0x5C7B, 0x5C7C, - 0x5C7D, 0x5C87, 0x5C88, 0x5C8A, 0x5C8F, 0x5C92, 0x5C9D, 0x5C9F, - 0x5CA0, 0x5CA2, 0x5CA3, 0x5CA6, 0x5CAA, 0x5CB2, 0x5CB4, 0x5CB5, - 0x5CBA, 0x5CC9, 0x5CCB, 0x5CD2, 0x5CDD, 0x5CD7, 0x5CEE, 0x5CF1, - 0x5CF2, 0x5CF4, 0x5D01, 0x5D06, 0x5D0D, 0x5D12, 0x5D2B, 0x5D23, - 0x5D24, 0x5D26, 0x5D27, 0x5D31, 0x5D34, 0x5D39, 0x5D3D, 0x5D3F, - 0x5D42, 0x5D43, 0x5D46, 0x5D48, 0x5D55, 0x5D51, 0x5D59, 0x5D4A, - 0x5D5F, 0x5D60, 0x5D61, 0x5D62, 0x5D64, 0x5D6A, 0x5D6D, 0x5D70, - 0x5D79, 0x5D7A, 0x5D7E, 0x5D7F, 0x5D81, 0x5D83, 0x5D88, 0x5D8A, - 0x5D92, 0x5D93, 0x5D94, 0x5D95, 0x5D99, 0x5D9B, 0x5D9F, 0x5DA0, - 0x5DA7, 0x5DAB, 0x5DB0, 0x5DB4, 0x5DB8, 0x5DB9, 0x5DC3, 0x5DC7, - 0x5DCB, 0x5DD0, 0x5DCE, 0x5DD8, 0x5DD9, 0x5DE0, 0x5DE4, -}; -static const unsigned short euc_to_utf8_8FBC[] = { - 0x5DE9, 0x5DF8, 0x5DF9, 0x5E00, 0x5E07, 0x5E0D, 0x5E12, - 0x5E14, 0x5E15, 0x5E18, 0x5E1F, 0x5E20, 0x5E2E, 0x5E28, 0x5E32, - 0x5E35, 0x5E3E, 0x5E4B, 0x5E50, 0x5E49, 0x5E51, 0x5E56, 0x5E58, - 0x5E5B, 0x5E5C, 0x5E5E, 0x5E68, 0x5E6A, 0x5E6B, 0x5E6C, 0x5E6D, - 0x5E6E, 0x5E70, 0x5E80, 0x5E8B, 0x5E8E, 0x5EA2, 0x5EA4, 0x5EA5, - 0x5EA8, 0x5EAA, 0x5EAC, 0x5EB1, 0x5EB3, 0x5EBD, 0x5EBE, 0x5EBF, - 0x5EC6, 0x5ECC, 0x5ECB, 0x5ECE, 0x5ED1, 0x5ED2, 0x5ED4, 0x5ED5, - 0x5EDC, 0x5EDE, 0x5EE5, 0x5EEB, 0x5F02, 0x5F06, 0x5F07, 0x5F08, - 0x5F0E, 0x5F19, 0x5F1C, 0x5F1D, 0x5F21, 0x5F22, 0x5F23, 0x5F24, - 0x5F28, 0x5F2B, 0x5F2C, 0x5F2E, 0x5F30, 0x5F34, 0x5F36, 0x5F3B, - 0x5F3D, 0x5F3F, 0x5F40, 0x5F44, 0x5F45, 0x5F47, 0x5F4D, 0x5F50, - 0x5F54, 0x5F58, 0x5F5B, 0x5F60, 0x5F63, 0x5F64, 0x5F67, -}; -static const unsigned short euc_to_utf8_8FBD[] = { - 0x5F6F, 0x5F72, 0x5F74, 0x5F75, 0x5F78, 0x5F7A, 0x5F7D, - 0x5F7E, 0x5F89, 0x5F8D, 0x5F8F, 0x5F96, 0x5F9C, 0x5F9D, 0x5FA2, - 0x5FA7, 0x5FAB, 0x5FA4, 0x5FAC, 0x5FAF, 0x5FB0, 0x5FB1, 0x5FB8, - 0x5FC4, 0x5FC7, 0x5FC8, 0x5FC9, 0x5FCB, 0x5FD0, 0x5FD1, 0x5FD2, - 0x5FD3, 0x5FD4, 0x5FDE, 0x5FE1, 0x5FE2, 0x5FE8, 0x5FE9, 0x5FEA, - 0x5FEC, 0x5FED, 0x5FEE, 0x5FEF, 0x5FF2, 0x5FF3, 0x5FF6, 0x5FFA, - 0x5FFC, 0x6007, 0x600A, 0x600D, 0x6013, 0x6014, 0x6017, 0x6018, - 0x601A, 0x601F, 0x6024, 0x602D, 0x6033, 0x6035, 0x6040, 0x6047, - 0x6048, 0x6049, 0x604C, 0x6051, 0x6054, 0x6056, 0x6057, 0x605D, - 0x6061, 0x6067, 0x6071, 0x607E, 0x607F, 0x6082, 0x6086, 0x6088, - 0x608A, 0x608E, 0x6091, 0x6093, 0x6095, 0x6098, 0x609D, 0x609E, - 0x60A2, 0x60A4, 0x60A5, 0x60A8, 0x60B0, 0x60B1, 0x60B7, -}; -static const unsigned short euc_to_utf8_8FBE[] = { - 0x60BB, 0x60BE, 0x60C2, 0x60C4, 0x60C8, 0x60C9, 0x60CA, - 0x60CB, 0x60CE, 0x60CF, 0x60D4, 0x60D5, 0x60D9, 0x60DB, 0x60DD, - 0x60DE, 0x60E2, 0x60E5, 0x60F2, 0x60F5, 0x60F8, 0x60FC, 0x60FD, - 0x6102, 0x6107, 0x610A, 0x610C, 0x6110, 0x6111, 0x6112, 0x6113, - 0x6114, 0x6116, 0x6117, 0x6119, 0x611C, 0x611E, 0x6122, 0x612A, - 0x612B, 0x6130, 0x6131, 0x6135, 0x6136, 0x6137, 0x6139, 0x6141, - 0x6145, 0x6146, 0x6149, 0x615E, 0x6160, 0x616C, 0x6172, 0x6178, - 0x617B, 0x617C, 0x617F, 0x6180, 0x6181, 0x6183, 0x6184, 0x618B, - 0x618D, 0x6192, 0x6193, 0x6197, 0x6198, 0x619C, 0x619D, 0x619F, - 0x61A0, 0x61A5, 0x61A8, 0x61AA, 0x61AD, 0x61B8, 0x61B9, 0x61BC, - 0x61C0, 0x61C1, 0x61C2, 0x61CE, 0x61CF, 0x61D5, 0x61DC, 0x61DD, - 0x61DE, 0x61DF, 0x61E1, 0x61E2, 0x61E7, 0x61E9, 0x61E5, -}; -static const unsigned short euc_to_utf8_8FBF[] = { - 0x61EC, 0x61ED, 0x61EF, 0x6201, 0x6203, 0x6204, 0x6207, - 0x6213, 0x6215, 0x621C, 0x6220, 0x6222, 0x6223, 0x6227, 0x6229, - 0x622B, 0x6239, 0x623D, 0x6242, 0x6243, 0x6244, 0x6246, 0x624C, - 0x6250, 0x6251, 0x6252, 0x6254, 0x6256, 0x625A, 0x625C, 0x6264, - 0x626D, 0x626F, 0x6273, 0x627A, 0x627D, 0x628D, 0x628E, 0x628F, - 0x6290, 0x62A6, 0x62A8, 0x62B3, 0x62B6, 0x62B7, 0x62BA, 0x62BE, - 0x62BF, 0x62C4, 0x62CE, 0x62D5, 0x62D6, 0x62DA, 0x62EA, 0x62F2, - 0x62F4, 0x62FC, 0x62FD, 0x6303, 0x6304, 0x630A, 0x630B, 0x630D, - 0x6310, 0x6313, 0x6316, 0x6318, 0x6329, 0x632A, 0x632D, 0x6335, - 0x6336, 0x6339, 0x633C, 0x6341, 0x6342, 0x6343, 0x6344, 0x6346, - 0x634A, 0x634B, 0x634E, 0x6352, 0x6353, 0x6354, 0x6358, 0x635B, - 0x6365, 0x6366, 0x636C, 0x636D, 0x6371, 0x6374, 0x6375, -}; -static const unsigned short euc_to_utf8_8FC0[] = { - 0x6378, 0x637C, 0x637D, 0x637F, 0x6382, 0x6384, 0x6387, - 0x638A, 0x6390, 0x6394, 0x6395, 0x6399, 0x639A, 0x639E, 0x63A4, - 0x63A6, 0x63AD, 0x63AE, 0x63AF, 0x63BD, 0x63C1, 0x63C5, 0x63C8, - 0x63CE, 0x63D1, 0x63D3, 0x63D4, 0x63D5, 0x63DC, 0x63E0, 0x63E5, - 0x63EA, 0x63EC, 0x63F2, 0x63F3, 0x63F5, 0x63F8, 0x63F9, 0x6409, - 0x640A, 0x6410, 0x6412, 0x6414, 0x6418, 0x641E, 0x6420, 0x6422, - 0x6424, 0x6425, 0x6429, 0x642A, 0x642F, 0x6430, 0x6435, 0x643D, - 0x643F, 0x644B, 0x644F, 0x6451, 0x6452, 0x6453, 0x6454, 0x645A, - 0x645B, 0x645C, 0x645D, 0x645F, 0x6460, 0x6461, 0x6463, 0x646D, - 0x6473, 0x6474, 0x647B, 0x647D, 0x6485, 0x6487, 0x648F, 0x6490, - 0x6491, 0x6498, 0x6499, 0x649B, 0x649D, 0x649F, 0x64A1, 0x64A3, - 0x64A6, 0x64A8, 0x64AC, 0x64B3, 0x64BD, 0x64BE, 0x64BF, -}; -static const unsigned short euc_to_utf8_8FC1[] = { - 0x64C4, 0x64C9, 0x64CA, 0x64CB, 0x64CC, 0x64CE, 0x64D0, - 0x64D1, 0x64D5, 0x64D7, 0x64E4, 0x64E5, 0x64E9, 0x64EA, 0x64ED, - 0x64F0, 0x64F5, 0x64F7, 0x64FB, 0x64FF, 0x6501, 0x6504, 0x6508, - 0x6509, 0x650A, 0x650F, 0x6513, 0x6514, 0x6516, 0x6519, 0x651B, - 0x651E, 0x651F, 0x6522, 0x6526, 0x6529, 0x652E, 0x6531, 0x653A, - 0x653C, 0x653D, 0x6543, 0x6547, 0x6549, 0x6550, 0x6552, 0x6554, - 0x655F, 0x6560, 0x6567, 0x656B, 0x657A, 0x657D, 0x6581, 0x6585, - 0x658A, 0x6592, 0x6595, 0x6598, 0x659D, 0x65A0, 0x65A3, 0x65A6, - 0x65AE, 0x65B2, 0x65B3, 0x65B4, 0x65BF, 0x65C2, 0x65C8, 0x65C9, - 0x65CE, 0x65D0, 0x65D4, 0x65D6, 0x65D8, 0x65DF, 0x65F0, 0x65F2, - 0x65F4, 0x65F5, 0x65F9, 0x65FE, 0x65FF, 0x6600, 0x6604, 0x6608, - 0x6609, 0x660D, 0x6611, 0x6612, 0x6615, 0x6616, 0x661D, -}; -static const unsigned short euc_to_utf8_8FC2[] = { - 0x661E, 0x6621, 0x6622, 0x6623, 0x6624, 0x6626, 0x6629, - 0x662A, 0x662B, 0x662C, 0x662E, 0x6630, 0x6631, 0x6633, 0x6639, - 0x6637, 0x6640, 0x6645, 0x6646, 0x664A, 0x664C, 0x6651, 0x664E, - 0x6657, 0x6658, 0x6659, 0x665B, 0x665C, 0x6660, 0x6661, 0x66FB, - 0x666A, 0x666B, 0x666C, 0x667E, 0x6673, 0x6675, 0x667F, 0x6677, - 0x6678, 0x6679, 0x667B, 0x6680, 0x667C, 0x668B, 0x668C, 0x668D, - 0x6690, 0x6692, 0x6699, 0x669A, 0x669B, 0x669C, 0x669F, 0x66A0, - 0x66A4, 0x66AD, 0x66B1, 0x66B2, 0x66B5, 0x66BB, 0x66BF, 0x66C0, - 0x66C2, 0x66C3, 0x66C8, 0x66CC, 0x66CE, 0x66CF, 0x66D4, 0x66DB, - 0x66DF, 0x66E8, 0x66EB, 0x66EC, 0x66EE, 0x66FA, 0x6705, 0x6707, - 0x670E, 0x6713, 0x6719, 0x671C, 0x6720, 0x6722, 0x6733, 0x673E, - 0x6745, 0x6747, 0x6748, 0x674C, 0x6754, 0x6755, 0x675D, -}; -static const unsigned short euc_to_utf8_8FC3[] = { - 0x6766, 0x676C, 0x676E, 0x6774, 0x6776, 0x677B, 0x6781, - 0x6784, 0x678E, 0x678F, 0x6791, 0x6793, 0x6796, 0x6798, 0x6799, - 0x679B, 0x67B0, 0x67B1, 0x67B2, 0x67B5, 0x67BB, 0x67BC, 0x67BD, - 0x67F9, 0x67C0, 0x67C2, 0x67C3, 0x67C5, 0x67C8, 0x67C9, 0x67D2, - 0x67D7, 0x67D9, 0x67DC, 0x67E1, 0x67E6, 0x67F0, 0x67F2, 0x67F6, - 0x67F7, 0x6852, 0x6814, 0x6819, 0x681D, 0x681F, 0x6828, 0x6827, - 0x682C, 0x682D, 0x682F, 0x6830, 0x6831, 0x6833, 0x683B, 0x683F, - 0x6844, 0x6845, 0x684A, 0x684C, 0x6855, 0x6857, 0x6858, 0x685B, - 0x686B, 0x686E, 0x686F, 0x6870, 0x6871, 0x6872, 0x6875, 0x6879, - 0x687A, 0x687B, 0x687C, 0x6882, 0x6884, 0x6886, 0x6888, 0x6896, - 0x6898, 0x689A, 0x689C, 0x68A1, 0x68A3, 0x68A5, 0x68A9, 0x68AA, - 0x68AE, 0x68B2, 0x68BB, 0x68C5, 0x68C8, 0x68CC, 0x68CF, -}; -static const unsigned short euc_to_utf8_8FC4[] = { - 0x68D0, 0x68D1, 0x68D3, 0x68D6, 0x68D9, 0x68DC, 0x68DD, - 0x68E5, 0x68E8, 0x68EA, 0x68EB, 0x68EC, 0x68ED, 0x68F0, 0x68F1, - 0x68F5, 0x68F6, 0x68FB, 0x68FC, 0x68FD, 0x6906, 0x6909, 0x690A, - 0x6910, 0x6911, 0x6913, 0x6916, 0x6917, 0x6931, 0x6933, 0x6935, - 0x6938, 0x693B, 0x6942, 0x6945, 0x6949, 0x694E, 0x6957, 0x695B, - 0x6963, 0x6964, 0x6965, 0x6966, 0x6968, 0x6969, 0x696C, 0x6970, - 0x6971, 0x6972, 0x697A, 0x697B, 0x697F, 0x6980, 0x698D, 0x6992, - 0x6996, 0x6998, 0x69A1, 0x69A5, 0x69A6, 0x69A8, 0x69AB, 0x69AD, - 0x69AF, 0x69B7, 0x69B8, 0x69BA, 0x69BC, 0x69C5, 0x69C8, 0x69D1, - 0x69D6, 0x69D7, 0x69E2, 0x69E5, 0x69EE, 0x69EF, 0x69F1, 0x69F3, - 0x69F5, 0x69FE, 0x6A00, 0x6A01, 0x6A03, 0x6A0F, 0x6A11, 0x6A15, - 0x6A1A, 0x6A1D, 0x6A20, 0x6A24, 0x6A28, 0x6A30, 0x6A32, -}; -static const unsigned short euc_to_utf8_8FC5[] = { - 0x6A34, 0x6A37, 0x6A3B, 0x6A3E, 0x6A3F, 0x6A45, 0x6A46, - 0x6A49, 0x6A4A, 0x6A4E, 0x6A50, 0x6A51, 0x6A52, 0x6A55, 0x6A56, - 0x6A5B, 0x6A64, 0x6A67, 0x6A6A, 0x6A71, 0x6A73, 0x6A7E, 0x6A81, - 0x6A83, 0x6A86, 0x6A87, 0x6A89, 0x6A8B, 0x6A91, 0x6A9B, 0x6A9D, - 0x6A9E, 0x6A9F, 0x6AA5, 0x6AAB, 0x6AAF, 0x6AB0, 0x6AB1, 0x6AB4, - 0x6ABD, 0x6ABE, 0x6ABF, 0x6AC6, 0x6AC9, 0x6AC8, 0x6ACC, 0x6AD0, - 0x6AD4, 0x6AD5, 0x6AD6, 0x6ADC, 0x6ADD, 0x6AE4, 0x6AE7, 0x6AEC, - 0x6AF0, 0x6AF1, 0x6AF2, 0x6AFC, 0x6AFD, 0x6B02, 0x6B03, 0x6B06, - 0x6B07, 0x6B09, 0x6B0F, 0x6B10, 0x6B11, 0x6B17, 0x6B1B, 0x6B1E, - 0x6B24, 0x6B28, 0x6B2B, 0x6B2C, 0x6B2F, 0x6B35, 0x6B36, 0x6B3B, - 0x6B3F, 0x6B46, 0x6B4A, 0x6B4D, 0x6B52, 0x6B56, 0x6B58, 0x6B5D, - 0x6B60, 0x6B67, 0x6B6B, 0x6B6E, 0x6B70, 0x6B75, 0x6B7D, -}; -static const unsigned short euc_to_utf8_8FC6[] = { - 0x6B7E, 0x6B82, 0x6B85, 0x6B97, 0x6B9B, 0x6B9F, 0x6BA0, - 0x6BA2, 0x6BA3, 0x6BA8, 0x6BA9, 0x6BAC, 0x6BAD, 0x6BAE, 0x6BB0, - 0x6BB8, 0x6BB9, 0x6BBD, 0x6BBE, 0x6BC3, 0x6BC4, 0x6BC9, 0x6BCC, - 0x6BD6, 0x6BDA, 0x6BE1, 0x6BE3, 0x6BE6, 0x6BE7, 0x6BEE, 0x6BF1, - 0x6BF7, 0x6BF9, 0x6BFF, 0x6C02, 0x6C04, 0x6C05, 0x6C09, 0x6C0D, - 0x6C0E, 0x6C10, 0x6C12, 0x6C19, 0x6C1F, 0x6C26, 0x6C27, 0x6C28, - 0x6C2C, 0x6C2E, 0x6C33, 0x6C35, 0x6C36, 0x6C3A, 0x6C3B, 0x6C3F, - 0x6C4A, 0x6C4B, 0x6C4D, 0x6C4F, 0x6C52, 0x6C54, 0x6C59, 0x6C5B, - 0x6C5C, 0x6C6B, 0x6C6D, 0x6C6F, 0x6C74, 0x6C76, 0x6C78, 0x6C79, - 0x6C7B, 0x6C85, 0x6C86, 0x6C87, 0x6C89, 0x6C94, 0x6C95, 0x6C97, - 0x6C98, 0x6C9C, 0x6C9F, 0x6CB0, 0x6CB2, 0x6CB4, 0x6CC2, 0x6CC6, - 0x6CCD, 0x6CCF, 0x6CD0, 0x6CD1, 0x6CD2, 0x6CD4, 0x6CD6, -}; -static const unsigned short euc_to_utf8_8FC7[] = { - 0x6CDA, 0x6CDC, 0x6CE0, 0x6CE7, 0x6CE9, 0x6CEB, 0x6CEC, - 0x6CEE, 0x6CF2, 0x6CF4, 0x6D04, 0x6D07, 0x6D0A, 0x6D0E, 0x6D0F, - 0x6D11, 0x6D13, 0x6D1A, 0x6D26, 0x6D27, 0x6D28, 0x6C67, 0x6D2E, - 0x6D2F, 0x6D31, 0x6D39, 0x6D3C, 0x6D3F, 0x6D57, 0x6D5E, 0x6D5F, - 0x6D61, 0x6D65, 0x6D67, 0x6D6F, 0x6D70, 0x6D7C, 0x6D82, 0x6D87, - 0x6D91, 0x6D92, 0x6D94, 0x6D96, 0x6D97, 0x6D98, 0x6DAA, 0x6DAC, - 0x6DB4, 0x6DB7, 0x6DB9, 0x6DBD, 0x6DBF, 0x6DC4, 0x6DC8, 0x6DCA, - 0x6DCE, 0x6DCF, 0x6DD6, 0x6DDB, 0x6DDD, 0x6DDF, 0x6DE0, 0x6DE2, - 0x6DE5, 0x6DE9, 0x6DEF, 0x6DF0, 0x6DF4, 0x6DF6, 0x6DFC, 0x6E00, - 0x6E04, 0x6E1E, 0x6E22, 0x6E27, 0x6E32, 0x6E36, 0x6E39, 0x6E3B, - 0x6E3C, 0x6E44, 0x6E45, 0x6E48, 0x6E49, 0x6E4B, 0x6E4F, 0x6E51, - 0x6E52, 0x6E53, 0x6E54, 0x6E57, 0x6E5C, 0x6E5D, 0x6E5E, -}; -static const unsigned short euc_to_utf8_8FC8[] = { - 0x6E62, 0x6E63, 0x6E68, 0x6E73, 0x6E7B, 0x6E7D, 0x6E8D, - 0x6E93, 0x6E99, 0x6EA0, 0x6EA7, 0x6EAD, 0x6EAE, 0x6EB1, 0x6EB3, - 0x6EBB, 0x6EBF, 0x6EC0, 0x6EC1, 0x6EC3, 0x6EC7, 0x6EC8, 0x6ECA, - 0x6ECD, 0x6ECE, 0x6ECF, 0x6EEB, 0x6EED, 0x6EEE, 0x6EF9, 0x6EFB, - 0x6EFD, 0x6F04, 0x6F08, 0x6F0A, 0x6F0C, 0x6F0D, 0x6F16, 0x6F18, - 0x6F1A, 0x6F1B, 0x6F26, 0x6F29, 0x6F2A, 0x6F2F, 0x6F30, 0x6F33, - 0x6F36, 0x6F3B, 0x6F3C, 0x6F2D, 0x6F4F, 0x6F51, 0x6F52, 0x6F53, - 0x6F57, 0x6F59, 0x6F5A, 0x6F5D, 0x6F5E, 0x6F61, 0x6F62, 0x6F68, - 0x6F6C, 0x6F7D, 0x6F7E, 0x6F83, 0x6F87, 0x6F88, 0x6F8B, 0x6F8C, - 0x6F8D, 0x6F90, 0x6F92, 0x6F93, 0x6F94, 0x6F96, 0x6F9A, 0x6F9F, - 0x6FA0, 0x6FA5, 0x6FA6, 0x6FA7, 0x6FA8, 0x6FAE, 0x6FAF, 0x6FB0, - 0x6FB5, 0x6FB6, 0x6FBC, 0x6FC5, 0x6FC7, 0x6FC8, 0x6FCA, -}; -static const unsigned short euc_to_utf8_8FC9[] = { - 0x6FDA, 0x6FDE, 0x6FE8, 0x6FE9, 0x6FF0, 0x6FF5, 0x6FF9, - 0x6FFC, 0x6FFD, 0x7000, 0x7005, 0x7006, 0x7007, 0x700D, 0x7017, - 0x7020, 0x7023, 0x702F, 0x7034, 0x7037, 0x7039, 0x703C, 0x7043, - 0x7044, 0x7048, 0x7049, 0x704A, 0x704B, 0x7054, 0x7055, 0x705D, - 0x705E, 0x704E, 0x7064, 0x7065, 0x706C, 0x706E, 0x7075, 0x7076, - 0x707E, 0x7081, 0x7085, 0x7086, 0x7094, 0x7095, 0x7096, 0x7097, - 0x7098, 0x709B, 0x70A4, 0x70AB, 0x70B0, 0x70B1, 0x70B4, 0x70B7, - 0x70CA, 0x70D1, 0x70D3, 0x70D4, 0x70D5, 0x70D6, 0x70D8, 0x70DC, - 0x70E4, 0x70FA, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x710B, - 0x710C, 0x710F, 0x711E, 0x7120, 0x712B, 0x712D, 0x712F, 0x7130, - 0x7131, 0x7138, 0x7141, 0x7145, 0x7146, 0x7147, 0x714A, 0x714B, - 0x7150, 0x7152, 0x7157, 0x715A, 0x715C, 0x715E, 0x7160, -}; -static const unsigned short euc_to_utf8_8FCA[] = { - 0x7168, 0x7179, 0x7180, 0x7185, 0x7187, 0x718C, 0x7192, - 0x719A, 0x719B, 0x71A0, 0x71A2, 0x71AF, 0x71B0, 0x71B2, 0x71B3, - 0x71BA, 0x71BF, 0x71C0, 0x71C1, 0x71C4, 0x71CB, 0x71CC, 0x71D3, - 0x71D6, 0x71D9, 0x71DA, 0x71DC, 0x71F8, 0x71FE, 0x7200, 0x7207, - 0x7208, 0x7209, 0x7213, 0x7217, 0x721A, 0x721D, 0x721F, 0x7224, - 0x722B, 0x722F, 0x7234, 0x7238, 0x7239, 0x7241, 0x7242, 0x7243, - 0x7245, 0x724E, 0x724F, 0x7250, 0x7253, 0x7255, 0x7256, 0x725A, - 0x725C, 0x725E, 0x7260, 0x7263, 0x7268, 0x726B, 0x726E, 0x726F, - 0x7271, 0x7277, 0x7278, 0x727B, 0x727C, 0x727F, 0x7284, 0x7289, - 0x728D, 0x728E, 0x7293, 0x729B, 0x72A8, 0x72AD, 0x72AE, 0x72B1, - 0x72B4, 0x72BE, 0x72C1, 0x72C7, 0x72C9, 0x72CC, 0x72D5, 0x72D6, - 0x72D8, 0x72DF, 0x72E5, 0x72F3, 0x72F4, 0x72FA, 0x72FB, -}; -static const unsigned short euc_to_utf8_8FCB[] = { - 0x72FE, 0x7302, 0x7304, 0x7305, 0x7307, 0x730B, 0x730D, - 0x7312, 0x7313, 0x7318, 0x7319, 0x731E, 0x7322, 0x7324, 0x7327, - 0x7328, 0x732C, 0x7331, 0x7332, 0x7335, 0x733A, 0x733B, 0x733D, - 0x7343, 0x734D, 0x7350, 0x7352, 0x7356, 0x7358, 0x735D, 0x735E, - 0x735F, 0x7360, 0x7366, 0x7367, 0x7369, 0x736B, 0x736C, 0x736E, - 0x736F, 0x7371, 0x7377, 0x7379, 0x737C, 0x7380, 0x7381, 0x7383, - 0x7385, 0x7386, 0x738E, 0x7390, 0x7393, 0x7395, 0x7397, 0x7398, - 0x739C, 0x739E, 0x739F, 0x73A0, 0x73A2, 0x73A5, 0x73A6, 0x73AA, - 0x73AB, 0x73AD, 0x73B5, 0x73B7, 0x73B9, 0x73BC, 0x73BD, 0x73BF, - 0x73C5, 0x73C6, 0x73C9, 0x73CB, 0x73CC, 0x73CF, 0x73D2, 0x73D3, - 0x73D6, 0x73D9, 0x73DD, 0x73E1, 0x73E3, 0x73E6, 0x73E7, 0x73E9, - 0x73F4, 0x73F5, 0x73F7, 0x73F9, 0x73FA, 0x73FB, 0x73FD, -}; -static const unsigned short euc_to_utf8_8FCC[] = { - 0x73FF, 0x7400, 0x7401, 0x7404, 0x7407, 0x740A, 0x7411, - 0x741A, 0x741B, 0x7424, 0x7426, 0x7428, 0x7429, 0x742A, 0x742B, - 0x742C, 0x742D, 0x742E, 0x742F, 0x7430, 0x7431, 0x7439, 0x7440, - 0x7443, 0x7444, 0x7446, 0x7447, 0x744B, 0x744D, 0x7451, 0x7452, - 0x7457, 0x745D, 0x7462, 0x7466, 0x7467, 0x7468, 0x746B, 0x746D, - 0x746E, 0x7471, 0x7472, 0x7480, 0x7481, 0x7485, 0x7486, 0x7487, - 0x7489, 0x748F, 0x7490, 0x7491, 0x7492, 0x7498, 0x7499, 0x749A, - 0x749C, 0x749F, 0x74A0, 0x74A1, 0x74A3, 0x74A6, 0x74A8, 0x74A9, - 0x74AA, 0x74AB, 0x74AE, 0x74AF, 0x74B1, 0x74B2, 0x74B5, 0x74B9, - 0x74BB, 0x74BF, 0x74C8, 0x74C9, 0x74CC, 0x74D0, 0x74D3, 0x74D8, - 0x74DA, 0x74DB, 0x74DE, 0x74DF, 0x74E4, 0x74E8, 0x74EA, 0x74EB, - 0x74EF, 0x74F4, 0x74FA, 0x74FB, 0x74FC, 0x74FF, 0x7506, -}; -static const unsigned short euc_to_utf8_8FCD[] = { - 0x7512, 0x7516, 0x7517, 0x7520, 0x7521, 0x7524, 0x7527, - 0x7529, 0x752A, 0x752F, 0x7536, 0x7539, 0x753D, 0x753E, 0x753F, - 0x7540, 0x7543, 0x7547, 0x7548, 0x754E, 0x7550, 0x7552, 0x7557, - 0x755E, 0x755F, 0x7561, 0x756F, 0x7571, 0x7579, 0x757A, 0x757B, - 0x757C, 0x757D, 0x757E, 0x7581, 0x7585, 0x7590, 0x7592, 0x7593, - 0x7595, 0x7599, 0x759C, 0x75A2, 0x75A4, 0x75B4, 0x75BA, 0x75BF, - 0x75C0, 0x75C1, 0x75C4, 0x75C6, 0x75CC, 0x75CE, 0x75CF, 0x75D7, - 0x75DC, 0x75DF, 0x75E0, 0x75E1, 0x75E4, 0x75E7, 0x75EC, 0x75EE, - 0x75EF, 0x75F1, 0x75F9, 0x7600, 0x7602, 0x7603, 0x7604, 0x7607, - 0x7608, 0x760A, 0x760C, 0x760F, 0x7612, 0x7613, 0x7615, 0x7616, - 0x7619, 0x761B, 0x761C, 0x761D, 0x761E, 0x7623, 0x7625, 0x7626, - 0x7629, 0x762D, 0x7632, 0x7633, 0x7635, 0x7638, 0x7639, -}; -static const unsigned short euc_to_utf8_8FCE[] = { - 0x763A, 0x763C, 0x764A, 0x7640, 0x7641, 0x7643, 0x7644, - 0x7645, 0x7649, 0x764B, 0x7655, 0x7659, 0x765F, 0x7664, 0x7665, - 0x766D, 0x766E, 0x766F, 0x7671, 0x7674, 0x7681, 0x7685, 0x768C, - 0x768D, 0x7695, 0x769B, 0x769C, 0x769D, 0x769F, 0x76A0, 0x76A2, - 0x76A3, 0x76A4, 0x76A5, 0x76A6, 0x76A7, 0x76A8, 0x76AA, 0x76AD, - 0x76BD, 0x76C1, 0x76C5, 0x76C9, 0x76CB, 0x76CC, 0x76CE, 0x76D4, - 0x76D9, 0x76E0, 0x76E6, 0x76E8, 0x76EC, 0x76F0, 0x76F1, 0x76F6, - 0x76F9, 0x76FC, 0x7700, 0x7706, 0x770A, 0x770E, 0x7712, 0x7714, - 0x7715, 0x7717, 0x7719, 0x771A, 0x771C, 0x7722, 0x7728, 0x772D, - 0x772E, 0x772F, 0x7734, 0x7735, 0x7736, 0x7739, 0x773D, 0x773E, - 0x7742, 0x7745, 0x7746, 0x774A, 0x774D, 0x774E, 0x774F, 0x7752, - 0x7756, 0x7757, 0x775C, 0x775E, 0x775F, 0x7760, 0x7762, -}; -static const unsigned short euc_to_utf8_8FCF[] = { - 0x7764, 0x7767, 0x776A, 0x776C, 0x7770, 0x7772, 0x7773, - 0x7774, 0x777A, 0x777D, 0x7780, 0x7784, 0x778C, 0x778D, 0x7794, - 0x7795, 0x7796, 0x779A, 0x779F, 0x77A2, 0x77A7, 0x77AA, 0x77AE, - 0x77AF, 0x77B1, 0x77B5, 0x77BE, 0x77C3, 0x77C9, 0x77D1, 0x77D2, - 0x77D5, 0x77D9, 0x77DE, 0x77DF, 0x77E0, 0x77E4, 0x77E6, 0x77EA, - 0x77EC, 0x77F0, 0x77F1, 0x77F4, 0x77F8, 0x77FB, 0x7805, 0x7806, - 0x7809, 0x780D, 0x780E, 0x7811, 0x781D, 0x7821, 0x7822, 0x7823, - 0x782D, 0x782E, 0x7830, 0x7835, 0x7837, 0x7843, 0x7844, 0x7847, - 0x7848, 0x784C, 0x784E, 0x7852, 0x785C, 0x785E, 0x7860, 0x7861, - 0x7863, 0x7864, 0x7868, 0x786A, 0x786E, 0x787A, 0x787E, 0x788A, - 0x788F, 0x7894, 0x7898, 0x78A1, 0x789D, 0x789E, 0x789F, 0x78A4, - 0x78A8, 0x78AC, 0x78AD, 0x78B0, 0x78B1, 0x78B2, 0x78B3, -}; -static const unsigned short euc_to_utf8_8FD0[] = { - 0x78BB, 0x78BD, 0x78BF, 0x78C7, 0x78C8, 0x78C9, 0x78CC, - 0x78CE, 0x78D2, 0x78D3, 0x78D5, 0x78D6, 0x78E4, 0x78DB, 0x78DF, - 0x78E0, 0x78E1, 0x78E6, 0x78EA, 0x78F2, 0x78F3, 0x7900, 0x78F6, - 0x78F7, 0x78FA, 0x78FB, 0x78FF, 0x7906, 0x790C, 0x7910, 0x791A, - 0x791C, 0x791E, 0x791F, 0x7920, 0x7925, 0x7927, 0x7929, 0x792D, - 0x7931, 0x7934, 0x7935, 0x793B, 0x793D, 0x793F, 0x7944, 0x7945, - 0x7946, 0x794A, 0x794B, 0x794F, 0x7951, 0x7954, 0x7958, 0x795B, - 0x795C, 0x7967, 0x7969, 0x796B, 0x7972, 0x7979, 0x797B, 0x797C, - 0x797E, 0x798B, 0x798C, 0x7991, 0x7993, 0x7994, 0x7995, 0x7996, - 0x7998, 0x799B, 0x799C, 0x79A1, 0x79A8, 0x79A9, 0x79AB, 0x79AF, - 0x79B1, 0x79B4, 0x79B8, 0x79BB, 0x79C2, 0x79C4, 0x79C7, 0x79C8, - 0x79CA, 0x79CF, 0x79D4, 0x79D6, 0x79DA, 0x79DD, 0x79DE, -}; -static const unsigned short euc_to_utf8_8FD1[] = { - 0x79E0, 0x79E2, 0x79E5, 0x79EA, 0x79EB, 0x79ED, 0x79F1, - 0x79F8, 0x79FC, 0x7A02, 0x7A03, 0x7A07, 0x7A09, 0x7A0A, 0x7A0C, - 0x7A11, 0x7A15, 0x7A1B, 0x7A1E, 0x7A21, 0x7A27, 0x7A2B, 0x7A2D, - 0x7A2F, 0x7A30, 0x7A34, 0x7A35, 0x7A38, 0x7A39, 0x7A3A, 0x7A44, - 0x7A45, 0x7A47, 0x7A48, 0x7A4C, 0x7A55, 0x7A56, 0x7A59, 0x7A5C, - 0x7A5D, 0x7A5F, 0x7A60, 0x7A65, 0x7A67, 0x7A6A, 0x7A6D, 0x7A75, - 0x7A78, 0x7A7E, 0x7A80, 0x7A82, 0x7A85, 0x7A86, 0x7A8A, 0x7A8B, - 0x7A90, 0x7A91, 0x7A94, 0x7A9E, 0x7AA0, 0x7AA3, 0x7AAC, 0x7AB3, - 0x7AB5, 0x7AB9, 0x7ABB, 0x7ABC, 0x7AC6, 0x7AC9, 0x7ACC, 0x7ACE, - 0x7AD1, 0x7ADB, 0x7AE8, 0x7AE9, 0x7AEB, 0x7AEC, 0x7AF1, 0x7AF4, - 0x7AFB, 0x7AFD, 0x7AFE, 0x7B07, 0x7B14, 0x7B1F, 0x7B23, 0x7B27, - 0x7B29, 0x7B2A, 0x7B2B, 0x7B2D, 0x7B2E, 0x7B2F, 0x7B30, -}; -static const unsigned short euc_to_utf8_8FD2[] = { - 0x7B31, 0x7B34, 0x7B3D, 0x7B3F, 0x7B40, 0x7B41, 0x7B47, - 0x7B4E, 0x7B55, 0x7B60, 0x7B64, 0x7B66, 0x7B69, 0x7B6A, 0x7B6D, - 0x7B6F, 0x7B72, 0x7B73, 0x7B77, 0x7B84, 0x7B89, 0x7B8E, 0x7B90, - 0x7B91, 0x7B96, 0x7B9B, 0x7B9E, 0x7BA0, 0x7BA5, 0x7BAC, 0x7BAF, - 0x7BB0, 0x7BB2, 0x7BB5, 0x7BB6, 0x7BBA, 0x7BBB, 0x7BBC, 0x7BBD, - 0x7BC2, 0x7BC5, 0x7BC8, 0x7BCA, 0x7BD4, 0x7BD6, 0x7BD7, 0x7BD9, - 0x7BDA, 0x7BDB, 0x7BE8, 0x7BEA, 0x7BF2, 0x7BF4, 0x7BF5, 0x7BF8, - 0x7BF9, 0x7BFA, 0x7BFC, 0x7BFE, 0x7C01, 0x7C02, 0x7C03, 0x7C04, - 0x7C06, 0x7C09, 0x7C0B, 0x7C0C, 0x7C0E, 0x7C0F, 0x7C19, 0x7C1B, - 0x7C20, 0x7C25, 0x7C26, 0x7C28, 0x7C2C, 0x7C31, 0x7C33, 0x7C34, - 0x7C36, 0x7C39, 0x7C3A, 0x7C46, 0x7C4A, 0x7C55, 0x7C51, 0x7C52, - 0x7C53, 0x7C59, 0x7C5A, 0x7C5B, 0x7C5C, 0x7C5D, 0x7C5E, -}; -static const unsigned short euc_to_utf8_8FD3[] = { - 0x7C61, 0x7C63, 0x7C67, 0x7C69, 0x7C6D, 0x7C6E, 0x7C70, - 0x7C72, 0x7C79, 0x7C7C, 0x7C7D, 0x7C86, 0x7C87, 0x7C8F, 0x7C94, - 0x7C9E, 0x7CA0, 0x7CA6, 0x7CB0, 0x7CB6, 0x7CB7, 0x7CBA, 0x7CBB, - 0x7CBC, 0x7CBF, 0x7CC4, 0x7CC7, 0x7CC8, 0x7CC9, 0x7CCD, 0x7CCF, - 0x7CD3, 0x7CD4, 0x7CD5, 0x7CD7, 0x7CD9, 0x7CDA, 0x7CDD, 0x7CE6, - 0x7CE9, 0x7CEB, 0x7CF5, 0x7D03, 0x7D07, 0x7D08, 0x7D09, 0x7D0F, - 0x7D11, 0x7D12, 0x7D13, 0x7D16, 0x7D1D, 0x7D1E, 0x7D23, 0x7D26, - 0x7D2A, 0x7D2D, 0x7D31, 0x7D3C, 0x7D3D, 0x7D3E, 0x7D40, 0x7D41, - 0x7D47, 0x7D48, 0x7D4D, 0x7D51, 0x7D53, 0x7D57, 0x7D59, 0x7D5A, - 0x7D5C, 0x7D5D, 0x7D65, 0x7D67, 0x7D6A, 0x7D70, 0x7D78, 0x7D7A, - 0x7D7B, 0x7D7F, 0x7D81, 0x7D82, 0x7D83, 0x7D85, 0x7D86, 0x7D88, - 0x7D8B, 0x7D8C, 0x7D8D, 0x7D91, 0x7D96, 0x7D97, 0x7D9D, -}; -static const unsigned short euc_to_utf8_8FD4[] = { - 0x7D9E, 0x7DA6, 0x7DA7, 0x7DAA, 0x7DB3, 0x7DB6, 0x7DB7, - 0x7DB9, 0x7DC2, 0x7DC3, 0x7DC4, 0x7DC5, 0x7DC6, 0x7DCC, 0x7DCD, - 0x7DCE, 0x7DD7, 0x7DD9, 0x7E00, 0x7DE2, 0x7DE5, 0x7DE6, 0x7DEA, - 0x7DEB, 0x7DED, 0x7DF1, 0x7DF5, 0x7DF6, 0x7DF9, 0x7DFA, 0x7E08, - 0x7E10, 0x7E11, 0x7E15, 0x7E17, 0x7E1C, 0x7E1D, 0x7E20, 0x7E27, - 0x7E28, 0x7E2C, 0x7E2D, 0x7E2F, 0x7E33, 0x7E36, 0x7E3F, 0x7E44, - 0x7E45, 0x7E47, 0x7E4E, 0x7E50, 0x7E52, 0x7E58, 0x7E5F, 0x7E61, - 0x7E62, 0x7E65, 0x7E6B, 0x7E6E, 0x7E6F, 0x7E73, 0x7E78, 0x7E7E, - 0x7E81, 0x7E86, 0x7E87, 0x7E8A, 0x7E8D, 0x7E91, 0x7E95, 0x7E98, - 0x7E9A, 0x7E9D, 0x7E9E, 0x7F3C, 0x7F3B, 0x7F3D, 0x7F3E, 0x7F3F, - 0x7F43, 0x7F44, 0x7F47, 0x7F4F, 0x7F52, 0x7F53, 0x7F5B, 0x7F5C, - 0x7F5D, 0x7F61, 0x7F63, 0x7F64, 0x7F65, 0x7F66, 0x7F6D, -}; -static const unsigned short euc_to_utf8_8FD5[] = { - 0x7F71, 0x7F7D, 0x7F7E, 0x7F7F, 0x7F80, 0x7F8B, 0x7F8D, - 0x7F8F, 0x7F90, 0x7F91, 0x7F96, 0x7F97, 0x7F9C, 0x7FA1, 0x7FA2, - 0x7FA6, 0x7FAA, 0x7FAD, 0x7FB4, 0x7FBC, 0x7FBF, 0x7FC0, 0x7FC3, - 0x7FC8, 0x7FCE, 0x7FCF, 0x7FDB, 0x7FDF, 0x7FE3, 0x7FE5, 0x7FE8, - 0x7FEC, 0x7FEE, 0x7FEF, 0x7FF2, 0x7FFA, 0x7FFD, 0x7FFE, 0x7FFF, - 0x8007, 0x8008, 0x800A, 0x800D, 0x800E, 0x800F, 0x8011, 0x8013, - 0x8014, 0x8016, 0x801D, 0x801E, 0x801F, 0x8020, 0x8024, 0x8026, - 0x802C, 0x802E, 0x8030, 0x8034, 0x8035, 0x8037, 0x8039, 0x803A, - 0x803C, 0x803E, 0x8040, 0x8044, 0x8060, 0x8064, 0x8066, 0x806D, - 0x8071, 0x8075, 0x8081, 0x8088, 0x808E, 0x809C, 0x809E, 0x80A6, - 0x80A7, 0x80AB, 0x80B8, 0x80B9, 0x80C8, 0x80CD, 0x80CF, 0x80D2, - 0x80D4, 0x80D5, 0x80D7, 0x80D8, 0x80E0, 0x80ED, 0x80EE, -}; -static const unsigned short euc_to_utf8_8FD6[] = { - 0x80F0, 0x80F2, 0x80F3, 0x80F6, 0x80F9, 0x80FA, 0x80FE, - 0x8103, 0x810B, 0x8116, 0x8117, 0x8118, 0x811C, 0x811E, 0x8120, - 0x8124, 0x8127, 0x812C, 0x8130, 0x8135, 0x813A, 0x813C, 0x8145, - 0x8147, 0x814A, 0x814C, 0x8152, 0x8157, 0x8160, 0x8161, 0x8167, - 0x8168, 0x8169, 0x816D, 0x816F, 0x8177, 0x8181, 0x8190, 0x8184, - 0x8185, 0x8186, 0x818B, 0x818E, 0x8196, 0x8198, 0x819B, 0x819E, - 0x81A2, 0x81AE, 0x81B2, 0x81B4, 0x81BB, 0x81CB, 0x81C3, 0x81C5, - 0x81CA, 0x81CE, 0x81CF, 0x81D5, 0x81D7, 0x81DB, 0x81DD, 0x81DE, - 0x81E1, 0x81E4, 0x81EB, 0x81EC, 0x81F0, 0x81F1, 0x81F2, 0x81F5, - 0x81F6, 0x81F8, 0x81F9, 0x81FD, 0x81FF, 0x8200, 0x8203, 0x820F, - 0x8213, 0x8214, 0x8219, 0x821A, 0x821D, 0x8221, 0x8222, 0x8228, - 0x8232, 0x8234, 0x823A, 0x8243, 0x8244, 0x8245, 0x8246, -}; -static const unsigned short euc_to_utf8_8FD7[] = { - 0x824B, 0x824E, 0x824F, 0x8251, 0x8256, 0x825C, 0x8260, - 0x8263, 0x8267, 0x826D, 0x8274, 0x827B, 0x827D, 0x827F, 0x8280, - 0x8281, 0x8283, 0x8284, 0x8287, 0x8289, 0x828A, 0x828E, 0x8291, - 0x8294, 0x8296, 0x8298, 0x829A, 0x829B, 0x82A0, 0x82A1, 0x82A3, - 0x82A4, 0x82A7, 0x82A8, 0x82A9, 0x82AA, 0x82AE, 0x82B0, 0x82B2, - 0x82B4, 0x82B7, 0x82BA, 0x82BC, 0x82BE, 0x82BF, 0x82C6, 0x82D0, - 0x82D5, 0x82DA, 0x82E0, 0x82E2, 0x82E4, 0x82E8, 0x82EA, 0x82ED, - 0x82EF, 0x82F6, 0x82F7, 0x82FD, 0x82FE, 0x8300, 0x8301, 0x8307, - 0x8308, 0x830A, 0x830B, 0x8354, 0x831B, 0x831D, 0x831E, 0x831F, - 0x8321, 0x8322, 0x832C, 0x832D, 0x832E, 0x8330, 0x8333, 0x8337, - 0x833A, 0x833C, 0x833D, 0x8342, 0x8343, 0x8344, 0x8347, 0x834D, - 0x834E, 0x8351, 0x8355, 0x8356, 0x8357, 0x8370, 0x8378, -}; -static const unsigned short euc_to_utf8_8FD8[] = { - 0x837D, 0x837F, 0x8380, 0x8382, 0x8384, 0x8386, 0x838D, - 0x8392, 0x8394, 0x8395, 0x8398, 0x8399, 0x839B, 0x839C, 0x839D, - 0x83A6, 0x83A7, 0x83A9, 0x83AC, 0x83BE, 0x83BF, 0x83C0, 0x83C7, - 0x83C9, 0x83CF, 0x83D0, 0x83D1, 0x83D4, 0x83DD, 0x8353, 0x83E8, - 0x83EA, 0x83F6, 0x83F8, 0x83F9, 0x83FC, 0x8401, 0x8406, 0x840A, - 0x840F, 0x8411, 0x8415, 0x8419, 0x83AD, 0x842F, 0x8439, 0x8445, - 0x8447, 0x8448, 0x844A, 0x844D, 0x844F, 0x8451, 0x8452, 0x8456, - 0x8458, 0x8459, 0x845A, 0x845C, 0x8460, 0x8464, 0x8465, 0x8467, - 0x846A, 0x8470, 0x8473, 0x8474, 0x8476, 0x8478, 0x847C, 0x847D, - 0x8481, 0x8485, 0x8492, 0x8493, 0x8495, 0x849E, 0x84A6, 0x84A8, - 0x84A9, 0x84AA, 0x84AF, 0x84B1, 0x84B4, 0x84BA, 0x84BD, 0x84BE, - 0x84C0, 0x84C2, 0x84C7, 0x84C8, 0x84CC, 0x84CF, 0x84D3, -}; -static const unsigned short euc_to_utf8_8FD9[] = { - 0x84DC, 0x84E7, 0x84EA, 0x84EF, 0x84F0, 0x84F1, 0x84F2, - 0x84F7, 0x8532, 0x84FA, 0x84FB, 0x84FD, 0x8502, 0x8503, 0x8507, - 0x850C, 0x850E, 0x8510, 0x851C, 0x851E, 0x8522, 0x8523, 0x8524, - 0x8525, 0x8527, 0x852A, 0x852B, 0x852F, 0x8533, 0x8534, 0x8536, - 0x853F, 0x8546, 0x854F, 0x8550, 0x8551, 0x8552, 0x8553, 0x8556, - 0x8559, 0x855C, 0x855D, 0x855E, 0x855F, 0x8560, 0x8561, 0x8562, - 0x8564, 0x856B, 0x856F, 0x8579, 0x857A, 0x857B, 0x857D, 0x857F, - 0x8581, 0x8585, 0x8586, 0x8589, 0x858B, 0x858C, 0x858F, 0x8593, - 0x8598, 0x859D, 0x859F, 0x85A0, 0x85A2, 0x85A5, 0x85A7, 0x85B4, - 0x85B6, 0x85B7, 0x85B8, 0x85BC, 0x85BD, 0x85BE, 0x85BF, 0x85C2, - 0x85C7, 0x85CA, 0x85CB, 0x85CE, 0x85AD, 0x85D8, 0x85DA, 0x85DF, - 0x85E0, 0x85E6, 0x85E8, 0x85ED, 0x85F3, 0x85F6, 0x85FC, -}; -static const unsigned short euc_to_utf8_8FDA[] = { - 0x85FF, 0x8600, 0x8604, 0x8605, 0x860D, 0x860E, 0x8610, - 0x8611, 0x8612, 0x8618, 0x8619, 0x861B, 0x861E, 0x8621, 0x8627, - 0x8629, 0x8636, 0x8638, 0x863A, 0x863C, 0x863D, 0x8640, 0x8642, - 0x8646, 0x8652, 0x8653, 0x8656, 0x8657, 0x8658, 0x8659, 0x865D, - 0x8660, 0x8661, 0x8662, 0x8663, 0x8664, 0x8669, 0x866C, 0x866F, - 0x8675, 0x8676, 0x8677, 0x867A, 0x868D, 0x8691, 0x8696, 0x8698, - 0x869A, 0x869C, 0x86A1, 0x86A6, 0x86A7, 0x86A8, 0x86AD, 0x86B1, - 0x86B3, 0x86B4, 0x86B5, 0x86B7, 0x86B8, 0x86B9, 0x86BF, 0x86C0, - 0x86C1, 0x86C3, 0x86C5, 0x86D1, 0x86D2, 0x86D5, 0x86D7, 0x86DA, - 0x86DC, 0x86E0, 0x86E3, 0x86E5, 0x86E7, 0x8688, 0x86FA, 0x86FC, - 0x86FD, 0x8704, 0x8705, 0x8707, 0x870B, 0x870E, 0x870F, 0x8710, - 0x8713, 0x8714, 0x8719, 0x871E, 0x871F, 0x8721, 0x8723, -}; -static const unsigned short euc_to_utf8_8FDB[] = { - 0x8728, 0x872E, 0x872F, 0x8731, 0x8732, 0x8739, 0x873A, - 0x873C, 0x873D, 0x873E, 0x8740, 0x8743, 0x8745, 0x874D, 0x8758, - 0x875D, 0x8761, 0x8764, 0x8765, 0x876F, 0x8771, 0x8772, 0x877B, - 0x8783, 0x8784, 0x8785, 0x8786, 0x8787, 0x8788, 0x8789, 0x878B, - 0x878C, 0x8790, 0x8793, 0x8795, 0x8797, 0x8798, 0x8799, 0x879E, - 0x87A0, 0x87A3, 0x87A7, 0x87AC, 0x87AD, 0x87AE, 0x87B1, 0x87B5, - 0x87BE, 0x87BF, 0x87C1, 0x87C8, 0x87C9, 0x87CA, 0x87CE, 0x87D5, - 0x87D6, 0x87D9, 0x87DA, 0x87DC, 0x87DF, 0x87E2, 0x87E3, 0x87E4, - 0x87EA, 0x87EB, 0x87ED, 0x87F1, 0x87F3, 0x87F8, 0x87FA, 0x87FF, - 0x8801, 0x8803, 0x8806, 0x8809, 0x880A, 0x880B, 0x8810, 0x8819, - 0x8812, 0x8813, 0x8814, 0x8818, 0x881A, 0x881B, 0x881C, 0x881E, - 0x881F, 0x8828, 0x882D, 0x882E, 0x8830, 0x8832, 0x8835, -}; -static const unsigned short euc_to_utf8_8FDC[] = { - 0x883A, 0x883C, 0x8841, 0x8843, 0x8845, 0x8848, 0x8849, - 0x884A, 0x884B, 0x884E, 0x8851, 0x8855, 0x8856, 0x8858, 0x885A, - 0x885C, 0x885F, 0x8860, 0x8864, 0x8869, 0x8871, 0x8879, 0x887B, - 0x8880, 0x8898, 0x889A, 0x889B, 0x889C, 0x889F, 0x88A0, 0x88A8, - 0x88AA, 0x88BA, 0x88BD, 0x88BE, 0x88C0, 0x88CA, 0x88CB, 0x88CC, - 0x88CD, 0x88CE, 0x88D1, 0x88D2, 0x88D3, 0x88DB, 0x88DE, 0x88E7, - 0x88EF, 0x88F0, 0x88F1, 0x88F5, 0x88F7, 0x8901, 0x8906, 0x890D, - 0x890E, 0x890F, 0x8915, 0x8916, 0x8918, 0x8919, 0x891A, 0x891C, - 0x8920, 0x8926, 0x8927, 0x8928, 0x8930, 0x8931, 0x8932, 0x8935, - 0x8939, 0x893A, 0x893E, 0x8940, 0x8942, 0x8945, 0x8946, 0x8949, - 0x894F, 0x8952, 0x8957, 0x895A, 0x895B, 0x895C, 0x8961, 0x8962, - 0x8963, 0x896B, 0x896E, 0x8970, 0x8973, 0x8975, 0x897A, -}; -static const unsigned short euc_to_utf8_8FDD[] = { - 0x897B, 0x897C, 0x897D, 0x8989, 0x898D, 0x8990, 0x8994, - 0x8995, 0x899B, 0x899C, 0x899F, 0x89A0, 0x89A5, 0x89B0, 0x89B4, - 0x89B5, 0x89B6, 0x89B7, 0x89BC, 0x89D4, 0x89D5, 0x89D6, 0x89D7, - 0x89D8, 0x89E5, 0x89E9, 0x89EB, 0x89ED, 0x89F1, 0x89F3, 0x89F6, - 0x89F9, 0x89FD, 0x89FF, 0x8A04, 0x8A05, 0x8A07, 0x8A0F, 0x8A11, - 0x8A12, 0x8A14, 0x8A15, 0x8A1E, 0x8A20, 0x8A22, 0x8A24, 0x8A26, - 0x8A2B, 0x8A2C, 0x8A2F, 0x8A35, 0x8A37, 0x8A3D, 0x8A3E, 0x8A40, - 0x8A43, 0x8A45, 0x8A47, 0x8A49, 0x8A4D, 0x8A4E, 0x8A53, 0x8A56, - 0x8A57, 0x8A58, 0x8A5C, 0x8A5D, 0x8A61, 0x8A65, 0x8A67, 0x8A75, - 0x8A76, 0x8A77, 0x8A79, 0x8A7A, 0x8A7B, 0x8A7E, 0x8A7F, 0x8A80, - 0x8A83, 0x8A86, 0x8A8B, 0x8A8F, 0x8A90, 0x8A92, 0x8A96, 0x8A97, - 0x8A99, 0x8A9F, 0x8AA7, 0x8AA9, 0x8AAE, 0x8AAF, 0x8AB3, -}; -static const unsigned short euc_to_utf8_8FDE[] = { - 0x8AB6, 0x8AB7, 0x8ABB, 0x8ABE, 0x8AC3, 0x8AC6, 0x8AC8, - 0x8AC9, 0x8ACA, 0x8AD1, 0x8AD3, 0x8AD4, 0x8AD5, 0x8AD7, 0x8ADD, - 0x8ADF, 0x8AEC, 0x8AF0, 0x8AF4, 0x8AF5, 0x8AF6, 0x8AFC, 0x8AFF, - 0x8B05, 0x8B06, 0x8B0B, 0x8B11, 0x8B1C, 0x8B1E, 0x8B1F, 0x8B0A, - 0x8B2D, 0x8B30, 0x8B37, 0x8B3C, 0x8B42, 0x8B43, 0x8B44, 0x8B45, - 0x8B46, 0x8B48, 0x8B52, 0x8B53, 0x8B54, 0x8B59, 0x8B4D, 0x8B5E, - 0x8B63, 0x8B6D, 0x8B76, 0x8B78, 0x8B79, 0x8B7C, 0x8B7E, 0x8B81, - 0x8B84, 0x8B85, 0x8B8B, 0x8B8D, 0x8B8F, 0x8B94, 0x8B95, 0x8B9C, - 0x8B9E, 0x8B9F, 0x8C38, 0x8C39, 0x8C3D, 0x8C3E, 0x8C45, 0x8C47, - 0x8C49, 0x8C4B, 0x8C4F, 0x8C51, 0x8C53, 0x8C54, 0x8C57, 0x8C58, - 0x8C5B, 0x8C5D, 0x8C59, 0x8C63, 0x8C64, 0x8C66, 0x8C68, 0x8C69, - 0x8C6D, 0x8C73, 0x8C75, 0x8C76, 0x8C7B, 0x8C7E, 0x8C86, -}; -static const unsigned short euc_to_utf8_8FDF[] = { - 0x8C87, 0x8C8B, 0x8C90, 0x8C92, 0x8C93, 0x8C99, 0x8C9B, - 0x8C9C, 0x8CA4, 0x8CB9, 0x8CBA, 0x8CC5, 0x8CC6, 0x8CC9, 0x8CCB, - 0x8CCF, 0x8CD6, 0x8CD5, 0x8CD9, 0x8CDD, 0x8CE1, 0x8CE8, 0x8CEC, - 0x8CEF, 0x8CF0, 0x8CF2, 0x8CF5, 0x8CF7, 0x8CF8, 0x8CFE, 0x8CFF, - 0x8D01, 0x8D03, 0x8D09, 0x8D12, 0x8D17, 0x8D1B, 0x8D65, 0x8D69, - 0x8D6C, 0x8D6E, 0x8D7F, 0x8D82, 0x8D84, 0x8D88, 0x8D8D, 0x8D90, - 0x8D91, 0x8D95, 0x8D9E, 0x8D9F, 0x8DA0, 0x8DA6, 0x8DAB, 0x8DAC, - 0x8DAF, 0x8DB2, 0x8DB5, 0x8DB7, 0x8DB9, 0x8DBB, 0x8DC0, 0x8DC5, - 0x8DC6, 0x8DC7, 0x8DC8, 0x8DCA, 0x8DCE, 0x8DD1, 0x8DD4, 0x8DD5, - 0x8DD7, 0x8DD9, 0x8DE4, 0x8DE5, 0x8DE7, 0x8DEC, 0x8DF0, 0x8DBC, - 0x8DF1, 0x8DF2, 0x8DF4, 0x8DFD, 0x8E01, 0x8E04, 0x8E05, 0x8E06, - 0x8E0B, 0x8E11, 0x8E14, 0x8E16, 0x8E20, 0x8E21, 0x8E22, -}; -static const unsigned short euc_to_utf8_8FE0[] = { - 0x8E23, 0x8E26, 0x8E27, 0x8E31, 0x8E33, 0x8E36, 0x8E37, - 0x8E38, 0x8E39, 0x8E3D, 0x8E40, 0x8E41, 0x8E4B, 0x8E4D, 0x8E4E, - 0x8E4F, 0x8E54, 0x8E5B, 0x8E5C, 0x8E5D, 0x8E5E, 0x8E61, 0x8E62, - 0x8E69, 0x8E6C, 0x8E6D, 0x8E6F, 0x8E70, 0x8E71, 0x8E79, 0x8E7A, - 0x8E7B, 0x8E82, 0x8E83, 0x8E89, 0x8E90, 0x8E92, 0x8E95, 0x8E9A, - 0x8E9B, 0x8E9D, 0x8E9E, 0x8EA2, 0x8EA7, 0x8EA9, 0x8EAD, 0x8EAE, - 0x8EB3, 0x8EB5, 0x8EBA, 0x8EBB, 0x8EC0, 0x8EC1, 0x8EC3, 0x8EC4, - 0x8EC7, 0x8ECF, 0x8ED1, 0x8ED4, 0x8EDC, 0x8EE8, 0x8EEE, 0x8EF0, - 0x8EF1, 0x8EF7, 0x8EF9, 0x8EFA, 0x8EED, 0x8F00, 0x8F02, 0x8F07, - 0x8F08, 0x8F0F, 0x8F10, 0x8F16, 0x8F17, 0x8F18, 0x8F1E, 0x8F20, - 0x8F21, 0x8F23, 0x8F25, 0x8F27, 0x8F28, 0x8F2C, 0x8F2D, 0x8F2E, - 0x8F34, 0x8F35, 0x8F36, 0x8F37, 0x8F3A, 0x8F40, 0x8F41, -}; -static const unsigned short euc_to_utf8_8FE1[] = { - 0x8F43, 0x8F47, 0x8F4F, 0x8F51, 0x8F52, 0x8F53, 0x8F54, - 0x8F55, 0x8F58, 0x8F5D, 0x8F5E, 0x8F65, 0x8F9D, 0x8FA0, 0x8FA1, - 0x8FA4, 0x8FA5, 0x8FA6, 0x8FB5, 0x8FB6, 0x8FB8, 0x8FBE, 0x8FC0, - 0x8FC1, 0x8FC6, 0x8FCA, 0x8FCB, 0x8FCD, 0x8FD0, 0x8FD2, 0x8FD3, - 0x8FD5, 0x8FE0, 0x8FE3, 0x8FE4, 0x8FE8, 0x8FEE, 0x8FF1, 0x8FF5, - 0x8FF6, 0x8FFB, 0x8FFE, 0x9002, 0x9004, 0x9008, 0x900C, 0x9018, - 0x901B, 0x9028, 0x9029, 0x902F, 0x902A, 0x902C, 0x902D, 0x9033, - 0x9034, 0x9037, 0x903F, 0x9043, 0x9044, 0x904C, 0x905B, 0x905D, - 0x9062, 0x9066, 0x9067, 0x906C, 0x9070, 0x9074, 0x9079, 0x9085, - 0x9088, 0x908B, 0x908C, 0x908E, 0x9090, 0x9095, 0x9097, 0x9098, - 0x9099, 0x909B, 0x90A0, 0x90A1, 0x90A2, 0x90A5, 0x90B0, 0x90B2, - 0x90B3, 0x90B4, 0x90B6, 0x90BD, 0x90CC, 0x90BE, 0x90C3, -}; -static const unsigned short euc_to_utf8_8FE2[] = { - 0x90C4, 0x90C5, 0x90C7, 0x90C8, 0x90D5, 0x90D7, 0x90D8, - 0x90D9, 0x90DC, 0x90DD, 0x90DF, 0x90E5, 0x90D2, 0x90F6, 0x90EB, - 0x90EF, 0x90F0, 0x90F4, 0x90FE, 0x90FF, 0x9100, 0x9104, 0x9105, - 0x9106, 0x9108, 0x910D, 0x9110, 0x9114, 0x9116, 0x9117, 0x9118, - 0x911A, 0x911C, 0x911E, 0x9120, 0x9125, 0x9122, 0x9123, 0x9127, - 0x9129, 0x912E, 0x912F, 0x9131, 0x9134, 0x9136, 0x9137, 0x9139, - 0x913A, 0x913C, 0x913D, 0x9143, 0x9147, 0x9148, 0x914F, 0x9153, - 0x9157, 0x9159, 0x915A, 0x915B, 0x9161, 0x9164, 0x9167, 0x916D, - 0x9174, 0x9179, 0x917A, 0x917B, 0x9181, 0x9183, 0x9185, 0x9186, - 0x918A, 0x918E, 0x9191, 0x9193, 0x9194, 0x9195, 0x9198, 0x919E, - 0x91A1, 0x91A6, 0x91A8, 0x91AC, 0x91AD, 0x91AE, 0x91B0, 0x91B1, - 0x91B2, 0x91B3, 0x91B6, 0x91BB, 0x91BC, 0x91BD, 0x91BF, -}; -static const unsigned short euc_to_utf8_8FE3[] = { - 0x91C2, 0x91C3, 0x91C5, 0x91D3, 0x91D4, 0x91D7, 0x91D9, - 0x91DA, 0x91DE, 0x91E4, 0x91E5, 0x91E9, 0x91EA, 0x91EC, 0x91ED, - 0x91EE, 0x91EF, 0x91F0, 0x91F1, 0x91F7, 0x91F9, 0x91FB, 0x91FD, - 0x9200, 0x9201, 0x9204, 0x9205, 0x9206, 0x9207, 0x9209, 0x920A, - 0x920C, 0x9210, 0x9212, 0x9213, 0x9216, 0x9218, 0x921C, 0x921D, - 0x9223, 0x9224, 0x9225, 0x9226, 0x9228, 0x922E, 0x922F, 0x9230, - 0x9233, 0x9235, 0x9236, 0x9238, 0x9239, 0x923A, 0x923C, 0x923E, - 0x9240, 0x9242, 0x9243, 0x9246, 0x9247, 0x924A, 0x924D, 0x924E, - 0x924F, 0x9251, 0x9258, 0x9259, 0x925C, 0x925D, 0x9260, 0x9261, - 0x9265, 0x9267, 0x9268, 0x9269, 0x926E, 0x926F, 0x9270, 0x9275, - 0x9276, 0x9277, 0x9278, 0x9279, 0x927B, 0x927C, 0x927D, 0x927F, - 0x9288, 0x9289, 0x928A, 0x928D, 0x928E, 0x9292, 0x9297, -}; -static const unsigned short euc_to_utf8_8FE4[] = { - 0x9299, 0x929F, 0x92A0, 0x92A4, 0x92A5, 0x92A7, 0x92A8, - 0x92AB, 0x92AF, 0x92B2, 0x92B6, 0x92B8, 0x92BA, 0x92BB, 0x92BC, - 0x92BD, 0x92BF, 0x92C0, 0x92C1, 0x92C2, 0x92C3, 0x92C5, 0x92C6, - 0x92C7, 0x92C8, 0x92CB, 0x92CC, 0x92CD, 0x92CE, 0x92D0, 0x92D3, - 0x92D5, 0x92D7, 0x92D8, 0x92D9, 0x92DC, 0x92DD, 0x92DF, 0x92E0, - 0x92E1, 0x92E3, 0x92E5, 0x92E7, 0x92E8, 0x92EC, 0x92EE, 0x92F0, - 0x92F9, 0x92FB, 0x92FF, 0x9300, 0x9302, 0x9308, 0x930D, 0x9311, - 0x9314, 0x9315, 0x931C, 0x931D, 0x931E, 0x931F, 0x9321, 0x9324, - 0x9325, 0x9327, 0x9329, 0x932A, 0x9333, 0x9334, 0x9336, 0x9337, - 0x9347, 0x9348, 0x9349, 0x9350, 0x9351, 0x9352, 0x9355, 0x9357, - 0x9358, 0x935A, 0x935E, 0x9364, 0x9365, 0x9367, 0x9369, 0x936A, - 0x936D, 0x936F, 0x9370, 0x9371, 0x9373, 0x9374, 0x9376, -}; -static const unsigned short euc_to_utf8_8FE5[] = { - 0x937A, 0x937D, 0x937F, 0x9380, 0x9381, 0x9382, 0x9388, - 0x938A, 0x938B, 0x938D, 0x938F, 0x9392, 0x9395, 0x9398, 0x939B, - 0x939E, 0x93A1, 0x93A3, 0x93A4, 0x93A6, 0x93A8, 0x93AB, 0x93B4, - 0x93B5, 0x93B6, 0x93BA, 0x93A9, 0x93C1, 0x93C4, 0x93C5, 0x93C6, - 0x93C7, 0x93C9, 0x93CA, 0x93CB, 0x93CC, 0x93CD, 0x93D3, 0x93D9, - 0x93DC, 0x93DE, 0x93DF, 0x93E2, 0x93E6, 0x93E7, 0x93F9, 0x93F7, - 0x93F8, 0x93FA, 0x93FB, 0x93FD, 0x9401, 0x9402, 0x9404, 0x9408, - 0x9409, 0x940D, 0x940E, 0x940F, 0x9415, 0x9416, 0x9417, 0x941F, - 0x942E, 0x942F, 0x9431, 0x9432, 0x9433, 0x9434, 0x943B, 0x943F, - 0x943D, 0x9443, 0x9445, 0x9448, 0x944A, 0x944C, 0x9455, 0x9459, - 0x945C, 0x945F, 0x9461, 0x9463, 0x9468, 0x946B, 0x946D, 0x946E, - 0x946F, 0x9471, 0x9472, 0x9484, 0x9483, 0x9578, 0x9579, -}; -static const unsigned short euc_to_utf8_8FE6[] = { - 0x957E, 0x9584, 0x9588, 0x958C, 0x958D, 0x958E, 0x959D, - 0x959E, 0x959F, 0x95A1, 0x95A6, 0x95A9, 0x95AB, 0x95AC, 0x95B4, - 0x95B6, 0x95BA, 0x95BD, 0x95BF, 0x95C6, 0x95C8, 0x95C9, 0x95CB, - 0x95D0, 0x95D1, 0x95D2, 0x95D3, 0x95D9, 0x95DA, 0x95DD, 0x95DE, - 0x95DF, 0x95E0, 0x95E4, 0x95E6, 0x961D, 0x961E, 0x9622, 0x9624, - 0x9625, 0x9626, 0x962C, 0x9631, 0x9633, 0x9637, 0x9638, 0x9639, - 0x963A, 0x963C, 0x963D, 0x9641, 0x9652, 0x9654, 0x9656, 0x9657, - 0x9658, 0x9661, 0x966E, 0x9674, 0x967B, 0x967C, 0x967E, 0x967F, - 0x9681, 0x9682, 0x9683, 0x9684, 0x9689, 0x9691, 0x9696, 0x969A, - 0x969D, 0x969F, 0x96A4, 0x96A5, 0x96A6, 0x96A9, 0x96AE, 0x96AF, - 0x96B3, 0x96BA, 0x96CA, 0x96D2, 0x5DB2, 0x96D8, 0x96DA, 0x96DD, - 0x96DE, 0x96DF, 0x96E9, 0x96EF, 0x96F1, 0x96FA, 0x9702, -}; -static const unsigned short euc_to_utf8_8FE7[] = { - 0x9703, 0x9705, 0x9709, 0x971A, 0x971B, 0x971D, 0x9721, - 0x9722, 0x9723, 0x9728, 0x9731, 0x9733, 0x9741, 0x9743, 0x974A, - 0x974E, 0x974F, 0x9755, 0x9757, 0x9758, 0x975A, 0x975B, 0x9763, - 0x9767, 0x976A, 0x976E, 0x9773, 0x9776, 0x9777, 0x9778, 0x977B, - 0x977D, 0x977F, 0x9780, 0x9789, 0x9795, 0x9796, 0x9797, 0x9799, - 0x979A, 0x979E, 0x979F, 0x97A2, 0x97AC, 0x97AE, 0x97B1, 0x97B2, - 0x97B5, 0x97B6, 0x97B8, 0x97B9, 0x97BA, 0x97BC, 0x97BE, 0x97BF, - 0x97C1, 0x97C4, 0x97C5, 0x97C7, 0x97C9, 0x97CA, 0x97CC, 0x97CD, - 0x97CE, 0x97D0, 0x97D1, 0x97D4, 0x97D7, 0x97D8, 0x97D9, 0x97DD, - 0x97DE, 0x97E0, 0x97DB, 0x97E1, 0x97E4, 0x97EF, 0x97F1, 0x97F4, - 0x97F7, 0x97F8, 0x97FA, 0x9807, 0x980A, 0x9819, 0x980D, 0x980E, - 0x9814, 0x9816, 0x981C, 0x981E, 0x9820, 0x9823, 0x9826, -}; -static const unsigned short euc_to_utf8_8FE8[] = { - 0x982B, 0x982E, 0x982F, 0x9830, 0x9832, 0x9833, 0x9835, - 0x9825, 0x983E, 0x9844, 0x9847, 0x984A, 0x9851, 0x9852, 0x9853, - 0x9856, 0x9857, 0x9859, 0x985A, 0x9862, 0x9863, 0x9865, 0x9866, - 0x986A, 0x986C, 0x98AB, 0x98AD, 0x98AE, 0x98B0, 0x98B4, 0x98B7, - 0x98B8, 0x98BA, 0x98BB, 0x98BF, 0x98C2, 0x98C5, 0x98C8, 0x98CC, - 0x98E1, 0x98E3, 0x98E5, 0x98E6, 0x98E7, 0x98EA, 0x98F3, 0x98F6, - 0x9902, 0x9907, 0x9908, 0x9911, 0x9915, 0x9916, 0x9917, 0x991A, - 0x991B, 0x991C, 0x991F, 0x9922, 0x9926, 0x9927, 0x992B, 0x9931, - 0x9932, 0x9933, 0x9934, 0x9935, 0x9939, 0x993A, 0x993B, 0x993C, - 0x9940, 0x9941, 0x9946, 0x9947, 0x9948, 0x994D, 0x994E, 0x9954, - 0x9958, 0x9959, 0x995B, 0x995C, 0x995E, 0x995F, 0x9960, 0x999B, - 0x999D, 0x999F, 0x99A6, 0x99B0, 0x99B1, 0x99B2, 0x99B5, -}; -static const unsigned short euc_to_utf8_8FE9[] = { - 0x99B9, 0x99BA, 0x99BD, 0x99BF, 0x99C3, 0x99C9, 0x99D3, - 0x99D4, 0x99D9, 0x99DA, 0x99DC, 0x99DE, 0x99E7, 0x99EA, 0x99EB, - 0x99EC, 0x99F0, 0x99F4, 0x99F5, 0x99F9, 0x99FD, 0x99FE, 0x9A02, - 0x9A03, 0x9A04, 0x9A0B, 0x9A0C, 0x9A10, 0x9A11, 0x9A16, 0x9A1E, - 0x9A20, 0x9A22, 0x9A23, 0x9A24, 0x9A27, 0x9A2D, 0x9A2E, 0x9A33, - 0x9A35, 0x9A36, 0x9A38, 0x9A47, 0x9A41, 0x9A44, 0x9A4A, 0x9A4B, - 0x9A4C, 0x9A4E, 0x9A51, 0x9A54, 0x9A56, 0x9A5D, 0x9AAA, 0x9AAC, - 0x9AAE, 0x9AAF, 0x9AB2, 0x9AB4, 0x9AB5, 0x9AB6, 0x9AB9, 0x9ABB, - 0x9ABE, 0x9ABF, 0x9AC1, 0x9AC3, 0x9AC6, 0x9AC8, 0x9ACE, 0x9AD0, - 0x9AD2, 0x9AD5, 0x9AD6, 0x9AD7, 0x9ADB, 0x9ADC, 0x9AE0, 0x9AE4, - 0x9AE5, 0x9AE7, 0x9AE9, 0x9AEC, 0x9AF2, 0x9AF3, 0x9AF5, 0x9AF9, - 0x9AFA, 0x9AFD, 0x9AFF, 0x9B00, 0x9B01, 0x9B02, 0x9B03, -}; -static const unsigned short euc_to_utf8_8FEA[] = { - 0x9B04, 0x9B05, 0x9B08, 0x9B09, 0x9B0B, 0x9B0C, 0x9B0D, - 0x9B0E, 0x9B10, 0x9B12, 0x9B16, 0x9B19, 0x9B1B, 0x9B1C, 0x9B20, - 0x9B26, 0x9B2B, 0x9B2D, 0x9B33, 0x9B34, 0x9B35, 0x9B37, 0x9B39, - 0x9B3A, 0x9B3D, 0x9B48, 0x9B4B, 0x9B4C, 0x9B55, 0x9B56, 0x9B57, - 0x9B5B, 0x9B5E, 0x9B61, 0x9B63, 0x9B65, 0x9B66, 0x9B68, 0x9B6A, - 0x9B6B, 0x9B6C, 0x9B6D, 0x9B6E, 0x9B73, 0x9B75, 0x9B77, 0x9B78, - 0x9B79, 0x9B7F, 0x9B80, 0x9B84, 0x9B85, 0x9B86, 0x9B87, 0x9B89, - 0x9B8A, 0x9B8B, 0x9B8D, 0x9B8F, 0x9B90, 0x9B94, 0x9B9A, 0x9B9D, - 0x9B9E, 0x9BA6, 0x9BA7, 0x9BA9, 0x9BAC, 0x9BB0, 0x9BB1, 0x9BB2, - 0x9BB7, 0x9BB8, 0x9BBB, 0x9BBC, 0x9BBE, 0x9BBF, 0x9BC1, 0x9BC7, - 0x9BC8, 0x9BCE, 0x9BD0, 0x9BD7, 0x9BD8, 0x9BDD, 0x9BDF, 0x9BE5, - 0x9BE7, 0x9BEA, 0x9BEB, 0x9BEF, 0x9BF3, 0x9BF7, 0x9BF8, -}; -static const unsigned short euc_to_utf8_8FEB[] = { - 0x9BF9, 0x9BFA, 0x9BFD, 0x9BFF, 0x9C00, 0x9C02, 0x9C0B, - 0x9C0F, 0x9C11, 0x9C16, 0x9C18, 0x9C19, 0x9C1A, 0x9C1C, 0x9C1E, - 0x9C22, 0x9C23, 0x9C26, 0x9C27, 0x9C28, 0x9C29, 0x9C2A, 0x9C31, - 0x9C35, 0x9C36, 0x9C37, 0x9C3D, 0x9C41, 0x9C43, 0x9C44, 0x9C45, - 0x9C49, 0x9C4A, 0x9C4E, 0x9C4F, 0x9C50, 0x9C53, 0x9C54, 0x9C56, - 0x9C58, 0x9C5B, 0x9C5D, 0x9C5E, 0x9C5F, 0x9C63, 0x9C69, 0x9C6A, - 0x9C5C, 0x9C6B, 0x9C68, 0x9C6E, 0x9C70, 0x9C72, 0x9C75, 0x9C77, - 0x9C7B, 0x9CE6, 0x9CF2, 0x9CF7, 0x9CF9, 0x9D0B, 0x9D02, 0x9D11, - 0x9D17, 0x9D18, 0x9D1C, 0x9D1D, 0x9D1E, 0x9D2F, 0x9D30, 0x9D32, - 0x9D33, 0x9D34, 0x9D3A, 0x9D3C, 0x9D45, 0x9D3D, 0x9D42, 0x9D43, - 0x9D47, 0x9D4A, 0x9D53, 0x9D54, 0x9D5F, 0x9D63, 0x9D62, 0x9D65, - 0x9D69, 0x9D6A, 0x9D6B, 0x9D70, 0x9D76, 0x9D77, 0x9D7B, -}; -static const unsigned short euc_to_utf8_8FEC[] = { - 0x9D7C, 0x9D7E, 0x9D83, 0x9D84, 0x9D86, 0x9D8A, 0x9D8D, - 0x9D8E, 0x9D92, 0x9D93, 0x9D95, 0x9D96, 0x9D97, 0x9D98, 0x9DA1, - 0x9DAA, 0x9DAC, 0x9DAE, 0x9DB1, 0x9DB5, 0x9DB9, 0x9DBC, 0x9DBF, - 0x9DC3, 0x9DC7, 0x9DC9, 0x9DCA, 0x9DD4, 0x9DD5, 0x9DD6, 0x9DD7, - 0x9DDA, 0x9DDE, 0x9DDF, 0x9DE0, 0x9DE5, 0x9DE7, 0x9DE9, 0x9DEB, - 0x9DEE, 0x9DF0, 0x9DF3, 0x9DF4, 0x9DFE, 0x9E0A, 0x9E02, 0x9E07, - 0x9E0E, 0x9E10, 0x9E11, 0x9E12, 0x9E15, 0x9E16, 0x9E19, 0x9E1C, - 0x9E1D, 0x9E7A, 0x9E7B, 0x9E7C, 0x9E80, 0x9E82, 0x9E83, 0x9E84, - 0x9E85, 0x9E87, 0x9E8E, 0x9E8F, 0x9E96, 0x9E98, 0x9E9B, 0x9E9E, - 0x9EA4, 0x9EA8, 0x9EAC, 0x9EAE, 0x9EAF, 0x9EB0, 0x9EB3, 0x9EB4, - 0x9EB5, 0x9EC6, 0x9EC8, 0x9ECB, 0x9ED5, 0x9EDF, 0x9EE4, 0x9EE7, - 0x9EEC, 0x9EED, 0x9EEE, 0x9EF0, 0x9EF1, 0x9EF2, 0x9EF5, -}; -static const unsigned short euc_to_utf8_8FED[] = { - 0x9EF8, 0x9EFF, 0x9F02, 0x9F03, 0x9F09, 0x9F0F, 0x9F10, - 0x9F11, 0x9F12, 0x9F14, 0x9F16, 0x9F17, 0x9F19, 0x9F1A, 0x9F1B, - 0x9F1F, 0x9F22, 0x9F26, 0x9F2A, 0x9F2B, 0x9F2F, 0x9F31, 0x9F32, - 0x9F34, 0x9F37, 0x9F39, 0x9F3A, 0x9F3C, 0x9F3D, 0x9F3F, 0x9F41, - 0x9F43, 0x9F44, 0x9F45, 0x9F46, 0x9F47, 0x9F53, 0x9F55, 0x9F56, - 0x9F57, 0x9F58, 0x9F5A, 0x9F5D, 0x9F5E, 0x9F68, 0x9F69, 0x9F6D, - 0x9F6E, 0x9F6F, 0x9F70, 0x9F71, 0x9F73, 0x9F75, 0x9F7A, 0x9F7D, - 0x9F8F, 0x9F90, 0x9F91, 0x9F92, 0x9F94, 0x9F96, 0x9F97, 0x9F9E, - 0x9FA1, 0x9FA2, 0x9FA3, 0x9FA5, 0, 0, 0, 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 euc_to_utf8_8FF3[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, - 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x2160, 0x2161, -}; -static const unsigned short euc_to_utf8_8FF4[] = { - 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, - 0x2169, 0xff07, 0xff02, 0x3231, 0x2116, 0x2121, 0x70bb, 0x4efc, - 0x50f4, 0x51ec, 0x5307, 0x5324, 0xfa0e, 0x548a, 0x5759, 0xfa0f, - 0xfa10, 0x589e, 0x5bec, 0x5cf5, 0x5d53, 0xfa11, 0x5fb7, 0x6085, - 0x6120, 0x654e, 0x663b, 0x6665, 0xfa12, 0xf929, 0x6801, 0xfa13, - 0xfa14, 0x6a6b, 0x6ae2, 0x6df8, 0x6df2, 0x7028, 0xfa15, 0xfa16, - 0x7501, 0x7682, 0x769e, 0xfa17, 0x7930, 0xfa18, 0xfa19, 0xfa1a, - 0xfa1b, 0x7ae7, 0xfa1c, 0xfa1d, 0x7da0, 0x7dd6, 0xfa1e, 0x8362, - 0xfa1f, 0x85b0, 0xfa20, 0xfa21, 0x8807, 0xfa22, 0x8b7f, 0x8cf4, - 0x8d76, 0xfa23, 0xfa24, 0xfa25, 0x90de, 0xfa26, 0x9115, 0xfa27, - 0xfa28, 0x9592, 0xf9dc, 0xfa29, 0x973b, 0x974d, 0x9751, 0xfa2a, - 0xfa2b, 0xfa2c, 0x999e, 0x9ad9, 0x9b72, 0xfa2d, 0x9ed1, -}; -#endif /* X0212_ENABLE */ - -const unsigned short euc_to_utf8_1byte[] = { - 0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0xFF66, 0xFF67, - 0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, 0xFF6F, - 0xFF70, 0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF76, 0xFF77, - 0xFF78, 0xFF79, 0xFF7A, 0xFF7B, 0xFF7C, 0xFF7D, 0xFF7E, 0xFF7F, - 0xFF80, 0xFF81, 0xFF82, 0xFF83, 0xFF84, 0xFF85, 0xFF86, 0xFF87, - 0xFF88, 0xFF89, 0xFF8A, 0xFF8B, 0xFF8C, 0xFF8D, 0xFF8E, 0xFF8F, - 0xFF90, 0xFF91, 0xFF92, 0xFF93, 0xFF94, 0xFF95, 0xFF96, 0xFF97, - 0xFF98, 0xFF99, 0xFF9A, 0xFF9B, 0xFF9C, 0xFF9D, 0xFF9E, 0xFF9F, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x00A9, 0x2122, -}; -const unsigned short *const euc_to_utf8_2bytes[] = { - euc_to_utf8_A1, euc_to_utf8_A2, euc_to_utf8_A3, - euc_to_utf8_A4, euc_to_utf8_A5, euc_to_utf8_A6, euc_to_utf8_A7, - euc_to_utf8_A8, euc_to_utf8_A9, euc_to_utf8_AA, euc_to_utf8_AB, - euc_to_utf8_AC, euc_to_utf8_AD, euc_to_utf8_AE, euc_to_utf8_AF, - 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, - 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, euc_to_utf8_F5, 0, 0, - 0, euc_to_utf8_F9, euc_to_utf8_FA, euc_to_utf8_FB, - euc_to_utf8_FC, 0, 0, -}; -/* Microsoft UCS Mapping Compatible */ -const unsigned short *const euc_to_utf8_2bytes_ms[] = { - euc_to_utf8_A1_ms, euc_to_utf8_A2_ms, euc_to_utf8_A3, - euc_to_utf8_A4, euc_to_utf8_A5, euc_to_utf8_A6, euc_to_utf8_A7, - euc_to_utf8_A8, euc_to_utf8_A9, euc_to_utf8_AA, euc_to_utf8_AB, - euc_to_utf8_AC, euc_to_utf8_AD, euc_to_utf8_AE, euc_to_utf8_AF, - 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, - 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, euc_to_utf8_F5, 0, 0, - 0, euc_to_utf8_F9, euc_to_utf8_FA, euc_to_utf8_FB, - euc_to_utf8_FC_ms, 0, 0, -}; -/* CP10001 */ -const unsigned short *const euc_to_utf8_2bytes_mac[] = { - euc_to_utf8_A1_ms, euc_to_utf8_A2_ms, euc_to_utf8_A3, - euc_to_utf8_A4, euc_to_utf8_A5, euc_to_utf8_A6, euc_to_utf8_A7, - euc_to_utf8_A8, euc_to_utf8_A9, euc_to_utf8_AA, euc_to_utf8_AB, - euc_to_utf8_AC_mac, euc_to_utf8_AD_mac, euc_to_utf8_AE, euc_to_utf8_AF, - 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, - 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, euc_to_utf8_F5, 0, 0, - 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[] = { - 0, euc_to_utf8_8FA2, 0, - 0, 0, euc_to_utf8_8FA6, euc_to_utf8_8FA7, - 0, euc_to_utf8_8FA9, euc_to_utf8_8FAA, euc_to_utf8_8FAB, - 0, 0, 0, 0, - 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, 0, 0, - 0, 0, 0, euc_to_utf8_8FF3, - 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 -static const unsigned short utf8_to_euc_C2[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xA242, 0x2171, 0x2172, 0xA270, 0x216F, 0xA243, 0x2178, - 0x212F, 0xA26D, 0xA26C, 0, 0x224C, 0, 0xA26E, 0xA234, - 0x216B, 0x215E, 0, 0, 0x212D, 0, 0x2279, 0, - 0xA231, 0, 0xA26B, 0, 0, 0, 0, 0xA244, -}; -static const unsigned short utf8_to_euc_C2_ms[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xA242, 0x2171, 0x2172, 0xA270, 0x5C, 0xA243, 0x2178, - 0x212F, 0xA26D, 0xA26C, 0, 0x224C, 0, 0xA26E, 0xA234, - 0x216B, 0x215E, 0, 0, 0x212D, 0, 0x2279, 0, - 0xA231, 0, 0xA26B, 0, 0, 0, 0, 0xA244, -}; -static const unsigned short utf8_to_euc_C2_mac[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0x00A0, 0xA242, 0x2171, 0x2172, 0xA270, 0x5C, 0xA243, 0x2178, - 0x212F, 0x00FD, 0xA26C, 0, 0x224C, 0, 0xA26E, 0xA234, - 0x216B, 0x215E, 0, 0, 0x212D, 0, 0x2279, 0, - 0xA231, 0, 0xA26B, 0, 0, 0, 0, 0xA244, -}; -static const unsigned short utf8_to_euc_C2_932[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x21, 0x2171, 0x2172, 0, 0x5C, 0x7C, 0x2178, - 0x212F, 0x63, 0x61, 0x2263, 0x224C, 0x2D, 0x52, 0x2131, - 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, - 0, 0xAA50, 0xAA52, 0xAA51, 0xAA54, 0xAA58, 0xAA53, 0x215F, - 0xA92C, 0xAA63, 0xAA62, 0xAA65, 0xAA64, 0xAA72, 0xA930, 0xA94E, - 0xAB22, 0xAB21, 0xAB24, 0xAB2A, 0xAB23, 0xAB29, 0xA941, 0xAB2E, - 0xAB32, 0xAB31, 0xAB34, 0xAB33, 0xAB40, 0xAB3F, 0xAB42, 0xAB41, - 0xA943, 0xAB50, 0xAB52, 0xAB51, 0xAB54, 0xAB58, 0xAB53, 0x2160, - 0xA94C, 0xAB63, 0xAB62, 0xAB65, 0xAB64, 0xAB72, 0xA950, 0xAB73, -}; -static const unsigned short utf8_to_euc_C3_932[] = { - 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, - 0x45, 0x45, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, - 0x44, 0x4E, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, 0x215F, - 0x4F, 0x55, 0x55, 0x55, 0x55, 0x59, 0x54, 0x73, - 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x63, - 0x65, 0x65, 0x65, 0x65, 0x69, 0x69, 0x69, 0x69, - 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, - 0xA922, 0xA942, 0xAA37, 0xAB37, 0, 0, 0xAA36, 0xAB36, - 0xAA38, 0xAB38, 0xAA35, 0xAB35, 0xAA3A, 0xAB3A, 0xAA3B, 0xAB3B, - 0xAA3D, 0xAB3D, 0xAA3C, 0, 0xAA3E, 0xAB3E, 0xA924, 0xA944, - 0xAA47, 0xAB47, 0xAA45, 0xAB45, 0, 0, 0xAA46, 0xAB46, - 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, - 0xAA56, 0xAB56, 0xA92D, 0xA94D, 0xAA59, 0xAB59, 0xAA5B, 0xAB5B, - 0xAA5A, 0xAB5A, 0xAA5C, 0xAB5C, 0xAA5D, 0xAB5D, 0xAA5F, 0xAB5F, - 0xAA5E, 0xAB5E, 0xAA61, 0xAB61, 0xAA60, 0xAB60, 0xA92F, 0xA94F, - 0xAA6C, 0xAB6C, 0xAA69, 0xAB69, 0xAA66, 0xAB66, 0xAA6B, 0xAB6B, - 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, - 0xAB43, 0xAA55, 0xAB55, 0xAA67, 0xAB67, 0xAA70, 0xAB70, 0xAA6D, - 0xAB6D, 0xAA6F, 0xAB6F, 0xAA6E, 0xAB6E, 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, - 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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xA22F, 0xA232, 0xA236, 0xA235, 0, 0xA233, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0xA676, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, 0x2626, 0x2627, - 0x2628, 0x2629, 0x262A, 0x262B, 0x262C, 0x262D, 0x262E, 0x262F, - 0x2630, 0x2631, 0, 0x2632, 0x2633, 0x2634, 0x2635, 0x2636, - 0x2637, 0x2638, 0xA665, 0xA66A, 0xA671, 0xA672, 0xA673, 0xA674, - 0xA67B, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, 0x2646, 0x2647, - 0x2648, 0x2649, 0x264A, 0x264B, 0x264C, 0x264D, 0x264E, 0x264F, -}; -static const unsigned short utf8_to_euc_CF[] = { - 0x2650, 0x2651, 0xA678, 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_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, - 0x2721, 0x2722, 0x2723, 0x2724, 0x2725, 0x2726, 0x2728, 0x2729, - 0x272A, 0x272B, 0x272C, 0x272D, 0x272E, 0x272F, 0x2730, 0x2731, - 0x2732, 0x2733, 0x2734, 0x2735, 0x2736, 0x2737, 0x2738, 0x2739, - 0x273A, 0x273B, 0x273C, 0x273D, 0x273E, 0x273F, 0x2740, 0x2741, - 0x2751, 0x2752, 0x2753, 0x2754, 0x2755, 0x2756, 0x2758, 0x2759, - 0x275A, 0x275B, 0x275C, 0x275D, 0x275E, 0x275F, 0x2760, 0x2761, -}; -static const unsigned short utf8_to_euc_D1[] = { - 0x2762, 0x2763, 0x2764, 0x2765, 0x2766, 0x2767, 0x2768, 0x2769, - 0x276A, 0x276B, 0x276C, 0x276D, 0x276E, 0x276F, 0x2770, 0x2771, - 0, 0x2757, 0xA772, 0xA773, 0xA774, 0xA775, 0xA776, 0xA777, - 0xA778, 0xA779, 0xA77A, 0xA77B, 0xA77C, 0, 0xA77D, 0xA77E, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0x213E, 0, 0, 0, 0x213D, 0x213D, 0x2142, 0, - 0x2146, 0x2147, 0, 0, 0x2148, 0x2149, 0, 0, - 0x2277, 0x2278, 0, 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, 0, 0, 0x2131, 0, -}; -static const unsigned short utf8_to_euc_E280_ms[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0x213E, 0, 0, 0, 0x213D, 0x213D, 0x2142, 0, - 0x2146, 0x2147, 0, 0, 0x2148, 0x2149, 0, 0, - 0x2277, 0x2278, 0, 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, 0, 0, 0x7E, 0, -}; -static const unsigned short utf8_to_euc_E280_932[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0x213E, 0, 0, 0, 0, 0x213D, 0, 0, - 0x2146, 0x2147, 0, 0, 0x2148, 0x2149, 0, 0, - 0x2277, 0x2278, 0, 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, 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, - 0, 0, 0, 0, 0, 0, 0x2D62, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x2D64, 0xA26F, 0, 0, 0, 0, 0, - 0, 0, 0, 0x2272, 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_E284_mac[] = { - 0, 0, 0, 0x216E, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0x2B7B, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x2B7D, 0x00FE, 0, 0, 0, 0, 0, - 0, 0, 0, 0x2272, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0x2D35, 0x2D36, 0x2D37, 0x2D38, 0x2D39, 0x2D3A, 0x2D3B, 0x2D3C, - 0x2D3D, 0x2D3E, 0, 0, 0, 0, 0, 0, - 0xF373, 0xF374, 0xF375, 0xF376, 0xF377, 0xF378, 0xF379, 0xF37A, - 0xF37B, 0xF37C, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short utf8_to_euc_E285_mac[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0x2A21, 0x2A22, 0x2A23, 0x2A24, 0x2A25, 0x2A26, 0x2A27, 0x2A28, - 0x2A29, 0x2A2A, 0, 0, 0, 0, 0, 0, - 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, - 0x222B, 0x222C, 0x222A, 0x222D, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0, 0, 0x224D, 0, 0x224E, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0, 0x2D74, 0x215D, 0, 0, 0, 0, 0, - 0, 0, 0x2265, 0, 0, 0x2267, 0x2167, 0x2D78, - 0x225C, 0, 0, 0, 0, 0x2142, 0, 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_E288_932[] = { - 0x224F, 0, 0x225F, 0x2250, 0, 0, 0, 0x2260, - 0x223A, 0, 0, 0x223B, 0, 0, 0, 0, - 0, 0x2D74, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2265, 0, 0, 0x2267, 0x2167, 0x2D78, - 0x225C, 0, 0, 0, 0, 0x2142, 0, 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_E288_mac[] = { - 0x224F, 0, 0x225F, 0x2250, 0, 0, 0, 0x2260, - 0x223A, 0, 0, 0x223B, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2265, 0, 0, 0x2267, 0x2167, 0x2F22, - 0x225C, 0, 0, 0, 0, 0x2142, 0, 0x224A, - 0x224B, 0x2241, 0x2240, 0x2269, 0x226A, 0, 0x2F21, 0, - 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, - 0, 0, 0x2262, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0x2162, 0x2261, 0, 0, 0, 0, 0x2165, 0x2166, - 0, 0, 0x2263, 0x2264, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_E28A_mac[] = { - 0, 0, 0x223E, 0x223F, 0, 0, 0x223C, 0x223D, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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, 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, - 0, 0, 0x225E, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0x2D21, 0x2D22, 0x2D23, 0x2D24, 0x2D25, 0x2D26, 0x2D27, 0x2D28, - 0x2D29, 0x2D2A, 0x2D2B, 0x2D2C, 0x2D2D, 0x2D2E, 0x2D2F, 0x2D30, - 0x2D31, 0x2D32, 0x2D33, 0x2D34, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short utf8_to_euc_E291_mac[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 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, 0x2922, 0x2923, 0x2924, 0x2925, 0x2926, 0x2927, 0x2928, - 0x2929, 0x292A, 0x292B, 0x292C, 0x292D, 0x292E, 0x292F, 0x2930, - 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, - 0x2824, 0, 0, 0x282F, 0x2826, 0, 0, 0x2831, - 0x2825, 0, 0, 0x2830, 0x2827, 0x283C, 0, 0, - 0x2837, 0, 0, 0x2832, 0x2829, 0x283E, 0, 0, - 0x2839, 0, 0, 0x2834, 0x2828, 0, 0, 0x2838, - 0x283D, 0, 0, 0x2833, 0x282A, 0, 0, 0x283A, - 0x283F, 0, 0, 0x2835, 0x282B, 0, 0, 0x283B, -}; -static const unsigned short utf8_to_euc_E295[] = { - 0, 0, 0x2840, 0, 0, 0, 0, 0, - 0, 0, 0, 0x2836, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_E296[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 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, 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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2276, 0, 0, 0x2275, 0, 0x2274, - 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, - 0x215A, 0x215B, 0x2229, 0x222E, 0x214C, 0x214D, 0, 0, - 0, 0, 0, 0, 0x2141, 0x2D60, 0, 0x2D61, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_E380_932[] = { - 0x2121, 0x2122, 0x2123, 0x2137, 0, 0x2139, 0x213A, 0x213B, - 0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, - 0x215A, 0x215B, 0x2229, 0x222E, 0x214C, 0x214D, 0, 0, - 0, 0, 0, 0, 0, 0x2D60, 0, 0x2D61, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0x2430, 0x2431, 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, - 0x2438, 0x2439, 0x243A, 0x243B, 0x243C, 0x243D, 0x243E, 0x243F, - 0x2440, 0x2441, 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, - 0x2448, 0x2449, 0x244A, 0x244B, 0x244C, 0x244D, 0x244E, 0x244F, - 0x2450, 0x2451, 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, - 0x2458, 0x2459, 0x245A, 0x245B, 0x245C, 0x245D, 0x245E, 0x245F, -}; -static const unsigned short utf8_to_euc_E382[] = { - 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, - 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, 0x246F, - 0x2470, 0x2471, 0x2472, 0x2473, 0, 0, 0, 0, - 0, 0, 0, 0x212B, 0x212C, 0x2135, 0x2136, 0, - 0, 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_E382_932[] = { - 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, - 0x2468, 0x2469, 0x246A, 0x246B, 0x246C, 0x246D, 0x246E, 0x246F, - 0x2470, 0x2471, 0x2472, 0x2473, 0x2574, 0, 0, 0, - 0, 0, 0, 0x212B, 0x212C, 0x2135, 0x2136, 0, - 0, 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_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, - 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, 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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x2D6A, 0x2D6B, 0, 0, 0, 0, 0, - 0, 0x2D6C, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short utf8_to_euc_E388_mac[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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, - 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, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -}; -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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x2D73, 0x2D74, 0x2D75, 0x2D76, - 0x2D77, 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_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, - 0, 0, 0, 0, 0x2D41, 0, 0, 0, - 0x2D44, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2D42, 0x2D4C, 0, 0, 0x2D4B, 0x2D45, - 0, 0, 0, 0x2D4D, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0x2D47, 0, - 0, 0, 0, 0x2D4F, 0, 0, 0, 0, -}; -static const unsigned short utf8_to_euc_E38C_mac[] = { - 0, 0, 0, 0x2E29, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x2E32, 0, 0, - 0, 0, 0, 0, 0x2E24, 0, 0, 0, - 0x2E2B, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x2E22, 0x2E34, 0, 0, 0x2E35, 0x2E2D, - 0, 0, 0, 0x2E37, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0x2E2A, 0, - 0, 0, 0, 0x2E36, 0, 0, 0, 0, -}; -static const unsigned short utf8_to_euc_E38D[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x2D40, 0x2D4E, 0, 0, 0x2D43, 0, 0, - 0, 0x2D48, 0, 0, 0, 0, 0, 0x2D49, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x2D5F, 0x2D6F, 0x2D6E, 0x2D6D, 0, -}; -static const unsigned short utf8_to_euc_E38D_mac[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x2E21, 0x2E2F, 0, 0, 0x2E23, 0, 0, - 0, 0x2E2E, 0, 0, 0, 0, 0, 0x2E31, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x2E6A, 0x2E69, 0x2E68, 0x2E67, 0, -}; -static const unsigned short utf8_to_euc_E38E[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0x2D53, 0x2D54, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x2D50, 0x2D51, 0x2D52, 0, - 0, 0x2D56, 0, 0, 0, 0, 0, 0, - 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_E38E_mac[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0x2B2B, 0x2B2D, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x2B21, 0x2B23, 0x2B29, 0, - 0, 0x2B27, 0, 0, 0, 0, 0, 0, - 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_E38F[] = { - 0, 0, 0, 0, 0x2D55, 0, 0, 0, - 0, 0, 0, 0, 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_E38F_mac[] = { - 0, 0, 0, 0, 0x2B2E, 0, 0, 0, - 0, 0, 0, 0, 0, 0x2B7C, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0x5022, 0x312F, 0xB025, 0, 0x336E, 0x5023, 0x4024, 0x5242, - 0x3556, 0x4A3A, 0, 0, 0, 0, 0x3E67, 0xB026, - 0, 0x4E3E, 0, 0xB027, 0xB028, 0, 0x4A42, 0, - 0xB029, 0, 0x5024, 0xB02A, 0, 0x4366, 0xB02B, 0xB02C, - 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, - 0, 0xB033, 0, 0, 0, 0x6949, 0x502A, 0x3E68, - 0x502B, 0x3235, 0xB034, 0, 0xB035, 0x3665, 0x3870, 0x4C69, - 0, 0, 0x5626, 0xB036, 0, 0, 0, 0, - 0xB037, 0xB038, 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_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, - 0, 0x313E, 0x385F, 0, 0x385E, 0x3066, 0xB03E, 0xB03F, - 0x4F4B, 0x4F4A, 0, 0x3A33, 0x3021, 0xB040, 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, 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, - 0xB044, 0, 0, 0, 0x3B46, 0x3B45, 0x423E, 0x503F, - 0x4955, 0x4067, 0xB045, 0xB046, 0, 0x2138, 0x5040, 0x5042, - 0xB047, 0xB048, 0xB049, 0x4265, 0x4E61, 0x304A, 0, 0, - 0xB04A, 0, 0, 0, 0, 0x5041, 0x323E, 0xB04B, - 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, 0, 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, - 0x4832, 0x3559, 0xB058, 0, 0, 0xB059, 0xB05A, 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, 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, 0, 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, - 0x3A34, 0x4D24, 0xB06C, 0x424E, 0xB06D, 0x323F, 0xB06E, 0x5049, - 0xB06F, 0x4D3E, 0x5045, 0x5047, 0x3A6E, 0x5048, 0x5524, 0xB070, - 0xB05F, 0, 0, 0xB071, 0, 0, 0, 0, - 0, 0x5050, 0xB072, 0, 0xB073, 0, 0xB074, 0x5053, - 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, - 0xB126, 0x5052, 0xB127, 0xB128, 0xB129, 0, 0x5055, 0xB12A, - 0x504E, 0xB12B, 0xB12C, 0x3621, 0, 0x304D, 0xB12D, 0xB12E, - 0x3622, 0x3241, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x5525, 0, 0x4B79, 0x496E, 0x3874, - 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, - 0x505E, 0x505C, 0xB140, 0, 0x5057, 0, 0, 0x422F, - 0x505A, 0, 0x505D, 0x505B, 0xB141, 0x4A5D, 0, 0x5058, - 0xB142, 0x3F2E, 0xB143, 0x4B73, 0x505F, 0x5060, 0, 0, - 0, 0, 0, 0, 0, 0, 0x3D24, 0x506D, - 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, 0, 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, 0, -}; -static const unsigned short utf8_to_euc_E580[] = { - 0xB149, 0xB14A, 0, 0, 0xB14B, 0x5066, 0x506F, 0xB14C, - 0, 0x4152, 0xB14D, 0x3844, 0xB14E, 0x475C, 0xB14F, 0x6047, - 0xB150, 0x506E, 0x455D, 0xB151, 0x5063, 0, 0x3876, 0xB152, - 0xB153, 0x3875, 0x5061, 0xB154, 0xB155, 0xB156, 0xB157, 0x3C5A, - 0, 0x5069, 0xB158, 0x4A6F, 0x434D, 0x5065, 0x3771, 0xB159, - 0x5062, 0x506A, 0x5064, 0x4E51, 0x506B, 0x4F41, 0xB15A, 0, - 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, - 0x5074, 0xB167, 0xB168, 0xB169, 0, 0x5073, 0x5077, 0xB16A, - 0, 0xB16B, 0x5076, 0, 0x4464, 0, 0, 0xB16C, - 0xB16D, 0, 0xB16E, 0xB16F, 0, 0x3772, 0xB170, 0xB171, - 0, 0, 0xB172, 0, 0x5078, 0xB173, 0, 0, - 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, - 0xB17E, 0x3766, 0xB221, 0xB222, 0xB223, 0, 0xB224, 0, - 0x3B31, 0x4877, 0x507B, 0xB225, 0xB226, 0, 0xB227, 0xB228, - 0xB229, 0xB22A, 0xB22B, 0, 0, 0, 0, 0, - 0, 0, 0xB22C, 0, 0x3A45, 0x4D43, 0, 0xB22D, - 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, - 0xB238, 0x3623, 0, 0xB239, 0xB23A, 0x4B4D, 0x5125, 0, - 0xB23B, 0, 0x4E3D, 0, 0xB23C, 0xB23D, 0x5126, 0xB23E, - 0, 0, 0xB23F, 0x5129, 0xB240, 0x5127, 0xB241, 0x414E, - 0xB242, 0xB243, 0, 0, 0, 0x5128, 0x512A, 0xB244, - 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, - 0, 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, 0, 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, - 0xB252, 0, 0x3C74, 0, 0x5132, 0x5131, 0x5130, 0xB253, - 0x5056, 0xB254, 0x5133, 0xB255, 0xB256, 0xB257, 0xB258, 0x3D7E, - 0, 0x5134, 0, 0xB259, 0, 0, 0, 0xB25A, - 0xB25B, 0, 0x4D25, 0, 0xB25C, 0xB25D, 0, 0xB25E, - 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, - 0x3B79, 0, 0x513B, 0xB268, 0x513D, 0xB269, 0, 0xB26A, - 0xB26B, 0, 0x455E, 0, 0x3375, 0, 0, 0xB26C, - 0, 0, 0x513E, 0, 0xB26D, 0x467E, 0xB26E, 0, - 0x4134, 0x5140, 0x5141, 0x482C, 0x3878, 0x4F3B, 0x5142, 0, - 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, 0, 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, - 0x666E, 0x5149, 0x4B41, 0x514A, 0, 0x514B, 0x514C, 0x3E69, - 0xB274, 0x3C4C, 0, 0, 0, 0xB275, 0, 0, - 0x3427, 0xB276, 0x514F, 0xB277, 0x514D, 0x4C3D, 0x514E, 0, - 0x495A, 0x5150, 0x5151, 0x5152, 0x455F, 0xB278, 0, 0, - 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, 0, 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, - 0, 0xB323, 0xB324, 0xB325, 0, 0xB326, 0x5245, 0, - 0xB327, 0, 0, 0x515B, 0x7425, 0x3645, 0xB328, 0, - 0x515C, 0x4B5E, 0xB329, 0, 0, 0xB32A, 0x3D68, 0x427C, - 0, 0x515E, 0x4664, 0, 0xF431, 0x515F, 0xB32B, 0, - 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, 0, 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, - 0, 0x373A, 0xB333, 0xB334, 0x5165, 0xB335, 0xB336, 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_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, - 0, 0, 0, 0, 0x5171, 0xB340, 0x4B36, 0xB341, - 0xB342, 0, 0xB343, 0x3964, 0xB344, 0, 0x5170, 0xB345, - 0xB346, 0xB347, 0, 0x3775, 0x3A5E, 0x476D, 0xB348, 0, - 0, 0x5174, 0x5172, 0, 0, 0, 0xB349, 0x497B, - 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, - 0, 0x517D, 0x517A, 0xB352, 0x5179, 0xB353, 0xB354, 0xB355, - 0xB356, 0, 0xB357, 0x4E4F, 0xB358, 0, 0, 0x3879, - 0x3243, 0, 0, 0x4E74, 0xB359, 0xB35A, 0xB35B, 0xB35C, - 0, 0x3D75, 0x4558, 0x3965, 0x5222, 0x5223, 0, 0xB35D, - 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, 0, 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, - 0, 0xB36B, 0x7055, 0, 0xB36C, 0x4630, 0xB36D, 0x5228, - 0x342A, 0x4C33, 0, 0xB36E, 0xB36F, 0x3E21, 0x5229, 0x4A67, - 0x522D, 0xB370, 0x402A, 0x522A, 0x3650, 0xB371, 0x522B, 0x342B, - 0xB372, 0xB373, 0xB374, 0, 0xB375, 0, 0, 0, - 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[] = { - 0, 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, - 0x5236, 0xB422, 0, 0xB423, 0, 0x5238, 0x323D, 0x4B4C, - 0xB424, 0x3A7C, 0x5239, 0xB425, 0xB426, 0x4159, 0xB427, 0xB428, - 0x3E22, 0x3629, 0, 0x523A, 0xF433, 0xB429, 0, 0xB42A, - 0xB42B, 0xB42C, 0x485B, 0xB42D, 0xB42E, 0xB42F, 0, 0x523B, - 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, - 0, 0x485C, 0x4234, 0x426E, 0x3628, 0, 0, 0x466E, - 0x4331, 0xB439, 0x476E, 0xB43A, 0x4B4E, 0, 0x5246, 0, - 0x406A, 0xB43B, 0, 0xB43C, 0, 0xB43D, 0x3735, 0, - 0, 0x5247, 0, 0, 0xB43E, 0xB43F, 0x5248, 0x312C, - 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, 0, 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, - 0, 0, 0, 0xB447, 0xB448, 0, 0x524D, 0, - 0x4E52, 0xB449, 0x387C, 0, 0, 0xB44A, 0, 0x3836, - 0x524E, 0xB44B, 0, 0, 0xB44C, 0x5250, 0x524F, 0, - 0x3F5F, 0x3139, 0xB44D, 0xB44E, 0, 0x315E, 0x5251, 0xB44F, - 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, - 0, 0, 0xB45A, 0xB45B, 0x3D47, 0xB45C, 0x3C68, 0x3C75, - 0, 0x3D76, 0xB45D, 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, 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, 0, 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, - 0x4547, 0x387E, 0, 0xB465, 0, 0, 0, 0, - 0, 0, 0xB466, 0x372F, 0, 0x5267, 0, 0x3663, - 0x4B4A, 0xB467, 0, 0, 0, 0, 0x485D, 0xB468, - 0xB469, 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_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, - 0, 0x465D, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xB474, 0x526C, - 0, 0, 0xB475, 0, 0xB476, 0, 0xB477, 0xB478, - 0x3C7E, 0xB479, 0x3C76, 0xB47A, 0, 0xB47B, 0xB47C, 0, - 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, - 0x5275, 0xB527, 0x5270, 0, 0, 0xB528, 0xB529, 0, - 0, 0, 0, 0, 0xB52A, 0, 0, 0xB52B, - 0, 0xB52C, 0x5278, 0, 0x5323, 0x527A, 0xB52D, 0xB52E, - 0x527E, 0xB52F, 0xB530, 0x5321, 0x527B, 0xB531, 0xB532, 0x533E, - 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, - 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, 0xB53F, 0x532D, 0x532C, 0xB540, - 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, - 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, 0xB54F, 0, 0, 0x5334, 0x4D23, - 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, - 0xB55B, 0xB55C, 0, 0x373C, 0, 0, 0x5337, 0x5338, - 0xB55D, 0, 0xB55E, 0xB55F, 0x5335, 0x533B, 0xB560, 0, - 0xB561, 0xB562, 0, 0x5332, 0xB563, 0, 0xB564, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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, - 0, 0xB56C, 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, 0xB573, 0x5345, 0, - 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, - 0, 0xB57D, 0xB57E, 0xB621, 0x5351, 0, 0, 0xB622, - 0xB623, 0, 0x534B, 0xB624, 0x534F, 0, 0xB625, 0x534D, - 0, 0, 0xB626, 0x3B4C, 0x5350, 0, 0, 0, - 0, 0xB627, 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_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, - 0xB630, 0xB631, 0xB632, 0, 0x5352, 0, 0x5354, 0x3E28, - 0x3133, 0xB633, 0, 0x5357, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x325E, 0, 0, 0xB634, 0, 0, 0x5362, - 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, - 0x535A, 0, 0, 0, 0xB647, 0, 0, 0, - 0, 0, 0, 0x337A, 0, 0, 0xB648, 0, - 0xB649, 0xB64A, 0xB64B, 0xB64C, 0x5361, 0, 0xB64D, 0, - 0x346F, 0xB64E, 0x5364, 0x5360, 0x5363, 0xB64F, 0, 0xB650, - 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, - 0, 0, 0, 0, 0x5369, 0xB659, 0, 0, - 0, 0xB65A, 0xB65B, 0, 0, 0xB65C, 0xB65D, 0xB65E, - 0x5368, 0, 0x4739, 0, 0, 0x536B, 0xB65F, 0xB660, - 0xB661, 0xB662, 0, 0xB663, 0xB664, 0xB665, 0x536C, 0, - 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, - 0xB66F, 0x5376, 0, 0x5377, 0, 0, 0, 0x5378, - 0x5145, 0xB672, 0x3C7C, 0x3B4D, 0xB673, 0xB674, 0x3273, 0xB675, - 0x3078, 0xB676, 0, 0x4344, 0xB677, 0xB678, 0xB679, 0xB67A, - 0xB67B, 0, 0, 0xB67D, 0, 0xB67E, 0x5379, 0, - 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, - 0, 0xB728, 0x3160, 0x5424, 0, 0xB729, 0x5426, 0, - 0x5425, 0, 0xB72A, 0xB72B, 0x5428, 0xB72C, 0, 0x455A, - 0xB72D, 0, 0xB72E, 0xB72F, 0xB730, 0xB731, 0x5429, 0x3035, - 0x3A5F, 0xB732, 0xB733, 0, 0xB734, 0x373D, 0xB735, 0xB736, - 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, - 0x3A41, 0x3923, 0xB740, 0, 0, 0, 0, 0, - 0, 0xF436, 0, 0, 0, 0, 0, 0, - 0, 0x5433, 0xB741, 0, 0x3A25, 0xB742, 0x4333, 0xB743, - 0xB744, 0x5430, 0x445A, 0xB745, 0, 0xB746, 0xB747, 0xB748, - 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, 0, 0, 0, 0, 0, 0, 0, - 0, 0x5433, 0xB741, 0, 0x3A25, 0, 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, - 0, 0, 0, 0x5436, 0xB757, 0xB760, 0, 0xB758, - 0, 0xB759, 0xB75A, 0, 0xB75B, 0xB75C, 0xB75D, 0xB75E, - 0x5437, 0xB75F, 0x3924, 0x3340, 0x5439, 0, 0, 0xB761, - 0xB762, 0xB763, 0x543A, 0, 0xB764, 0, 0, 0, - 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, - 0, 0, 0x543F, 0x5440, 0x543E, 0xB76B, 0x5442, 0, - 0, 0, 0, 0, 0x4738, 0xB76C, 0xB76D, 0x3068, - 0x4956, 0xB77E, 0, 0x5443, 0xB76E, 0, 0xB76F, 0xB770, - 0, 0xB771, 0, 0, 0, 0xB772, 0, 0, - 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, - 0, 0, 0, 0, 0, 0x4244, 0, 0, - 0, 0x5445, 0, 0xB823, 0, 0x5446, 0xB824, 0xB825, - 0xB826, 0x5448, 0, 0, 0x4469, 0, 0xB827, 0xB828, - 0, 0, 0x342E, 0, 0, 0xB829, 0, 0x7421, - 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, - 0xB831, 0x413A, 0x544D, 0, 0x4563, 0xB832, 0, 0x4549, - 0x4564, 0x4839, 0x444D, 0, 0, 0, 0x3A49, 0xB833, - 0, 0xB834, 0x5449, 0, 0xB835, 0, 0, 0xB836, - 0xB837, 0x3176, 0, 0x4536, 0, 0, 0, 0, - 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, - 0xB844, 0, 0, 0x4A68, 0xB845, 0, 0xB846, 0x417D, - 0, 0, 0, 0, 0x4446, 0xB847, 0xF439, 0x5452, - 0xB848, 0xB849, 0xB84A, 0, 0, 0, 0xB84B, 0, - 0x4B4F, 0xB84C, 0, 0x5453, 0, 0, 0x5458, 0, - 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, 0, 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, - 0xB855, 0x545B, 0xB856, 0x545A, 0xB857, 0x3968, 0xB858, 0x545C, - 0x545E, 0x545D, 0xB859, 0, 0x5460, 0xB85A, 0x5455, 0x5462, - 0, 0xB85B, 0xB85C, 0, 0x5461, 0x545F, 0, 0, - 0, 0xB85D, 0, 0x3B4E, 0x3F51, 0, 0x4154, 0x5463, - 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, - 0x546B, 0, 0xB863, 0xB864, 0xB865, 0x4D3C, 0x3330, 0, - 0x5249, 0x3D48, 0x423F, 0x546C, 0x4C6B, 0xB867, 0, 0, - 0, 0xB868, 0x4C34, 0xB869, 0xB86A, 0x546E, 0, 0x4267, - 0xB86B, 0x4537, 0x4240, 0x4957, 0x546F, 0x5470, 0x317B, 0xB86C, - 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, - 0x5476, 0x3740, 0xB874, 0xB875, 0x4B5B, 0x5475, 0, 0x4565, - 0x5479, 0xB876, 0x5478, 0xB877, 0, 0xB878, 0xB879, 0xB87A, - 0x547B, 0xB87B, 0x547A, 0xB87C, 0, 0x317C, 0, 0x547C, - 0x3E29, 0x547E, 0x4325, 0xB87D, 0x547D, 0xB87E, 0x4A33, 0xB921, - 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, 0, 0x4B5B, 0x5475, 0, 0x4565, - 0x5479, 0xB876, 0x5478, 0xA545, 0, 0x2F69, 0xB879, 0xA546, - 0x547B, 0xB87B, 0x547A, 0, 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, - 0, 0, 0xB92B, 0x3538, 0, 0xB92C, 0x4D45, 0xB92D, - 0, 0x4C2F, 0, 0x562C, 0, 0x5523, 0, 0xB92E, - 0, 0, 0, 0x5526, 0xB92F, 0x4245, 0, 0xB930, - 0x4B38, 0, 0, 0, 0x454A, 0xB931, 0xB932, 0xB933, - 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, 0, 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, - 0x3039, 0x3848, 0xB93F, 0x402B, 0x3051, 0, 0, 0, - 0, 0x552C, 0x552D, 0, 0x552A, 0xB940, 0xB941, 0xB942, - 0, 0, 0, 0xB943, 0xB944, 0x3138, 0x342F, 0xB945, - 0x5529, 0, 0x4C45, 0x4931, 0, 0, 0xB946, 0xB947, - 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, - 0, 0x5530, 0xB951, 0xB952, 0, 0, 0, 0, - 0x4C3C, 0, 0x5533, 0, 0x5531, 0, 0xB953, 0x552F, - 0x3F31, 0, 0, 0xB954, 0xB955, 0x552E, 0, 0xB956, - 0xB957, 0x4A5A, 0xB958, 0, 0, 0xB959, 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_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, - 0xB960, 0, 0, 0, 0, 0xB961, 0, 0, - 0, 0, 0x3A27, 0, 0, 0, 0xB962, 0, - 0, 0, 0x5539, 0xB963, 0, 0xB964, 0x4958, 0xB965, - 0, 0, 0x553A, 0, 0x5535, 0xB966, 0, 0, - 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, - 0xB96C, 0, 0x475E, 0xB96D, 0, 0, 0xB96E, 0, - 0, 0xB96F, 0x553B, 0x4932, 0xB970, 0, 0xB971, 0xB972, - 0xB973, 0, 0xB974, 0, 0, 0, 0, 0xB975, - 0, 0, 0, 0, 0xB976, 0, 0, 0, - 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, - 0x554C, 0, 0, 0, 0, 0, 0x5545, 0x5542, - 0, 0, 0xBA25, 0, 0xBA26, 0, 0, 0, - 0xBA27, 0x4364, 0, 0x5541, 0, 0xBA28, 0x5543, 0, - 0, 0x5544, 0xBA29, 0, 0, 0, 0xBA2A, 0, - 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, - 0, 0, 0, 0, 0, 0, 0x554A, 0xBA31, - 0, 0xBA33, 0, 0xBA34, 0, 0xBA35, 0, 0, - 0, 0xBA36, 0x3E6E, 0, 0, 0xBA37, 0, 0, - 0, 0, 0x554D, 0, 0x445C, 0xBA38, 0, 0, - 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, - 0x3B52, 0x5553, 0xBA3D, 0, 0x3926, 0x5554, 0xBA3E, 0x3B7A, - 0x4238, 0, 0x5555, 0x5556, 0x3B5A, 0x3927, 0xBA3F, 0x4C52, - 0, 0, 0, 0x3528, 0x3849, 0x5557, 0x3358, 0, - 0xBA40, 0x5558, 0, 0x4239, 0, 0, 0xBA41, 0xBA42, - 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, - 0xBA4C, 0xBA4D, 0, 0xBA4E, 0xBA4F, 0x4566, 0xBA50, 0x3D21, - 0x3431, 0x4368, 0x446A, 0x3038, 0x3539, 0x4A75, 0, 0x3C42, - 0, 0, 0x3552, 0x406B, 0x3C3C, 0x4D28, 0x5561, 0, - 0xBA51, 0xBA52, 0, 0, 0xBA53, 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_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, - 0x5567, 0, 0x3428, 0x3677, 0x5566, 0, 0xBA5F, 0xBA60, - 0xBA61, 0xBA62, 0xBA63, 0x3432, 0, 0x3F32, 0x556B, 0x3B21, - 0xBA64, 0x3249, 0x556A, 0, 0x5568, 0x556C, 0x5569, 0x472B, - 0x5C4D, 0x3F33, 0, 0x556D, 0xF43A, 0, 0x4E40, 0xBA65, - 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, - 0, 0x3E2F, 0, 0x5575, 0, 0, 0x406D, 0xBA6A, - 0, 0, 0x3E30, 0, 0, 0, 0xBA6B, 0xBA6C, - 0x5576, 0, 0x5577, 0xBA6D, 0x4C60, 0, 0xBA6E, 0, - 0x5578, 0xBA6F, 0, 0xBA70, 0xBA71, 0x3646, 0xBA72, 0, - 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, - 0x5621, 0x367D, 0, 0x557E, 0, 0x4538, 0, 0, - 0, 0xBA77, 0xBA78, 0, 0xBA79, 0, 0x4230, 0, - 0x454B, 0x3C48, 0xBA7A, 0xBA7B, 0x4158, 0x4D7A, 0, 0xBA7C, - 0xBA7D, 0xBA7E, 0, 0, 0x5624, 0xBB21, 0x5625, 0x4656, - 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, - 0x3474, 0x562A, 0xBB2D, 0, 0x562B, 0, 0, 0, - 0, 0, 0, 0, 0, 0xBB2E, 0, 0xBB2F, - 0xBB30, 0x322C, 0xBB31, 0xBB32, 0, 0, 0xBB33, 0, - 0x413B, 0x3464, 0xBB34, 0x562D, 0x4C28, 0, 0, 0, - 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, - 0, 0, 0xBB3B, 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, 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, 0, 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, - 0, 0x5642, 0xBB45, 0, 0x5643, 0x563D, 0x3333, 0x563E, - 0x5647, 0x5646, 0x5645, 0x5641, 0, 0, 0, 0x5640, - 0, 0, 0x5644, 0xBB47, 0xBB48, 0, 0xBB49, 0xBB4A, - 0, 0x4A78, 0, 0xBB46, 0, 0, 0, 0, - 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, - 0x4D72, 0xBB55, 0x5649, 0xF43C, 0, 0xBB54, 0, 0, - 0, 0xBB56, 0, 0, 0x563F, 0, 0, 0xBB58, - 0xBB59, 0xBB5A, 0xBB5B, 0, 0xBB5C, 0, 0, 0, - 0, 0x3F73, 0xBB5D, 0, 0x564C, 0xBB5E, 0, 0x3A37, - 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, - 0x5657, 0, 0xBB68, 0xBB69, 0xBB6A, 0xBB6B, 0, 0, - 0, 0xBB6C, 0, 0xBB6D, 0, 0x5653, 0, 0xBB6E, - 0xBB6F, 0, 0x5652, 0, 0, 0, 0, 0xBB70, - 0, 0, 0, 0xBB71, 0x5654, 0, 0x5655, 0, - 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, - 0xBB79, 0, 0x565D, 0x565C, 0, 0, 0x565E, 0, - 0xBB7B, 0xBB7C, 0, 0x565F, 0, 0x406E, 0x3D23, 0, - 0xBB7D, 0x3D64, 0, 0x4163, 0xBB7E, 0x3929, 0x3A38, 0x392A, - 0x3570, 0xBC21, 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_E5B7_x0213[] = { - 0, 0, 0, 0xBB76, 0, 0, 0, 0xBB77, - 0, 0x565A, 0, 0x4F7D, 0x3460, 0x565B, 0xBB7A, 0, - 0, 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, - 0, 0x5666, 0xBC27, 0, 0xBC28, 0xBC29, 0x4421, 0, - 0xBC2A, 0x5665, 0x5664, 0x5667, 0, 0x446B, 0, 0xBC2B, - 0xBC2C, 0, 0, 0, 0, 0x3F63, 0, 0, - 0xBC2E, 0, 0, 0x3B55, 0, 0x404A, 0xBC2D, 0x4253, - 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, - 0xBC33, 0xBC35, 0, 0, 0x566F, 0x4B6B, 0xBC36, 0x566E, - 0xBC37, 0, 0, 0xBC38, 0xBC39, 0, 0xBC3A, 0x5670, - 0, 0x4828, 0x5671, 0x4A3E, 0x5672, 0, 0, 0, - 0xBC3B, 0, 0xBC3C, 0xBC3D, 0xBC3E, 0xBC3F, 0xBC40, 0, - 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, - 0, 0, 0, 0, 0, 0x446C, 0x4A79, 0x4539, - 0, 0, 0x392E, 0, 0x495C, 0, 0, 0, - 0x5679, 0, 0xBC45, 0, 0xBC46, 0xBC47, 0x4559, 0x3A42, - 0xBC48, 0, 0xBC49, 0x384B, 0xBC4A, 0x446D, 0, 0, - 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, - 0x567D, 0xBC54, 0xBC55, 0x3347, 0xBC56, 0xBC57, 0x5721, 0, - 0, 0, 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, 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, - 0x4675, 0x5736, 0, 0x355D, 0x4424, 0x307A, 0x5737, 0x4A26, - 0x3930, 0xBC61, 0, 0x4350, 0xBC62, 0xBC63, 0, 0x446F, - 0, 0xBC64, 0xBC65, 0xBC66, 0xBC67, 0x4C6F, 0x3839, 0x384C, - 0xBC68, 0x5738, 0, 0xBC69, 0xBC6A, 0x5739, 0xBC6B, 0x573F, - 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, 0, 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, - 0xBC77, 0x5740, 0, 0x4576, 0xBC78, 0, 0x5741, 0x5742, - 0xBC79, 0x5743, 0, 0xBC7A, 0x5734, 0x5733, 0, 0, - 0xBC7B, 0x5744, 0x3741, 0xBC7C, 0xBC7D, 0, 0x4927, 0xBC7E, - 0, 0x3A4C, 0x4937, 0x4426, 0x494B, 0x5745, 0, 0xBD21, - 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, - 0x3D79, 0x574D, 0x454C, 0x3D3E, 0, 0, 0xBD2C, 0x4640, - 0x5751, 0x5750, 0, 0, 0xBD2D, 0xBD2E, 0x574F, 0, - 0x5752, 0x3866, 0xBD2F, 0, 0xBD32, 0, 0, 0xBD30, - 0x5753, 0x497C, 0x3D5B, 0xBD31, 0xBD33, 0x5754, 0x4879, 0xBD34, - 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, - 0xBD3D, 0xBD3E, 0xBD3F, 0xBD40, 0xBD41, 0, 0x5756, 0x3B56, - 0x4B3A, 0x4B3B, 0, 0, 0x317E, 0x575B, 0xBD42, 0, - 0x4369, 0xBD43, 0xBD44, 0, 0x5758, 0, 0, 0, - 0xBD45, 0xBD46, 0xBD47, 0x3277, 0xBD48, 0xBD49, 0xBD4A, 0xBD4B, - 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, - 0x5761, 0, 0x455C, 0xBD54, 0xBD55, 0x5766, 0x495D, 0xBD56, - 0xBD57, 0x5760, 0xBD58, 0x5765, 0x4E67, 0x3B57, 0, 0xBD59, - 0x4255, 0x575E, 0, 0, 0xBD5A, 0x355E, 0x5768, 0x402D, - 0x3165, 0x5762, 0x3278, 0x5767, 0, 0xBD5B, 0, 0x3631, - 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, - 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, 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, 0, 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, - 0, 0xBD72, 0x5825, 0xBD73, 0x3279, 0xBD74, 0x5823, 0x5824, - 0xBD75, 0, 0x577E, 0x5822, 0, 0xBD76, 0xBD77, 0x3867, - 0x4D2A, 0, 0xBD78, 0x3435, 0xBD79, 0xBD7A, 0x3159, 0x5826, - 0xBD7B, 0x473A, 0x302D, 0, 0, 0, 0, 0, - 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, 0, 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, - 0, 0x4F47, 0, 0x582B, 0xBE2B, 0xBE2C, 0, 0, - 0x5831, 0xBE2D, 0x397B, 0xBE2E, 0x404B, 0xBE2F, 0xBE30, 0x3054, - 0x582A, 0x5828, 0xBE31, 0x415A, 0, 0xBE32, 0, 0x577C, - 0x3B34, 0, 0, 0, 0, 0, 0, 0, - 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, 0, 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, - 0xBE3C, 0xBE3D, 0xBE3E, 0xBE3F, 0xBE40, 0x5833, 0xBE41, 0xBE42, - 0, 0xBE43, 0x3672, 0x3026, 0xBE44, 0, 0xBE45, 0x3436, - 0xF440, 0x583B, 0xBE46, 0, 0, 0, 0, 0x5843, - 0x5842, 0, 0xBE47, 0xBE48, 0x5847, 0, 0, 0, - 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, 0, 0xAC5B, 0xAC5C, 0xBE40, 0x5833, 0xBE41, 0xBE42, - 0, 0xAC5D, 0x3672, 0x3026, 0x7458, 0, 0xAC5E, 0x3436, - 0, 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, - 0, 0, 0, 0x5858, 0, 0x4A69, 0, 0, - 0x584E, 0x584F, 0x5850, 0, 0, 0x5857, 0xBE53, 0x5856, - 0xBE54, 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, 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, - 0x4E79, 0x5861, 0xBE61, 0xBE62, 0x585E, 0, 0x585B, 0xBE63, - 0xBE64, 0x585A, 0x585F, 0, 0xBE65, 0xBE66, 0, 0xBE67, - 0xBE68, 0, 0, 0, 0x4A30, 0xBE69, 0, 0x4634, - 0xBE6A, 0x3746, 0xBE6B, 0x5862, 0x585D, 0xBE6C, 0x5863, 0, - 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, - 0x327B, 0, 0, 0, 0, 0xBE75, 0, 0, - 0, 0, 0, 0, 0xBE76, 0xBE77, 0xBE78, 0xBE79, - 0, 0xBE7A, 0xBE7B, 0x5870, 0, 0xBE7E, 0x586F, 0xBE7C, - 0, 0xBE7D, 0, 0, 0xBF21, 0xBF22, 0, 0xBF23, - 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, - 0x402E, 0x3266, 0x327C, 0xBF28, 0x587D, 0xBF29, 0x303F, 0, - 0, 0, 0x404C, 0x587E, 0xBF2A, 0x6C43, 0x5921, 0x3761, - 0xBF2B, 0x5922, 0xBF2C, 0xBF2D, 0, 0, 0x406F, 0xBF2E, - 0, 0xBF2F, 0x5923, 0xBF30, 0, 0, 0x5924, 0x353A, - 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, 0, 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, - 0xBF38, 0xBF39, 0xBF3A, 0x4247, 0xBF3B, 0x4A27, 0xBF3C, 0, - 0x4271, 0, 0xBF3D, 0x592C, 0xBF3E, 0, 0x592A, 0, - 0x592D, 0, 0, 0x592B, 0xBF3F, 0, 0, 0, - 0x592E, 0, 0, 0, 0, 0xBF40, 0x4A31, 0xBF41, - 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, - 0xBF48, 0x4D5E, 0x5933, 0x5934, 0x5938, 0x456A, 0x5935, 0x3933, - 0x405E, 0, 0, 0x5946, 0x4834, 0, 0x4272, 0, - 0, 0, 0, 0, 0, 0, 0xBF49, 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_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, - 0x327D, 0x593A, 0x3571, 0x4273, 0x5936, 0xBF53, 0xBF54, 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, 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, - 0xBF60, 0x4429, 0, 0xBF61, 0, 0, 0xBF62, 0, - 0xBF63, 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, 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, - 0x5950, 0, 0xBF73, 0xBF74, 0xBF75, 0x4A61, 0, 0x443D, - 0xBF76, 0, 0, 0xBF77, 0x415C, 0, 0, 0, - 0, 0, 0, 0, 0, 0xBF78, 0xBF79, 0x4A7B, - 0x3C4E, 0x5960, 0, 0x595F, 0xBF7A, 0xBF7B, 0x3F78, 0, - 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, - 0xC029, 0, 0x4753, 0, 0xC02A, 0xC02B, 0x5955, 0, - 0x3721, 0xC02C, 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, 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, - 0x4473, 0xC039, 0x5967, 0xC03A, 0xC03B, 0xC03C, 0x4D2C, 0, - 0, 0, 0x4D48, 0x3439, 0xC03D, 0, 0, 0, - 0xC03E, 0x302E, 0, 0x5965, 0, 0xC03F, 0, 0, - 0, 0x5962, 0xC040, 0, 0xC041, 0, 0x3478, 0, - 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, - 0xC049, 0, 0xC04A, 0x596D, 0xC04B, 0, 0x596A, 0x5971, - 0xC04C, 0, 0, 0, 0x5953, 0, 0xC04D, 0, - 0xC04E, 0, 0xC04F, 0, 0xC050, 0xC051, 0x596E, 0, - 0x5972, 0xC052, 0xC053, 0, 0x4842, 0x456B, 0, 0xC054, - 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, - 0, 0xC05B, 0xC05C, 0xC05D, 0xC05E, 0, 0, 0, - 0x4526, 0, 0xC05F, 0xC060, 0xC061, 0xC062, 0, 0xC063, - 0xC064, 0xC065, 0, 0xC066, 0, 0, 0, 0x5974, - 0, 0x4B60, 0, 0, 0, 0xC067, 0, 0x5975, - 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, - 0xC06F, 0xC070, 0x3B35, 0x597A, 0, 0x5979, 0, 0, - 0xC071, 0xC072, 0x4732, 0xC073, 0, 0xC074, 0x4635, 0xC075, - 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, 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, - 0xC127, 0xC128, 0x5A22, 0, 0x593F, 0xC129, 0, 0xC12A, - 0x5A26, 0, 0x5A21, 0, 0, 0, 0, 0, - 0x5A2B, 0x5A2C, 0x4527, 0x5A2E, 0xC12B, 0xC12C, 0x3B24, 0x5A29, - 0, 0xC12D, 0xC12E, 0, 0x353C, 0xC12F, 0, 0x5A2F, - 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, - 0, 0, 0, 0xC13B, 0xC13C, 0, 0xC13D, 0, - 0x5A37, 0xC13E, 0, 0xC13F, 0x5A38, 0x5970, 0xC140, 0xC141, - 0, 0, 0xC142, 0x5A3B, 0x5A3A, 0, 0xC143, 0, - 0, 0xC144, 0x5978, 0x5A3C, 0x5A30, 0, 0xC145, 0x3B59, - 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, - 0xC14D, 0x355F, 0xC14E, 0, 0xC14F, 0x5A45, 0x5A44, 0x4754, - 0x5A47, 0x3635, 0, 0, 0, 0x5A49, 0x5A48, 0xC150, - 0xC151, 0, 0x343A, 0x3B36, 0, 0, 0x4658, 0xC152, - 0, 0, 0, 0xC153, 0x3749, 0, 0, 0, - 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, 0, 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, - 0x4865, 0x4843, 0xC159, 0, 0, 0xC15A, 0, 0x454D, - 0xC15B, 0x4E41, 0, 0x5A4F, 0x3C50, 0xC15C, 0, 0x5A50, - 0xC15D, 0x3036, 0, 0xC15E, 0x3654, 0x404D, 0xC15F, 0x4960, - 0, 0, 0, 0x5A51, 0x3B42, 0x4347, 0xC160, 0x3B5B, - 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, - 0xC169, 0, 0x5A58, 0, 0xC16A, 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, 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, - 0, 0xC17A, 0xC17B, 0x3057, 0x404E, 0xC17C, 0xC17D, 0, - 0, 0, 0, 0, 0x5A66, 0xC17E, 0xC221, 0x4031, - 0x3147, 0xC222, 0xC223, 0xC224, 0xC225, 0x3D55, 0xC226, 0x4B66, - 0x3A72, 0xC227, 0xC228, 0xC229, 0xC22A, 0x3E3C, 0xC22B, 0x4027, - 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, 0, 0x4027, - 0x7534, 0x7535, 0, 0x7536, 0x5A65, 0x5A63, 0x5A64, 0xC230, - 0, 0xC22F, 0x7530, 0, 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, - 0, 0xC236, 0x3B2F, 0, 0, 0, 0, 0xC238, - 0xC239, 0xC23A, 0, 0xC23B, 0xC23C, 0x5A6C, 0x5A6B, 0x5A70, - 0xC23D, 0xC23E, 0x5A71, 0, 0x5A6D, 0xF443, 0x3322, 0x5A6E, - 0x5A6F, 0x4855, 0xC240, 0xC241, 0xC242, 0, 0x4961, 0x374A, - 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, - 0xC250, 0x3D6B, 0xC251, 0, 0, 0, 0x4348, 0x3045, - 0x5A78, 0xC252, 0xC253, 0xC254, 0xC255, 0x5A79, 0, 0xC256, - 0xC257, 0, 0x442A, 0, 0xC258, 0, 0x4E71, 0, - 0, 0, 0, 0x3B43, 0, 0xC259, 0x4A6B, 0, - 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, - 0, 0, 0, 0, 0xC266, 0, 0x5B23, 0, - 0, 0x3D6C, 0x5B24, 0xC267, 0x4D4B, 0x4778, 0, 0xC268, - 0x5B25, 0, 0, 0, 0, 0, 0x5B27, 0, - 0xC269, 0x5B28, 0, 0xC26A, 0xC26B, 0, 0xC26C, 0, - 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, - 0, 0, 0, 0xC271, 0x3A73, 0x443F, 0x5B2D, 0x4F2F, - 0, 0xC272, 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, 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, 0, 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, - 0x3A60, 0x423C, 0, 0x3C5D, 0xC27C, 0xC27D, 0x3E73, 0, - 0, 0x5B3B, 0, 0, 0x454E, 0xC27E, 0x5B39, 0x422B, - 0x5B3A, 0x3E72, 0x4C5D, 0x5B3C, 0x5B3D, 0x4D68, 0xC321, 0, - 0, 0, 0x5B42, 0, 0xC322, 0x393A, 0xC323, 0x4755, - 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, - 0x404F, 0xC32B, 0, 0xC32C, 0, 0x4B6D, 0xC32D, 0x4E53, - 0xC32E, 0xC32F, 0x4B67, 0xC330, 0x324C, 0x3B5E, 0, 0, - 0x4F48, 0x5B46, 0x3F75, 0, 0, 0, 0x5B45, 0, - 0, 0x5B40, 0, 0, 0, 0, 0, 0x384F, - 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, - 0x4B3F, 0x343B, 0xC33F, 0x4077, 0x3D40, 0, 0, 0xC340, - 0x4453, 0xC341, 0x4D2E, 0, 0xC342, 0x5B51, 0x5B50, 0, - 0, 0xC343, 0x5B52, 0, 0x5B4F, 0, 0xC344, 0x5B57, - 0, 0x5B4D, 0, 0, 0x5B4B, 0, 0x5B53, 0x5B49, - 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, - 0, 0, 0, 0x4072, 0xC34A, 0, 0x4034, 0x372A, - 0, 0xC34B, 0, 0, 0, 0xC34C, 0x5B59, 0xC34D, - 0, 0x393B, 0x337C, 0, 0, 0, 0, 0xC34F, - 0xC34E, 0x5B5B, 0x3374, 0x5B61, 0xC350, 0xC351, 0, 0xC352, - 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, - 0x364D, 0x372C, 0xC349, 0x343C, 0x354B, 0xC35C, 0, 0xC35D, - 0xC35E, 0x5B62, 0, 0xC35F, 0x3A79, 0x4B71, 0, 0x3B37, - 0, 0, 0, 0x5B63, 0, 0, 0, 0x4930, - 0, 0, 0, 0xC360, 0, 0, 0xC361, 0xC362, - 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, - 0, 0, 0, 0x3034, 0x5B69, 0, 0xC36F, 0x393C, - 0xC370, 0, 0xC371, 0x5B6B, 0xC372, 0x5B6A, 0, 0x5B66, - 0x5B71, 0xC373, 0x3E3F, 0xC374, 0, 0xC375, 0x546D, 0x3868, - 0x4D7C, 0xC376, 0xC377, 0, 0, 0x5B68, 0xC378, 0x4474, - 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, - 0xC421, 0xC422, 0x4B40, 0xC423, 0x5C21, 0x5C23, 0xC424, 0x5C27, - 0x5B79, 0xC425, 0x432A, 0, 0xC426, 0xC427, 0, 0x456F, - 0x5C2B, 0x5B7C, 0, 0x5C28, 0, 0xC428, 0, 0x5C22, - 0xC429, 0, 0xC42A, 0xC42B, 0xC42C, 0xC42D, 0x3F39, 0x5C2C, - 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, - 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, 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, - 0, 0, 0, 0x4976, 0x5C38, 0x424A, 0, 0xC446, - 0, 0x5C3E, 0x413F, 0xC447, 0x5C35, 0x5C42, 0x5C41, 0, - 0x466F, 0x5C40, 0x466A, 0xC448, 0xC449, 0xC44A, 0xC44B, 0, - 0xC44C, 0xC44D, 0x5C44, 0x5C37, 0xC44E, 0x3648, 0x5C3A, 0x3D5D, - 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, - 0, 0x5C54, 0xC457, 0, 0x4F31, 0x5C57, 0xC458, 0, - 0xC459, 0, 0, 0x3F3A, 0x5C56, 0, 0, 0, - 0x5C55, 0xC45A, 0, 0, 0, 0xC45B, 0xC45C, 0x5C52, - 0xC45D, 0, 0, 0xC45E, 0, 0xC45F, 0x5C46, 0xC460, - 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, - 0x5C47, 0xC467, 0, 0x5C4A, 0, 0, 0xC468, 0xC469, - 0x4D4D, 0x4B6A, 0, 0, 0, 0x5C4F, 0x5C59, 0, - 0, 0, 0xC46A, 0, 0, 0xC46B, 0, 0x5C61, - 0x5C5A, 0, 0, 0x5C67, 0, 0x5C65, 0xC46C, 0xC46D, - 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, - 0, 0xC476, 0x5C69, 0x5C6C, 0x5C66, 0xC477, 0, 0x4374, - 0, 0x4938, 0xC478, 0x5C5C, 0, 0xC479, 0x5C64, 0x3E40, - 0xC47A, 0x4C4F, 0x5C78, 0x5C6B, 0xC47B, 0, 0, 0, - 0xC47C, 0x3822, 0x3223, 0x335F, 0, 0, 0x5C53, 0, - 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, - 0xC52B, 0xC52C, 0xC52D, 0, 0, 0xC52E, 0xC52F, 0, - 0x354C, 0x5C74, 0, 0xC530, 0, 0, 0, 0x3521, - 0, 0x464B, 0x5C73, 0, 0xC531, 0, 0x5C75, 0xC532, - 0, 0, 0xC533, 0xF449, 0, 0, 0, 0, - 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, - 0x5C79, 0xC53D, 0, 0, 0, 0, 0, 0x5D21, - 0, 0, 0, 0xC53E, 0x5B58, 0xC53F, 0xC540, 0xC541, - 0x5C7B, 0, 0x5C7D, 0x5C7E, 0, 0xC542, 0, 0, - 0, 0, 0x5D2C, 0xC543, 0x5D28, 0, 0x5B6D, 0xC544, - 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, - 0xC54F, 0x5D2A, 0, 0x4F26, 0xC550, 0xC551, 0xC552, 0, - 0, 0, 0x5D2D, 0x367B, 0xC553, 0xC554, 0x5D29, 0x5D2B, - 0, 0, 0xF44A, 0, 0xC555, 0, 0, 0xC556, - 0x4827, 0, 0x5D2E, 0, 0xC557, 0, 0, 0, - 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, 0, 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, - 0xC563, 0xC564, 0x5D33, 0, 0, 0, 0x5D34, 0xC565, - 0, 0, 0, 0xC566, 0, 0x3135, 0xC567, 0x5D36, - 0x3767, 0x3C21, 0, 0x3655, 0xC568, 0, 0, 0x3224, - 0xC569, 0, 0, 0xC56A, 0xC56B, 0, 0, 0xC56C, - 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, - 0x5D3F, 0, 0xC574, 0x343F, 0x5D41, 0, 0xC575, 0, - 0xC576, 0x5D40, 0, 0x5D42, 0, 0xC577, 0, 0x5D43, - 0xC578, 0x5D44, 0x3B5F, 0x4035, 0x3A21, 0, 0x4970, 0xC579, - 0, 0x4A62, 0x4F44, 0xC57A, 0, 0, 0xC57B, 0x3B75, - 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, - 0, 0, 0, 0, 0, 0x5D4D, 0x3F23, 0xC624, - 0x5D4C, 0, 0, 0xC625, 0, 0, 0x5D4E, 0xC626, - 0xC627, 0, 0xC628, 0xC629, 0x5D4F, 0, 0, 0, - 0xC62A, 0xC62B, 0x5D50, 0x5D51, 0xC62C, 0xC62D, 0xC62E, 0x5D52, - 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, - 0, 0, 0x4647, 0x5D5A, 0x4866, 0, 0xC638, 0, - 0x487B, 0, 0xC639, 0x4C53, 0, 0, 0, 0x5D5B, - 0, 0xC63A, 0, 0xC63B, 0, 0, 0xC63C, 0xC63D, - 0, 0, 0, 0x5D5D, 0x5D5C, 0, 0xC63E, 0x5D5F, - 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, - 0xC649, 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, 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, - 0x3C2E, 0, 0xC65C, 0, 0xC65D, 0x5D68, 0, 0x3440, - 0, 0xC65E, 0x3178, 0xC65F, 0xC660, 0x4672, 0x5D67, 0x393E, - 0x4353, 0, 0x5D69, 0, 0, 0, 0, 0xC736, - 0x5D71, 0, 0x5D6A, 0xC661, 0, 0xC662, 0, 0xC663, - 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, 0, - 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, - 0x5D74, 0, 0x5D73, 0x3723, 0xC66D, 0xC66E, 0x322D, 0xC66F, - 0xC670, 0x3A3B, 0x5D6D, 0x5D6F, 0xC671, 0, 0, 0xC672, - 0, 0x4B57, 0x4274, 0, 0, 0, 0, 0, - 0, 0, 0, 0x4B77, 0, 0, 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_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, - 0xC67A, 0xC67B, 0xC67C, 0x5D77, 0xC67D, 0x4B21, 0xC67E, 0x5D79, - 0, 0x5E24, 0xC721, 0x5E22, 0xC722, 0x5D7B, 0, 0, - 0xC723, 0x4B22, 0x4748, 0x3563, 0, 0x4525, 0, 0xC724, - 0x436D, 0xC725, 0x5E25, 0xC726, 0xC727, 0, 0xC728, 0x5E23, - 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, - 0, 0xC730, 0x5E2F, 0xC731, 0, 0, 0, 0x4076, - 0, 0x5E2C, 0xC732, 0x4D6C, 0, 0, 0x4636, 0x5E26, - 0, 0, 0, 0, 0, 0x4445, 0xC733, 0xC734, - 0xC735, 0x314C, 0x393F, 0x5E29, 0, 0, 0xC737, 0xC738, - 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, - 0, 0, 0, 0, 0, 0, 0, 0xC73D, - 0, 0x5E36, 0x5E34, 0, 0x494D, 0, 0xC73E, 0xC73F, - 0, 0xC740, 0, 0x5E31, 0x5E33, 0xC741, 0x313A, 0xC742, - 0, 0x3940, 0x4F32, 0, 0x333D, 0, 0x4962, 0xC743, - 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, 0, - 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, - 0, 0xC748, 0xC749, 0x5E32, 0xC74A, 0x5E38, 0xC74B, 0xC74C, - 0xC74D, 0x4E5E, 0, 0x4573, 0x4642, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xC74E, 0, 0xC74F, 0, 0, 0x3336, - 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, 0, 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, - 0, 0x3D4A, 0x5E47, 0, 0, 0x5E4C, 0xC75A, 0, - 0x4571, 0x5E4A, 0, 0xC75B, 0, 0xC75C, 0x5E44, 0xC75D, - 0xC75E, 0x4338, 0xC75F, 0, 0x5E4B, 0xC760, 0x5E40, 0, - 0x5E46, 0xC761, 0x5E4D, 0x307C, 0x5E43, 0, 0x5E4E, 0xC762, - 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, 0, 0x3D5F, 0xC764, 0x4A25, 0xEE6C, 0x3A2E, - 0, 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, - 0, 0, 0, 0x374C, 0, 0x5E3C, 0, 0, - 0, 0x5E52, 0x3D6D, 0x383A, 0, 0x5E61, 0xC769, 0x5E5B, - 0x3574, 0x454F, 0xC76A, 0x5E56, 0x5E5F, 0x302F, 0x3132, 0xC76B, - 0, 0x3239, 0, 0x5E58, 0x422C, 0x5E4F, 0x5E51, 0x3941, - 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, 0, 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, - 0, 0xC777, 0xC778, 0xC779, 0xC77A, 0, 0x3850, 0xC77B, - 0x3E45, 0, 0, 0x4339, 0xC77C, 0xC77D, 0xC77E, 0x5E54, - 0, 0, 0xC821, 0xC822, 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_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, - 0x383B, 0, 0, 0xC828, 0, 0, 0x3D60, 0, - 0x5E65, 0xC829, 0, 0, 0x4E2F, 0x3942, 0, 0x5E72, - 0xC82A, 0, 0x306E, 0, 0, 0x5E70, 0, 0xC82B, - 0, 0, 0x5E64, 0, 0, 0xC82C, 0xC82D, 0x5E6A, - 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, - 0, 0x336A, 0, 0x5E68, 0x5E6D, 0x5E6E, 0, 0, - 0, 0, 0, 0, 0, 0x426C, 0x425A, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xC83B, 0x5E76, 0xC83C, 0xC83D, 0x5E7C, - 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, - 0, 0x5E74, 0, 0x5F22, 0x3169, 0x4166, 0xC846, 0, - 0xC847, 0, 0xC848, 0xC849, 0, 0, 0, 0, - 0x4779, 0, 0x3441, 0x4E7A, 0, 0, 0xC84A, 0, - 0, 0xC84B, 0xC84C, 0x4C21, 0x4452, 0xC853, 0, 0xC84D, - 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, - 0, 0xC855, 0xC856, 0xC857, 0x3769, 0, 0, 0xC858, - 0x5F2F, 0xC859, 0xC85A, 0x5F2A, 0x4078, 0xC85B, 0xC85C, 0x3363, - 0, 0xC85D, 0xC85E, 0, 0x3D61, 0, 0x5F33, 0, - 0xC85F, 0, 0, 0, 0xC860, 0x5F2C, 0x442C, 0x5F29, - 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, - 0xC869, 0x5F31, 0xC86A, 0xC86B, 0xC86C, 0, 0xC86D, 0x3442, - 0, 0, 0xC86E, 0, 0, 0, 0, 0xC86F, - 0xC870, 0x5F36, 0, 0x5F35, 0x5F37, 0xC871, 0xC872, 0xC873, - 0xC874, 0, 0x5F3A, 0, 0, 0, 0xC875, 0xC876, - 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, - 0, 0, 0, 0, 0x5F3E, 0x5F3C, 0, 0, - 0x5F3F, 0, 0xC921, 0x5F42, 0, 0, 0xC922, 0x5F3B, - 0x396A, 0x4728, 0, 0, 0x5E39, 0, 0, 0, - 0xC923, 0xC924, 0, 0x4D74, 0x5F3D, 0, 0x5F41, 0x4275, - 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, - 0, 0x5F46, 0, 0, 0, 0x494E, 0, 0xC92F, - 0x5F4E, 0, 0x5F4B, 0x5F4A, 0, 0x5F4D, 0x4654, 0x5F4F, - 0xC930, 0, 0, 0xC931, 0, 0, 0x4375, 0x426D, - 0xF44D, 0, 0, 0, 0x4025, 0, 0, 0xC932, - 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, - 0, 0x5F53, 0, 0, 0xC93D, 0xC93E, 0, 0, - 0x4667, 0, 0, 0, 0, 0xC93F, 0xC940, 0, - 0, 0, 0, 0x5F54, 0xC942, 0xC943, 0, 0, - 0, 0, 0, 0x3250, 0xC944, 0, 0xC945, 0x4574, - 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, - 0, 0, 0x5F56, 0, 0xC94C, 0xC94D, 0xC94E, 0xC94F, - 0xC950, 0x5F55, 0, 0xC951, 0, 0, 0, 0, - 0, 0, 0, 0, 0xC952, 0, 0, 0, - 0, 0, 0, 0xC953, 0x5F59, 0x433A, 0x5F5C, 0x5F57, - 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, - 0, 0xC959, 0, 0xC95A, 0xC95B, 0xC95C, 0xC95D, 0, - 0xC95E, 0x5F60, 0, 0, 0xC95F, 0x5F5F, 0, 0x5F5D, - 0, 0, 0, 0, 0xC960, 0, 0, 0, - 0, 0, 0, 0, 0, 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_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, - 0, 0, 0, 0, 0x316B, 0, 0, 0, - 0, 0x5F64, 0x4A32, 0, 0x5F63, 0, 0xC96A, 0, - 0xC96B, 0x4C35, 0, 0, 0, 0, 0x3E47, 0, - 0, 0, 0, 0xC96C, 0, 0xC96D, 0, 0xC96E, - 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, - 0xC978, 0, 0xC979, 0, 0, 0x5F66, 0x5F6B, 0xC97A, - 0, 0x316C, 0xC97B, 0, 0xC97C, 0, 0xC97D, 0, - 0xC97E, 0, 0x5F69, 0, 0x4761, 0x5F65, 0x5F68, 0x3E48, - 0xCA21, 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_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, - 0, 0, 0xCA27, 0, 0x4D50, 0x5F70, 0, 0, - 0, 0x7426, 0xCA28, 0xCA29, 0, 0, 0, 0x3D4F, - 0xCA2A, 0, 0xCA2B, 0, 0, 0, 0, 0, - 0x5F71, 0, 0, 0, 0x5F72, 0, 0, 0xCA2C, - 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, - 0x4E55, 0, 0x5F76, 0xCA37, 0x5F78, 0x316D, 0xCA38, 0x5F73, - 0, 0xCA39, 0xCA3A, 0, 0xCA3B, 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, 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, - 0x6024, 0, 0, 0xCA42, 0, 0, 0, 0xCA43, - 0, 0, 0xCA44, 0x6025, 0, 0xCA45, 0, 0xCA46, - 0, 0, 0, 0, 0xCA47, 0, 0, 0, - 0x6026, 0, 0x445E, 0xCA48, 0x6028, 0x6027, 0, 0xCA49, - 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, - 0xCA53, 0, 0x442D, 0xCA54, 0, 0xCA55, 0xCA56, 0, - 0x6031, 0x3267, 0xCA57, 0x356D, 0xCA58, 0x4C46, 0xCA59, 0x4C36, - 0xCA5A, 0x3234, 0x4F34, 0xCA5B, 0, 0, 0, 0x4B52, - 0xCA5C, 0x4A2A, 0, 0xCA5D, 0, 0, 0xCA5E, 0xCA5F, - 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, - 0, 0, 0x6037, 0xCA6A, 0, 0, 0x6038, 0, - 0, 0, 0, 0xCA6B, 0, 0, 0, 0, - 0x353E, 0, 0x6039, 0, 0, 0, 0, 0x603A, - 0xCA6C, 0, 0, 0, 0x3824, 0xCA6D, 0xCA6E, 0x4848, - 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, - 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, 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, - 0, 0, 0xCB28, 0xCB29, 0, 0, 0x604B, 0x6048, - 0xCB2A, 0xCB2B, 0, 0x4C54, 0x604A, 0x604C, 0xCB2C, 0x4E44, - 0, 0, 0xCB2D, 0, 0xCB2E, 0x6050, 0, 0xCB2F, - 0xCB30, 0x604F, 0x4376, 0x472D, 0xCB31, 0, 0x3825, 0x604E, - 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, 0, 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, - 0xCB3A, 0, 0xCB3B, 0, 0, 0, 0xCB3C, 0x6055, - 0xCB3D, 0, 0, 0, 0, 0xCB3E, 0xCB3F, 0xCB40, - 0xCB41, 0, 0, 0x3D43, 0, 0, 0xCB42, 0xCB43, - 0x6057, 0xCB44, 0x6056, 0xCB45, 0xCB46, 0, 0xCB47, 0xCB48, - 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, - 0xCB53, 0, 0, 0xCB54, 0, 0xCB55, 0x366A, 0xCB56, - 0xCB57, 0, 0, 0, 0xCB58, 0, 0xCB59, 0xCB5A, - 0xCB5B, 0, 0xCB5C, 0, 0, 0xCB5D, 0xCB5E, 0, - 0, 0x3461, 0xCB5F, 0xCB60, 0, 0xCB61, 0, 0, - 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, 0, 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, - 0, 0, 0xCB6E, 0xCB6F, 0, 0, 0xCB70, 0, - 0, 0xCB71, 0, 0, 0, 0xCB72, 0x6064, 0, - 0x3C6E, 0xCB73, 0, 0xCB74, 0, 0x6062, 0xCB75, 0xCB76, - 0, 0xCB77, 0x373E, 0, 0, 0x4849, 0x6063, 0, - 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, 0, 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, 0, 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, - 0, 0xCC27, 0, 0, 0, 0, 0, 0, - 0, 0, 0xCC28, 0xCC29, 0, 0, 0, 0, - 0, 0, 0x4276, 0, 0xCC2A, 0x6068, 0xCC2B, 0, - 0xCC2C, 0xCC2D, 0xCC2E, 0xCC2F, 0xCC30, 0xCC31, 0xCC32, 0xCC33, - 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, 0, 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, - 0, 0xCC3E, 0xCC3F, 0, 0, 0x606C, 0, 0xCC40, - 0, 0x606F, 0x386A, 0x314D, 0x6071, 0xCC41, 0x3F70, 0x606E, - 0x4E5C, 0, 0xCC42, 0x6074, 0x7424, 0, 0xCC43, 0xCC44, - 0xCC45, 0x6072, 0x6075, 0xCC46, 0, 0xCC47, 0xCC48, 0x6067, - 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, - 0xCC52, 0xCC53, 0xCC54, 0, 0, 0, 0, 0, - 0xCC55, 0xCC56, 0xCC57, 0, 0xCC58, 0, 0x6079, 0xCC59, - 0xCC5A, 0xCC5B, 0x6065, 0xCC5C, 0, 0, 0xCC5D, 0x607A, - 0xCC5E, 0xCC5F, 0xCC60, 0xCC61, 0, 0, 0xCC62, 0xCC63, - 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, - 0xCC6D, 0, 0, 0xCC6E, 0x607D, 0, 0, 0, - 0xCC6F, 0, 0xCC70, 0xCC71, 0x313B, 0, 0xCC72, 0xCC73, - 0x6121, 0, 0x493B, 0x6122, 0xCC74, 0, 0x3424, 0x6123, - 0xCC75, 0x6124, 0xCC76, 0xCC77, 0, 0, 0x6125, 0xCC78, - 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, - 0, 0x3979, 0xCD21, 0x6132, 0, 0x6131, 0xCD22, 0xCD23, - 0x3445, 0, 0x3F53, 0, 0x453C, 0, 0x6133, 0x4038, - 0xCD24, 0xCD25, 0, 0x3B3A, 0xCD26, 0x3179, 0x6134, 0xCD27, - 0x4D51, 0xCD28, 0xCD29, 0x4A63, 0x6135, 0, 0, 0xCD2A, - 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, - 0xCD35, 0x482A, 0xCD36, 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, 0, 0x6142, 0, 0xCD3B, - 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, - 0xCD45, 0x353F, 0xCD46, 0xCD47, 0x614B, 0xCD48, 0, 0, - 0, 0xCD49, 0x614C, 0, 0xCD4A, 0x614D, 0, 0, - 0, 0, 0xCD4B, 0x614F, 0xCD4C, 0x614E, 0, 0, - 0, 0, 0, 0x3156, 0, 0, 0, 0, - 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, - 0, 0, 0x615A, 0, 0x3C26, 0x3A2F, 0, 0xCD57, - 0x4577, 0x615B, 0, 0x444B, 0xCD58, 0, 0x615D, 0xCD59, - 0xCD5A, 0xCD5B, 0x4E21, 0x615C, 0xCD5C, 0, 0, 0xCD5D, - 0, 0x4169, 0, 0, 0xCD5E, 0, 0xCD5F, 0xCD60, - 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, - 0, 0, 0xCD6C, 0xCD6D, 0, 0xCD6E, 0xCD6F, 0, - 0, 0xCD70, 0, 0xCD71, 0xCD72, 0xCD73, 0xCD74, 0x6169, - 0x616B, 0x616C, 0x616D, 0xCD75, 0x616E, 0xCD76, 0xCD77, 0x616A, - 0, 0xCD78, 0, 0, 0, 0xCD79, 0, 0, - 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, - 0, 0, 0x4C7E, 0, 0, 0xCE2B, 0x4A4A, 0, - 0x6176, 0xCE2C, 0, 0, 0x6175, 0, 0, 0xCE2D, - 0, 0x6177, 0x6178, 0, 0xCE2E, 0xCE2F, 0, 0x617C, - 0x6179, 0x617A, 0x617B, 0, 0x617D, 0xCE30, 0xCE31, 0xCE32, - 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, - 0x3B29, 0, 0, 0x622B, 0, 0xCE39, 0x622A, 0, - 0, 0x622C, 0x622D, 0xCE3A, 0xCE3B, 0xCE3C, 0xF452, 0xCE3D, - 0xCE3E, 0, 0xCE3F, 0xCE40, 0xCE41, 0xCE42, 0xCE43, 0xCE44, - 0xCE45, 0, 0xCE46, 0, 0, 0xCE47, 0x4869, 0, - 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, 0, 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, - 0, 0, 0x6236, 0, 0xCE4F, 0, 0x6235, 0x4570, - 0, 0xCE50, 0, 0x4039, 0x5D39, 0, 0x6237, 0x4C41, - 0xCE51, 0x6238, 0, 0x3446, 0x4857, 0x6239, 0xCE52, 0x623A, - 0xCE53, 0, 0x623B, 0, 0xCE54, 0, 0x4C5C, 0, - 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, - 0, 0, 0xCE5E, 0, 0xCE5F, 0xCE60, 0, 0xCE61, - 0, 0xCE62, 0xCE63, 0x6246, 0xCE64, 0, 0x6243, 0x3F3F, - 0x4C32, 0, 0xCE65, 0, 0x6242, 0x6244, 0x6245, 0, - 0xCE66, 0x6241, 0, 0, 0, 0xCE67, 0xCE68, 0xCE69, - 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, - 0, 0, 0xCE77, 0, 0, 0, 0xCE78, 0xCE79, - 0, 0, 0x624A, 0x624D, 0xCE7A, 0, 0xCE7B, 0xCE7C, - 0xCE7D, 0x3F67, 0xCE7E, 0x4644, 0xCF21, 0x624E, 0x4B53, 0xCF22, - 0x624B, 0, 0xCF23, 0x624C, 0xCF24, 0, 0, 0, - 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, - 0, 0x6254, 0, 0, 0xCF2F, 0xCF30, 0xCF31, 0, - 0, 0, 0xCF32, 0, 0, 0, 0x6256, 0xCF33, - 0x6255, 0, 0xCF34, 0, 0, 0x4A4D, 0, 0xCF35, - 0, 0, 0xCF36, 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_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, - 0, 0xCF3E, 0xCF3F, 0, 0, 0xCF40, 0, 0x6260, - 0, 0xCF41, 0x6261, 0x4C37, 0x6262, 0, 0xCF42, 0xCF43, - 0xCF44, 0, 0x4C70, 0x6263, 0xCF45, 0x434E, 0xCF46, 0x476A, - 0, 0x366B, 0xCF47, 0, 0xCF48, 0x433B, 0x6264, 0x363A, - 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, - 0, 0xCF53, 0x6267, 0, 0x3826, 0x3A55, 0, 0, - 0, 0, 0, 0, 0, 0xCF54, 0, 0, - 0x6269, 0xCF55, 0xCF56, 0xCF57, 0, 0x4556, 0x3A56, 0x354E, - 0, 0, 0, 0, 0, 0xCF58, 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_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, - 0, 0, 0xCF63, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xCF64, 0x3E4B, 0xCF65, 0, - 0xCF66, 0xCF67, 0, 0xCF68, 0xCF69, 0, 0, 0, - 0xCF6A, 0, 0xCF6B, 0x4E32, 0x3945, 0, 0xCF6C, 0x3827, - 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, 0, 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, - 0, 0x486A, 0, 0x3130, 0xCF71, 0x3A6C, 0, 0x4F52, - 0xCF72, 0, 0x6270, 0, 0, 0xCF74, 0xCF75, 0xCF76, - 0, 0xCF73, 0, 0x6272, 0xCF77, 0, 0, 0x4A4B, - 0xCF78, 0x4059, 0x6274, 0, 0xCF79, 0xCF7A, 0, 0x6275, - 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, - 0x4858, 0x6276, 0xD029, 0xD02A, 0x6279, 0xD02B, 0xD02C, 0, - 0, 0, 0x6322, 0xD02E, 0, 0, 0, 0xD02F, - 0xD030, 0xD031, 0, 0, 0xD02D, 0, 0xD032, 0x6321, - 0x4B61, 0, 0xD033, 0, 0x627E, 0, 0, 0x306B, - 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, - 0xD03E, 0x6327, 0x6326, 0, 0, 0, 0, 0, - 0, 0x6328, 0xD03F, 0, 0xD040, 0, 0xD041, 0xD042, - 0xD043, 0, 0, 0, 0, 0xD044, 0x6268, 0xD045, - 0, 0xD046, 0x626A, 0x632A, 0x6329, 0xD047, 0, 0, - 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, - 0x4D34, 0xD054, 0, 0x6331, 0xD055, 0x6330, 0x4144, 0x632D, - 0xD056, 0, 0x632F, 0xD057, 0xD058, 0x3D4B, 0x3F40, 0x632E, - 0x632C, 0, 0x472A, 0, 0, 0x3E4D, 0, 0xD059, - 0x493C, 0xD05A, 0, 0xD05B, 0, 0x3A57, 0, 0, - 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, - 0, 0xD063, 0, 0xD064, 0xD065, 0xD066, 0xD067, 0, - 0xD068, 0, 0, 0xD069, 0xD06A, 0x6335, 0, 0, - 0, 0xD06B, 0, 0, 0, 0, 0x357A, 0x6336, - 0xD06C, 0xD06D, 0x6338, 0xD06E, 0, 0, 0x6339, 0xD06F, - 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, - 0, 0x324A, 0x4943, 0, 0xD07A, 0x633E, 0xD07B, 0, - 0x486B, 0, 0xD07C, 0, 0, 0xD07D, 0xD07E, 0x4145, - 0xD121, 0x6341, 0xD122, 0x6342, 0x4769, 0xD123, 0x3F41, 0x633F, - 0, 0x4361, 0xD124, 0xD125, 0x6340, 0xD126, 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_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, - 0, 0xD130, 0, 0, 0x4C2D, 0xD131, 0, 0x4923, - 0x6345, 0x6346, 0x4355, 0xD132, 0x4E47, 0, 0xD133, 0x6348, - 0x6347, 0xD134, 0, 0, 0, 0, 0, 0xD135, - 0, 0, 0, 0xD136, 0, 0xD137, 0x3C6F, 0xD138, - 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, - 0x302C, 0, 0, 0, 0, 0xD144, 0xD145, 0x634F, - 0, 0xD146, 0, 0, 0xD147, 0xD148, 0, 0xD149, - 0xD14A, 0x6351, 0x6352, 0x3E77, 0, 0xD14B, 0, 0xD14C, - 0, 0x6353, 0xD14D, 0x334F, 0, 0xD14E, 0, 0, - 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, - 0xD158, 0xD159, 0x4362, 0x416B, 0xD15A, 0x635A, 0x635C, 0x6359, - 0x635B, 0, 0, 0, 0, 0, 0xD15B, 0x3722, - 0xD15C, 0, 0, 0xD15D, 0, 0, 0, 0, - 0, 0x635D, 0x3726, 0, 0xD15E, 0, 0x3567, 0x4D52, - 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, - 0, 0xD168, 0x5474, 0x636A, 0, 0x6369, 0, 0, - 0, 0x636B, 0x636C, 0xD169, 0x4E35, 0x636D, 0, 0x706F, - 0x3E4F, 0x636E, 0x636F, 0x3D57, 0, 0x4638, 0x6370, 0xF459, - 0xD16A, 0xD16B, 0x4328, 0xD16C, 0xD16D, 0x6371, 0, 0x433C, - 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, - 0, 0x3E50, 0, 0, 0xD174, 0, 0, 0, - 0x6378, 0x6379, 0, 0x452B, 0, 0, 0x637A, 0xD175, - 0x335E, 0, 0, 0xD176, 0, 0x3F5A, 0x4964, 0xD177, - 0x637C, 0xD178, 0xD179, 0xD17A, 0x4268, 0xD17B, 0xD17C, 0xD17D, - 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, - 0x637E, 0x435E, 0x457B, 0, 0x457A, 0xD229, 0x3A76, 0, - 0, 0, 0, 0, 0, 0x6438, 0, 0, - 0xD22A, 0, 0, 0, 0xD22B, 0x6428, 0xD22C, 0x642A, - 0, 0xD22D, 0xD22E, 0, 0x642D, 0xD22F, 0x642E, 0xD230, - 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, - 0xD237, 0xD238, 0x6436, 0, 0x4773, 0x4C27, 0xD239, 0x3B3B, - 0x6430, 0x6439, 0x6434, 0xD23A, 0x6433, 0x642F, 0xD23B, 0x6431, - 0xD23C, 0x3449, 0, 0, 0, 0xD23D, 0, 0, - 0, 0, 0x433D, 0, 0xD23E, 0x407D, 0, 0xD23F, - 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, - 0, 0, 0, 0, 0xD24C, 0, 0xD24D, 0xD24E, - 0, 0xD24F, 0xD250, 0xD251, 0, 0x6440, 0, 0, - 0x3C44, 0, 0, 0, 0x4646, 0x6445, 0x6444, 0, - 0xD252, 0x6441, 0xD253, 0, 0, 0x4F36, 0, 0, - 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, - 0, 0x6442, 0x5255, 0x6449, 0x6443, 0, 0, 0x644C, - 0, 0xD266, 0, 0xD267, 0, 0, 0, 0x6452, - 0xD268, 0x344A, 0, 0x644F, 0, 0xD269, 0xD26A, 0x6450, - 0xD26B, 0, 0x6451, 0x6454, 0xD26C, 0, 0, 0, - 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, - 0x645B, 0xD276, 0xD277, 0xD278, 0x6458, 0xD275, 0x645F, 0, - 0x645C, 0xD279, 0xD27A, 0xD27B, 0xD27C, 0xD27D, 0xD27E, 0x645D, - 0x6446, 0xD321, 0, 0xD322, 0x645E, 0x6460, 0, 0xD323, - 0, 0xD324, 0, 0, 0x6461, 0xD325, 0xD326, 0, - 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, - 0x6464, 0, 0x4E33, 0, 0xD32F, 0x4774, 0, 0x4146, - 0x4734, 0, 0, 0x3D4D, 0, 0, 0xD330, 0x3040, - 0xD331, 0x6469, 0x6467, 0, 0x6465, 0x3421, 0xD332, 0x3E51, - 0x646A, 0, 0, 0x6468, 0, 0x6466, 0x646E, 0, - 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, - 0, 0, 0x6475, 0xD340, 0xD341, 0xD342, 0x457C, 0xD343, - 0x6474, 0xD344, 0xD345, 0, 0x6476, 0xD346, 0x4A35, 0x416C, - 0x3947, 0, 0x6477, 0, 0, 0, 0xD347, 0x4E48, - 0, 0xD348, 0, 0xD349, 0, 0, 0, 0x6479, - 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, - 0x4933, 0xD350, 0xD351, 0xD352, 0x3D63, 0x6523, 0xD353, 0x3C53, - 0x3949, 0x3B66, 0x3569, 0x4A36, 0x6522, 0xD354, 0xD355, 0, - 0x4147, 0x4B42, 0x3A77, 0xD356, 0, 0, 0xD357, 0, - 0, 0, 0xD358, 0x3B67, 0x445D, 0xD359, 0x6527, 0x4E5F, - 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, - 0x376B, 0xD363, 0, 0xD364, 0, 0, 0x652D, 0xD365, - 0, 0xD366, 0xD367, 0x6536, 0xD368, 0xD369, 0x394A, 0, - 0, 0x4D6D, 0x303C, 0x6533, 0, 0xD36A, 0x356B, 0xD36B, - 0x6530, 0, 0xD36C, 0, 0, 0, 0x6531, 0, - 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, - 0, 0xD37B, 0, 0x6534, 0, 0, 0xD37C, 0xD37D, - 0, 0x3751, 0x4233, 0x6539, 0x416E, 0xD37E, 0xD421, 0x6546, - 0xF45C, 0, 0x6542, 0x653C, 0, 0, 0xD422, 0xD423, - 0, 0, 0xD424, 0x6540, 0x3C7A, 0x305D, 0x653B, 0x6543, - 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, - 0, 0x4E50, 0x3D6F, 0, 0, 0x656E, 0xF45D, 0xD431, - 0x6548, 0xD432, 0x407E, 0, 0x6544, 0x6549, 0x654B, 0, - 0x4479, 0x654E, 0xD434, 0, 0x654A, 0xD435, 0xD436, 0, - 0x4A54, 0x344B, 0xD437, 0xD438, 0x4C4B, 0xD439, 0, 0x305E, - 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, - 0xD440, 0xD441, 0x6553, 0, 0, 0xD442, 0, 0xD443, - 0, 0, 0, 0x477B, 0xD444, 0xD445, 0x3C4A, 0x6555, - 0xD446, 0x6552, 0x6558, 0x6551, 0, 0, 0x3D44, 0xD447, - 0xD448, 0, 0, 0x4B25, 0xD449, 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_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, - 0xD453, 0, 0xD454, 0, 0x3F25, 0x4136, 0x6564, 0, - 0xD455, 0x6566, 0x6567, 0, 0, 0x6563, 0x6565, 0xD456, - 0, 0xD457, 0xD458, 0, 0, 0xD459, 0x655A, 0x6562, - 0, 0x656A, 0x6569, 0xD45A, 0, 0x4B7A, 0xD45B, 0xD45C, - 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, - 0x6576, 0xD465, 0x6575, 0x6577, 0x6578, 0xD466, 0x6579, 0, - 0xD467, 0, 0xD468, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 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, 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, - 0x6625, 0x6626, 0xD474, 0xD475, 0x6628, 0x6627, 0, 0, - 0x6629, 0, 0, 0xD476, 0xD477, 0xD478, 0, 0x662A, - 0x662B, 0xD479, 0, 0xD47A, 0xD47B, 0xD47C, 0xD47D, 0x662E, - 0x662C, 0x662D, 0x3A61, 0x3753, 0, 0xD47E, 0x4356, 0, - 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, - 0xD529, 0xD52A, 0, 0, 0x6636, 0, 0xD52B, 0xD52C, - 0, 0, 0x6639, 0, 0xD52D, 0x6638, 0x6637, 0, - 0, 0xD52E, 0xD52F, 0x663A, 0x3732, 0, 0xD530, 0, - 0x4122, 0x3541, 0xD531, 0, 0, 0xD532, 0x663E, 0x663B, - 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, 0, 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, - 0, 0, 0x3D2C, 0, 0x6646, 0x6645, 0, 0, - 0, 0, 0, 0xD53B, 0, 0, 0, 0xD53C, - 0x3F69, 0x6647, 0, 0xD53D, 0, 0xD53E, 0x6648, 0, - 0xD53F, 0x6649, 0, 0x3465, 0xD540, 0, 0xD541, 0xD542, - 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, - 0x4251, 0xD54E, 0x6650, 0xD54F, 0xD550, 0x394C, 0xD551, 0x4C57, - 0x6651, 0x6652, 0, 0, 0x6653, 0xD552, 0xD553, 0xD554, - 0xD555, 0x6654, 0, 0, 0xD556, 0, 0xD557, 0, - 0x6655, 0, 0, 0, 0xD558, 0, 0xD559, 0, - 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, - 0, 0, 0x665A, 0, 0, 0, 0x403B, 0, - 0x665B, 0, 0x665C, 0, 0, 0, 0x4A39, 0x665D, - 0xD564, 0x416F, 0x665E, 0, 0xD565, 0, 0xD566, 0, - 0x665F, 0, 0, 0, 0, 0xD567, 0, 0x4E7E, - 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, - 0, 0, 0, 0x666B, 0, 0, 0x3E53, 0, - 0x492A, 0, 0x666C, 0x666A, 0xD56D, 0x344E, 0xD56E, 0, - 0, 0x3854, 0x3B68, 0, 0, 0x486E, 0xD56F, 0xD570, - 0, 0x382A, 0x4B43, 0xD571, 0x666F, 0x666D, 0, 0x394E, - 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, - 0, 0, 0xD577, 0, 0xD578, 0xD579, 0x6676, 0xD57A, - 0xD57B, 0x6672, 0x6675, 0x6670, 0, 0x6673, 0x4B26, 0, - 0xD57C, 0x3855, 0, 0, 0x307D, 0x6671, 0, 0, - 0, 0, 0, 0, 0, 0xD57D, 0xD57E, 0x6678, - 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, - 0, 0, 0, 0, 0, 0, 0xD62A, 0xD62B, - 0xD62C, 0, 0x3553, 0x667A, 0xD62D, 0, 0xD62E, 0, - 0xD62F, 0, 0, 0x667C, 0xD630, 0, 0, 0xD631, - 0, 0x667B, 0, 0, 0xD632, 0, 0, 0x667D, - 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, - 0x4965, 0x6725, 0xD63B, 0x6724, 0x3950, 0x4F53, 0, 0xD63C, - 0, 0, 0, 0, 0, 0, 0, 0x6735, - 0xD63D, 0xD63E, 0, 0, 0, 0x6729, 0x672A, 0xD63F, - 0xD640, 0xD641, 0, 0x3C70, 0, 0xD642, 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_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, - 0xD646, 0, 0, 0x6736, 0, 0x6732, 0xD64C, 0, - 0xD64D, 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, 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, - 0, 0x6742, 0, 0x4221, 0, 0xD65B, 0, 0xD65C, - 0x6744, 0x6743, 0x6746, 0xD65D, 0, 0xD65E, 0xD65F, 0x6747, - 0x6748, 0xD660, 0, 0x3F43, 0xD661, 0x3269, 0, 0x6749, - 0x4E57, 0, 0x3C2B, 0xD662, 0xD663, 0x3D2D, 0, 0, - 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, - 0x6753, 0, 0x5030, 0xD670, 0xD671, 0, 0x6754, 0x4A5E, - 0x345C, 0xD672, 0xD673, 0x4124, 0x3D58, 0xD674, 0x4971, 0x3D2E, - 0, 0xD675, 0xD676, 0, 0, 0, 0, 0, - 0xD677, 0x6755, 0x3952, 0x6756, 0x484C, 0, 0x6764, 0, - 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, - 0, 0xD724, 0, 0, 0, 0, 0xD725, 0, - 0x675B, 0x675A, 0x675D, 0, 0xD726, 0x675C, 0, 0x675E, - 0xD727, 0, 0x6760, 0xD728, 0x675F, 0, 0x344F, 0xD729, - 0x6761, 0, 0x6762, 0x6763, 0, 0xD72A, 0x3A31, 0x4E49, - 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, - 0, 0xD737, 0x676A, 0, 0xD738, 0, 0xD739, 0, - 0xD73A, 0x4967, 0xD73B, 0xD73C, 0, 0x3C47, 0, 0x676C, - 0xD73D, 0xD73E, 0, 0xD73F, 0xD740, 0x3329, 0x3032, 0xD741, - 0xD742, 0xD743, 0xD744, 0x676B, 0x676E, 0x474E, 0xD745, 0x3F44, - 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, - 0xD74F, 0x3171, 0x6772, 0x4E6A, 0x425D, 0xD750, 0, 0x4944, - 0, 0x677E, 0xD751, 0x3257, 0x677C, 0, 0x677A, 0x6771, - 0xD752, 0x676F, 0xD753, 0x6770, 0xD754, 0x3C63, 0x366C, 0x4377, - 0xD755, 0, 0xD756, 0x4651, 0, 0xD757, 0, 0xD758, - 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, - 0, 0, 0, 0, 0, 0, 0x6823, 0x682C, - 0x682D, 0, 0, 0xD764, 0x302B, 0xD765, 0xD766, 0xD767, - 0, 0xD768, 0xD769, 0x6834, 0, 0, 0, 0, - 0x3071, 0, 0, 0x682B, 0xD76A, 0xD76B, 0xD76C, 0x682A, - 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, - 0x6828, 0xD779, 0x3953, 0xD83E, 0xD763, 0xD77A, 0xD77B, 0xD77C, - 0x4171, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF45F, 0, 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, 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, - 0, 0, 0xD828, 0x6776, 0xD829, 0xD82A, 0x6833, 0, - 0xD82B, 0xD82C, 0x682F, 0xD82D, 0xD82E, 0xD82F, 0x3450, 0x6831, - 0x683C, 0, 0x6832, 0, 0, 0, 0xD830, 0xD831, - 0x683E, 0xD832, 0x6830, 0x477C, 0xD833, 0xD84C, 0, 0, - 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, - 0xD83A, 0xD83B, 0, 0x325B, 0xD83C, 0, 0x3E54, 0, - 0x6845, 0, 0, 0, 0x3A5A, 0xD83D, 0, 0x4551, - 0x684A, 0, 0, 0, 0, 0, 0, 0, - 0xD83F, 0x4A6E, 0xD840, 0x6841, 0, 0, 0, 0x325A, - 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, 0, 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, - 0, 0xD849, 0, 0x6840, 0, 0xD84A, 0, 0, - 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, 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, - 0, 0xD855, 0xD856, 0, 0, 0, 0xD857, 0x4378, - 0xD858, 0xD859, 0xD85A, 0x336B, 0xD85B, 0, 0, 0, - 0xD85C, 0x4972, 0x6864, 0x4621, 0xD85D, 0xD85E, 0x3031, 0xD85F, - 0, 0x685D, 0xD860, 0x6859, 0x4172, 0x6853, 0x685B, 0x6860, - 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, - 0x3D2F, 0, 0xD86A, 0xD86B, 0x3C2C, 0xD86C, 0, 0, - 0, 0x4C58, 0, 0, 0x4947, 0, 0xD86D, 0x6867, - 0, 0x6870, 0, 0, 0, 0, 0xD86E, 0, - 0xD86F, 0xD870, 0xD871, 0, 0, 0x685A, 0, 0xD872, - 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, - 0x686C, 0x4C2C, 0, 0xD87E, 0, 0, 0x686F, 0, - 0, 0x6868, 0x686B, 0, 0xD921, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xD922, - 0, 0, 0xD923, 0, 0x4B29, 0, 0x4F21, 0xD924, - 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, - 0xD932, 0x4A4E, 0, 0x4C22, 0x6879, 0x6878, 0, 0x6874, - 0x6875, 0, 0x3136, 0, 0xD933, 0, 0xD934, 0x6877, - 0, 0x6871, 0xD935, 0xD936, 0xD937, 0xD938, 0x4455, 0xD939, - 0, 0, 0xD93A, 0xD93B, 0x6876, 0x307E, 0, 0xD93C, - 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, - 0xD943, 0xD944, 0xD945, 0xD946, 0, 0x6924, 0xD947, 0x4979, - 0x687D, 0xD948, 0x6856, 0, 0xD949, 0xD94A, 0xD94B, 0xD94C, - 0xD94D, 0xD94E, 0xD94F, 0x687C, 0xD950, 0, 0, 0, - 0x4F4F, 0x4622, 0x4973, 0xD951, 0, 0x692B, 0, 0xD952, - 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, 0, 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, - 0x6933, 0x6928, 0, 0xD95F, 0x692C, 0, 0, 0x3172, - 0xD960, 0x4665, 0, 0x692D, 0x6930, 0xD961, 0, 0xD962, - 0xD963, 0, 0xD964, 0, 0x6926, 0xD965, 0x4126, 0xD966, - 0x692A, 0x3B27, 0x3F45, 0x3730, 0x4C74, 0xD974, 0x4C79, 0x3D72, - 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, - 0x6938, 0, 0, 0, 0, 0x6939, 0, 0, - 0xD975, 0, 0xD976, 0, 0x693C, 0x693A, 0, 0xD977, - 0xD978, 0, 0, 0, 0x4623, 0x693B, 0xD979, 0, - 0xD97A, 0x484D, 0x692E, 0, 0, 0xD97B, 0, 0, - 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, - 0xDA27, 0xDA28, 0xDA29, 0x693F, 0, 0, 0x5D31, 0x5D22, - 0xDA2A, 0xDA2B, 0x6945, 0xDA2C, 0, 0, 0xDA2D, 0, - 0, 0xDA2E, 0x6944, 0, 0, 0, 0, 0xDA2F, - 0, 0xDA30, 0, 0, 0, 0x4D76, 0, 0x623C, - 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, - 0x3554, 0, 0xDA39, 0xDA3A, 0x694A, 0x515D, 0xDA3B, 0xDA3C, - 0xDA3D, 0xDA3E, 0x3575, 0, 0x4E3A, 0xDA3F, 0x3673, 0x694B, - 0xDA40, 0xDA41, 0xDA42, 0xDA43, 0xDA44, 0, 0, 0x694C, - 0, 0xDA45, 0, 0x436E, 0xDA46, 0, 0, 0xDA47, - 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, - 0, 0xDA4D, 0, 0x694E, 0, 0x3B3D, 0xDA4E, 0, - 0xDA4F, 0, 0xDA50, 0, 0xDA51, 0, 0, 0, - 0, 0xDA52, 0, 0x694F, 0x4742, 0, 0xDA53, 0xDA54, - 0xDA55, 0x6950, 0x6951, 0x695B, 0, 0xDA56, 0, 0x6955, - 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, - 0, 0xDA63, 0xDA64, 0, 0x695C, 0xDA65, 0, 0xDA66, - 0, 0x333F, 0xDA67, 0x6961, 0xDA68, 0, 0x695D, 0x6960, - 0xDA69, 0, 0, 0xDA6A, 0x483A, 0xDA6B, 0, 0xDA6C, - 0, 0x695E, 0, 0, 0x695F, 0x4948, 0x485A, 0x6962, - 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, - 0xDA77, 0x6969, 0x6963, 0xDA78, 0xDA79, 0, 0, 0, - 0x4358, 0xDA7A, 0x6974, 0, 0x4C2A, 0, 0xDA7B, 0xDA7C, - 0, 0xDA7D, 0, 0xDA7E, 0, 0x6972, 0, 0, - 0xDB21, 0x6973, 0, 0, 0, 0, 0xDB22, 0xDB23, - 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, - 0, 0, 0, 0x6A21, 0, 0x3F2A, 0, 0x697B, - 0xDB2F, 0x697E, 0, 0, 0, 0xDB30, 0, 0x6976, - 0x6975, 0xDB31, 0, 0x6A22, 0xDB32, 0xDB33, 0x325C, 0, - 0x697C, 0, 0x6A23, 0, 0, 0, 0x697D, 0xDB34, - 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, - 0xDB41, 0, 0, 0xDB42, 0, 0xDB43, 0, 0xDB44, - 0xDB45, 0xDB46, 0, 0, 0, 0, 0xDB47, 0x6A26, - 0xDB48, 0, 0x6A25, 0xDB49, 0, 0, 0, 0xDB4A, - 0, 0, 0, 0x6A2E, 0xDB4B, 0xDB4C, 0xDB4D, 0x6A28, - 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, - 0x6A2C, 0, 0x6A3D, 0, 0, 0xDB57, 0xDB58, 0, - 0, 0xDB59, 0xDB5A, 0, 0xDB5B, 0, 0, 0xDB5C, - 0x6A36, 0, 0xDB5D, 0xDB5E, 0xDB5F, 0, 0, 0, - 0, 0, 0xDB60, 0xDB61, 0, 0xDB62, 0, 0x6A34, - 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, - 0xDB6E, 0x6A3E, 0xDB70, 0xDB71, 0xDB72, 0x6A40, 0x6A3F, 0, - 0xDB73, 0xDB6F, 0xDB74, 0xDB75, 0xDB76, 0, 0xDB77, 0xDB78, - 0, 0x6A42, 0x6A41, 0x695A, 0, 0, 0, 0x6A46, - 0xDB79, 0, 0, 0, 0, 0xDB7A, 0xDB7B, 0, - 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, 0, - 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, - 0, 0xDC2B, 0x6A4A, 0x3D51, 0, 0xDC2C, 0xDC2D, 0x3339, - 0xDC2E, 0x6A4B, 0xDC2F, 0x3152, 0xDC30, 0x3E57, 0x6A4C, 0xDC31, - 0xDC32, 0x3955, 0x6A4D, 0x3061, 0xDC33, 0, 0, 0, - 0x493D, 0xDC34, 0, 0x6A4E, 0, 0, 0, 0, - 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, - 0, 0, 0x6A58, 0, 0, 0, 0x4235, 0x6A57, - 0xDC39, 0x6A5A, 0xDC3A, 0xDC3B, 0xDC3C, 0, 0x6A51, 0xDC3D, - 0xDC3E, 0, 0x6A5B, 0, 0x6A5D, 0, 0, 0, - 0xDC3F, 0, 0xDC40, 0x486F, 0, 0, 0x6A59, 0, - 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, - 0, 0xDC4A, 0xDC4B, 0xDC4C, 0x6A63, 0x4D35, 0, 0, - 0x6A64, 0x6A65, 0, 0xDC4D, 0x4A64, 0x6A66, 0xDC4E, 0x3A40, - 0, 0x4E23, 0, 0, 0, 0, 0, 0xDC4F, - 0x6A6B, 0, 0, 0, 0, 0, 0, 0xDC50, - 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, - 0x336C, 0, 0x4B2B, 0x6A70, 0, 0xDC5A, 0xDC5B, 0, - 0xDC5C, 0xDC5D, 0xDC5E, 0, 0xDC5F, 0x6A7C, 0x6A72, 0, - 0xDC60, 0, 0, 0, 0, 0x6A73, 0xDC61, 0xDC62, - 0xDC63, 0, 0x6A74, 0x6A75, 0, 0, 0, 0, - 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, - 0, 0, 0xDC71, 0, 0, 0, 0x3228, 0xDC72, - 0, 0, 0xDC73, 0xDC74, 0xDC75, 0, 0x6A7E, 0x365F, - 0x6A7D, 0xDC76, 0xDC77, 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_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, - 0xDD26, 0, 0, 0x6B2C, 0xDD27, 0xDD28, 0x3B6B, 0x4741, - 0x6B2D, 0, 0x3350, 0xDD29, 0xDD2A, 0, 0, 0xDD2B, - 0xDD2C, 0x6B2E, 0, 0, 0, 0xDD2D, 0x6B30, 0x4D77, - 0, 0x6B2F, 0x3F46, 0, 0x6B31, 0, 0, 0x6B32, - 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, - 0, 0, 0x3351, 0, 0xDD34, 0xDD35, 0xDD36, 0xDD37, - 0xDD38, 0, 0x6B38, 0, 0x6B39, 0x6B3A, 0, 0, - 0, 0, 0, 0x3272, 0, 0xDD39, 0x3F28, 0x6B3B, - 0, 0xDD3A, 0, 0xDD3B, 0, 0xDD3C, 0, 0, - 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, - 0x6B40, 0xDD47, 0xDD48, 0x3731, 0xDD49, 0xDD4A, 0x6B3F, 0x4277, - 0x352D, 0, 0, 0x6B42, 0, 0x6B43, 0xDD4B, 0x3E59, - 0xDD4C, 0, 0xDD4D, 0x376D, 0xDD4E, 0x6B44, 0xDD4F, 0, - 0, 0, 0x4B2C, 0xDD50, 0xDD51, 0x405F, 0, 0xDD52, - 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, - 0x3A3E, 0x4242, 0x6B48, 0xDD5E, 0x3E5B, 0x493E, 0xDD5F, 0xDD60, - 0xDD61, 0, 0, 0x6B47, 0xDD62, 0xDD63, 0x3B6C, 0, - 0x3153, 0xDD64, 0x6B4E, 0x3758, 0, 0xDD65, 0x3B6E, 0xDD66, - 0, 0x3B6D, 0, 0x4F4D, 0x6B4D, 0x6B4C, 0x4127, 0, - 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, - 0xDD74, 0x6B54, 0xDD75, 0x4040, 0, 0x4342, 0xDD76, 0xDD77, - 0x4D36, 0xDD78, 0x6B57, 0, 0, 0, 0x386C, 0xDD79, - 0x403F, 0x6B53, 0, 0x6B58, 0x386D, 0x6B55, 0x6B56, 0xDD7A, - 0x6B52, 0xDD7B, 0, 0, 0x4062, 0x4649, 0xDD7C, 0xDD7D, - 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, - 0, 0xDE2A, 0x4E4A, 0xDE2B, 0xDE2C, 0xDE2D, 0x4F40, 0xDE2E, - 0, 0, 0x6B5C, 0x6B67, 0x4435, 0xDE2F, 0x6B66, 0xDE30, - 0x6B63, 0x6B6B, 0x6B64, 0, 0x6B60, 0, 0x447C, 0x6B5F, - 0, 0, 0, 0x6B5D, 0xDE31, 0x4D21, 0x3B70, 0, - 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, - 0x6B6D, 0xDE3B, 0, 0, 0x6B62, 0, 0x6B6C, 0x6B6E, - 0, 0x382C, 0x6B6A, 0x3956, 0xDE3C, 0x3C55, 0xDE3D, 0xDE3E, - 0x6B6F, 0x4D58, 0, 0, 0, 0, 0x6B72, 0, - 0x6B75, 0, 0, 0x6B73, 0x4935, 0xDE40, 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_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, - 0, 0, 0xDE4A, 0xDE4B, 0xDE4C, 0, 0x6B7B, 0, - 0x3C31, 0xDE4D, 0x6B7D, 0x6B7C, 0x4968, 0, 0xDE4F, 0x6C21, - 0, 0, 0, 0xDE50, 0, 0, 0x3759, 0, - 0, 0, 0, 0x6B7E, 0x6C22, 0xDE51, 0, 0x6C23, - 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, 0, 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, - 0x3D32, 0, 0x6C29, 0x6C2A, 0xDE5D, 0xDE5E, 0x6C2B, 0, - 0, 0x6C2C, 0x6C2D, 0, 0xDE5F, 0, 0xDE60, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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, 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, - 0x6C34, 0xDE6B, 0, 0xDE6C, 0xDE6D, 0x6C35, 0, 0xDE6E, - 0xDE6F, 0xDE72, 0x465A, 0xDE70, 0, 0xDE71, 0, 0, - 0, 0x3E5D, 0x6C36, 0xDE73, 0xDE74, 0, 0xDE75, 0, - 0xDE76, 0xDE77, 0x396B, 0x502E, 0x6C37, 0xDE78, 0, 0, - 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, - 0xDF23, 0, 0xDF24, 0xDF25, 0x6C40, 0, 0, 0, - 0x6C42, 0xDF26, 0, 0xDF27, 0xDF28, 0x332D, 0x4467, 0, - 0x4969, 0x3A62, 0x3957, 0, 0xDF29, 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_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, - 0, 0x4678, 0, 0x4950, 0, 0xDF32, 0xDF31, 0, - 0, 0xDF33, 0x6C4F, 0x3B3F, 0x3B72, 0xDF34, 0x3E5E, 0, - 0x4765, 0xDF35, 0x382D, 0x6C4E, 0x6C4D, 0, 0x496A, 0, - 0xDF36, 0, 0x3C41, 0, 0xDF37, 0x4552, 0, 0xDF38, - 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, - 0x6C59, 0, 0xDF43, 0x6C5B, 0x6C5D, 0, 0x6C5E, 0xDF44, - 0, 0, 0, 0xDF45, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 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, 0xDF48, 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_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, 0, 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, - 0xDF4F, 0xDF50, 0, 0, 0, 0xDF51, 0, 0, - 0, 0x6C64, 0, 0, 0, 0, 0xDF52, 0xDF53, - 0xDF54, 0, 0, 0x3C71, 0, 0, 0xDF55, 0, - 0x3F76, 0, 0, 0xDF56, 0xDF57, 0, 0, 0xDF58, - 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, - 0, 0xDF65, 0, 0, 0xDF66, 0xDF67, 0x6C6A, 0xDF68, - 0, 0xDF69, 0x6C69, 0x6C6C, 0, 0x3577, 0, 0x6C70, - 0, 0x4057, 0, 0x6C71, 0xDF6A, 0xDF6B, 0, 0xDF6C, - 0x3859, 0, 0x6C6E, 0x6C6F, 0xDF6D, 0, 0, 0x4F29, - 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, - 0x6C78, 0xDF79, 0, 0, 0xDF7A, 0, 0xDF7B, 0, - 0, 0, 0, 0, 0, 0x6C76, 0x6C77, 0x6C79, - 0xDF7C, 0xDF7D, 0xDF7E, 0xE021, 0, 0, 0xE022, 0xE023, - 0, 0, 0x6D29, 0, 0, 0, 0, 0, - 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, - 0x6D24, 0, 0, 0, 0xE031, 0x6D2B, 0, 0, - 0, 0x6D26, 0, 0xE032, 0xE033, 0xE034, 0xE035, 0x4058, - 0x6D28, 0xE036, 0xE037, 0x6D2A, 0x6D27, 0, 0, 0, - 0, 0xE038, 0, 0, 0xE039, 0xE03A, 0, 0xE03B, - 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, - 0xE044, 0x6D36, 0xE045, 0x6D35, 0x6D37, 0xE046, 0, 0, - 0, 0x6D38, 0xE047, 0xE048, 0, 0xE049, 0xE04A, 0, - 0, 0x6D3A, 0xE04B, 0, 0, 0, 0, 0xE04C, - 0, 0xE04D, 0x6D39, 0x3F48, 0x6D3B, 0xE04E, 0xE04F, 0x366D, - 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, - 0, 0xE05A, 0x382E, 0, 0xE05B, 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, 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, 0, - 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, - 0xE06A, 0, 0x6D4C, 0x6D4E, 0x4A65, 0x6D4B, 0xE06B, 0xE06C, - 0xE06D, 0x6D4D, 0, 0x6D51, 0x6D4F, 0x3531, 0xE06E, 0x6D50, - 0xE06F, 0xE070, 0, 0xE071, 0, 0xE072, 0x6D53, 0xE073, - 0xE074, 0x475A, 0x4E58, 0, 0xE075, 0xE076, 0xE077, 0x3D34, - 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, - 0, 0xE124, 0xE125, 0xE126, 0xE127, 0xE128, 0, 0x6D5E, - 0xE129, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x3F49, 0x6D63, 0xE12D, 0x3C2D, 0x6D64, - 0xE12E, 0xE12F, 0, 0x6D65, 0xE130, 0xE131, 0xE132, 0x5221, - 0x517E, 0, 0, 0, 0, 0x6D66, 0x6570, 0x6D67, - 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, - 0xE13D, 0x3661, 0xE13E, 0xE13F, 0x4A56, 0xE140, 0, 0, - 0, 0, 0x6D69, 0, 0, 0, 0, 0, - 0xE141, 0, 0x6D6B, 0xE142, 0xE143, 0x6D6A, 0x3260, 0, - 0xE144, 0x4676, 0x6D6C, 0x4777, 0, 0x4533, 0xE145, 0x6D6D, - 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, - 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, 0xE156, 0x4261, 0xE153, - 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, - 0x6E22, 0x6E23, 0x6E24, 0x463B, 0x4323, 0x3063, 0x6E28, 0, - 0x6E29, 0x7423, 0, 0xE15E, 0x423D, 0xE15F, 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_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, 0, - 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, - 0xE16C, 0x4D38, 0, 0, 0, 0xE16D, 0, 0xE16E, - 0xE16F, 0xE170, 0, 0xE171, 0, 0, 0, 0, - 0xE172, 0xE173, 0xE174, 0x4661, 0, 0xE175, 0x4B2E, 0, - 0x6E37, 0, 0x3C59, 0, 0, 0, 0, 0x6E38, - 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, - 0, 0, 0xE22D, 0, 0, 0xE225, 0, 0xE226, - 0xE227, 0xE228, 0, 0x6E3E, 0xE229, 0xE22A, 0xF46C, 0xE22B, - 0, 0x3734, 0x6E3B, 0, 0x6E3C, 0xE22C, 0, 0, - 0x4974, 0, 0, 0xE22F, 0, 0x3354, 0, 0xE230, - 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, - 0xE23B, 0, 0x6E40, 0, 0xE23C, 0xF46E, 0xE23D, 0xE23E, - 0xE23F, 0x6E41, 0xE240, 0, 0xE241, 0, 0xE242, 0, - 0xE243, 0, 0xE245, 0xE246, 0, 0xE244, 0, 0xE247, - 0, 0xE248, 0, 0, 0, 0x4522, 0xE249, 0xE24A, - 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, - 0, 0, 0x3C72, 0xE257, 0x3F6C, 0, 0x6E45, 0xE258, - 0x6E46, 0xE259, 0xE25A, 0xE25B, 0, 0, 0, 0, - 0, 0xE25C, 0x3F5D, 0x6E47, 0xE25D, 0x6E48, 0, 0xE25E, - 0, 0x6E49, 0x4D6F, 0, 0x3D37, 0xE25F, 0, 0, - 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, - 0x386F, 0xE26A, 0x4043, 0xE26B, 0xE26C, 0xE26D, 0, 0x4830, - 0xE26E, 0, 0, 0, 0x3D39, 0, 0xE26F, 0, - 0, 0xE270, 0x6E4F, 0, 0x3E5F, 0, 0xE271, 0, - 0xE272, 0, 0x6E52, 0x6E50, 0xE273, 0xE274, 0xE275, 0x6E51, - 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, - 0x6E5A, 0x3662, 0, 0xE324, 0xE325, 0, 0x6E5B, 0xE326, - 0x4523, 0xE327, 0xE328, 0x6E5E, 0x3378, 0x3F4B, 0xE329, 0x6E5C, - 0, 0x6E5D, 0, 0x4460, 0xE32A, 0xE32B, 0x4B55, 0x367C, - 0, 0xE32C, 0xE32D, 0, 0xE32E, 0xE32F, 0xE330, 0xE331, - 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, 0, 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, - 0xE341, 0x6E67, 0xE342, 0xE343, 0x6E64, 0x6E66, 0xE344, 0, - 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, 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, 0, 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, - 0x6E71, 0xE361, 0, 0, 0, 0, 0, 0x6E69, - 0xE362, 0xE363, 0x6E76, 0x3174, 0xE364, 0xE365, 0x6E68, 0, - 0xE366, 0xE367, 0x482D, 0, 0x6E6C, 0xE368, 0x3E60, 0xE369, - 0xE36A, 0xE36B, 0, 0, 0, 0, 0xE36C, 0xE36D, - 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, 0, - 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, - 0, 0x412D, 0xE37D, 0x6E74, 0, 0x6E6E, 0x6E73, 0xE37E, - 0x4C43, 0xE421, 0x4438, 0x6E75, 0x6E72, 0, 0, 0xE422, - 0xE423, 0, 0, 0, 0xE424, 0xE425, 0, 0xE426, - 0xE427, 0, 0, 0xE428, 0, 0x412C, 0, 0xE429, - 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, - 0xE43E, 0, 0x4B2F, 0xE43F, 0, 0xE440, 0, 0xE441, - 0xE442, 0xE443, 0, 0, 0xE444, 0xE445, 0, 0xE446, - 0xE447, 0xE448, 0, 0xE449, 0x3D7B, 0xE44A, 0, 0xE44B, - 0xE44C, 0x6E7A, 0x4A5F, 0, 0xE44D, 0x3154, 0xE44E, 0, - 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, 0, 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, - 0x3F6D, 0xE457, 0, 0, 0xE458, 0xE459, 0, 0, - 0x3F6E, 0x6F21, 0x6F23, 0, 0xE45A, 0xE45B, 0xE45C, 0xE45D, - 0x3E7B, 0xE45E, 0x6F22, 0x6F24, 0xE45F, 0xE460, 0x3653, 0xE461, - 0x4945, 0xE462, 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_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, - 0xE46B, 0xE46C, 0xE46D, 0, 0x4457, 0xE46E, 0x6F2C, 0xE46F, - 0xE470, 0, 0xE471, 0x4343, 0x6F28, 0, 0xE472, 0, - 0x6F29, 0, 0, 0, 0xE473, 0xE474, 0, 0xE475, - 0, 0xE476, 0xE477, 0, 0x372D, 0xE478, 0x6F2B, 0xE479, - 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, - 0, 0, 0xE52C, 0, 0x6F30, 0xE52D, 0x3A3F, 0x4179, - 0xE52E, 0, 0x444A, 0xE52F, 0, 0, 0xE530, 0, - 0, 0xE531, 0, 0xE532, 0xE533, 0, 0xE534, 0x333B, - 0xE535, 0xE53B, 0, 0xE536, 0x6F2E, 0x6F2F, 0x4443, 0, - 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, 0, 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, - 0x6F39, 0x452D, 0, 0xE546, 0, 0, 0x6F32, 0x6F33, - 0x6F36, 0xE547, 0, 0, 0xE548, 0x6F38, 0xE549, 0xE54A, - 0, 0x3640, 0xE54B, 0, 0x6F3B, 0x6F35, 0xE54C, 0xE54D, - 0x6F34, 0, 0, 0, 0, 0, 0, 0, - 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, - 0, 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, - 0x6F41, 0, 0, 0x6F3E, 0x6F3D, 0xE55C, 0xE55D, 0xE55E, - 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, 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, 0, 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, - 0, 0x3455, 0x6F48, 0x4C7A, 0, 0xE56E, 0, 0, - 0, 0xE56F, 0x6F54, 0x6F4A, 0xE570, 0, 0x6F4D, 0xE571, - 0x6F4B, 0xE572, 0x6F4C, 0xE573, 0, 0, 0, 0, - 0xE574, 0, 0x6F4E, 0xE575, 0, 0xE576, 0xE577, 0xE578, - 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, - 0, 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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_E995[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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, - 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, - 0, 0x3457, 0xF471, 0x3456, 0x6F5C, 0, 0x6F5D, 0, - 0x6F5E, 0x6F5F, 0, 0, 0, 0xE627, 0xE628, 0xE629, - 0x6F60, 0xE62A, 0x3458, 0x3355, 0x395E, 0x4836, 0xE62B, 0x6F62, - 0x6F61, 0xE62C, 0, 0xE62D, 0xE62E, 0x6F63, 0, 0, - 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, 0, 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, - 0xE638, 0xE639, 0xE63A, 0xE63B, 0x6F6E, 0x6F6D, 0x6F6F, 0, - 0x462E, 0xE63C, 0xE63D, 0, 0x6F70, 0xE63E, 0xE63F, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x496C, 0xE644, 0xE645, 0, - 0, 0x6F74, 0xE646, 0, 0xE647, 0xE648, 0xE649, 0, - 0x6F75, 0, 0x3A65, 0, 0xE64A, 0, 0x6F76, 0x6F77, - 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, - 0x3842, 0, 0xE654, 0, 0xE655, 0, 0xE656, 0xE657, - 0xE658, 0, 0, 0x4A45, 0x6F7D, 0x7021, 0x6F7E, 0x7022, - 0, 0xE659, 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_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, - 0, 0xE665, 0, 0, 0x3356, 0x7028, 0xE666, 0x7029, - 0x7027, 0x3764, 0xE667, 0x3A5D, 0x3E63, 0xE668, 0, 0xE669, - 0x3123, 0, 0, 0x4E59, 0xE66A, 0xE66B, 0xE66C, 0x702B, - 0x6E2E, 0xE66D, 0x702A, 0, 0, 0, 0xE66E, 0xE66F, - 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, - 0, 0x3B28, 0xE673, 0, 0, 0x703A, 0x6A2D, 0, - 0xE675, 0x5256, 0xE676, 0x3F77, 0x7038, 0xE677, 0xE678, 0xE679, - 0, 0, 0x4E25, 0x4671, 0, 0, 0, 0, - 0x312B, 0xE67A, 0x4063, 0x3C36, 0, 0, 0, 0xE67B, - 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, - 0, 0x7041, 0, 0x703F, 0, 0, 0x7043, 0, - 0, 0x7044, 0xE724, 0xE725, 0x417A, 0xE726, 0x3262, 0, - 0, 0xE727, 0xE728, 0xE729, 0x7045, 0, 0, 0x4C38, - 0xE72A, 0, 0x7046, 0, 0, 0, 0, 0, - 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, - 0, 0xF476, 0x4044, 0, 0, 0xE732, 0x4C77, 0xE733, - 0xE734, 0x4045, 0xE735, 0xE736, 0x7050, 0, 0x4873, 0, - 0x7051, 0x7353, 0x4C4C, 0xE737, 0x7052, 0, 0x7053, 0xE738, - 0x7054, 0x3357, 0xE739, 0x7056, 0, 0x3F59, 0xE73A, 0, - 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, 0, 0x704B, 0, 0x704C, 0xFB7B, - 0x704D, 0x704F, 0xE72F, 0, 0, 0x7D68, 0x7D69, 0x7D6A, - 0, 0, 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, - 0x7060, 0, 0, 0, 0, 0xE744, 0xE745, 0xE746, - 0x3E64, 0xE747, 0xE748, 0, 0x7061, 0, 0xE749, 0xE74A, - 0x3547, 0, 0xE74B, 0x7064, 0, 0, 0x7063, 0, - 0x7062, 0, 0, 0x6B71, 0xE74C, 0x4A5C, 0xE74D, 0, - 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, - 0xE761, 0xE762, 0, 0x345A, 0xE763, 0, 0, 0xE764, - 0xE765, 0xE766, 0, 0xE76A, 0x706B, 0xE767, 0xE768, 0, - 0xE769, 0xE76B, 0, 0, 0xE76C, 0, 0, 0, - 0, 0, 0, 0, 0, 0x706C, 0x4723, 0xE76D, - 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, - 0x4D42, 0x3468, 0x4852, 0x465C, 0xE778, 0, 0xE779, 0x3F7C, - 0x4E4E, 0xE775, 0x375B, 0, 0xE77A, 0, 0xE77B, 0, - 0xE77C, 0x7076, 0, 0xE77D, 0x7075, 0xE828, 0xE77E, 0, - 0, 0, 0, 0xE821, 0x4B4B, 0x462C, 0xE822, 0xE823, - 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, - 0, 0xE82D, 0xE82E, 0xE82F, 0x3469, 0x3832, 0xE830, 0xE831, - 0x346A, 0xE832, 0xE833, 0x453F, 0, 0, 0x4E60, 0, - 0, 0, 0xE834, 0xE835, 0, 0xE836, 0xE837, 0x385C, - 0, 0, 0xE838, 0x707C, 0xE839, 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_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, - 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, 0xE83A, 0, 0xE83B, 0xE83C, 0x7125, - 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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x4874, 0x664C, 0, 0, 0x3F29, - 0, 0xE848, 0x3532, 0xE849, 0, 0xE84A, 0xE84B, 0xE84C, - 0, 0x712B, 0xE84D, 0x712C, 0, 0x522C, 0x5D3B, 0x4853, - 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, - 0x3B41, 0xE853, 0x712F, 0x326E, 0x7130, 0xE854, 0xE855, 0xE856, - 0x7131, 0, 0xE857, 0xE858, 0xE859, 0x7133, 0x7134, 0xE85A, - 0x7136, 0x7132, 0xE85B, 0, 0x7135, 0, 0xE85C, 0xE85D, - 0x345B, 0, 0, 0xE85E, 0x7137, 0, 0x7138, 0, - 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, 0, - 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, - 0x713E, 0x7140, 0x7141, 0, 0xE86F, 0x7143, 0, 0x3642, - 0xE870, 0xE871, 0, 0xE872, 0xE873, 0, 0xE874, 0xE875, - 0xE876, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0, 0, 0, 0, 0, 0, 0x3C73, 0x7144, - 0x7145, 0x3961, 0, 0xE877, 0, 0xE878, 0xF47A, 0xE879, - 0, 0, 0, 0, 0, 0x7146, 0xE87A, 0, - 0x333E, 0, 0, 0, 0x474F, 0x7147, 0x7148, 0, - 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, - 0x4373, 0x714E, 0x3670, 0xE927, 0xE928, 0x326F, 0, 0, - 0x714D, 0xE929, 0xE92A, 0x714B, 0xE92B, 0x714C, 0xE92C, 0x714A, - 0, 0, 0x7158, 0, 0, 0, 0, 0xE92D, - 0, 0, 0xE92E, 0xE92F, 0xE930, 0x714F, 0x7150, 0, - 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, - 0xE93C, 0xE93D, 0x417B, 0x3833, 0, 0, 0xE93E, 0, - 0, 0x7159, 0, 0, 0, 0, 0xE93F, 0, - 0xE940, 0, 0xE941, 0xE942, 0xE943, 0, 0, 0xE944, - 0x424D, 0, 0, 0x715A, 0, 0xE945, 0xE946, 0, - 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, - 0, 0xE952, 0, 0, 0xE953, 0x7161, 0xE954, 0x7164, - 0, 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_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, - 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, 0xE959, - 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, - 0xE967, 0x7171, 0xE968, 0x7172, 0x7173, 0xE969, 0xE96A, 0xE96B, - 0x3962, 0xF47B, 0, 0xE96C, 0xE96D, 0, 0x7174, 0x7175, - 0xE96E, 0, 0x7176, 0x7177, 0xE96F, 0xE970, 0x7178, 0xE971, - 0, 0xE972, 0x4831, 0x717A, 0xE973, 0x4926, 0x717B, 0x7179, - 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, 0, 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, - 0xEA29, 0, 0xEA2A, 0, 0, 0, 0xEA2B, 0, - 0x7223, 0xEA2C, 0x7224, 0xEA2D, 0xEA2E, 0, 0, 0x7225, - 0xEA2F, 0, 0x7226, 0x7227, 0, 0x7228, 0xEA30, 0x7229, - 0x722A, 0x722B, 0x722C, 0xEA31, 0, 0xEA32, 0x722D, 0x722E, - 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, - 0, 0x7235, 0, 0, 0x4B62, 0xEA3D, 0xEA3E, 0xEA3F, - 0x7236, 0, 0x357B, 0xEA40, 0, 0, 0xEA41, 0, - 0, 0xEA42, 0, 0xEA43, 0, 0xEA44, 0xEA45, 0, - 0xEA46, 0, 0xEA47, 0xEA48, 0xEA49, 0xEA4A, 0xEA4B, 0x4F25, - 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, - 0xEA5C, 0x723A, 0x4A2B, 0x7238, 0xEA5D, 0, 0x723B, 0x723C, - 0, 0, 0xEA5E, 0, 0, 0xEA5F, 0xEA60, 0x723D, - 0x723E, 0, 0, 0, 0, 0, 0xEA61, 0xEA62, - 0x723F, 0xEA63, 0x4B6E, 0x3B2D, 0xEA64, 0x3A7A, 0x412F, 0, - 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, 0, 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, - 0xEA72, 0x7246, 0x7247, 0, 0x724B, 0, 0x3B2A, 0xEA73, - 0xEA74, 0, 0, 0x4264, 0, 0xEA75, 0, 0xEA76, - 0, 0x724C, 0x7249, 0x7248, 0x724A, 0xEA77, 0, 0xEA78, - 0x375F, 0, 0xEA79, 0xEA7A, 0, 0, 0, 0xEA7B, - 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, - 0x4F4C, 0xEB29, 0x7258, 0x7254, 0x7252, 0x7251, 0xEB2A, 0, - 0xEB2B, 0xEB2C, 0xEB2D, 0x725C, 0xEB2E, 0, 0xEB2F, 0, - 0, 0x725F, 0xEB30, 0xEB31, 0x725E, 0x725D, 0xEB32, 0xEB33, - 0xEB34, 0xEB35, 0xEB36, 0, 0, 0x4949, 0x725B, 0x3073, - 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, - 0xEB44, 0, 0x4B70, 0xEB45, 0xEB46, 0, 0xEB47, 0x4E5A, - 0xEB48, 0, 0x7265, 0xEB49, 0xEB50, 0xEB4A, 0xEB4B, 0xEB4C, - 0x7266, 0, 0, 0xEB4D, 0, 0, 0, 0x7267, - 0xEB52, 0xEB4E, 0xEB4F, 0xEB51, 0, 0, 0xEB53, 0, - 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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x443B, 0xEB59, 0x726A, - 0, 0x4837, 0, 0x726F, 0x726B, 0, 0, 0, - 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, - 0, 0xEB5F, 0x7279, 0, 0, 0x7278, 0, 0xEB60, - 0xEB61, 0, 0, 0x3175, 0xEB62, 0xEB63, 0xEB64, 0x7276, - 0, 0, 0, 0x7275, 0, 0, 0x7273, 0, - 0x337B, 0, 0x7272, 0x3C32, 0x3229, 0, 0, 0xEB65, - 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, - 0x7325, 0x7324, 0, 0xEB72, 0xEB73, 0, 0, 0, - 0, 0x7326, 0, 0, 0x312D, 0x7321, 0x7322, 0xEB74, - 0x3974, 0x4C39, 0xEB76, 0xEB75, 0x7323, 0xEB77, 0, 0, - 0, 0xEB78, 0xEB79, 0xEB7A, 0x4B32, 0, 0, 0x732B, - 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, - 0, 0, 0xEC29, 0xEC2A, 0, 0xEC2B, 0xEC2C, 0xEC2D, - 0xEC2E, 0, 0x732D, 0, 0, 0, 0, 0, - 0, 0xEC2F, 0, 0, 0x732E, 0, 0, 0, - 0, 0x732F, 0xEC30, 0x732A, 0xEC31, 0, 0xEC32, 0x7274, - 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, - 0, 0, 0, 0x733A, 0xEC3C, 0xEC3D, 0xEC3E, 0xEC3F, - 0, 0x7339, 0xEC40, 0, 0, 0, 0xEC41, 0xEC42, - 0xEC43, 0, 0, 0, 0, 0xEC44, 0x733C, 0xEC45, - 0, 0xEC46, 0, 0xEC47, 0, 0x733D, 0xEC48, 0x733E, - 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, - 0xEC51, 0xEC52, 0xEC53, 0, 0, 0xEC54, 0xEC55, 0, - 0, 0xEC56, 0x7340, 0x7341, 0xEC57, 0xEC58, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 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, 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, - 0, 0x734C, 0x734A, 0x4F3C, 0, 0x734B, 0xEC64, 0x4E6F, - 0xEC65, 0, 0, 0xEC66, 0, 0x734D, 0xEC67, 0x4E5B, - 0, 0, 0, 0, 0xEC68, 0x734E, 0x477E, 0, - 0xEC69, 0x734F, 0x7351, 0, 0xEC6A, 0x7352, 0xEC6B, 0xEC6C, - 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, - 0x7357, 0xF47E, 0x3975, 0, 0x7358, 0xEC74, 0, 0, - 0x6054, 0x4C5B, 0, 0x4263, 0x7359, 0x735B, 0x735A, 0xEC75, - 0x735C, 0, 0, 0, 0xEC76, 0x735D, 0, 0xEC77, - 0x735E, 0, 0, 0, 0xEC78, 0xEC79, 0xEC7A, 0x735F, - 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, - 0xED27, 0xED28, 0xED29, 0x385D, 0xED2A, 0x736A, 0xED2B, 0xED2C, - 0, 0xED2D, 0xED2E, 0xED2F, 0, 0, 0, 0xED30, - 0x414D, 0x736B, 0xED31, 0, 0, 0, 0xED32, 0, - 0, 0, 0xED33, 0xED34, 0x736C, 0, 0, 0xED35, - 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, - 0, 0, 0x736F, 0xED45, 0x7370, 0xED46, 0xED47, 0xED48, - 0xED49, 0, 0xED4A, 0, 0, 0xED4B, 0xED4C, 0x7372, - 0x7373, 0x7374, 0x4E70, 0x7371, 0, 0, 0x7375, 0x7376, - 0xED4D, 0xED4E, 0x7378, 0, 0x7377, 0xED4F, 0xED50, 0xED51, - 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, - 0xED59, 0xED5A, 0xED5B, 0, 0xED5C, 0x737C, 0xED5D, 0xED5E, - 0, 0, 0, 0, 0x737D, 0x6354, 0xED5F, 0, - 0x737E, 0xED60, 0xED61, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xF445, 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_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, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xF472, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_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, - 0xF438, 0xF43D, 0xF444, 0xF447, 0xF448, 0xF44E, 0xF44F, 0xF453, - 0xF455, 0xF456, 0xF457, 0xF458, 0xF45A, 0xF45B, 0xF45E, 0xF460, - 0xF462, 0xF463, 0xF465, 0xF469, 0xF46A, 0xF46B, 0xF46D, 0xF46F, - 0xF470, 0xF473, 0xF477, 0xF478, 0xF479, 0xF47D, 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_x0213[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0x2F4B, - 0x2F57, 0x4F72, 0, 0xAE79, 0x757A, 0x775A, 0x776F, 0, - 0, 0x793C, 0x793D, 0x7941, 0, 0, 0, 0x7B3A, - 0xF738, 0xF745, 0x7C2E, 0, 0xF96E, 0, 0x7C6A, 0, - 0, 0, 0, 0, 0, 0, 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, - 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_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, - 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377, - 0x2378, 0x2379, 0x237A, 0x2150, 0x2143, 0x2151, 0xA237, 0, - 0, 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_EFBD_ms[] = { - 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, 0x2141, 0, - 0, 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_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, - 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, - 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0E5C, 0x0E5D, 0x0E5E, 0x0E5F, - 0, 0, 0, 0, 0, 0, 0, 0, - 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_EFBF[] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0x2171, 0x2172, 0x224C, 0x2131, 0xA243, 0x216F, 0, 0, - 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_EFBF_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, 0x2131, 0, 0x216F, 0, 0, - 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_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, - utf8_to_euc_E288, utf8_to_euc_E289, utf8_to_euc_E28A, 0, - utf8_to_euc_E28C, 0, 0, 0, - 0, utf8_to_euc_E291, 0, 0, - utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297, - utf8_to_euc_E298, utf8_to_euc_E299, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_E2_ms[] = { - utf8_to_euc_E280_ms, 0, 0, 0, - utf8_to_euc_E284, utf8_to_euc_E285, utf8_to_euc_E286, utf8_to_euc_E287, - utf8_to_euc_E288, utf8_to_euc_E289, utf8_to_euc_E28A, 0, - utf8_to_euc_E28C, 0, 0, 0, - 0, utf8_to_euc_E291, 0, 0, - utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297, - utf8_to_euc_E298, utf8_to_euc_E299, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_E2_932[] = { - utf8_to_euc_E280_932, 0, 0, 0, - utf8_to_euc_E284, utf8_to_euc_E285, utf8_to_euc_E286, utf8_to_euc_E287, - utf8_to_euc_E288_932, utf8_to_euc_E289, utf8_to_euc_E28A, 0, - utf8_to_euc_E28C, 0, 0, 0, - 0, utf8_to_euc_E291, 0, 0, - utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297, - utf8_to_euc_E298, utf8_to_euc_E299, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_E2_mac[] = { - utf8_to_euc_E280_932, 0, 0, 0, - utf8_to_euc_E284_mac, utf8_to_euc_E285_mac, utf8_to_euc_E286, utf8_to_euc_E287, - utf8_to_euc_E288_mac, utf8_to_euc_E289, utf8_to_euc_E28A_mac, 0, - utf8_to_euc_E28C, 0, 0, 0, - 0, utf8_to_euc_E291_mac, 0, 0, - utf8_to_euc_E294, utf8_to_euc_E295, utf8_to_euc_E296, utf8_to_euc_E297, - utf8_to_euc_E298, utf8_to_euc_E299, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_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, - utf8_to_euc_E388, 0, utf8_to_euc_E38A, 0, - utf8_to_euc_E38C, utf8_to_euc_E38D, utf8_to_euc_E38E, utf8_to_euc_E38F, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_932[] = { - utf8_to_euc_E380_932, utf8_to_euc_E381, utf8_to_euc_E382_932, utf8_to_euc_E383, - 0, 0, 0, 0, - utf8_to_euc_E388, 0, utf8_to_euc_E38A, 0, - utf8_to_euc_E38C, utf8_to_euc_E38D, utf8_to_euc_E38E, utf8_to_euc_E38F, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_mac[] = { - utf8_to_euc_E380_932, utf8_to_euc_E381, utf8_to_euc_E382_932, utf8_to_euc_E383, - 0, 0, 0, 0, - utf8_to_euc_E388_mac, 0, utf8_to_euc_E38A_mac, 0, - utf8_to_euc_E38C_mac, utf8_to_euc_E38D_mac, utf8_to_euc_E38E_mac, utf8_to_euc_E38F_mac, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_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, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_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, - utf8_to_euc_E588, utf8_to_euc_E589, utf8_to_euc_E58A, utf8_to_euc_E58B, - utf8_to_euc_E58C, utf8_to_euc_E58D, utf8_to_euc_E58E, utf8_to_euc_E58F, - utf8_to_euc_E590, utf8_to_euc_E591, utf8_to_euc_E592, utf8_to_euc_E593, - utf8_to_euc_E594, utf8_to_euc_E595, utf8_to_euc_E596, utf8_to_euc_E597, - utf8_to_euc_E598, utf8_to_euc_E599, utf8_to_euc_E59A, utf8_to_euc_E59B, - utf8_to_euc_E59C, utf8_to_euc_E59D, utf8_to_euc_E59E, utf8_to_euc_E59F, - utf8_to_euc_E5A0, utf8_to_euc_E5A1, utf8_to_euc_E5A2, utf8_to_euc_E5A3, - utf8_to_euc_E5A4, utf8_to_euc_E5A5, utf8_to_euc_E5A6, utf8_to_euc_E5A7, - utf8_to_euc_E5A8, utf8_to_euc_E5A9, utf8_to_euc_E5AA, utf8_to_euc_E5AB, - utf8_to_euc_E5AC, utf8_to_euc_E5AD, utf8_to_euc_E5AE, utf8_to_euc_E5AF, - utf8_to_euc_E5B0, utf8_to_euc_E5B1, utf8_to_euc_E5B2, utf8_to_euc_E5B3, - utf8_to_euc_E5B4, utf8_to_euc_E5B5, utf8_to_euc_E5B6, utf8_to_euc_E5B7, - 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, - utf8_to_euc_E688, utf8_to_euc_E689, utf8_to_euc_E68A, utf8_to_euc_E68B, - utf8_to_euc_E68C, utf8_to_euc_E68D, utf8_to_euc_E68E, utf8_to_euc_E68F, - utf8_to_euc_E690, utf8_to_euc_E691, utf8_to_euc_E692, utf8_to_euc_E693, - utf8_to_euc_E694, utf8_to_euc_E695, utf8_to_euc_E696, utf8_to_euc_E697, - utf8_to_euc_E698, utf8_to_euc_E699, utf8_to_euc_E69A, utf8_to_euc_E69B, - utf8_to_euc_E69C, utf8_to_euc_E69D, utf8_to_euc_E69E, utf8_to_euc_E69F, - utf8_to_euc_E6A0, utf8_to_euc_E6A1, utf8_to_euc_E6A2, utf8_to_euc_E6A3, - utf8_to_euc_E6A4, utf8_to_euc_E6A5, utf8_to_euc_E6A6, utf8_to_euc_E6A7, - utf8_to_euc_E6A8, utf8_to_euc_E6A9, utf8_to_euc_E6AA, utf8_to_euc_E6AB, - utf8_to_euc_E6AC, utf8_to_euc_E6AD, utf8_to_euc_E6AE, utf8_to_euc_E6AF, - utf8_to_euc_E6B0, utf8_to_euc_E6B1, utf8_to_euc_E6B2, utf8_to_euc_E6B3, - utf8_to_euc_E6B4, utf8_to_euc_E6B5, utf8_to_euc_E6B6, utf8_to_euc_E6B7, - 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, - utf8_to_euc_E788, utf8_to_euc_E789, utf8_to_euc_E78A, utf8_to_euc_E78B, - utf8_to_euc_E78C, utf8_to_euc_E78D, utf8_to_euc_E78E, utf8_to_euc_E78F, - utf8_to_euc_E790, utf8_to_euc_E791, utf8_to_euc_E792, utf8_to_euc_E793, - utf8_to_euc_E794, utf8_to_euc_E795, utf8_to_euc_E796, utf8_to_euc_E797, - utf8_to_euc_E798, utf8_to_euc_E799, utf8_to_euc_E79A, utf8_to_euc_E79B, - utf8_to_euc_E79C, utf8_to_euc_E79D, utf8_to_euc_E79E, utf8_to_euc_E79F, - utf8_to_euc_E7A0, utf8_to_euc_E7A1, utf8_to_euc_E7A2, utf8_to_euc_E7A3, - utf8_to_euc_E7A4, utf8_to_euc_E7A5, utf8_to_euc_E7A6, utf8_to_euc_E7A7, - utf8_to_euc_E7A8, utf8_to_euc_E7A9, utf8_to_euc_E7AA, utf8_to_euc_E7AB, - utf8_to_euc_E7AC, utf8_to_euc_E7AD, utf8_to_euc_E7AE, utf8_to_euc_E7AF, - utf8_to_euc_E7B0, utf8_to_euc_E7B1, utf8_to_euc_E7B2, utf8_to_euc_E7B3, - utf8_to_euc_E7B4, utf8_to_euc_E7B5, utf8_to_euc_E7B6, utf8_to_euc_E7B7, - 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, - utf8_to_euc_E888, utf8_to_euc_E889, utf8_to_euc_E88A, utf8_to_euc_E88B, - utf8_to_euc_E88C, utf8_to_euc_E88D, utf8_to_euc_E88E, utf8_to_euc_E88F, - utf8_to_euc_E890, utf8_to_euc_E891, utf8_to_euc_E892, utf8_to_euc_E893, - utf8_to_euc_E894, utf8_to_euc_E895, utf8_to_euc_E896, utf8_to_euc_E897, - utf8_to_euc_E898, utf8_to_euc_E899, utf8_to_euc_E89A, utf8_to_euc_E89B, - utf8_to_euc_E89C, utf8_to_euc_E89D, utf8_to_euc_E89E, utf8_to_euc_E89F, - utf8_to_euc_E8A0, utf8_to_euc_E8A1, utf8_to_euc_E8A2, utf8_to_euc_E8A3, - utf8_to_euc_E8A4, utf8_to_euc_E8A5, utf8_to_euc_E8A6, utf8_to_euc_E8A7, - utf8_to_euc_E8A8, utf8_to_euc_E8A9, utf8_to_euc_E8AA, utf8_to_euc_E8AB, - utf8_to_euc_E8AC, utf8_to_euc_E8AD, utf8_to_euc_E8AE, 0, - utf8_to_euc_E8B0, utf8_to_euc_E8B1, utf8_to_euc_E8B2, utf8_to_euc_E8B3, - utf8_to_euc_E8B4, utf8_to_euc_E8B5, utf8_to_euc_E8B6, utf8_to_euc_E8B7, - 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, - utf8_to_euc_E988, utf8_to_euc_E989, utf8_to_euc_E98A, utf8_to_euc_E98B, - utf8_to_euc_E98C, utf8_to_euc_E98D, utf8_to_euc_E98E, utf8_to_euc_E98F, - utf8_to_euc_E990, utf8_to_euc_E991, utf8_to_euc_E992, 0, - 0, utf8_to_euc_E995, utf8_to_euc_E996, utf8_to_euc_E997, - utf8_to_euc_E998, utf8_to_euc_E999, utf8_to_euc_E99A, utf8_to_euc_E99B, - utf8_to_euc_E99C, utf8_to_euc_E99D, utf8_to_euc_E99E, utf8_to_euc_E99F, - utf8_to_euc_E9A0, utf8_to_euc_E9A1, utf8_to_euc_E9A2, utf8_to_euc_E9A3, - utf8_to_euc_E9A4, utf8_to_euc_E9A5, utf8_to_euc_E9A6, utf8_to_euc_E9A7, - utf8_to_euc_E9A8, utf8_to_euc_E9A9, utf8_to_euc_E9AA, utf8_to_euc_E9AB, - utf8_to_euc_E9AC, utf8_to_euc_E9AD, utf8_to_euc_E9AE, utf8_to_euc_E9AF, - utf8_to_euc_E9B0, utf8_to_euc_E9B1, 0, utf8_to_euc_E9B3, - utf8_to_euc_E9B4, utf8_to_euc_E9B5, utf8_to_euc_E9B6, utf8_to_euc_E9B7, - 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, - 0, 0, 0, 0, - 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, 0, 0, utf8_to_euc_EFA7, - utf8_to_euc_EFA8, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - utf8_to_euc_EFBC, utf8_to_euc_EFBD, utf8_to_euc_EFBE, utf8_to_euc_EFBF, -}; -static const unsigned short *const utf8_to_euc_EF_ms[] = { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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, 0, 0, utf8_to_euc_EFA7, - utf8_to_euc_EFA8, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 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_x0213, -}; -const unsigned short *const utf8_to_euc_2bytes[] = { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 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, utf8_to_euc_C3, - utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7, - 0, 0, 0, utf8_to_euc_CB, - 0, 0, utf8_to_euc_CE, utf8_to_euc_CF, - 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 utf8_to_euc_2bytes_ms[] = { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 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_ms, utf8_to_euc_C3, - utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7, - 0, 0, 0, utf8_to_euc_CB, - 0, 0, utf8_to_euc_CE, utf8_to_euc_CF, - 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 utf8_to_euc_2bytes_932[] = { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 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_932, utf8_to_euc_C3_932, - utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7, - 0, 0, 0, utf8_to_euc_CB, - 0, 0, utf8_to_euc_CE, utf8_to_euc_CF, - 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 utf8_to_euc_2bytes_mac[] = { - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 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_mac, utf8_to_euc_C3, - utf8_to_euc_C4, utf8_to_euc_C5, 0, utf8_to_euc_C7, - 0, 0, 0, utf8_to_euc_CB, - 0, 0, utf8_to_euc_CE, utf8_to_euc_CF, - 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 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, - utf8_to_euc_E8, utf8_to_euc_E9, 0, 0, - 0, 0, 0, utf8_to_euc_EF, -}; -const unsigned short *const *const utf8_to_euc_3bytes_ms[] = { - 0, 0, utf8_to_euc_E2_ms, utf8_to_euc_E3, - utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7, - 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_932[] = { - 0, 0, utf8_to_euc_E2_932, utf8_to_euc_E3_932, - utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7, - 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_mac[] = { - 0, 0, utf8_to_euc_E2_mac, utf8_to_euc_E3_mac, - utf8_to_euc_E4, utf8_to_euc_E5, utf8_to_euc_E6, utf8_to_euc_E7, - 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 - -/* Normalization Table by Apple */ -/* http://developer.apple.com/technotes/tn/tn1150table.html */ - -const struct normalization_pair normalization_table[] = { - {{0xcd,0xbe}, {0x3b}}, - {{0xc3,0x80}, {0x41,0xcc,0x80,0x00}}, - {{0xc3,0x81}, {0x41,0xcc,0x81}}, - {{0xc3,0x82}, {0x41,0xcc,0x82}}, - {{0xe1,0xba,0xa6}, {0x41,0xcc,0x82,0xcc,0x80}}, - {{0xe1,0xba,0xa4}, {0x41,0xcc,0x82,0xcc,0x81}}, - {{0xe1,0xba,0xaa}, {0x41,0xcc,0x82,0xcc,0x83}}, - {{0xe1,0xba,0xa8}, {0x41,0xcc,0x82,0xcc,0x89}}, - {{0xc3,0x83}, {0x41,0xcc,0x83}}, - {{0xc4,0x80}, {0x41,0xcc,0x84}}, - {{0xc4,0x82}, {0x41,0xcc,0x86}}, - {{0xe1,0xba,0xb0}, {0x41,0xcc,0x86,0xcc,0x80}}, - {{0xe1,0xba,0xae}, {0x41,0xcc,0x86,0xcc,0x81}}, - {{0xe1,0xba,0xb4}, {0x41,0xcc,0x86,0xcc,0x83}}, - {{0xe1,0xba,0xb2}, {0x41,0xcc,0x86,0xcc,0x89}}, - {{0xc7,0xa0}, {0x41,0xcc,0x87,0xcc,0x84}}, - {{0xc3,0x84}, {0x41,0xcc,0x88}}, - {{0xc7,0x9e}, {0x41,0xcc,0x88,0xcc,0x84}}, - {{0xe1,0xba,0xa2}, {0x41,0xcc,0x89}}, - {{0xc3,0x85}, {0x41,0xcc,0x8a}}, - {{0xc7,0xba}, {0x41,0xcc,0x8a,0xcc,0x81}}, - {{0xc7,0x8d}, {0x41,0xcc,0x8c}}, - {{0xc8,0x80}, {0x41,0xcc,0x8f}}, - {{0xc8,0x82}, {0x41,0xcc,0x91}}, - {{0xe1,0xba,0xa0}, {0x41,0xcc,0xa3}}, - {{0xe1,0xba,0xac}, {0x41,0xcc,0xa3,0xcc,0x82}}, - {{0xe1,0xba,0xb6}, {0x41,0xcc,0xa3,0xcc,0x86}}, - {{0xe1,0xb8,0x80}, {0x41,0xcc,0xa5}}, - {{0xc4,0x84}, {0x41,0xcc,0xa8}}, - {{0xe1,0xb8,0x82}, {0x42,0xcc,0x87}}, - {{0xe1,0xb8,0x84}, {0x42,0xcc,0xa3}}, - {{0xe1,0xb8,0x86}, {0x42,0xcc,0xb1}}, - {{0xc4,0x86}, {0x43,0xcc,0x81}}, - {{0xc4,0x88}, {0x43,0xcc,0x82}}, - {{0xc4,0x8a}, {0x43,0xcc,0x87}}, - {{0xc4,0x8c}, {0x43,0xcc,0x8c}}, - {{0xc3,0x87}, {0x43,0xcc,0xa7}}, - {{0xe1,0xb8,0x88}, {0x43,0xcc,0xa7,0xcc,0x81}}, - {{0xe1,0xb8,0x8a}, {0x44,0xcc,0x87}}, - {{0xc4,0x8e}, {0x44,0xcc,0x8c}}, - {{0xe1,0xb8,0x8c}, {0x44,0xcc,0xa3}}, - {{0xe1,0xb8,0x90}, {0x44,0xcc,0xa7}}, - {{0xe1,0xb8,0x92}, {0x44,0xcc,0xad}}, - {{0xe1,0xb8,0x8e}, {0x44,0xcc,0xb1}}, - {{0xc3,0x88}, {0x45,0xcc,0x80}}, - {{0xc3,0x89}, {0x45,0xcc,0x81}}, - {{0xc3,0x8a}, {0x45,0xcc,0x82}}, - {{0xe1,0xbb,0x80}, {0x45,0xcc,0x82,0xcc,0x80}}, - {{0xe1,0xba,0xbe}, {0x45,0xcc,0x82,0xcc,0x81}}, - {{0xe1,0xbb,0x84}, {0x45,0xcc,0x82,0xcc,0x83}}, - {{0xe1,0xbb,0x82}, {0x45,0xcc,0x82,0xcc,0x89}}, - {{0xe1,0xba,0xbc}, {0x45,0xcc,0x83}}, - {{0xc4,0x92}, {0x45,0xcc,0x84}}, - {{0xe1,0xb8,0x94}, {0x45,0xcc,0x84,0xcc,0x80}}, - {{0xe1,0xb8,0x96}, {0x45,0xcc,0x84,0xcc,0x81}}, - {{0xc4,0x94}, {0x45,0xcc,0x86}}, - {{0xc4,0x96}, {0x45,0xcc,0x87}}, - {{0xc3,0x8b}, {0x45,0xcc,0x88}}, - {{0xe1,0xba,0xba}, {0x45,0xcc,0x89}}, - {{0xc4,0x9a}, {0x45,0xcc,0x8c}}, - {{0xc8,0x84}, {0x45,0xcc,0x8f}}, - {{0xc8,0x86}, {0x45,0xcc,0x91}}, - {{0xe1,0xba,0xb8}, {0x45,0xcc,0xa3}}, - {{0xe1,0xbb,0x86}, {0x45,0xcc,0xa3,0xcc,0x82}}, - {{0xe1,0xb8,0x9c}, {0x45,0xcc,0xa7,0xcc,0x86}}, - {{0xc4,0x98}, {0x45,0xcc,0xa8}}, - {{0xe1,0xb8,0x98}, {0x45,0xcc,0xad}}, - {{0xe1,0xb8,0x9a}, {0x45,0xcc,0xb0}}, - {{0xe1,0xb8,0x9e}, {0x46,0xcc,0x87}}, - {{0xc7,0xb4}, {0x47,0xcc,0x81}}, - {{0xc4,0x9c}, {0x47,0xcc,0x82}}, - {{0xe1,0xb8,0xa0}, {0x47,0xcc,0x84}}, - {{0xc4,0x9e}, {0x47,0xcc,0x86}}, - {{0xc4,0xa0}, {0x47,0xcc,0x87}}, - {{0xc7,0xa6}, {0x47,0xcc,0x8c}}, - {{0xc4,0xa2}, {0x47,0xcc,0xa7}}, - {{0xc4,0xa4}, {0x48,0xcc,0x82}}, - {{0xe1,0xb8,0xa2}, {0x48,0xcc,0x87}}, - {{0xe1,0xb8,0xa6}, {0x48,0xcc,0x88}}, - {{0xe1,0xb8,0xa4}, {0x48,0xcc,0xa3}}, - {{0xe1,0xb8,0xa8}, {0x48,0xcc,0xa7}}, - {{0xe1,0xb8,0xaa}, {0x48,0xcc,0xae}}, - {{0xc3,0x8c}, {0x49,0xcc,0x80}}, - {{0xc3,0x8d}, {0x49,0xcc,0x81}}, - {{0xc3,0x8e}, {0x49,0xcc,0x82}}, - {{0xc4,0xa8}, {0x49,0xcc,0x83}}, - {{0xc4,0xaa}, {0x49,0xcc,0x84}}, - {{0xc4,0xac}, {0x49,0xcc,0x86}}, - {{0xc4,0xb0}, {0x49,0xcc,0x87}}, - {{0xc3,0x8f}, {0x49,0xcc,0x88}}, - {{0xe1,0xb8,0xae}, {0x49,0xcc,0x88,0xcc,0x81}}, - {{0xe1,0xbb,0x88}, {0x49,0xcc,0x89}}, - {{0xc7,0x8f}, {0x49,0xcc,0x8c}}, - {{0xc8,0x88}, {0x49,0xcc,0x8f}}, - {{0xc8,0x8a}, {0x49,0xcc,0x91}}, - {{0xe1,0xbb,0x8a}, {0x49,0xcc,0xa3}}, - {{0xc4,0xae}, {0x49,0xcc,0xa8}}, - {{0xe1,0xb8,0xac}, {0x49,0xcc,0xb0}}, - {{0xc4,0xb4}, {0x4a,0xcc,0x82}}, - {{0xe1,0xb8,0xb0}, {0x4b,0xcc,0x81}}, - {{0xc7,0xa8}, {0x4b,0xcc,0x8c}}, - {{0xe1,0xb8,0xb2}, {0x4b,0xcc,0xa3}}, - {{0xc4,0xb6}, {0x4b,0xcc,0xa7}}, - {{0xe1,0xb8,0xb4}, {0x4b,0xcc,0xb1}}, - {{0xc4,0xb9}, {0x4c,0xcc,0x81}}, - {{0xc4,0xbd}, {0x4c,0xcc,0x8c}}, - {{0xe1,0xb8,0xb6}, {0x4c,0xcc,0xa3}}, - {{0xe1,0xb8,0xb8}, {0x4c,0xcc,0xa3,0xcc,0x84}}, - {{0xc4,0xbb}, {0x4c,0xcc,0xa7}}, - {{0xe1,0xb8,0xbc}, {0x4c,0xcc,0xad}}, - {{0xe1,0xb8,0xba}, {0x4c,0xcc,0xb1}}, - {{0xe1,0xb8,0xbe}, {0x4d,0xcc,0x81}}, - {{0xe1,0xb9,0x80}, {0x4d,0xcc,0x87}}, - {{0xe1,0xb9,0x82}, {0x4d,0xcc,0xa3}}, - {{0xc5,0x83}, {0x4e,0xcc,0x81}}, - {{0xc3,0x91}, {0x4e,0xcc,0x83}}, - {{0xe1,0xb9,0x84}, {0x4e,0xcc,0x87}}, - {{0xc5,0x87}, {0x4e,0xcc,0x8c}}, - {{0xe1,0xb9,0x86}, {0x4e,0xcc,0xa3}}, - {{0xc5,0x85}, {0x4e,0xcc,0xa7}}, - {{0xe1,0xb9,0x8a}, {0x4e,0xcc,0xad}}, - {{0xe1,0xb9,0x88}, {0x4e,0xcc,0xb1}}, - {{0xc3,0x92}, {0x4f,0xcc,0x80}}, - {{0xc3,0x93}, {0x4f,0xcc,0x81}}, - {{0xc3,0x94}, {0x4f,0xcc,0x82}}, - {{0xe1,0xbb,0x92}, {0x4f,0xcc,0x82,0xcc,0x80}}, - {{0xe1,0xbb,0x90}, {0x4f,0xcc,0x82,0xcc,0x81}}, - {{0xe1,0xbb,0x96}, {0x4f,0xcc,0x82,0xcc,0x83}}, - {{0xe1,0xbb,0x94}, {0x4f,0xcc,0x82,0xcc,0x89}}, - {{0xc3,0x95}, {0x4f,0xcc,0x83}}, - {{0xe1,0xb9,0x8c}, {0x4f,0xcc,0x83,0xcc,0x81}}, - {{0xe1,0xb9,0x8e}, {0x4f,0xcc,0x83,0xcc,0x88}}, - {{0xc5,0x8c}, {0x4f,0xcc,0x84}}, - {{0xe1,0xb9,0x90}, {0x4f,0xcc,0x84,0xcc,0x80}}, - {{0xe1,0xb9,0x92}, {0x4f,0xcc,0x84,0xcc,0x81}}, - {{0xc5,0x8e}, {0x4f,0xcc,0x86}}, - {{0xc3,0x96}, {0x4f,0xcc,0x88}}, - {{0xe1,0xbb,0x8e}, {0x4f,0xcc,0x89}}, - {{0xc5,0x90}, {0x4f,0xcc,0x8b}}, - {{0xc7,0x91}, {0x4f,0xcc,0x8c}}, - {{0xc8,0x8c}, {0x4f,0xcc,0x8f}}, - {{0xc8,0x8e}, {0x4f,0xcc,0x91}}, - {{0xc6,0xa0}, {0x4f,0xcc,0x9b}}, - {{0xe1,0xbb,0x9c}, {0x4f,0xcc,0x9b,0xcc,0x80}}, - {{0xe1,0xbb,0x9a}, {0x4f,0xcc,0x9b,0xcc,0x81}}, - {{0xe1,0xbb,0xa0}, {0x4f,0xcc,0x9b,0xcc,0x83}}, - {{0xe1,0xbb,0x9e}, {0x4f,0xcc,0x9b,0xcc,0x89}}, - {{0xe1,0xbb,0xa2}, {0x4f,0xcc,0x9b,0xcc,0xa3}}, - {{0xe1,0xbb,0x8c}, {0x4f,0xcc,0xa3}}, - {{0xe1,0xbb,0x98}, {0x4f,0xcc,0xa3,0xcc,0x82}}, - {{0xc7,0xaa}, {0x4f,0xcc,0xa8}}, - {{0xc7,0xac}, {0x4f,0xcc,0xa8,0xcc,0x84}}, - {{0xe1,0xb9,0x94}, {0x50,0xcc,0x81}}, - {{0xe1,0xb9,0x96}, {0x50,0xcc,0x87}}, - {{0xc5,0x94}, {0x52,0xcc,0x81}}, - {{0xe1,0xb9,0x98}, {0x52,0xcc,0x87}}, - {{0xc5,0x98}, {0x52,0xcc,0x8c}}, - {{0xc8,0x90}, {0x52,0xcc,0x8f}}, - {{0xc8,0x92}, {0x52,0xcc,0x91}}, - {{0xe1,0xb9,0x9a}, {0x52,0xcc,0xa3}}, - {{0xe1,0xb9,0x9c}, {0x52,0xcc,0xa3,0xcc,0x84}}, - {{0xc5,0x96}, {0x52,0xcc,0xa7}}, - {{0xe1,0xb9,0x9e}, {0x52,0xcc,0xb1}}, - {{0xc5,0x9a}, {0x53,0xcc,0x81}}, - {{0xe1,0xb9,0xa4}, {0x53,0xcc,0x81,0xcc,0x87}}, - {{0xc5,0x9c}, {0x53,0xcc,0x82}}, - {{0xe1,0xb9,0xa0}, {0x53,0xcc,0x87}}, - {{0xc5,0xa0}, {0x53,0xcc,0x8c}}, - {{0xe1,0xb9,0xa6}, {0x53,0xcc,0x8c,0xcc,0x87}}, - {{0xe1,0xb9,0xa2}, {0x53,0xcc,0xa3}}, - {{0xe1,0xb9,0xa8}, {0x53,0xcc,0xa3,0xcc,0x87}}, - {{0xc5,0x9e}, {0x53,0xcc,0xa7}}, - {{0xe1,0xb9,0xaa}, {0x54,0xcc,0x87}}, - {{0xc5,0xa4}, {0x54,0xcc,0x8c}}, - {{0xe1,0xb9,0xac}, {0x54,0xcc,0xa3}}, - {{0xc5,0xa2}, {0x54,0xcc,0xa7}}, - {{0xe1,0xb9,0xb0}, {0x54,0xcc,0xad}}, - {{0xe1,0xb9,0xae}, {0x54,0xcc,0xb1}}, - {{0xc3,0x99}, {0x55,0xcc,0x80}}, - {{0xc3,0x9a}, {0x55,0xcc,0x81}}, - {{0xc3,0x9b}, {0x55,0xcc,0x82}}, - {{0xc5,0xa8}, {0x55,0xcc,0x83}}, - {{0xe1,0xb9,0xb8}, {0x55,0xcc,0x83,0xcc,0x81}}, - {{0xc5,0xaa}, {0x55,0xcc,0x84}}, - {{0xe1,0xb9,0xba}, {0x55,0xcc,0x84,0xcc,0x88}}, - {{0xc5,0xac}, {0x55,0xcc,0x86}}, - {{0xc3,0x9c}, {0x55,0xcc,0x88}}, - {{0xc7,0x9b}, {0x55,0xcc,0x88,0xcc,0x80}}, - {{0xc7,0x97}, {0x55,0xcc,0x88,0xcc,0x81}}, - {{0xc7,0x95}, {0x55,0xcc,0x88,0xcc,0x84}}, - {{0xc7,0x99}, {0x55,0xcc,0x88,0xcc,0x8c}}, - {{0xe1,0xbb,0xa6}, {0x55,0xcc,0x89}}, - {{0xc5,0xae}, {0x55,0xcc,0x8a}}, - {{0xc5,0xb0}, {0x55,0xcc,0x8b}}, - {{0xc7,0x93}, {0x55,0xcc,0x8c}}, - {{0xc8,0x94}, {0x55,0xcc,0x8f}}, - {{0xc8,0x96}, {0x55,0xcc,0x91}}, - {{0xc6,0xaf}, {0x55,0xcc,0x9b}}, - {{0xe1,0xbb,0xaa}, {0x55,0xcc,0x9b,0xcc,0x80}}, - {{0xe1,0xbb,0xa8}, {0x55,0xcc,0x9b,0xcc,0x81}}, - {{0xe1,0xbb,0xae}, {0x55,0xcc,0x9b,0xcc,0x83}}, - {{0xe1,0xbb,0xac}, {0x55,0xcc,0x9b,0xcc,0x89}}, - {{0xe1,0xbb,0xb0}, {0x55,0xcc,0x9b,0xcc,0xa3}}, - {{0xe1,0xbb,0xa4}, {0x55,0xcc,0xa3}}, - {{0xe1,0xb9,0xb2}, {0x55,0xcc,0xa4}}, - {{0xc5,0xb2}, {0x55,0xcc,0xa8}}, - {{0xe1,0xb9,0xb6}, {0x55,0xcc,0xad}}, - {{0xe1,0xb9,0xb4}, {0x55,0xcc,0xb0}}, - {{0xe1,0xb9,0xbc}, {0x56,0xcc,0x83}}, - {{0xe1,0xb9,0xbe}, {0x56,0xcc,0xa3}}, - {{0xe1,0xba,0x80}, {0x57,0xcc,0x80}}, - {{0xe1,0xba,0x82}, {0x57,0xcc,0x81}}, - {{0xc5,0xb4}, {0x57,0xcc,0x82}}, - {{0xe1,0xba,0x86}, {0x57,0xcc,0x87}}, - {{0xe1,0xba,0x84}, {0x57,0xcc,0x88}}, - {{0xe1,0xba,0x88}, {0x57,0xcc,0xa3}}, - {{0xe1,0xba,0x8a}, {0x58,0xcc,0x87}}, - {{0xe1,0xba,0x8c}, {0x58,0xcc,0x88}}, - {{0xe1,0xbb,0xb2}, {0x59,0xcc,0x80}}, - {{0xc3,0x9d}, {0x59,0xcc,0x81}}, - {{0xc5,0xb6}, {0x59,0xcc,0x82}}, - {{0xe1,0xbb,0xb8}, {0x59,0xcc,0x83}}, - {{0xe1,0xba,0x8e}, {0x59,0xcc,0x87}}, - {{0xc5,0xb8}, {0x59,0xcc,0x88}}, - {{0xe1,0xbb,0xb6}, {0x59,0xcc,0x89}}, - {{0xe1,0xbb,0xb4}, {0x59,0xcc,0xa3}}, - {{0xc5,0xb9}, {0x5a,0xcc,0x81}}, - {{0xe1,0xba,0x90}, {0x5a,0xcc,0x82}}, - {{0xc5,0xbb}, {0x5a,0xcc,0x87}}, - {{0xc5,0xbd}, {0x5a,0xcc,0x8c}}, - {{0xe1,0xba,0x92}, {0x5a,0xcc,0xa3}}, - {{0xe1,0xba,0x94}, {0x5a,0xcc,0xb1}}, - {{0xe1,0xbf,0xaf}, {0x60}}, - {{0xc3,0xa0}, {0x61,0xcc,0x80}}, - {{0xc3,0xa1}, {0x61,0xcc,0x81}}, - {{0xc3,0xa2}, {0x61,0xcc,0x82}}, - {{0xe1,0xba,0xa7}, {0x61,0xcc,0x82,0xcc,0x80}}, - {{0xe1,0xba,0xa5}, {0x61,0xcc,0x82,0xcc,0x81}}, - {{0xe1,0xba,0xab}, {0x61,0xcc,0x82,0xcc,0x83}}, - {{0xe1,0xba,0xa9}, {0x61,0xcc,0x82,0xcc,0x89}}, - {{0xc3,0xa3}, {0x61,0xcc,0x83}}, - {{0xc4,0x81}, {0x61,0xcc,0x84}}, - {{0xc4,0x83}, {0x61,0xcc,0x86}}, - {{0xe1,0xba,0xb1}, {0x61,0xcc,0x86,0xcc,0x80}}, - {{0xe1,0xba,0xaf}, {0x61,0xcc,0x86,0xcc,0x81}}, - {{0xe1,0xba,0xb5}, {0x61,0xcc,0x86,0xcc,0x83}}, - {{0xe1,0xba,0xb3}, {0x61,0xcc,0x86,0xcc,0x89}}, - {{0xc7,0xa1}, {0x61,0xcc,0x87,0xcc,0x84}}, - {{0xc3,0xa4}, {0x61,0xcc,0x88}}, - {{0xc7,0x9f}, {0x61,0xcc,0x88,0xcc,0x84}}, - {{0xe1,0xba,0xa3}, {0x61,0xcc,0x89}}, - {{0xc3,0xa5}, {0x61,0xcc,0x8a}}, - {{0xc7,0xbb}, {0x61,0xcc,0x8a,0xcc,0x81}}, - {{0xc7,0x8e}, {0x61,0xcc,0x8c}}, - {{0xc8,0x81}, {0x61,0xcc,0x8f}}, - {{0xc8,0x83}, {0x61,0xcc,0x91}}, - {{0xe1,0xba,0xa1}, {0x61,0xcc,0xa3}}, - {{0xe1,0xba,0xad}, {0x61,0xcc,0xa3,0xcc,0x82}}, - {{0xe1,0xba,0xb7}, {0x61,0xcc,0xa3,0xcc,0x86}}, - {{0xe1,0xb8,0x81}, {0x61,0xcc,0xa5}}, - {{0xc4,0x85}, {0x61,0xcc,0xa8}}, - {{0xe1,0xb8,0x83}, {0x62,0xcc,0x87}}, - {{0xe1,0xb8,0x85}, {0x62,0xcc,0xa3}}, - {{0xe1,0xb8,0x87}, {0x62,0xcc,0xb1}}, - {{0xc4,0x87}, {0x63,0xcc,0x81}}, - {{0xc4,0x89}, {0x63,0xcc,0x82}}, - {{0xc4,0x8b}, {0x63,0xcc,0x87}}, - {{0xc4,0x8d}, {0x63,0xcc,0x8c}}, - {{0xc3,0xa7}, {0x63,0xcc,0xa7}}, - {{0xe1,0xb8,0x89}, {0x63,0xcc,0xa7,0xcc,0x81}}, - {{0xe1,0xb8,0x8b}, {0x64,0xcc,0x87}}, - {{0xc4,0x8f}, {0x64,0xcc,0x8c}}, - {{0xe1,0xb8,0x8d}, {0x64,0xcc,0xa3}}, - {{0xe1,0xb8,0x91}, {0x64,0xcc,0xa7}}, - {{0xe1,0xb8,0x93}, {0x64,0xcc,0xad}}, - {{0xe1,0xb8,0x8f}, {0x64,0xcc,0xb1}}, - {{0xc3,0xa8}, {0x65,0xcc,0x80}}, - {{0xc3,0xa9}, {0x65,0xcc,0x81}}, - {{0xc3,0xaa}, {0x65,0xcc,0x82}}, - {{0xe1,0xbb,0x81}, {0x65,0xcc,0x82,0xcc,0x80}}, - {{0xe1,0xba,0xbf}, {0x65,0xcc,0x82,0xcc,0x81}}, - {{0xe1,0xbb,0x85}, {0x65,0xcc,0x82,0xcc,0x83}}, - {{0xe1,0xbb,0x83}, {0x65,0xcc,0x82,0xcc,0x89}}, - {{0xe1,0xba,0xbd}, {0x65,0xcc,0x83}}, - {{0xc4,0x93}, {0x65,0xcc,0x84}}, - {{0xe1,0xb8,0x95}, {0x65,0xcc,0x84,0xcc,0x80}}, - {{0xe1,0xb8,0x97}, {0x65,0xcc,0x84,0xcc,0x81}}, - {{0xc4,0x95}, {0x65,0xcc,0x86}}, - {{0xc4,0x97}, {0x65,0xcc,0x87}}, - {{0xc3,0xab}, {0x65,0xcc,0x88}}, - {{0xe1,0xba,0xbb}, {0x65,0xcc,0x89}}, - {{0xc4,0x9b}, {0x65,0xcc,0x8c}}, - {{0xc8,0x85}, {0x65,0xcc,0x8f}}, - {{0xc8,0x87}, {0x65,0xcc,0x91}}, - {{0xe1,0xba,0xb9}, {0x65,0xcc,0xa3}}, - {{0xe1,0xbb,0x87}, {0x65,0xcc,0xa3,0xcc,0x82}}, - {{0xe1,0xb8,0x9d}, {0x65,0xcc,0xa7,0xcc,0x86}}, - {{0xc4,0x99}, {0x65,0xcc,0xa8}}, - {{0xe1,0xb8,0x99}, {0x65,0xcc,0xad}}, - {{0xe1,0xb8,0x9b}, {0x65,0xcc,0xb0}}, - {{0xe1,0xb8,0x9f}, {0x66,0xcc,0x87}}, - {{0xc7,0xb5}, {0x67,0xcc,0x81}}, - {{0xc4,0x9d}, {0x67,0xcc,0x82}}, - {{0xe1,0xb8,0xa1}, {0x67,0xcc,0x84}}, - {{0xc4,0x9f}, {0x67,0xcc,0x86}}, - {{0xc4,0xa1}, {0x67,0xcc,0x87}}, - {{0xc7,0xa7}, {0x67,0xcc,0x8c}}, - {{0xc4,0xa3}, {0x67,0xcc,0xa7}}, - {{0xc4,0xa5}, {0x68,0xcc,0x82}}, - {{0xe1,0xb8,0xa3}, {0x68,0xcc,0x87}}, - {{0xe1,0xb8,0xa7}, {0x68,0xcc,0x88}}, - {{0xe1,0xb8,0xa5}, {0x68,0xcc,0xa3}}, - {{0xe1,0xb8,0xa9}, {0x68,0xcc,0xa7}}, - {{0xe1,0xb8,0xab}, {0x68,0xcc,0xae}}, - {{0xe1,0xba,0x96}, {0x68,0xcc,0xb1}}, - {{0xc3,0xac}, {0x69,0xcc,0x80}}, - {{0xc3,0xad}, {0x69,0xcc,0x81}}, - {{0xc3,0xae}, {0x69,0xcc,0x82}}, - {{0xc4,0xa9}, {0x69,0xcc,0x83}}, - {{0xc4,0xab}, {0x69,0xcc,0x84}}, - {{0xc4,0xad}, {0x69,0xcc,0x86}}, - {{0xc3,0xaf}, {0x69,0xcc,0x88}}, - {{0xe1,0xb8,0xaf}, {0x69,0xcc,0x88,0xcc,0x81}}, - {{0xe1,0xbb,0x89}, {0x69,0xcc,0x89}}, - {{0xc7,0x90}, {0x69,0xcc,0x8c}}, - {{0xc8,0x89}, {0x69,0xcc,0x8f}}, - {{0xc8,0x8b}, {0x69,0xcc,0x91}}, - {{0xe1,0xbb,0x8b}, {0x69,0xcc,0xa3}}, - {{0xc4,0xaf}, {0x69,0xcc,0xa8}}, - {{0xe1,0xb8,0xad}, {0x69,0xcc,0xb0}}, - {{0xc4,0xb5}, {0x6a,0xcc,0x82}}, - {{0xc7,0xb0}, {0x6a,0xcc,0x8c}}, - {{0xe1,0xb8,0xb1}, {0x6b,0xcc,0x81}}, - {{0xc7,0xa9}, {0x6b,0xcc,0x8c}}, - {{0xe1,0xb8,0xb3}, {0x6b,0xcc,0xa3}}, - {{0xc4,0xb7}, {0x6b,0xcc,0xa7}}, - {{0xe1,0xb8,0xb5}, {0x6b,0xcc,0xb1}}, - {{0xc4,0xba}, {0x6c,0xcc,0x81}}, - {{0xc4,0xbe}, {0x6c,0xcc,0x8c}}, - {{0xe1,0xb8,0xb7}, {0x6c,0xcc,0xa3}}, - {{0xe1,0xb8,0xb9}, {0x6c,0xcc,0xa3,0xcc,0x84}}, - {{0xc4,0xbc}, {0x6c,0xcc,0xa7}}, - {{0xe1,0xb8,0xbd}, {0x6c,0xcc,0xad}}, - {{0xe1,0xb8,0xbb}, {0x6c,0xcc,0xb1}}, - {{0xe1,0xb8,0xbf}, {0x6d,0xcc,0x81}}, - {{0xe1,0xb9,0x81}, {0x6d,0xcc,0x87}}, - {{0xe1,0xb9,0x83}, {0x6d,0xcc,0xa3}}, - {{0xc5,0x84}, {0x6e,0xcc,0x81}}, - {{0xc3,0xb1}, {0x6e,0xcc,0x83}}, - {{0xe1,0xb9,0x85}, {0x6e,0xcc,0x87}}, - {{0xc5,0x88}, {0x6e,0xcc,0x8c}}, - {{0xe1,0xb9,0x87}, {0x6e,0xcc,0xa3}}, - {{0xc5,0x86}, {0x6e,0xcc,0xa7}}, - {{0xe1,0xb9,0x8b}, {0x6e,0xcc,0xad}}, - {{0xe1,0xb9,0x89}, {0x6e,0xcc,0xb1}}, - {{0xc3,0xb2}, {0x6f,0xcc,0x80}}, - {{0xc3,0xb3}, {0x6f,0xcc,0x81}}, - {{0xc3,0xb4}, {0x6f,0xcc,0x82}}, - {{0xe1,0xbb,0x93}, {0x6f,0xcc,0x82,0xcc,0x80}}, - {{0xe1,0xbb,0x91}, {0x6f,0xcc,0x82,0xcc,0x81}}, - {{0xe1,0xbb,0x97}, {0x6f,0xcc,0x82,0xcc,0x83}}, - {{0xe1,0xbb,0x95}, {0x6f,0xcc,0x82,0xcc,0x89}}, - {{0xc3,0xb5}, {0x6f,0xcc,0x83}}, - {{0xe1,0xb9,0x8d}, {0x6f,0xcc,0x83,0xcc,0x81}}, - {{0xe1,0xb9,0x8f}, {0x6f,0xcc,0x83,0xcc,0x88}}, - {{0xc5,0x8d}, {0x6f,0xcc,0x84}}, - {{0xe1,0xb9,0x91}, {0x6f,0xcc,0x84,0xcc,0x80}}, - {{0xe1,0xb9,0x93}, {0x6f,0xcc,0x84,0xcc,0x81}}, - {{0xc5,0x8f}, {0x6f,0xcc,0x86}}, - {{0xc3,0xb6}, {0x6f,0xcc,0x88}}, - {{0xe1,0xbb,0x8f}, {0x6f,0xcc,0x89}}, - {{0xc5,0x91}, {0x6f,0xcc,0x8b}}, - {{0xc7,0x92}, {0x6f,0xcc,0x8c}}, - {{0xc8,0x8d}, {0x6f,0xcc,0x8f}}, - {{0xc8,0x8f}, {0x6f,0xcc,0x91}}, - {{0xc6,0xa1}, {0x6f,0xcc,0x9b}}, - {{0xe1,0xbb,0x9d}, {0x6f,0xcc,0x9b,0xcc,0x80}}, - {{0xe1,0xbb,0x9b}, {0x6f,0xcc,0x9b,0xcc,0x81}}, - {{0xe1,0xbb,0xa1}, {0x6f,0xcc,0x9b,0xcc,0x83}}, - {{0xe1,0xbb,0x9f}, {0x6f,0xcc,0x9b,0xcc,0x89}}, - {{0xe1,0xbb,0xa3}, {0x6f,0xcc,0x9b,0xcc,0xa3}}, - {{0xe1,0xbb,0x8d}, {0x6f,0xcc,0xa3}}, - {{0xe1,0xbb,0x99}, {0x6f,0xcc,0xa3,0xcc,0x82}}, - {{0xc7,0xab}, {0x6f,0xcc,0xa8}}, - {{0xc7,0xad}, {0x6f,0xcc,0xa8,0xcc,0x84}}, - {{0xe1,0xb9,0x95}, {0x70,0xcc,0x81}}, - {{0xe1,0xb9,0x97}, {0x70,0xcc,0x87}}, - {{0xc5,0x95}, {0x72,0xcc,0x81}}, - {{0xe1,0xb9,0x99}, {0x72,0xcc,0x87}}, - {{0xc5,0x99}, {0x72,0xcc,0x8c}}, - {{0xc8,0x91}, {0x72,0xcc,0x8f}}, - {{0xc8,0x93}, {0x72,0xcc,0x91}}, - {{0xe1,0xb9,0x9b}, {0x72,0xcc,0xa3}}, - {{0xe1,0xb9,0x9d}, {0x72,0xcc,0xa3,0xcc,0x84}}, - {{0xc5,0x97}, {0x72,0xcc,0xa7}}, - {{0xe1,0xb9,0x9f}, {0x72,0xcc,0xb1}}, - {{0xc5,0x9b}, {0x73,0xcc,0x81}}, - {{0xe1,0xb9,0xa5}, {0x73,0xcc,0x81,0xcc,0x87}}, - {{0xc5,0x9d}, {0x73,0xcc,0x82}}, - {{0xe1,0xb9,0xa1}, {0x73,0xcc,0x87}}, - {{0xc5,0xa1}, {0x73,0xcc,0x8c}}, - {{0xe1,0xb9,0xa7}, {0x73,0xcc,0x8c,0xcc,0x87}}, - {{0xe1,0xb9,0xa3}, {0x73,0xcc,0xa3}}, - {{0xe1,0xb9,0xa9}, {0x73,0xcc,0xa3,0xcc,0x87}}, - {{0xc5,0x9f}, {0x73,0xcc,0xa7}}, - {{0xe1,0xb9,0xab}, {0x74,0xcc,0x87}}, - {{0xe1,0xba,0x97}, {0x74,0xcc,0x88}}, - {{0xc5,0xa5}, {0x74,0xcc,0x8c}}, - {{0xe1,0xb9,0xad}, {0x74,0xcc,0xa3}}, - {{0xc5,0xa3}, {0x74,0xcc,0xa7}}, - {{0xe1,0xb9,0xb1}, {0x74,0xcc,0xad}}, - {{0xe1,0xb9,0xaf}, {0x74,0xcc,0xb1}}, - {{0xc3,0xb9}, {0x75,0xcc,0x80}}, - {{0xc3,0xba}, {0x75,0xcc,0x81}}, - {{0xc3,0xbb}, {0x75,0xcc,0x82}}, - {{0xc5,0xa9}, {0x75,0xcc,0x83}}, - {{0xe1,0xb9,0xb9}, {0x75,0xcc,0x83,0xcc,0x81}}, - {{0xc5,0xab}, {0x75,0xcc,0x84}}, - {{0xe1,0xb9,0xbb}, {0x75,0xcc,0x84,0xcc,0x88}}, - {{0xc5,0xad}, {0x75,0xcc,0x86}}, - {{0xc3,0xbc}, {0x75,0xcc,0x88}}, - {{0xc7,0x9c}, {0x75,0xcc,0x88,0xcc,0x80}}, - {{0xc7,0x98}, {0x75,0xcc,0x88,0xcc,0x81}}, - {{0xc7,0x96}, {0x75,0xcc,0x88,0xcc,0x84}}, - {{0xc7,0x9a}, {0x75,0xcc,0x88,0xcc,0x8c}}, - {{0xe1,0xbb,0xa7}, {0x75,0xcc,0x89}}, - {{0xc5,0xaf}, {0x75,0xcc,0x8a}}, - {{0xc5,0xb1}, {0x75,0xcc,0x8b}}, - {{0xc7,0x94}, {0x75,0xcc,0x8c}}, - {{0xc8,0x95}, {0x75,0xcc,0x8f}}, - {{0xc8,0x97}, {0x75,0xcc,0x91}}, - {{0xc6,0xb0}, {0x75,0xcc,0x9b}}, - {{0xe1,0xbb,0xab}, {0x75,0xcc,0x9b,0xcc,0x80}}, - {{0xe1,0xbb,0xa9}, {0x75,0xcc,0x9b,0xcc,0x81}}, - {{0xe1,0xbb,0xaf}, {0x75,0xcc,0x9b,0xcc,0x83}}, - {{0xe1,0xbb,0xad}, {0x75,0xcc,0x9b,0xcc,0x89}}, - {{0xe1,0xbb,0xb1}, {0x75,0xcc,0x9b,0xcc,0xa3}}, - {{0xe1,0xbb,0xa5}, {0x75,0xcc,0xa3}}, - {{0xe1,0xb9,0xb3}, {0x75,0xcc,0xa4}}, - {{0xc5,0xb3}, {0x75,0xcc,0xa8}}, - {{0xe1,0xb9,0xb7}, {0x75,0xcc,0xad}}, - {{0xe1,0xb9,0xb5}, {0x75,0xcc,0xb0}}, - {{0xe1,0xb9,0xbd}, {0x76,0xcc,0x83}}, - {{0xe1,0xb9,0xbf}, {0x76,0xcc,0xa3}}, - {{0xe1,0xba,0x81}, {0x77,0xcc,0x80}}, - {{0xe1,0xba,0x83}, {0x77,0xcc,0x81}}, - {{0xc5,0xb5}, {0x77,0xcc,0x82}}, - {{0xe1,0xba,0x87}, {0x77,0xcc,0x87}}, - {{0xe1,0xba,0x85}, {0x77,0xcc,0x88}}, - {{0xe1,0xba,0x98}, {0x77,0xcc,0x8a}}, - {{0xe1,0xba,0x89}, {0x77,0xcc,0xa3}}, - {{0xe1,0xba,0x8b}, {0x78,0xcc,0x87}}, - {{0xe1,0xba,0x8d}, {0x78,0xcc,0x88}}, - {{0xe1,0xbb,0xb3}, {0x79,0xcc,0x80}}, - {{0xc3,0xbd}, {0x79,0xcc,0x81}}, - {{0xc5,0xb7}, {0x79,0xcc,0x82}}, - {{0xe1,0xbb,0xb9}, {0x79,0xcc,0x83}}, - {{0xe1,0xba,0x8f}, {0x79,0xcc,0x87}}, - {{0xc3,0xbf}, {0x79,0xcc,0x88}}, - {{0xe1,0xbb,0xb7}, {0x79,0xcc,0x89}}, - {{0xe1,0xba,0x99}, {0x79,0xcc,0x8a}}, - {{0xe1,0xbb,0xb5}, {0x79,0xcc,0xa3}}, - {{0xc5,0xba}, {0x7a,0xcc,0x81}}, - {{0xe1,0xba,0x91}, {0x7a,0xcc,0x82}}, - {{0xc5,0xbc}, {0x7a,0xcc,0x87}}, - {{0xc5,0xbe}, {0x7a,0xcc,0x8c}}, - {{0xe1,0xba,0x93}, {0x7a,0xcc,0xa3}}, - {{0xe1,0xba,0x95}, {0x7a,0xcc,0xb1}}, - {{0xe1,0xbf,0xad}, {0xc2,0xa8,0xcc,0x80}}, - {{0xe1,0xbf,0xae}, {0xc2,0xa8,0xcc,0x81}}, - {{0xce,0x85}, {0xc2,0xa8,0xcc,0x8d}}, - {{0xe1,0xbf,0x81}, {0xc2,0xa8,0xcd,0x82}}, - {{0xe1,0xbf,0xbd}, {0xc2,0xb4}}, - {{0xce,0x87}, {0xc2,0xb7}}, - {{0xd3,0x94}, {0xc3,0x86}}, - {{0xc7,0xbc}, {0xc3,0x86,0xcc,0x81}}, - {{0xc7,0xa2}, {0xc3,0x86,0xcc,0x84}}, - {{0xc7,0xbe}, {0xc3,0x98,0xcc,0x81}}, - {{0xd3,0x95}, {0xc3,0xa6}}, - {{0xc7,0xbd}, {0xc3,0xa6,0xcc,0x81}}, - {{0xc7,0xa3}, {0xc3,0xa6,0xcc,0x84}}, - {{0xc7,0xbf}, {0xc3,0xb8,0xcc,0x81}}, - {{0xe1,0xba,0x9b}, {0xc5,0xbf,0xcc,0x87}}, - {{0xd3,0x98}, {0xc6,0x8f}}, - {{0xd3,0x9a}, {0xc6,0x8f,0xcc,0x88}}, - {{0xd3,0xa8}, {0xc6,0x9f}}, - {{0xd3,0xaa}, {0xc6,0x9f,0xcc,0x88}}, - {{0xd3,0xa0}, {0xc6,0xb7}}, - {{0xc7,0xae}, {0xc6,0xb7,0xcc,0x8c}}, - {{0xd3,0x99}, {0xc9,0x99}}, - {{0xd3,0x9b}, {0xc9,0x99,0xcc,0x88}}, - {{0xd3,0xa9}, {0xc9,0xb5}}, - {{0xd3,0xab}, {0xc9,0xb5,0xcc,0x88}}, - {{0xd3,0xa1}, {0xca,0x92}}, - {{0xc7,0xaf}, {0xca,0x92,0xcc,0x8c}}, - {{0xcd,0xb4}, {0xca,0xb9}}, - {{0xcd,0x80}, {0xcc,0x80}}, - {{0xcd,0x81}, {0xcc,0x81}}, - {{0xcc,0x90}, {0xcc,0x86,0xcc,0x87}}, - {{0xcd,0x84}, {0xcc,0x88,0xcc,0x8d}}, - {{0xcd,0x83}, {0xcc,0x93}}, - {{0xe1,0xbe,0xba}, {0xce,0x91,0xcc,0x80}}, - {{0xe1,0xbe,0xbb}, {0xce,0x91,0xcc,0x81}}, - {{0xe1,0xbe,0xb9}, {0xce,0x91,0xcc,0x84}}, - {{0xe1,0xbe,0xb8}, {0xce,0x91,0xcc,0x86}}, - {{0xce,0x86}, {0xce,0x91,0xcc,0x8d}}, - {{0xe1,0xbc,0x88}, {0xce,0x91,0xcc,0x93}}, - {{0xe1,0xbc,0x8a}, {0xce,0x91,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbc,0x8c}, {0xce,0x91,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbc,0x8e}, {0xce,0x91,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbc,0x89}, {0xce,0x91,0xcc,0x94}}, - {{0xe1,0xbc,0x8b}, {0xce,0x91,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbc,0x8d}, {0xce,0x91,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbc,0x8f}, {0xce,0x91,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbe,0xbc}, {0xce,0x91,0xcd,0x85}}, - {{0xe1,0xbe,0x88}, {0xce,0x91,0xcd,0x85,0xcc,0x93}}, - {{0xe1,0xbe,0x8a}, {0xce,0x91,0xcd,0x85,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbe,0x8c}, {0xce,0x91,0xcd,0x85,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbe,0x8e}, {0xce,0x91,0xcd,0x85,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbe,0x89}, {0xce,0x91,0xcd,0x85,0xcc,0x94}}, - {{0xe1,0xbe,0x8b}, {0xce,0x91,0xcd,0x85,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbe,0x8d}, {0xce,0x91,0xcd,0x85,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbe,0x8f}, {0xce,0x91,0xcd,0x85,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0x88}, {0xce,0x95,0xcc,0x80}}, - {{0xe1,0xbf,0x89}, {0xce,0x95,0xcc,0x81}}, - {{0xce,0x88}, {0xce,0x95,0xcc,0x8d}}, - {{0xe1,0xbc,0x98}, {0xce,0x95,0xcc,0x93}}, - {{0xe1,0xbc,0x9a}, {0xce,0x95,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbc,0x9c}, {0xce,0x95,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbc,0x99}, {0xce,0x95,0xcc,0x94}}, - {{0xe1,0xbc,0x9b}, {0xce,0x95,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbc,0x9d}, {0xce,0x95,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbf,0x8a}, {0xce,0x97,0xcc,0x80}}, - {{0xe1,0xbf,0x8b}, {0xce,0x97,0xcc,0x81}}, - {{0xce,0x89}, {0xce,0x97,0xcc,0x8d}}, - {{0xe1,0xbc,0xa8}, {0xce,0x97,0xcc,0x93}}, - {{0xe1,0xbc,0xaa}, {0xce,0x97,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbc,0xac}, {0xce,0x97,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbc,0xae}, {0xce,0x97,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbc,0xa9}, {0xce,0x97,0xcc,0x94}}, - {{0xe1,0xbc,0xab}, {0xce,0x97,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbc,0xad}, {0xce,0x97,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbc,0xaf}, {0xce,0x97,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0x8c}, {0xce,0x97,0xcd,0x85}}, - {{0xe1,0xbe,0x98}, {0xce,0x97,0xcd,0x85,0xcc,0x93}}, - {{0xe1,0xbe,0x9a}, {0xce,0x97,0xcd,0x85,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbe,0x9c}, {0xce,0x97,0xcd,0x85,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbe,0x9e}, {0xce,0x97,0xcd,0x85,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbe,0x99}, {0xce,0x97,0xcd,0x85,0xcc,0x94}}, - {{0xe1,0xbe,0x9b}, {0xce,0x97,0xcd,0x85,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbe,0x9d}, {0xce,0x97,0xcd,0x85,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbe,0x9f}, {0xce,0x97,0xcd,0x85,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0x9a}, {0xce,0x99,0xcc,0x80}}, - {{0xe1,0xbf,0x9b}, {0xce,0x99,0xcc,0x81}}, - {{0xe1,0xbf,0x99}, {0xce,0x99,0xcc,0x84}}, - {{0xe1,0xbf,0x98}, {0xce,0x99,0xcc,0x86}}, - {{0xce,0xaa}, {0xce,0x99,0xcc,0x88}}, - {{0xce,0x8a}, {0xce,0x99,0xcc,0x8d}}, - {{0xe1,0xbc,0xb8}, {0xce,0x99,0xcc,0x93}}, - {{0xe1,0xbc,0xba}, {0xce,0x99,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbc,0xbc}, {0xce,0x99,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbc,0xbe}, {0xce,0x99,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbc,0xb9}, {0xce,0x99,0xcc,0x94}}, - {{0xe1,0xbc,0xbb}, {0xce,0x99,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbc,0xbd}, {0xce,0x99,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbc,0xbf}, {0xce,0x99,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0xb8}, {0xce,0x9f,0xcc,0x80}}, - {{0xe1,0xbf,0xb9}, {0xce,0x9f,0xcc,0x81}}, - {{0xce,0x8c}, {0xce,0x9f,0xcc,0x8d}}, - {{0xe1,0xbd,0x88}, {0xce,0x9f,0xcc,0x93}}, - {{0xe1,0xbd,0x8a}, {0xce,0x9f,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbd,0x8c}, {0xce,0x9f,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbd,0x89}, {0xce,0x9f,0xcc,0x94}}, - {{0xe1,0xbd,0x8b}, {0xce,0x9f,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbd,0x8d}, {0xce,0x9f,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbf,0xac}, {0xce,0xa1,0xcc,0x94}}, - {{0xe1,0xbf,0xaa}, {0xce,0xa5,0xcc,0x80}}, - {{0xe1,0xbf,0xab}, {0xce,0xa5,0xcc,0x81}}, - {{0xe1,0xbf,0xa9}, {0xce,0xa5,0xcc,0x84}}, - {{0xe1,0xbf,0xa8}, {0xce,0xa5,0xcc,0x86}}, - {{0xce,0xab}, {0xce,0xa5,0xcc,0x88}}, - {{0xce,0x8e}, {0xce,0xa5,0xcc,0x8d}}, - {{0xe1,0xbd,0x99}, {0xce,0xa5,0xcc,0x94}}, - {{0xe1,0xbd,0x9b}, {0xce,0xa5,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbd,0x9d}, {0xce,0xa5,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbd,0x9f}, {0xce,0xa5,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0xba}, {0xce,0xa9,0xcc,0x80}}, - {{0xe1,0xbf,0xbb}, {0xce,0xa9,0xcc,0x81}}, - {{0xce,0x8f}, {0xce,0xa9,0xcc,0x8d}}, - {{0xe1,0xbd,0xa8}, {0xce,0xa9,0xcc,0x93}}, - {{0xe1,0xbd,0xaa}, {0xce,0xa9,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbd,0xac}, {0xce,0xa9,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbd,0xae}, {0xce,0xa9,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbd,0xa9}, {0xce,0xa9,0xcc,0x94}}, - {{0xe1,0xbd,0xab}, {0xce,0xa9,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbd,0xad}, {0xce,0xa9,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbd,0xaf}, {0xce,0xa9,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0xbc}, {0xce,0xa9,0xcd,0x85}}, - {{0xe1,0xbe,0xa8}, {0xce,0xa9,0xcd,0x85,0xcc,0x93}}, - {{0xe1,0xbe,0xaa}, {0xce,0xa9,0xcd,0x85,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbe,0xac}, {0xce,0xa9,0xcd,0x85,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbe,0xae}, {0xce,0xa9,0xcd,0x85,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbe,0xa9}, {0xce,0xa9,0xcd,0x85,0xcc,0x94}}, - {{0xe1,0xbe,0xab}, {0xce,0xa9,0xcd,0x85,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbe,0xad}, {0xce,0xa9,0xcd,0x85,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbe,0xaf}, {0xce,0xa9,0xcd,0x85,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbd,0xb0}, {0xce,0xb1,0xcc,0x80}}, - {{0xe1,0xbd,0xb1}, {0xce,0xb1,0xcc,0x81}}, - {{0xe1,0xbe,0xb1}, {0xce,0xb1,0xcc,0x84}}, - {{0xe1,0xbe,0xb0}, {0xce,0xb1,0xcc,0x86}}, - {{0xce,0xac}, {0xce,0xb1,0xcc,0x8d}}, - {{0xe1,0xbc,0x80}, {0xce,0xb1,0xcc,0x93}}, - {{0xe1,0xbc,0x82}, {0xce,0xb1,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbc,0x84}, {0xce,0xb1,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbc,0x86}, {0xce,0xb1,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbc,0x81}, {0xce,0xb1,0xcc,0x94}}, - {{0xe1,0xbc,0x83}, {0xce,0xb1,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbc,0x85}, {0xce,0xb1,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbc,0x87}, {0xce,0xb1,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbe,0xb6}, {0xce,0xb1,0xcd,0x82}}, - {{0xe1,0xbe,0xb3}, {0xce,0xb1,0xcd,0x85}}, - {{0xe1,0xbe,0xb2}, {0xce,0xb1,0xcd,0x85,0xcc,0x80}}, - {{0xe1,0xbe,0xb4}, {0xce,0xb1,0xcd,0x85,0xcc,0x81}}, - {{0xe1,0xbe,0x80}, {0xce,0xb1,0xcd,0x85,0xcc,0x93}}, - {{0xe1,0xbe,0x82}, {0xce,0xb1,0xcd,0x85,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbe,0x84}, {0xce,0xb1,0xcd,0x85,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbe,0x86}, {0xce,0xb1,0xcd,0x85,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbe,0x81}, {0xce,0xb1,0xcd,0x85,0xcc,0x94}}, - {{0xe1,0xbe,0x83}, {0xce,0xb1,0xcd,0x85,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbe,0x85}, {0xce,0xb1,0xcd,0x85,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbe,0x87}, {0xce,0xb1,0xcd,0x85,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbe,0xb7}, {0xce,0xb1,0xcd,0x85,0xcd,0x82}}, - {{0xe1,0xbd,0xb2}, {0xce,0xb5,0xcc,0x80}}, - {{0xe1,0xbd,0xb3}, {0xce,0xb5,0xcc,0x81}}, - {{0xce,0xad}, {0xce,0xb5,0xcc,0x8d}}, - {{0xe1,0xbc,0x90}, {0xce,0xb5,0xcc,0x93}}, - {{0xe1,0xbc,0x92}, {0xce,0xb5,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbc,0x94}, {0xce,0xb5,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbc,0x91}, {0xce,0xb5,0xcc,0x94}}, - {{0xe1,0xbc,0x93}, {0xce,0xb5,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbc,0x95}, {0xce,0xb5,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbd,0xb4}, {0xce,0xb7,0xcc,0x80}}, - {{0xe1,0xbd,0xb5}, {0xce,0xb7,0xcc,0x81}}, - {{0xce,0xae}, {0xce,0xb7,0xcc,0x8d}}, - {{0xe1,0xbc,0xa0}, {0xce,0xb7,0xcc,0x93}}, - {{0xe1,0xbc,0xa2}, {0xce,0xb7,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbc,0xa4}, {0xce,0xb7,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbc,0xa6}, {0xce,0xb7,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbc,0xa1}, {0xce,0xb7,0xcc,0x94}}, - {{0xe1,0xbc,0xa3}, {0xce,0xb7,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbc,0xa5}, {0xce,0xb7,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbc,0xa7}, {0xce,0xb7,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0x86}, {0xce,0xb7,0xcd,0x82}}, - {{0xe1,0xbf,0x83}, {0xce,0xb7,0xcd,0x85}}, - {{0xe1,0xbf,0x82}, {0xce,0xb7,0xcd,0x85,0xcc,0x80}}, - {{0xe1,0xbf,0x84}, {0xce,0xb7,0xcd,0x85,0xcc,0x81}}, - {{0xe1,0xbe,0x90}, {0xce,0xb7,0xcd,0x85,0xcc,0x93}}, - {{0xe1,0xbe,0x92}, {0xce,0xb7,0xcd,0x85,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbe,0x94}, {0xce,0xb7,0xcd,0x85,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbe,0x96}, {0xce,0xb7,0xcd,0x85,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbe,0x91}, {0xce,0xb7,0xcd,0x85,0xcc,0x94}}, - {{0xe1,0xbe,0x93}, {0xce,0xb7,0xcd,0x85,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbe,0x95}, {0xce,0xb7,0xcd,0x85,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbe,0x97}, {0xce,0xb7,0xcd,0x85,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0x87}, {0xce,0xb7,0xcd,0x85,0xcd,0x82}}, - {{0xe1,0xbe,0xbe}, {0xce,0xb9}}, - {{0xe1,0xbd,0xb6}, {0xce,0xb9,0xcc,0x80}}, - {{0xe1,0xbd,0xb7}, {0xce,0xb9,0xcc,0x81}}, - {{0xe1,0xbf,0x91}, {0xce,0xb9,0xcc,0x84}}, - {{0xe1,0xbf,0x90}, {0xce,0xb9,0xcc,0x86}}, - {{0xcf,0x8a}, {0xce,0xb9,0xcc,0x88}}, - {{0xe1,0xbf,0x92}, {0xce,0xb9,0xcc,0x88,0xcc,0x80}}, - {{0xe1,0xbf,0x93}, {0xce,0xb9,0xcc,0x88,0xcc,0x81}}, - {{0xce,0x90}, {0xce,0xb9,0xcc,0x88,0xcc,0x8d}}, - {{0xe1,0xbf,0x97}, {0xce,0xb9,0xcc,0x88,0xcd,0x82}}, - {{0xce,0xaf}, {0xce,0xb9,0xcc,0x8d}}, - {{0xe1,0xbc,0xb0}, {0xce,0xb9,0xcc,0x93}}, - {{0xe1,0xbc,0xb2}, {0xce,0xb9,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbc,0xb4}, {0xce,0xb9,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbc,0xb6}, {0xce,0xb9,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbc,0xb1}, {0xce,0xb9,0xcc,0x94}}, - {{0xe1,0xbc,0xb3}, {0xce,0xb9,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbc,0xb5}, {0xce,0xb9,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbc,0xb7}, {0xce,0xb9,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0x96}, {0xce,0xb9,0xcd,0x82}}, - {{0xe1,0xbd,0xb8}, {0xce,0xbf,0xcc,0x80}}, - {{0xe1,0xbd,0xb9}, {0xce,0xbf,0xcc,0x81}}, - {{0xcf,0x8c}, {0xce,0xbf,0xcc,0x8d}}, - {{0xe1,0xbd,0x80}, {0xce,0xbf,0xcc,0x93}}, - {{0xe1,0xbd,0x82}, {0xce,0xbf,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbd,0x84}, {0xce,0xbf,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbd,0x81}, {0xce,0xbf,0xcc,0x94}}, - {{0xe1,0xbd,0x83}, {0xce,0xbf,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbd,0x85}, {0xce,0xbf,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbf,0xb4}, {0xce,0xbf,0xcd,0x85,0xcc,0x81}}, - {{0xe1,0xbf,0xa4}, {0xcf,0x81,0xcc,0x93}}, - {{0xe1,0xbf,0xa5}, {0xcf,0x81,0xcc,0x94}}, - {{0xe1,0xbd,0xba}, {0xcf,0x85,0xcc,0x80}}, - {{0xe1,0xbd,0xbb}, {0xcf,0x85,0xcc,0x81}}, - {{0xe1,0xbf,0xa1}, {0xcf,0x85,0xcc,0x84}}, - {{0xe1,0xbf,0xa0}, {0xcf,0x85,0xcc,0x86}}, - {{0xcf,0x8b}, {0xcf,0x85,0xcc,0x88}}, - {{0xe1,0xbf,0xa2}, {0xcf,0x85,0xcc,0x88,0xcc,0x80}}, - {{0xe1,0xbf,0xa3}, {0xcf,0x85,0xcc,0x88,0xcc,0x81}}, - {{0xce,0xb0}, {0xcf,0x85,0xcc,0x88,0xcc,0x8d}}, - {{0xe1,0xbf,0xa7}, {0xcf,0x85,0xcc,0x88,0xcd,0x82}}, - {{0xcf,0x8d}, {0xcf,0x85,0xcc,0x8d}}, - {{0xe1,0xbd,0x90}, {0xcf,0x85,0xcc,0x93}}, - {{0xe1,0xbd,0x92}, {0xcf,0x85,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbd,0x94}, {0xcf,0x85,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbd,0x96}, {0xcf,0x85,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbd,0x91}, {0xcf,0x85,0xcc,0x94}}, - {{0xe1,0xbd,0x93}, {0xcf,0x85,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbd,0x95}, {0xcf,0x85,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbd,0x97}, {0xcf,0x85,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0xa6}, {0xcf,0x85,0xcd,0x82}}, - {{0xe1,0xbd,0xbc}, {0xcf,0x89,0xcc,0x80}}, - {{0xe1,0xbd,0xbd}, {0xcf,0x89,0xcc,0x81}}, - {{0xcf,0x8e}, {0xcf,0x89,0xcc,0x8d}}, - {{0xe1,0xbd,0xa0}, {0xcf,0x89,0xcc,0x93}}, - {{0xe1,0xbd,0xa2}, {0xcf,0x89,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbd,0xa4}, {0xcf,0x89,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbd,0xa6}, {0xcf,0x89,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbd,0xa1}, {0xcf,0x89,0xcc,0x94}}, - {{0xe1,0xbd,0xa3}, {0xcf,0x89,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbd,0xa5}, {0xcf,0x89,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbd,0xa7}, {0xcf,0x89,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0xb6}, {0xcf,0x89,0xcd,0x82}}, - {{0xe1,0xbf,0xb3}, {0xcf,0x89,0xcd,0x85}}, - {{0xe1,0xbf,0xb2}, {0xcf,0x89,0xcd,0x85,0xcc,0x80}}, - {{0xe1,0xbe,0xa0}, {0xcf,0x89,0xcd,0x85,0xcc,0x93}}, - {{0xe1,0xbe,0xa2}, {0xcf,0x89,0xcd,0x85,0xcc,0x93,0xcc,0x80}}, - {{0xe1,0xbe,0xa4}, {0xcf,0x89,0xcd,0x85,0xcc,0x93,0xcc,0x81}}, - {{0xe1,0xbe,0xa6}, {0xcf,0x89,0xcd,0x85,0xcc,0x93,0xcd,0x82}}, - {{0xe1,0xbe,0xa1}, {0xcf,0x89,0xcd,0x85,0xcc,0x94}}, - {{0xe1,0xbe,0xa3}, {0xcf,0x89,0xcd,0x85,0xcc,0x94,0xcc,0x80}}, - {{0xe1,0xbe,0xa5}, {0xcf,0x89,0xcd,0x85,0xcc,0x94,0xcc,0x81}}, - {{0xe1,0xbe,0xa7}, {0xcf,0x89,0xcd,0x85,0xcc,0x94,0xcd,0x82}}, - {{0xe1,0xbf,0xb7}, {0xcf,0x89,0xcd,0x85,0xcd,0x82}}, - {{0xcf,0x94}, {0xcf,0x92,0xcc,0x88}}, - {{0xcf,0x93}, {0xcf,0x92,0xcc,0x8d}}, - {{0xd0,0x87}, {0xd0,0x86,0xcc,0x88}}, - {{0xd3,0x90}, {0xd0,0x90,0xcc,0x86}}, - {{0xd3,0x92}, {0xd0,0x90,0xcc,0x88}}, - {{0xd0,0x83}, {0xd0,0x93,0xcc,0x81}}, - {{0xd3,0x96}, {0xd0,0x95,0xcc,0x86}}, - {{0xd0,0x81}, {0xd0,0x95,0xcc,0x88}}, - {{0xd3,0x81}, {0xd0,0x96,0xcc,0x86}}, - {{0xd3,0x9c}, {0xd0,0x96,0xcc,0x88}}, - {{0xd3,0x9e}, {0xd0,0x97,0xcc,0x88}}, - {{0xd3,0xa2}, {0xd0,0x98,0xcc,0x84}}, - {{0xd0,0x99}, {0xd0,0x98,0xcc,0x86}}, - {{0xd3,0xa4}, {0xd0,0x98,0xcc,0x88}}, - {{0xd0,0x8c}, {0xd0,0x9a,0xcc,0x81}}, - {{0xd3,0xa6}, {0xd0,0x9e,0xcc,0x88}}, - {{0xd3,0xae}, {0xd0,0xa3,0xcc,0x84}}, - {{0xd0,0x8e}, {0xd0,0xa3,0xcc,0x86}}, - {{0xd3,0xb0}, {0xd0,0xa3,0xcc,0x88}}, - {{0xd3,0xb2}, {0xd0,0xa3,0xcc,0x8b}}, - {{0xd3,0xb4}, {0xd0,0xa7,0xcc,0x88}}, - {{0xd3,0xb8}, {0xd0,0xab,0xcc,0x88}}, - {{0xd3,0x91}, {0xd0,0xb0,0xcc,0x86}}, - {{0xd3,0x93}, {0xd0,0xb0,0xcc,0x88}}, - {{0xd1,0x93}, {0xd0,0xb3,0xcc,0x81}}, - {{0xd3,0x97}, {0xd0,0xb5,0xcc,0x86}}, - {{0xd1,0x91}, {0xd0,0xb5,0xcc,0x88}}, - {{0xd3,0x82}, {0xd0,0xb6,0xcc,0x86}}, - {{0xd3,0x9d}, {0xd0,0xb6,0xcc,0x88}}, - {{0xd3,0x9f}, {0xd0,0xb7,0xcc,0x88}}, - {{0xd3,0xa3}, {0xd0,0xb8,0xcc,0x84}}, - {{0xd0,0xb9}, {0xd0,0xb8,0xcc,0x86}}, - {{0xd3,0xa5}, {0xd0,0xb8,0xcc,0x88}}, - {{0xd1,0x9c}, {0xd0,0xba,0xcc,0x81}}, - {{0xd3,0xa7}, {0xd0,0xbe,0xcc,0x88}}, - {{0xd3,0xaf}, {0xd1,0x83,0xcc,0x84}}, - {{0xd1,0x9e}, {0xd1,0x83,0xcc,0x86}}, - {{0xd3,0xb1}, {0xd1,0x83,0xcc,0x88}}, - {{0xd3,0xb3}, {0xd1,0x83,0xcc,0x8b}}, - {{0xd3,0xb5}, {0xd1,0x87,0xcc,0x88}}, - {{0xd3,0xb9}, {0xd1,0x8b,0xcc,0x88}}, - {{0xd1,0x97}, {0xd1,0x96,0xcc,0x88}}, - {{0xd1,0xb6}, {0xd1,0xb4,0xcc,0x8f}}, - {{0xd1,0xb7}, {0xd1,0xb5,0xcc,0x8f}}, - {{0xef,0xac,0xae}, {0xd7,0x90,0xd6,0xb7}}, - {{0xef,0xac,0xaf}, {0xd7,0x90,0xd6,0xb8}}, - {{0xef,0xac,0xb0}, {0xd7,0x90,0xd6,0xbc}}, - {{0xef,0xac,0xb1}, {0xd7,0x91,0xd6,0xbc}}, - {{0xef,0xad,0x8c}, {0xd7,0x91,0xd6,0xbf}}, - {{0xef,0xac,0xb2}, {0xd7,0x92,0xd6,0xbc}}, - {{0xef,0xac,0xb3}, {0xd7,0x93,0xd6,0xbc}}, - {{0xef,0xac,0xb4}, {0xd7,0x94,0xd6,0xbc}}, - {{0xef,0xad,0x8b}, {0xd7,0x95,0xd6,0xb9}}, - {{0xef,0xac,0xb5}, {0xd7,0x95,0xd6,0xbc}}, - {{0xef,0xac,0xb6}, {0xd7,0x96,0xd6,0xbc}}, - {{0xef,0xac,0xb8}, {0xd7,0x98,0xd6,0xbc}}, - {{0xef,0xac,0xb9}, {0xd7,0x99,0xd6,0xbc}}, - {{0xef,0xac,0xba}, {0xd7,0x9a,0xd6,0xbc}}, - {{0xef,0xac,0xbb}, {0xd7,0x9b,0xd6,0xbc}}, - {{0xef,0xad,0x8d}, {0xd7,0x9b,0xd6,0xbf}}, - {{0xef,0xac,0xbc}, {0xd7,0x9c,0xd6,0xbc}}, - {{0xef,0xac,0xbe}, {0xd7,0x9e,0xd6,0xbc}}, - {{0xef,0xad,0x80}, {0xd7,0xa0,0xd6,0xbc}}, - {{0xef,0xad,0x81}, {0xd7,0xa1,0xd6,0xbc}}, - {{0xef,0xad,0x83}, {0xd7,0xa3,0xd6,0xbc}}, - {{0xef,0xad,0x84}, {0xd7,0xa4,0xd6,0xbc}}, - {{0xef,0xad,0x8e}, {0xd7,0xa4,0xd6,0xbf}}, - {{0xef,0xad,0x86}, {0xd7,0xa6,0xd6,0xbc}}, - {{0xef,0xad,0x87}, {0xd7,0xa7,0xd6,0xbc}}, - {{0xef,0xad,0x88}, {0xd7,0xa8,0xd6,0xbc}}, - {{0xef,0xad,0x89}, {0xd7,0xa9,0xd6,0xbc}}, - {{0xef,0xac,0xac}, {0xd7,0xa9,0xd6,0xbc,0xd7,0x81}}, - {{0xef,0xac,0xad}, {0xd7,0xa9,0xd6,0xbc,0xd7,0x82}}, - {{0xef,0xac,0xaa}, {0xd7,0xa9,0xd7,0x81}}, - {{0xef,0xac,0xab}, {0xd7,0xa9,0xd7,0x82}}, - {{0xef,0xad,0x8a}, {0xd7,0xaa,0xd6,0xbc}}, - {{0xef,0xac,0x9f}, {0xd7,0xb2,0xd6,0xb7}}, - {{0xe0,0xa5,0x98}, {0xe0,0xa4,0x95,0xe0,0xa4,0xbc}}, - {{0xe0,0xa5,0x99}, {0xe0,0xa4,0x96,0xe0,0xa4,0xbc}}, - {{0xe0,0xa5,0x9a}, {0xe0,0xa4,0x97,0xe0,0xa4,0xbc}}, - {{0xe0,0xa5,0x9b}, {0xe0,0xa4,0x9c,0xe0,0xa4,0xbc}}, - {{0xe0,0xa5,0x9c}, {0xe0,0xa4,0xa1,0xe0,0xa4,0xbc}}, - {{0xe0,0xa5,0x9d}, {0xe0,0xa4,0xa2,0xe0,0xa4,0xbc}}, - {{0xe0,0xa4,0xa9}, {0xe0,0xa4,0xa8,0xe0,0xa4,0xbc}}, - {{0xe0,0xa5,0x9e}, {0xe0,0xa4,0xab,0xe0,0xa4,0xbc}}, - {{0xe0,0xa5,0x9f}, {0xe0,0xa4,0xaf,0xe0,0xa4,0xbc}}, - {{0xe0,0xa4,0xb1}, {0xe0,0xa4,0xb0,0xe0,0xa4,0xbc}}, - {{0xe0,0xa4,0xb4}, {0xe0,0xa4,0xb3,0xe0,0xa4,0xbc}}, - {{0xe0,0xa7,0x9c}, {0xe0,0xa6,0xa1,0xe0,0xa6,0xbc}}, - {{0xe0,0xa7,0x9d}, {0xe0,0xa6,0xa2,0xe0,0xa6,0xbc}}, - {{0xe0,0xa6,0xb0}, {0xe0,0xa6,0xac,0xe0,0xa6,0xbc}}, - {{0xe0,0xa7,0x9f}, {0xe0,0xa6,0xaf,0xe0,0xa6,0xbc}}, - {{0xe0,0xa7,0x8b}, {0xe0,0xa7,0x87,0xe0,0xa6,0xbe}}, - {{0xe0,0xa7,0x8c}, {0xe0,0xa7,0x87,0xe0,0xa7,0x97}}, - {{0xe0,0xa9,0x99}, {0xe0,0xa8,0x96,0xe0,0xa8,0xbc}}, - {{0xe0,0xa9,0x9a}, {0xe0,0xa8,0x97,0xe0,0xa8,0xbc}}, - {{0xe0,0xa9,0x9b}, {0xe0,0xa8,0x9c,0xe0,0xa8,0xbc}}, - {{0xe0,0xa9,0x9c}, {0xe0,0xa8,0xa1,0xe0,0xa8,0xbc}}, - {{0xe0,0xa9,0x9e}, {0xe0,0xa8,0xab,0xe0,0xa8,0xbc}}, - {{0xe0,0xad,0x9c}, {0xe0,0xac,0xa1,0xe0,0xac,0xbc}}, - {{0xe0,0xad,0x9d}, {0xe0,0xac,0xa2,0xe0,0xac,0xbc}}, - {{0xe0,0xad,0x9f}, {0xe0,0xac,0xaf,0xe0,0xac,0xbc}}, - {{0xe0,0xad,0x8b}, {0xe0,0xad,0x87,0xe0,0xac,0xbe}}, - {{0xe0,0xad,0x88}, {0xe0,0xad,0x87,0xe0,0xad,0x96}}, - {{0xe0,0xad,0x8c}, {0xe0,0xad,0x87,0xe0,0xad,0x97}}, - {{0xe0,0xae,0x94}, {0xe0,0xae,0x92,0xe0,0xaf,0x97}}, - {{0xe0,0xaf,0x8a}, {0xe0,0xaf,0x86,0xe0,0xae,0xbe}}, - {{0xe0,0xaf,0x8c}, {0xe0,0xaf,0x86,0xe0,0xaf,0x97}}, - {{0xe0,0xaf,0x8b}, {0xe0,0xaf,0x87,0xe0,0xae,0xbe}}, - {{0xe0,0xb1,0x88}, {0xe0,0xb1,0x86,0xe0,0xb1,0x96}}, - {{0xe0,0xb3,0x80}, {0xe0,0xb2,0xbf,0xe0,0xb3,0x95}}, - {{0xe0,0xb3,0x8a}, {0xe0,0xb3,0x86,0xe0,0xb3,0x82}}, - {{0xe0,0xb3,0x8b}, {0xe0,0xb3,0x86,0xe0,0xb3,0x82,0xe0,0xb3,0x95}}, - {{0xe0,0xb3,0x87}, {0xe0,0xb3,0x86,0xe0,0xb3,0x95}}, - {{0xe0,0xb3,0x88}, {0xe0,0xb3,0x86,0xe0,0xb3,0x96}}, - {{0xe0,0xb5,0x8a}, {0xe0,0xb5,0x86,0xe0,0xb4,0xbe}}, - {{0xe0,0xb5,0x8c}, {0xe0,0xb5,0x86,0xe0,0xb5,0x97}}, - {{0xe0,0xb5,0x8b}, {0xe0,0xb5,0x87,0xe0,0xb4,0xbe}}, - {{0xe0,0xb8,0xb3}, {0xe0,0xb9,0x8d,0xe0,0xb8,0xb2}}, - {{0xe0,0xba,0xb3}, {0xe0,0xbb,0x8d,0xe0,0xba,0xb2}}, - {{0xe0,0xbd,0xa9}, {0xe0,0xbd,0x80,0xe0,0xbe,0xb5}}, - {{0xe0,0xbd,0x83}, {0xe0,0xbd,0x82,0xe0,0xbe,0xb7}}, - {{0xe0,0xbd,0x8d}, {0xe0,0xbd,0x8c,0xe0,0xbe,0xb7}}, - {{0xe0,0xbd,0x92}, {0xe0,0xbd,0x91,0xe0,0xbe,0xb7}}, - {{0xe0,0xbd,0x97}, {0xe0,0xbd,0x96,0xe0,0xbe,0xb7}}, - {{0xe0,0xbd,0x9c}, {0xe0,0xbd,0x9b,0xe0,0xbe,0xb7}}, - {{0xe0,0xbd,0xb3}, {0xe0,0xbd,0xb2,0xe0,0xbd,0xb1}}, - {{0xe0,0xbd,0xb5}, {0xe0,0xbd,0xb4,0xe0,0xbd,0xb1}}, - {{0xe0,0xbe,0x81}, {0xe0,0xbe,0x80,0xe0,0xbd,0xb1}}, - {{0xe0,0xbe,0xb9}, {0xe0,0xbe,0x90,0xe0,0xbe,0xb5}}, - {{0xe0,0xbe,0x93}, {0xe0,0xbe,0x92,0xe0,0xbe,0xb7}}, - {{0xe0,0xbe,0x9d}, {0xe0,0xbe,0x9c,0xe0,0xbe,0xb7}}, - {{0xe0,0xbe,0xa2}, {0xe0,0xbe,0xa1,0xe0,0xbe,0xb7}}, - {{0xe0,0xbe,0xa7}, {0xe0,0xbe,0xa6,0xe0,0xbe,0xb7}}, - {{0xe0,0xbe,0xac}, {0xe0,0xbe,0xab,0xe0,0xbe,0xb7}}, - {{0xe0,0xbd,0xb6}, {0xe0,0xbe,0xb2,0xe0,0xbe,0x80}}, - {{0xe0,0xbd,0xb7}, {0xe0,0xbe,0xb2,0xe0,0xbe,0x80,0xe0,0xbd,0xb1}}, - {{0xe0,0xbd,0xb8}, {0xe0,0xbe,0xb3,0xe0,0xbe,0x80}}, - {{0xe0,0xbd,0xb9}, {0xe0,0xbe,0xb3,0xe0,0xbe,0x80,0xe0,0xbd,0xb1}}, - {{0xe1,0xbf,0x8d}, {0xe1,0xbe,0xbf,0xcc,0x80}}, - {{0xe1,0xbf,0x8e}, {0xe1,0xbe,0xbf,0xcc,0x81}}, - {{0xe1,0xbf,0x8f}, {0xe1,0xbe,0xbf,0xcd,0x82}}, - {{0xe1,0xbf,0x9d}, {0xe1,0xbf,0xbe,0xcc,0x80}}, - {{0xe1,0xbf,0x9e}, {0xe1,0xbf,0xbe,0xcc,0x81}}, - {{0xe1,0xbf,0x9f}, {0xe1,0xbf,0xbe,0xcd,0x82}}, - {{0xe3,0x82,0x94}, {0xe3,0x81,0x86,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x8c}, {0xe3,0x81,0x8b,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x8e}, {0xe3,0x81,0x8d,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x90}, {0xe3,0x81,0x8f,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x92}, {0xe3,0x81,0x91,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x94}, {0xe3,0x81,0x93,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x96}, {0xe3,0x81,0x95,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x98}, {0xe3,0x81,0x97,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x9a}, {0xe3,0x81,0x99,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x9c}, {0xe3,0x81,0x9b,0xe3,0x82,0x99}}, - {{0xe3,0x81,0x9e}, {0xe3,0x81,0x9d,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xa0}, {0xe3,0x81,0x9f,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xa2}, {0xe3,0x81,0xa1,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xa5}, {0xe3,0x81,0xa4,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xa7}, {0xe3,0x81,0xa6,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xa9}, {0xe3,0x81,0xa8,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xb0}, {0xe3,0x81,0xaf,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xb1}, {0xe3,0x81,0xaf,0xe3,0x82,0x9a}}, - {{0xe3,0x81,0xb3}, {0xe3,0x81,0xb2,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xb4}, {0xe3,0x81,0xb2,0xe3,0x82,0x9a}}, - {{0xe3,0x81,0xb6}, {0xe3,0x81,0xb5,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xb7}, {0xe3,0x81,0xb5,0xe3,0x82,0x9a}}, - {{0xe3,0x81,0xb9}, {0xe3,0x81,0xb8,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xba}, {0xe3,0x81,0xb8,0xe3,0x82,0x9a}}, - {{0xe3,0x81,0xbc}, {0xe3,0x81,0xbb,0xe3,0x82,0x99}}, - {{0xe3,0x81,0xbd}, {0xe3,0x81,0xbb,0xe3,0x82,0x9a}}, - {{0xe3,0x82,0x9e}, {0xe3,0x82,0x9d,0xe3,0x82,0x99}}, - {{0xe3,0x83,0xb4}, {0xe3,0x82,0xa6,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xac}, {0xe3,0x82,0xab,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xae}, {0xe3,0x82,0xad,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xb0}, {0xe3,0x82,0xaf,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xb2}, {0xe3,0x82,0xb1,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xb4}, {0xe3,0x82,0xb3,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xb6}, {0xe3,0x82,0xb5,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xb8}, {0xe3,0x82,0xb7,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xba}, {0xe3,0x82,0xb9,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xbc}, {0xe3,0x82,0xbb,0xe3,0x82,0x99}}, - {{0xe3,0x82,0xbe}, {0xe3,0x82,0xbd,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x80}, {0xe3,0x82,0xbf,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x82}, {0xe3,0x83,0x81,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x85}, {0xe3,0x83,0x84,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x87}, {0xe3,0x83,0x86,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x89}, {0xe3,0x83,0x88,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x90}, {0xe3,0x83,0x8f,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x91}, {0xe3,0x83,0x8f,0xe3,0x82,0x9a}}, - {{0xe3,0x83,0x93}, {0xe3,0x83,0x92,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x94}, {0xe3,0x83,0x92,0xe3,0x82,0x9a}}, - {{0xe3,0x83,0x96}, {0xe3,0x83,0x95,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x97}, {0xe3,0x83,0x95,0xe3,0x82,0x9a}}, - {{0xe3,0x83,0x99}, {0xe3,0x83,0x98,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x9a}, {0xe3,0x83,0x98,0xe3,0x82,0x9a}}, - {{0xe3,0x83,0x9c}, {0xe3,0x83,0x9b,0xe3,0x82,0x99}}, - {{0xe3,0x83,0x9d}, {0xe3,0x83,0x9b,0xe3,0x82,0x9a}}, - {{0xe3,0x83,0xb7}, {0xe3,0x83,0xaf,0xe3,0x82,0x99}}, - {{0xe3,0x83,0xb8}, {0xe3,0x83,0xb0,0xe3,0x82,0x99}}, - {{0xe3,0x83,0xb9}, {0xe3,0x83,0xb1,0xe3,0x82,0x99}}, - {{0xe3,0x83,0xba}, {0xe3,0x83,0xb2,0xe3,0x82,0x99}}, - {{0xe3,0x83,0xbe}, {0xe3,0x83,0xbd,0xe3,0x82,0x99}}, -}; -#endif /* UNICODE_NORMALIZATION */ -#endif /* UTF8_INPUT_ENABLE */ - -#ifdef SHIFTJIS_CP932 -const unsigned short shiftjis_cp932[3][189] = { - { - 0xEEEF, 0xEEF0, 0xEEF1, 0xEEF2, 0xEEF3, 0xEEF4, 0xEEF5, 0xEEF6, - 0xEEF7, 0xEEF8, 0x8754, 0x8755, 0x8756, 0x8757, 0x8758, 0x8759, - 0x875A, 0x875B, 0x875C, 0x875D, 0x81CA, 0xEEFA, 0xEEFB, 0xEEFC, - 0x878A, 0x8782, 0x8784, 0x81E6, 0xED40, 0xED41, 0xED42, 0xED43, - 0xED44, 0xED45, 0xED46, 0xED47, 0xED48, 0xED49, 0xED4A, 0xED4B, - 0xED4C, 0xED4D, 0xED4E, 0xED4F, 0xED50, 0xED51, 0xED52, 0xED53, - 0xED54, 0xED55, 0xED56, 0xED57, 0xED58, 0xED59, 0xED5A, 0xED5B, - 0xED5C, 0xED5D, 0xED5E, 0xED5F, 0xED60, 0xED61, 0xED62, 0, - 0xED63, 0xED64, 0xED65, 0xED66, 0xED67, 0xED68, 0xED69, 0xED6A, - 0xED6B, 0xED6C, 0xED6D, 0xED6E, 0xED6F, 0xED70, 0xED71, 0xED72, - 0xED73, 0xED74, 0xED75, 0xED76, 0xED77, 0xED78, 0xED79, 0xED7A, - 0xED7B, 0xED7C, 0xED7D, 0xED7E, 0xED80, 0xED81, 0xED82, 0xED83, - 0xED84, 0xED85, 0xED86, 0xED87, 0xED88, 0xED89, 0xED8A, 0xED8B, - 0xED8C, 0xED8D, 0xED8E, 0xED8F, 0xED90, 0xED91, 0xED92, 0xED93, - 0xED94, 0xED95, 0xED96, 0xED97, 0xED98, 0xED99, 0xED9A, 0xED9B, - 0xED9C, 0xED9D, 0xED9E, 0xED9F, 0xEDA0, 0xEDA1, 0xEDA2, 0xEDA3, - 0xEDA4, 0xEDA5, 0xEDA6, 0xEDA7, 0xEDA8, 0xEDA9, 0xEDAA, 0xEDAB, - 0xEDAC, 0xEDAD, 0xEDAE, 0xEDAF, 0xEDB0, 0xEDB1, 0xEDB2, 0xEDB3, - 0xEDB4, 0xEDB5, 0xEDB6, 0xEDB7, 0xEDB8, 0xEDB9, 0xEDBA, 0xEDBB, - 0xEDBC, 0xEDBD, 0xEDBE, 0xEDBF, 0xEDC0, 0xEDC1, 0xEDC2, 0xEDC3, - 0xEDC4, 0xEDC5, 0xEDC6, 0xEDC7, 0xEDC8, 0xEDC9, 0xEDCA, 0xEDCB, - 0xEDCC, 0xEDCD, 0xEDCE, 0xEDCF, 0xEDD0, 0xEDD1, 0xEDD2, 0xEDD3, - 0xEDD4, 0xEDD5, 0xEDD6, 0xEDD7, 0xEDD8, 0xEDD9, 0xEDDA, 0xEDDB, - 0xEDDC, 0xEDDD, 0xEDDE, 0xEDDF, 0xEDE0, - }, - { - 0xEDE1, 0xEDE2, 0xEDE3, 0xEDE4, 0xEDE5, 0xEDE6, 0xEDE7, 0xEDE8, - 0xEDE9, 0xEDEA, 0xEDEB, 0xEDEC, 0xEDED, 0xEDEE, 0xEDEF, 0xEDF0, - 0xEDF1, 0xEDF2, 0xEDF3, 0xEDF4, 0xEDF5, 0xEDF6, 0xEDF7, 0xEDF8, - 0xEDF9, 0xEDFA, 0xEDFB, 0xEDFC, 0xEE40, 0xEE41, 0xEE42, 0xEE43, - 0xEE44, 0xEE45, 0xEE46, 0xEE47, 0xEE48, 0xEE49, 0xEE4A, 0xEE4B, - 0xEE4C, 0xEE4D, 0xEE4E, 0xEE4F, 0xEE50, 0xEE51, 0xEE52, 0xEE53, - 0xEE54, 0xEE55, 0xEE56, 0xEE57, 0xEE58, 0xEE59, 0xEE5A, 0xEE5B, - 0xEE5C, 0xEE5D, 0xEE5E, 0xEE5F, 0xEE60, 0xEE61, 0xEE62, 0, - 0xEE63, 0xEE64, 0xEE65, 0xEE66, 0xEE67, 0xEE68, 0xEE69, 0xEE6A, - 0xEE6B, 0xEE6C, 0xEE6D, 0xEE6E, 0xEE6F, 0xEE70, 0xEE71, 0xEE72, - 0xEE73, 0xEE74, 0xEE75, 0xEE76, 0xEE77, 0xEE78, 0xEE79, 0xEE7A, - 0xEE7B, 0xEE7C, 0xEE7D, 0xEE7E, 0xEE80, 0xEE81, 0xEE82, 0xEE83, - 0xEE84, 0xEE85, 0xEE86, 0xEE87, 0xEE88, 0xEE89, 0xEE8A, 0xEE8B, - 0xEE8C, 0xEE8D, 0xEE8E, 0xEE8F, 0xEE90, 0xEE91, 0xEE92, 0xEE93, - 0xEE94, 0xEE95, 0xEE96, 0xEE97, 0xEE98, 0xEE99, 0xEE9A, 0xEE9B, - 0xEE9C, 0xEE9D, 0xEE9E, 0xEE9F, 0xEEA0, 0xEEA1, 0xEEA2, 0xEEA3, - 0xEEA4, 0xEEA5, 0xEEA6, 0xEEA7, 0xEEA8, 0xEEA9, 0xEEAA, 0xEEAB, - 0xEEAC, 0xEEAD, 0xEEAE, 0xEEAF, 0xEEB0, 0xEEB1, 0xEEB2, 0xEEB3, - 0xEEB4, 0xEEB5, 0xEEB6, 0xEEB7, 0xEEB8, 0xEEB9, 0xEEBA, 0xEEBB, - 0xEEBC, 0xEEBD, 0xEEBE, 0xEEBF, 0xEEC0, 0xEEC1, 0xEEC2, 0xEEC3, - 0xEEC4, 0xEEC5, 0xEEC6, 0xEEC7, 0xEEC8, 0xEEC9, 0xEECA, 0xEECB, - 0xEECC, 0xEECD, 0xEECE, 0xEECF, 0xEED0, 0xEED1, 0xEED2, 0xEED3, - 0xEED4, 0xEED5, 0xEED6, 0xEED7, 0xEED8, 0xEED9, 0xEEDA, 0xEEDB, - 0xEEDC, 0xEEDD, 0xEEDE, 0xEEDF, 0xEEE0, - }, - { - 0xEEE1, 0xEEE2, 0xEEE3, 0xEEE4, 0xEEE5, 0xEEE6, 0xEEE7, 0xEEE8, - 0xEEE9, 0xEEEA, 0xEEEB, 0xEEEC, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 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 cp932inv[2][189] = { - { - 0xFA5C, 0xFA5D, 0xFA5E, 0xFA5F, 0xFA60, 0xFA61, 0xFA62, 0xFA63, - 0xFA64, 0xFA65, 0xFA66, 0xFA67, 0xFA68, 0xFA69, 0xFA6A, 0xFA6B, - 0xFA6C, 0xFA6D, 0xFA6E, 0xFA6F, 0xFA70, 0xFA71, 0xFA72, 0xFA73, - 0xFA74, 0xFA75, 0xFA76, 0xFA77, 0xFA78, 0xFA79, 0xFA7A, 0xFA7B, - 0xFA7C, 0xFA7D, 0xFA7E, 0xFA80, 0xFA81, 0xFA82, 0xFA83, 0xFA84, - 0xFA85, 0xFA86, 0xFA87, 0xFA88, 0xFA89, 0xFA8A, 0xFA8B, 0xFA8C, - 0xFA8D, 0xFA8E, 0xFA8F, 0xFA90, 0xFA91, 0xFA92, 0xFA93, 0xFA94, - 0xFA95, 0xFA96, 0xFA97, 0xFA98, 0xFA99, 0xFA9A, 0xFA9B, 0, - 0xFA9C, 0xFA9D, 0xFA9E, 0xFA9F, 0xFAA0, 0xFAA1, 0xFAA2, 0xFAA3, - 0xFAA4, 0xFAA5, 0xFAA6, 0xFAA7, 0xFAA8, 0xFAA9, 0xFAAA, 0xFAAB, - 0xFAAC, 0xFAAD, 0xFAAE, 0xFAAF, 0xFAB0, 0xFAB1, 0xFAB2, 0xFAB3, - 0xFAB4, 0xFAB5, 0xFAB6, 0xFAB7, 0xFAB8, 0xFAB9, 0xFABA, 0xFABB, - 0xFABC, 0xFABD, 0xFABE, 0xFABF, 0xFAC0, 0xFAC1, 0xFAC2, 0xFAC3, - 0xFAC4, 0xFAC5, 0xFAC6, 0xFAC7, 0xFAC8, 0xFAC9, 0xFACA, 0xFACB, - 0xFACC, 0xFACD, 0xFACE, 0xFACF, 0xFAD0, 0xFAD1, 0xFAD2, 0xFAD3, - 0xFAD4, 0xFAD5, 0xFAD6, 0xFAD7, 0xFAD8, 0xFAD9, 0xFADA, 0xFADB, - 0xFADC, 0xFADD, 0xFADE, 0xFADF, 0xFAE0, 0xFAE1, 0xFAE2, 0xFAE3, - 0xFAE4, 0xFAE5, 0xFAE6, 0xFAE7, 0xFAE8, 0xFAE9, 0xFAEA, 0xFAEB, - 0xFAEC, 0xFAED, 0xFAEE, 0xFAEF, 0xFAF0, 0xFAF1, 0xFAF2, 0xFAF3, - 0xFAF4, 0xFAF5, 0xFAF6, 0xFAF7, 0xFAF8, 0xFAF9, 0xFAFA, 0xFAFB, - 0xFAFC, 0xFB40, 0xFB41, 0xFB42, 0xFB43, 0xFB44, 0xFB45, 0xFB46, - 0xFB47, 0xFB48, 0xFB49, 0xFB4A, 0xFB4B, 0xFB4C, 0xFB4D, 0xFB4E, - 0xFB4F, 0xFB50, 0xFB51, 0xFB52, 0xFB53, 0xFB54, 0xFB55, 0xFB56, - 0xFB57, 0xFB58, 0xFB59, 0xFB5A, 0xFB5B, - }, - { - 0xFB5C, 0xFB5D, 0xFB5E, 0xFB5F, 0xFB60, 0xFB61, 0xFB62, 0xFB63, - 0xFB64, 0xFB65, 0xFB66, 0xFB67, 0xFB68, 0xFB69, 0xFB6A, 0xFB6B, - 0xFB6C, 0xFB6D, 0xFB6E, 0xFB6F, 0xFB70, 0xFB71, 0xFB72, 0xFB73, - 0xFB74, 0xFB75, 0xFB76, 0xFB77, 0xFB78, 0xFB79, 0xFB7A, 0xFB7B, - 0xFB7C, 0xFB7D, 0xFB7E, 0xFB80, 0xFB81, 0xFB82, 0xFB83, 0xFB84, - 0xFB85, 0xFB86, 0xFB87, 0xFB88, 0xFB89, 0xFB8A, 0xFB8B, 0xFB8C, - 0xFB8D, 0xFB8E, 0xFB8F, 0xFB90, 0xFB91, 0xFB92, 0xFB93, 0xFB94, - 0xFB95, 0xFB96, 0xFB97, 0xFB98, 0xFB99, 0xFB9A, 0xFB9B, 0, - 0xFB9C, 0xFB9D, 0xFB9E, 0xFB9F, 0xFBA0, 0xFBA1, 0xFBA2, 0xFBA3, - 0xFBA4, 0xFBA5, 0xFBA6, 0xFBA7, 0xFBA8, 0xFBA9, 0xFBAA, 0xFBAB, - 0xFBAC, 0xFBAD, 0xFBAE, 0xFBAF, 0xFBB0, 0xFBB1, 0xFBB2, 0xFBB3, - 0xFBB4, 0xFBB5, 0xFBB6, 0xFBB7, 0xFBB8, 0xFBB9, 0xFBBA, 0xFBBB, - 0xFBBC, 0xFBBD, 0xFBBE, 0xFBBF, 0xFBC0, 0xFBC1, 0xFBC2, 0xFBC3, - 0xFBC4, 0xFBC5, 0xFBC6, 0xFBC7, 0xFBC8, 0xFBC9, 0xFBCA, 0xFBCB, - 0xFBCC, 0xFBCD, 0xFBCE, 0xFBCF, 0xFBD0, 0xFBD1, 0xFBD2, 0xFBD3, - 0xFBD4, 0xFBD5, 0xFBD6, 0xFBD7, 0xFBD8, 0xFBD9, 0xFBDA, 0xFBDB, - 0xFBDC, 0xFBDD, 0xFBDE, 0xFBDF, 0xFBE0, 0xFBE1, 0xFBE2, 0xFBE3, - 0xFBE4, 0xFBE5, 0xFBE6, 0xFBE7, 0xFBE8, 0xFBE9, 0xFBEA, 0xFBEB, - 0xFBEC, 0xFBED, 0xFBEE, 0xFBEF, 0xFBF0, 0xFBF1, 0xFBF2, 0xFBF3, - 0xFBF4, 0xFBF5, 0xFBF6, 0xFBF7, 0xFBF8, 0xFBF9, 0xFBFA, 0xFBFB, - 0xFBFC, 0xFC40, 0xFC41, 0xFC42, 0xFC43, 0xFC44, 0xFC45, 0xFC46, - 0xFC47, 0xFC48, 0xFC49, 0xFC4A, 0xFC4B, 0, 0, 0xFA40, - 0xFA41, 0xFA42, 0xFA43, 0xFA44, 0xFA45, 0xFA46, 0xFA47, 0xFA48, - 0xFA49, 0x81CA, 0xFA55, 0xFA56, 0xFA57, - }, -}; -#endif /* SHIFTJIS_CP932 */ - -#ifdef X0212_ENABLE -const unsigned short shiftjis_x0212[3][189] = { - { - 0xF373, 0xF374, 0xF375, 0xF376, 0xF377, 0xF378, 0xF379, 0xF37A, - 0xF37B, 0xF37C, 0xF37D, 0xF37E, 0xF421, 0xF422, 0xF423, 0xF424, - 0xF425, 0xF426, 0xF427, 0xF428, 0x224C, 0xA243, 0xF429, 0xF42A, - 0xF42B, 0xF42C, 0xF42D, 0x2268, 0xD463, 0xDC5F, 0xE469, 0xE378, - 0xD921, 0xB13B, 0xF42E, 0xC22D, 0xC37C, 0xE450, 0xC23F, 0xBC74, - 0xB029, 0xB048, 0xF42F, 0xB052, 0xB054, 0xB063, 0xB06E, 0xB127, - 0xB123, 0xB12C, 0xB129, 0xB13E, 0xB15F, 0xB158, 0xB148, 0xB157, - 0xB163, 0xB174, 0xB161, 0xB223, 0xF430, 0xB23B, 0xB266, 0, - 0xB26D, 0xB275, 0xB27C, 0xF431, 0xB335, 0xB358, 0xB35B, 0xB365, - 0xB36E, 0xB37B, 0xF432, 0xF433, 0xB440, 0xB447, 0xB450, 0xB45E, - 0xF434, 0xB52A, 0xF435, 0xB52F, 0xB544, 0xB568, 0xF436, 0xB742, - 0xB764, 0xB768, 0xB767, 0xF437, 0xF438, 0xF439, 0xB84E, 0xB861, - 0xB875, 0xB877, 0xB878, 0xB87C, 0xB92F, 0xB937, 0xBA3E, 0xBA5B, - 0xCD2A, 0xBA61, 0xF43A, 0xBA6B, 0xBB33, 0xBB38, 0xF43B, 0xBB4A, - 0xF43C, 0xF43D, 0xBB50, 0xBB5E, 0xBB74, 0xBB75, 0xBB79, 0xBC64, - 0xBC6D, 0xBC7E, 0xF43E, 0xBD42, 0xBD67, 0xF43F, 0xBD70, 0xBE30, - 0xBE2C, 0xF440, 0xBE33, 0xBE3D, 0xBE4D, 0xBE49, 0xBE64, 0xBF28, - 0xBF49, 0xC044, 0xC064, 0xC074, 0xC126, 0xF441, 0xC175, 0xC17C, - 0xF442, 0xC178, 0xC22B, 0xC221, 0xC225, 0xF443, 0xC238, 0xC23A, - 0xF444, 0xC244, 0xC252, 0xC257, 0xC25B, 0xC25E, 0xC26D, 0xC270, - 0xF445, 0xC321, 0xC335, 0xC349, 0xC339, 0xF446, 0xC358, 0xC37E, - 0xF447, 0xC44C, 0xF448, 0xC459, 0xC46A, 0xC47D, 0xF449, 0xC527, - 0xC535, 0xC536, 0xF44A, 0xC555, 0xC638, 0xC657, 0xC660, 0xC66A, - 0xC663, 0xC721, 0xC72B, 0xC747, 0xC743, - }, - { - 0xC74B, 0xC74F, 0xC759, 0xF44B, 0xF44C, 0xC766, 0xC76E, 0xC77C, - 0xC76B, 0xC770, 0xC831, 0xC865, 0xC878, 0xC926, 0xC92B, 0xC92D, - 0xF44D, 0xC94A, 0xC953, 0xC969, 0xC963, 0xC97C, 0xC974, 0xC975, - 0xF44E, 0xCA33, 0xCA3D, 0xCA6F, 0xCA71, 0xCB2E, 0xF44F, 0xCB4A, - 0xCB66, 0xCB6A, 0xCB70, 0xCB74, 0xCB6E, 0xCC25, 0xCB79, 0xCC2B, - 0xCC2E, 0xCC2D, 0xCC32, 0xCC42, 0xCC50, 0xCC59, 0xF450, 0xCD3B, - 0xF451, 0xCE3B, 0xF452, 0xCE3A, 0xCE43, 0xF453, 0xCE72, 0xB35D, - 0xCF55, 0xCF62, 0xCF69, 0xCF6D, 0xF454, 0xF455, 0xF456, 0, - 0xF457, 0xD065, 0xF458, 0xD069, 0xD168, 0xF459, 0xF45A, 0xD16C, - 0xD23B, 0xF45B, 0xD361, 0xD368, 0xD427, 0xF45C, 0xF45D, 0xD454, - 0xD472, 0xD52E, 0xF45E, 0xD75E, 0xF45F, 0xD822, 0xD837, 0xD841, - 0xD851, 0xD874, 0xD946, 0xD948, 0xD951, 0xF460, 0xF461, 0xF462, - 0xF463, 0xF464, 0xDC53, 0xDD48, 0xDD54, 0xDD6A, 0xDD7A, 0xDE24, - 0xDE30, 0xF465, 0xDE35, 0xDE4B, 0xF466, 0xDF39, 0xF467, 0xDF43, - 0xF468, 0xF469, 0xE059, 0xF46A, 0xF46B, 0xE162, 0xF46C, 0xF46D, - 0xF46E, 0xE247, 0xE328, 0xE326, 0xE329, 0xE32F, 0xE330, 0xE32A, - 0xE32B, 0xE33C, 0xE341, 0xE33F, 0xE355, 0xE358, 0xE356, 0xE35F, - 0xE363, 0xE361, 0xE354, 0xE369, 0xE426, 0xE371, 0xE372, 0xE44B, - 0xE441, 0xE443, 0xE43E, 0xF46F, 0xE440, 0xE447, 0xE43F, 0xE460, - 0xE45E, 0xE451, 0xF470, 0xE45C, 0xE452, 0xE45B, 0xE454, 0xE47A, - 0xE46F, 0xE533, 0xE53F, 0xE549, 0xE550, 0xE562, 0xE56A, 0xE56B, - 0xF471, 0xF472, 0xF473, 0xE668, 0xE66F, 0xE72C, 0xF474, 0xE72E, - 0xF475, 0xE731, 0xF476, 0xE732, 0xE831, 0xE836, 0xF477, 0xF478, - 0xE85D, 0xF479, 0xF47A, 0xE951, 0xF47B, - }, - { - 0xE96D, 0xEA4D, 0xF47C, 0xEA5B, 0xEA66, 0xEA6A, 0xEB25, 0xEB7B, - 0xEB7A, 0xF47D, 0xEC56, 0xF47E, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 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 x0212_shiftjis_A2[] = { - 0x819F, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x8143, 0, 0, 0x8150, 0, 0, 0x8160, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFA55, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_B0[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0xFA68, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFA69, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFA6B, 0, 0xFA6C, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFA6D, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFA6E, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_B1[] = { - 0, 0, 0xFA70, 0, 0, 0, 0xFA6F, - 0, 0xFA72, 0, 0, 0xFA71, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFA61, 0, 0, 0xFA73, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFA76, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFA77, - 0xFA75, 0, 0, 0, 0, 0, 0, 0xFA74, - 0, 0xFA7A, 0, 0xFA78, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFA79, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_B2[] = { - 0, 0, 0xFA7B, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFA7D, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFA7E, 0, - 0, 0, 0, 0, 0, 0xFA80, 0, 0, - 0, 0, 0, 0, 0, 0xFA81, 0, 0, - 0, 0, 0, 0, 0xFA82, 0, 0, -}; -static const unsigned short x0212_shiftjis_B3[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFA84, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFA85, 0, 0, 0xFA86, 0, 0xFB77, 0, 0, - 0, 0, 0, 0, 0, 0xFA87, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFA88, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFA89, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_B4[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFA8C, 0, 0, 0, 0, 0, 0, 0xFA8D, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFA8E, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFA8F, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_B5[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFA91, 0, 0, 0, 0, 0xFA93, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFA94, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFA95, 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 x0212_shiftjis_B7[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFA97, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFA98, 0, 0, 0xFA9A, - 0xFA99, 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 x0212_shiftjis_B8[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFA9E, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFA9F, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFAA0, 0, 0xFAA1, - 0xFAA2, 0, 0, 0, 0xFAA3, 0, 0, -}; -static const unsigned short x0212_shiftjis_B9[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFAA4, - 0, 0, 0, 0, 0, 0, 0, 0xFAA5, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_BA[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFAA6, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFAA7, 0, 0, 0, 0, - 0, 0xFAA9, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFAAB, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_BB[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFAAC, 0, 0, 0, 0, - 0xFAAD, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFAAF, 0, 0, 0, 0, 0, - 0xFAB2, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFAB3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFAB4, 0xFAB5, 0, 0, - 0, 0xFAB6, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_BC[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFAB7, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFAB8, 0, 0, - 0, 0, 0, 0, 0xFA67, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFAB9, -}; -static const unsigned short x0212_shiftjis_BD[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFABB, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFABC, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFABE, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_BE[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFAC0, 0, 0, 0, - 0xFABF, 0, 0, 0xFAC2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFAC3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFAC5, 0, 0, 0, 0xFAC4, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFAC6, 0, 0, 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 x0212_shiftjis_BF[] = { - 0, 0, 0, 0, 0, 0, 0, - 0xFAC7, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFAC8, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_C0[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFAC9, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFACA, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFACB, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_C1[] = { - 0, 0, 0, 0, 0, 0xFACC, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFACE, 0, 0, - 0xFAD1, 0, 0, 0, 0xFACF, 0, 0, -}; -static const unsigned short x0212_shiftjis_C2[] = { - 0xFAD3, 0, 0, 0, 0xFAD4, 0, 0, - 0, 0, 0, 0xFAD2, 0, 0xFA63, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFAD6, 0, 0xFAD7, 0, 0, 0, 0, 0xFA66, - 0, 0, 0, 0, 0xFAD9, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFADA, 0, 0, 0, 0, 0xFADB, - 0, 0, 0, 0xFADC, 0, 0, 0xFADD, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFADE, 0, 0, - 0xFADF, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_C3[] = { - 0xFAE1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFAE2, 0, 0, - 0, 0xFAE4, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFAE3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFAE6, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFA64, 0, 0xFAE7, -}; -static const unsigned short x0212_shiftjis_C4[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFAE9, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFAEB, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFAEC, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFAED, 0, -}; -static const unsigned short x0212_shiftjis_C5[] = { - 0, 0, 0, 0, 0, 0, 0xFAEF, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFAF0, 0xFAF1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFAF3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_C6[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFAF4, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFAF5, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFAF6, 0, 0, 0xFAF8, 0, 0, 0, 0, - 0, 0, 0xFAF7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_C7[] = { - 0xFAF9, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFAFA, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFAFC, 0, 0, 0, 0xFAFB, - 0, 0, 0, 0xFB40, 0, 0, 0, 0xFB41, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFB42, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFB45, 0, - 0, 0, 0, 0xFB48, 0, 0, 0xFB46, 0, - 0xFB49, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFB47, 0, 0, -}; -static const unsigned short x0212_shiftjis_C8[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFB4A, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFB4B, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFB4C, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_C9[] = { - 0, 0, 0, 0, 0, 0xFB4D, 0, - 0, 0, 0, 0xFB4E, 0, 0xFB4F, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFB51, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFB52, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFB54, 0, 0, 0, 0, - 0, 0xFB53, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFB56, 0xFB57, 0, 0, - 0, 0, 0, 0, 0xFB55, 0, 0, -}; -static const unsigned short x0212_shiftjis_CA[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFB59, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFB5A, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFB5B, - 0, 0xFB5C, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_CB[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFB5D, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFB5F, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFB60, 0, - 0, 0, 0xFB61, 0, 0, 0, 0xFB64, 0, - 0xFB62, 0, 0, 0, 0xFB63, 0, 0, 0, - 0, 0xFB66, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_CC[] = { - 0, 0, 0, 0, 0xFB65, 0, 0, - 0, 0, 0, 0xFB67, 0, 0xFB69, 0xFB68, 0, - 0, 0, 0xFB6A, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFB6B, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFB6C, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFB6D, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_CD[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFAA8, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFB6F, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_CE[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFB73, 0xFB71, 0, 0, 0, 0, - 0, 0, 0, 0xFB74, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFB76, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_CF[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 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, 0xFB79, 0, 0, 0, 0, 0, - 0, 0xFB7A, 0, 0, 0, 0xFB7B, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_D0[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFB81, 0, 0, - 0, 0xFB83, 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 x0212_shiftjis_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, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFB84, 0, 0, 0, 0xFB87, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_D2[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFB88, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_D3[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFB8A, 0, 0, 0, 0, 0, 0, - 0xFB8B, 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 x0212_shiftjis_D4[] = { - 0, 0, 0, 0, 0, 0, 0xFB8C, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFB8F, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFA5C, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFB90, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_D5[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFB91, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_D7[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFB93, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_D8[] = { - 0, 0xFB95, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFB96, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFB97, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFB98, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFB99, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_D9[] = { - 0xFA60, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFB9A, 0, - 0xFB9B, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFB9C, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_DC[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFBA2, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFA5D, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_DD[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFBA3, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFBA4, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFBA5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFBA6, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_DE[] = { - 0, 0, 0, 0xFBA7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFBA8, 0, 0, 0, 0, 0xFBAA, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFBAB, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_DF[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFBAD, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFBAF, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_E0[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFBB2, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_E1[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFBB5, 0, 0, 0, 0, 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 x0212_shiftjis_E2[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFBB9, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_E3[] = { - 0, 0, 0, 0, 0, 0xFBBB, 0, - 0xFBBA, 0xFBBC, 0xFBBF, 0xFBC0, 0, 0, 0, 0xFBBD, - 0xFBBE, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFBC1, 0, 0, 0xFBC3, - 0, 0xFBC2, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFBCA, 0xFBC4, 0xFBC6, 0, - 0xFBC5, 0, 0, 0, 0, 0, 0, 0xFBC7, - 0, 0xFBC9, 0, 0xFBC8, 0, 0, 0, 0, - 0, 0xFBCB, 0, 0, 0, 0, 0, 0, - 0, 0xFBCD, 0xFBCE, 0, 0, 0, 0, 0, - 0xFA5F, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_E4[] = { - 0, 0, 0, 0, 0, 0xFBCC, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFBD2, 0xFBD6, - 0xFBD4, 0xFBD0, 0, 0xFBD1, 0, 0, 0, 0xFBD5, - 0, 0, 0, 0xFBCF, 0, 0, 0, 0, - 0xFA65, 0xFBD9, 0xFBDC, 0, 0xFBDE, 0, 0, 0, - 0, 0, 0, 0xFBDD, 0xFBDB, 0, 0xFBD8, 0, - 0xFBD7, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFA5E, 0, 0, 0, 0, 0, 0xFBE0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFBDF, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_E5[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFBE1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0xFBE2, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFBE3, 0, 0, 0, 0, 0, 0, - 0xFBE4, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFBE5, 0, 0, 0, 0, 0, - 0, 0, 0xFBE6, 0xFBE7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_E6[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0xFBEB, 0, 0, 0, 0, 0, 0, 0xFBEC, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_E7[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xFBED, 0, 0xFBEF, 0, - 0, 0xFBF1, 0xFBF3, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_E8[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFBF4, 0, 0, 0, 0, 0xFBF5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFBF8, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_E9[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xFBFB, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFC40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_EA[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0xFC41, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFC43, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFC44, 0, - 0, 0, 0xFC45, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_EB[] = { - 0, 0, 0, 0, 0xFC46, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xFC48, 0xFC47, 0, 0, 0, -}; -static const unsigned short x0212_shiftjis_EC[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xFC4A, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 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 x0212_shiftjis_F3[] = { - 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0xFA40, 0xFA41, 0xFA42, 0xFA43, 0xFA44, - 0xFA45, 0xFA46, 0xFA47, 0xFA48, 0xFA49, 0xFA4A, 0xFA4B, -}; -static const unsigned short x0212_shiftjis_F4[] = { - 0xFA4C, 0xFA4D, 0xFA4E, 0xFA4F, 0xFA50, 0xFA51, 0xFA52, - 0xFA53, 0xFA56, 0xFA57, 0xFA58, 0xFA59, 0xFA5A, 0xFA62, 0xFA6A, - 0xFA7C, 0xFA83, 0xFA8A, 0xFA8B, 0xFA90, 0xFA92, 0xFA96, 0xFA9B, - 0xFA9C, 0xFA9D, 0xFAAA, 0xFAAE, 0xFAB0, 0xFAB1, 0xFABA, 0xFABD, - 0xFAC1, 0xFACD, 0xFAD0, 0xFAD5, 0xFAD8, 0xFAE0, 0xFAE5, 0xFAE8, - 0xFAEA, 0xFAEE, 0xFAF2, 0xFB43, 0xFB44, 0xFB50, 0xFB58, 0xFB5E, - 0xFB6E, 0xFB70, 0xFB72, 0xFB75, 0xFB7C, 0xFB7D, 0xFB7E, 0xFB80, - 0xFB82, 0xFB85, 0xFB86, 0xFB89, 0xFB8D, 0xFB8E, 0xFB92, 0xFB94, - 0xFB9D, 0xFB9E, 0xFB9F, 0xFBA0, 0xFBA1, 0xFBA9, 0xFBAC, 0xFBAE, - 0xFBB0, 0xFBB1, 0xFBB3, 0xFBB4, 0xFBB6, 0xFBB7, 0xFBB8, 0xFBD3, - 0xFBDA, 0xFBE8, 0xFBE9, 0xFBEA, 0xFBEE, 0xFBF0, 0xFBF2, 0xFBF6, - 0xFBF7, 0xFBF9, 0xFBFA, 0xFBFC, 0xFC42, 0xFC49, 0xFC4B, -}; -const unsigned short *const x0212_shiftjis[] = { - 0, x0212_shiftjis_A2, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, 0, - x0212_shiftjis_B0, x0212_shiftjis_B1, x0212_shiftjis_B2, x0212_shiftjis_B3, - x0212_shiftjis_B4, x0212_shiftjis_B5, 0, x0212_shiftjis_B7, - x0212_shiftjis_B8, x0212_shiftjis_B9, x0212_shiftjis_BA, x0212_shiftjis_BB, - x0212_shiftjis_BC, x0212_shiftjis_BD, x0212_shiftjis_BE, x0212_shiftjis_BF, - x0212_shiftjis_C0, x0212_shiftjis_C1, x0212_shiftjis_C2, x0212_shiftjis_C3, - x0212_shiftjis_C4, x0212_shiftjis_C5, x0212_shiftjis_C6, x0212_shiftjis_C7, - x0212_shiftjis_C8, x0212_shiftjis_C9, x0212_shiftjis_CA, x0212_shiftjis_CB, - x0212_shiftjis_CC, x0212_shiftjis_CD, x0212_shiftjis_CE, x0212_shiftjis_CF, - x0212_shiftjis_D0, x0212_shiftjis_D1, x0212_shiftjis_D2, x0212_shiftjis_D3, - x0212_shiftjis_D4, x0212_shiftjis_D5, 0, x0212_shiftjis_D7, - x0212_shiftjis_D8, x0212_shiftjis_D9, 0, 0, - x0212_shiftjis_DC, x0212_shiftjis_DD, x0212_shiftjis_DE, x0212_shiftjis_DF, - x0212_shiftjis_E0, x0212_shiftjis_E1, x0212_shiftjis_E2, x0212_shiftjis_E3, - x0212_shiftjis_E4, x0212_shiftjis_E5, x0212_shiftjis_E6, x0212_shiftjis_E7, - x0212_shiftjis_E8, x0212_shiftjis_E9, x0212_shiftjis_EA, x0212_shiftjis_EB, - x0212_shiftjis_EC, 0, 0, 0, - 0, 0, 0, x0212_shiftjis_F3, - x0212_shiftjis_F4, 0, 0, 0, - 0, 0, 0, 0, - 0, 0, 0, -}; -#endif /* X0212_ENABLE */ diff --git a/ext/nkf/nkf-utf8/utf8tbl.h b/ext/nkf/nkf-utf8/utf8tbl.h deleted file mode 100644 index 54a34271dd..0000000000 --- a/ext/nkf/nkf-utf8/utf8tbl.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * utf8tbl.h - Header file for Conversion Table - * - */ - -#ifndef _UTF8TBL_H_ -#define _UTF8TBL_H_ - -#ifdef UTF8_OUTPUT_ENABLE -#define sizeof_euc_to_utf8_1byte 94 -#define sizeof_euc_to_utf8_2bytes 94 -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 -#define sizeof_utf8_to_euc_C2 64 -#define sizeof_utf8_to_euc_E5B8 64 -#define sizeof_utf8_to_euc_2bytes 112 -#define sizeof_utf8_to_euc_3bytes 16 -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 - -#define NORMALIZATION_TABLE_LENGTH 942 -#define NORMALIZATION_TABLE_NFC_LENGTH 3 -#define NORMALIZATION_TABLE_NFD_LENGTH 9 -struct normalization_pair { - const unsigned char nfc[NORMALIZATION_TABLE_NFC_LENGTH]; - const unsigned char nfd[NORMALIZATION_TABLE_NFD_LENGTH]; -}; -extern const struct normalization_pair normalization_table[]; -#endif - -#ifdef SHIFTJIS_CP932 -#define CP932_TABLE_BEGIN 0xFA -#define CP932_TABLE_END 0xFC -extern const unsigned short shiftjis_cp932[3][189]; -#define CP932INV_TABLE_BEGIN 0xED -#define CP932INV_TABLE_END 0xEE -extern const unsigned short cp932inv[2][189]; -#endif /* SHIFTJIS_CP932 */ - -#ifdef X0212_ENABLE -extern const unsigned short shiftjis_x0212[3][189]; -extern const unsigned short *const x0212_shiftjis[]; -#endif /* X0212_ENABLE */ - -#endif diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c deleted file mode 100644 index c6ddee1976..0000000000 --- a/ext/nkf/nkf.c +++ /dev/null @@ -1,503 +0,0 @@ -/* - * NKF - Ruby extension for Network Kanji Filter - * - * original nkf2.x is maintained at http://sourceforge.jp/projects/nkf/ - * - * $Id$ - * - */ - -#define RUBY_NKF_REVISION "$Revision$" -#define RUBY_NKF_VERSION NKF_VERSION " (" NKF_RELEASE_DATE ")" - -#include "ruby/ruby.h" -#include "ruby/encoding.h" - -/* Replace nkf's getchar/putchar for variable modification */ -/* we never use getc, ungetc */ - -#undef getc -#undef ungetc -#define getc(f) (input_ctr>=i_len?-1:input[input_ctr++]) -#define ungetc(c,f) input_ctr-- - -#define INCSIZE 32 -#undef putchar -#undef TRUE -#undef FALSE -#define putchar(c) rb_nkf_putchar(c) - -/* Input/Output pointers */ - -static unsigned char *output; -static unsigned char *input; -static int input_ctr; -static int i_len; -static int output_ctr; -static int o_len; -static int incsize; - -static VALUE result; - -static int -rb_nkf_putchar(unsigned int c) -{ - if (output_ctr >= o_len) { - o_len += incsize; - rb_str_resize(result, o_len); - incsize *= 2; - output = (unsigned char *)RSTRING_PTR(result); - } - output[output_ctr++] = c; - - return c; -} - -/* Include kanji filter main part */ -/* getchar and putchar will be replaced during inclusion */ - -#define PERL_XS 1 -#include "nkf-utf8/config.h" -#include "nkf-utf8/utf8tbl.c" -#include "nkf-utf8/nkf.c" - -rb_encoding* rb_nkf_enc_get(const char *name) -{ - int idx = rb_enc_find_index(name); - if (idx < 0) { - nkf_encoding *nkf_enc = nkf_enc_find(name); - idx = rb_enc_find_index(nkf_enc_name(nkf_enc_to_base_encoding(nkf_enc))); - if (idx < 0) { - idx = rb_define_dummy_encoding(name); - } - } - return rb_enc_from_index(idx); -} - -int nkf_split_options(const char *arg) -{ - int count = 0; - unsigned char option[256]; - int i = 0, j = 0; - int is_escaped = FALSE; - int is_single_quoted = FALSE; - int is_double_quoted = FALSE; - for(i = 0; arg[i]; i++){ - if(j == 255){ - return -1; - }else if(is_single_quoted){ - if(arg[i] == '\''){ - is_single_quoted = FALSE; - }else{ - option[j++] = arg[i]; - } - }else if(is_escaped){ - is_escaped = FALSE; - option[j++] = arg[i]; - }else if(arg[i] == '\\'){ - is_escaped = TRUE; - }else if(is_double_quoted){ - if(arg[i] == '"'){ - is_double_quoted = FALSE; - }else{ - option[j++] = arg[i]; - } - }else if(arg[i] == '\''){ - is_single_quoted = TRUE; - }else if(arg[i] == '"'){ - is_double_quoted = TRUE; - }else if(arg[i] == ' '){ - option[j] = '\0'; - options(option); - j = 0; - }else{ - option[j++] = arg[i]; - } - } - if(j){ - option[j] = '\0'; - options(option); - } - return count; -} - -/* - * call-seq: - * NKF.nkf(opt, str) => string - * - * Convert _str_ and return converted result. - * Conversion details are specified by _opt_ as String. - * - * require 'nkf' - * output = NKF.nkf("-s", input) - */ - -static VALUE -rb_nkf_convert(VALUE obj, VALUE opt, VALUE src) -{ - VALUE tmp; - reinit(); - nkf_split_options(StringValueCStr(opt)); - if (!output_encoding) rb_raise(rb_eArgError, "no output encoding given"); - - switch (nkf_enc_to_index(output_encoding)) { - case UTF_8_BOM: output_encoding = nkf_enc_from_index(UTF_8); break; - case UTF_16BE_BOM: output_encoding = nkf_enc_from_index(UTF_16BE); break; - case UTF_16LE_BOM: output_encoding = nkf_enc_from_index(UTF_16LE); break; - case UTF_32BE_BOM: output_encoding = nkf_enc_from_index(UTF_32BE); break; - case UTF_32LE_BOM: output_encoding = nkf_enc_from_index(UTF_32LE); break; - } - output_bom_f = FALSE; - - incsize = INCSIZE; - - input_ctr = 0; - input = (unsigned char *)StringValuePtr(src); - i_len = RSTRING_LENINT(src); - tmp = rb_str_new(0, i_len*3 + 10); - - output_ctr = 0; - output = (unsigned char *)RSTRING_PTR(tmp); - o_len = RSTRING_LENINT(tmp); - *output = '\0'; - - /* use _result_ begin*/ - result = tmp; - kanji_convert(NULL); - result = Qnil; - /* use _result_ end */ - - rb_str_set_len(tmp, output_ctr); - - if (mimeout_f) - rb_enc_associate(tmp, rb_usascii_encoding()); - else - rb_enc_associate(tmp, rb_nkf_enc_get(nkf_enc_name(output_encoding))); - - return tmp; -} - - -/* - * call-seq: - * NKF.guess(str) => encoding - * - * Returns guessed encoding of _str_ by nkf routine. - * - */ - -static VALUE -rb_nkf_guess(VALUE obj, VALUE src) -{ - reinit(); - - input_ctr = 0; - input = (unsigned char *)StringValuePtr(src); - i_len = RSTRING_LENINT(src); - - guess_f = TRUE; - kanji_convert( NULL ); - guess_f = FALSE; - - return rb_enc_from_encoding(rb_nkf_enc_get(get_guessed_code())); -} - - -/* - * NKF - Ruby extension for Network Kanji Filter - * - * == Description - * - * This is a Ruby Extension version of nkf (Network Kanji Filter). - * It converts the first argument and returns converted result. Conversion - * details are specified by flags as the first argument. - * - * *Nkf* is a yet another kanji code converter among networks, hosts and terminals. - * It converts input kanji code to designated kanji code - * such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 or UTF-16. - * - * One of the most unique faculty of *nkf* is the guess of the input kanji encodings. - * It currently recognizes ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 and UTF-16. - * So users needn't set the input kanji code explicitly. - * - * By default, X0201 kana is converted into X0208 kana. - * For X0201 kana, SO/SI, SSO and ESC-(-I methods are supported. - * For automatic code detection, nkf assumes no X0201 kana in Shift_JIS. - * To accept X0201 in Shift_JIS, use <b>-X</b>, <b>-x</b> or <b>-S</b>. - * - * == Flags - * - * === -b -u - * - * Output is buffered (DEFAULT), Output is unbuffered. - * - * === -j -s -e -w -w16 -w32 - * - * Output code is ISO-2022-JP (7bit JIS), Shift_JIS, EUC-JP, - * UTF-8N, UTF-16BE, UTF-32BE. - * Without this option and compile option, ISO-2022-JP is assumed. - * - * === -J -S -E -W -W16 -W32 - * - * Input assumption is JIS 7 bit, Shift_JIS, EUC-JP, - * UTF-8, UTF-16, UTF-32. - * - * ==== -J - * - * Assume JIS input. It also accepts EUC-JP. - * This is the default. This flag does not exclude Shift_JIS. - * - * ==== -S - * - * Assume Shift_JIS and X0201 kana input. It also accepts JIS. - * EUC-JP is recognized as X0201 kana. Without <b>-x</b> flag, - * X0201 kana (halfwidth kana) is converted into X0208. - * - * ==== -E - * - * Assume EUC-JP input. It also accepts JIS. - * Same as -J. - * - * === -t - * - * No conversion. - * - * === -i_ - * - * Output sequence to designate JIS-kanji. (DEFAULT B) - * - * === -o_ - * - * Output sequence to designate ASCII. (DEFAULT B) - * - * === -r - * - * {de/en}crypt ROT13/47 - * - * === \-h[123] --hiragana --katakana --katakana-hiragana - * - * [-h1 --hiragana] Katakana to Hiragana conversion. - * - * [-h2 --katakana] Hiragana to Katakana conversion. - * - * [-h3 --katakana-hiragana] Katakana to Hiragana and Hiragana to Katakana conversion. - * - * === -T - * - * Text mode output (MS-DOS) - * - * === -l - * - * ISO8859-1 (Latin-1) support - * - * === -f[<code>m</code> [- <code>n</code>]] - * - * Folding on <code>m</code> length with <code>n</code> margin in a line. - * Without this option, fold length is 60 and fold margin is 10. - * - * === -F - * - * New line preserving line folding. - * - * === \-Z[0-3] - * - * Convert X0208 alphabet (Fullwidth Alphabets) to ASCII. - * - * [-Z -Z0] Convert X0208 alphabet to ASCII. - * - * [-Z1] Converts X0208 kankaku to single ASCII space. - * - * [-Z2] Converts X0208 kankaku to double ASCII spaces. - * - * [-Z3] Replacing Fullwidth >, <, ", & into '>', '<', '"', '&' as in HTML. - * - * === -X -x - * - * Assume X0201 kana in MS-Kanji. - * With <b>-X</b> or without this option, X0201 is converted into X0208 Kana. - * With <b>-x</b>, try to preserve X0208 kana and do not convert X0201 kana to X0208. - * In JIS output, ESC-(-I is used. In EUC output, SSO is used. - * - * === \-B[0-2] - * - * Assume broken JIS-Kanji input, which lost ESC. - * Useful when your site is using old B-News Nihongo patch. - * - * [-B1] allows any char after ESC-( or ESC-$. - * - * [-B2] forces ASCII after NL. - * - * === -I - * - * Replacing non iso-2022-jp char into a geta character - * (substitute character in Japanese). - * - * === -d -c - * - * Delete \r in line feed, Add \r in line feed. - * - * === \-m[BQN0] - * - * MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT) - * To see ISO8859-1 (Latin-1) -l is necessary. - * - * [-mB] Decode MIME base64 encoded stream. Remove header or other part before - * conversion. - * - * [-mQ] Decode MIME quoted stream. '_' in quoted stream is converted to space. - * - * [-mN] Non-strict decoding. - * It allows line break in the middle of the base64 encoding. - * - * [-m0] No MIME decode. - * - * === -M - * - * MIME encode. Header style. All ASCII code and control characters are intact. - * Kanji conversion is performed before encoding, so this cannot be used as a picture encoder. - * - * [-MB] MIME encode Base64 stream. - * - * [-MQ] Perform quoted encoding. - * - * === -l - * - * Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP. - * <b>-s</b>, <b>-e</b> and <b>-x</b> are not compatible with this option. - * - * === \-L[uwm] - * - * new line mode - * Without this option, nkf doesn't convert line breaks. - * - * [-Lu] unix (LF) - * - * [-Lw] windows (CRLF) - * - * [-Lm] mac (CR) - * - * === --fj --unix --mac --msdos --windows - * - * convert for these system - * - * === --jis --euc --sjis --mime --base64 - * - * convert for named code - * - * === --jis-input --euc-input --sjis-input --mime-input --base64-input - * - * assume input system - * - * === --ic=<code>input codeset</code> --oc=<code>output codeset</code> - * - * Set the input or output codeset. - * NKF supports following codesets and those codeset name are case insensitive. - * - * [ISO-2022-JP] a.k.a. RFC1468, 7bit JIS, JUNET - * - * [EUC-JP (eucJP-nkf)] a.k.a. AT&T JIS, Japanese EUC, UJIS - * - * [eucJP-ascii] a.k.a. x-eucjp-open-19970715-ascii - * - * [eucJP-ms] a.k.a. x-eucjp-open-19970715-ms - * - * [CP51932] Microsoft Version of EUC-JP. - * - * [Shift_JIS] SJIS, MS-Kanji - * - * [Windows-31J] a.k.a. CP932 - * - * [UTF-8] same as UTF-8N - * - * [UTF-8N] UTF-8 without BOM - * - * [UTF-8-BOM] UTF-8 with BOM - * - * [UTF-16] same as UTF-16BE - * - * [UTF-16BE] UTF-16 Big Endian without BOM - * - * [UTF-16BE-BOM] UTF-16 Big Endian with BOM - * - * [UTF-16LE] UTF-16 Little Endian without BOM - * - * [UTF-16LE-BOM] UTF-16 Little Endian with BOM - * - * [UTF-32] same as UTF-32BE - * - * [UTF-32BE] UTF-32 Big Endian without BOM - * - * [UTF-32BE-BOM] UTF-32 Big Endian with BOM - * - * [UTF-32LE] UTF-32 Little Endian without BOM - * - * [UTF-32LE-BOM] UTF-32 Little Endian with BOM - * - * [UTF8-MAC] NKDed UTF-8, a.k.a. UTF8-NFD (input only) - * - * === --fb-{skip, html, xml, perl, java, subchar} - * - * Specify the way that nkf handles unassigned characters. - * Without this option, --fb-skip is assumed. - * - * === --prefix= <code>escape character</code> <code>target character</code> .. - * - * When nkf converts to Shift_JIS, - * nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters. - * 1st byte of argument is the escape character and following bytes are target characters. - * - * === --no-cp932ext - * - * Handle the characters extended in CP932 as unassigned characters. - * - * == --no-best-fit-chars - * - * When Unicode to Encoded byte conversion, - * don't convert characters which is not round trip safe. - * When Unicode to Unicode conversion, - * with this and -x option, nkf can be used as UTF converter. - * (In other words, without this and -x option, nkf doesn't save some characters) - * - * When nkf convert string which related to path, you should use this option. - * - * === --cap-input - * - * Decode hex encoded characters. - * - * === --url-input - * - * Unescape percent escaped characters. - * - * === -- - * - * Ignore rest of -option. - */ - -void -Init_nkf(void) -{ - VALUE mNKF = rb_define_module("NKF"); - - rb_define_module_function(mNKF, "nkf", rb_nkf_convert, 2); - rb_define_module_function(mNKF, "guess", rb_nkf_guess, 1); - rb_define_alias(rb_singleton_class(mNKF), "guess", "guess"); - - rb_define_const(mNKF, "AUTO", Qnil); - rb_define_const(mNKF, "NOCONV", Qnil); - rb_define_const(mNKF, "UNKNOWN", Qnil); - rb_define_const(mNKF, "BINARY", rb_enc_from_encoding(rb_nkf_enc_get("BINARY"))); - rb_define_const(mNKF, "ASCII", rb_enc_from_encoding(rb_nkf_enc_get("US-ASCII"))); - rb_define_const(mNKF, "JIS", rb_enc_from_encoding(rb_nkf_enc_get("ISO-2022-JP"))); - rb_define_const(mNKF, "EUC", rb_enc_from_encoding(rb_nkf_enc_get("EUC-JP"))); - rb_define_const(mNKF, "SJIS", rb_enc_from_encoding(rb_nkf_enc_get("Shift_JIS"))); - rb_define_const(mNKF, "UTF8", rb_enc_from_encoding(rb_utf8_encoding())); - rb_define_const(mNKF, "UTF16", rb_enc_from_encoding(rb_nkf_enc_get("UTF-16BE"))); - rb_define_const(mNKF, "UTF32", rb_enc_from_encoding(rb_nkf_enc_get("UTF-32BE"))); - - /* Full version string of nkf */ - rb_define_const(mNKF, "VERSION", rb_str_new2(RUBY_NKF_VERSION)); - /* Version of nkf */ - rb_define_const(mNKF, "NKF_VERSION", rb_str_new2(NKF_VERSION)); - /* Release date of nkf */ - rb_define_const(mNKF, "NKF_RELEASE_DATE", rb_str_new2(NKF_RELEASE_DATE)); -} diff --git a/ext/nkf/nkf.gemspec b/ext/nkf/nkf.gemspec deleted file mode 100644 index 2d77c71ff8..0000000000 --- a/ext/nkf/nkf.gemspec +++ /dev/null @@ -1,24 +0,0 @@ -Gem::Specification.new do |spec| - spec.name = "nkf" - spec.version = "0.1.1" - spec.authors = ["NARUSE Yui"] - spec.email = ["naruse@airemix.jp"] - - spec.summary = %q{Ruby extension for Network Kanji Filter} - spec.description = %q{Ruby extension for Network Kanji Filter} - spec.homepage = "https://github.com/ruby/nkf" - spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0") - spec.licenses = ["Ruby", "BSD-2-Clause"] - - spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = spec.homepage - - # Specify which files should be added to the gem when it is released. - # The `git ls-files -z` loads the files in the RubyGem that have been added into git. - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - end - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] -end diff --git a/ext/objspace/depend b/ext/objspace/depend index 88c66a232b..a02168b06a 100644 --- a/ext/objspace/depend +++ b/ext/objspace/depend @@ -2,10 +2,12 @@ object_tracing.o: $(RUBY_EXTCONF_H) object_tracing.o: $(arch_hdrdir)/ruby/config.h object_tracing.o: $(hdrdir)/ruby/assert.h +object_tracing.o: $(hdrdir)/ruby/atomic.h object_tracing.o: $(hdrdir)/ruby/backward.h object_tracing.o: $(hdrdir)/ruby/backward/2/assume.h object_tracing.o: $(hdrdir)/ruby/backward/2/attributes.h object_tracing.o: $(hdrdir)/ruby/backward/2/bool.h +object_tracing.o: $(hdrdir)/ruby/backward/2/gcc_version_since.h object_tracing.o: $(hdrdir)/ruby/backward/2/inttypes.h object_tracing.o: $(hdrdir)/ruby/backward/2/limits.h object_tracing.o: $(hdrdir)/ruby/backward/2/long_long.h @@ -13,6 +15,7 @@ object_tracing.o: $(hdrdir)/ruby/backward/2/stdalign.h object_tracing.o: $(hdrdir)/ruby/backward/2/stdarg.h object_tracing.o: $(hdrdir)/ruby/debug.h object_tracing.o: $(hdrdir)/ruby/defines.h +object_tracing.o: $(hdrdir)/ruby/encoding.h object_tracing.o: $(hdrdir)/ruby/intern.h object_tracing.o: $(hdrdir)/ruby/internal/abi.h object_tracing.o: $(hdrdir)/ruby/internal/anyargs.h @@ -52,6 +55,7 @@ object_tracing.o: $(hdrdir)/ruby/internal/attr/noexcept.h object_tracing.o: $(hdrdir)/ruby/internal/attr/noinline.h object_tracing.o: $(hdrdir)/ruby/internal/attr/nonnull.h object_tracing.o: $(hdrdir)/ruby/internal/attr/noreturn.h +object_tracing.o: $(hdrdir)/ruby/internal/attr/packed_struct.h object_tracing.o: $(hdrdir)/ruby/internal/attr/pure.h object_tracing.o: $(hdrdir)/ruby/internal/attr/restrict.h object_tracing.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -84,6 +88,15 @@ object_tracing.o: $(hdrdir)/ruby/internal/core/rtypeddata.h object_tracing.o: $(hdrdir)/ruby/internal/ctype.h object_tracing.o: $(hdrdir)/ruby/internal/dllexport.h object_tracing.o: $(hdrdir)/ruby/internal/dosish.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/coderange.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/ctype.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/encoding.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/pathname.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/re.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/sprintf.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/string.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/symbol.h +object_tracing.o: $(hdrdir)/ruby/internal/encoding/transcode.h object_tracing.o: $(hdrdir)/ruby/internal/error.h object_tracing.o: $(hdrdir)/ruby/internal/eval.h object_tracing.o: $(hdrdir)/ruby/internal/event.h @@ -111,7 +124,6 @@ object_tracing.o: $(hdrdir)/ruby/internal/intern/enumerator.h object_tracing.o: $(hdrdir)/ruby/internal/intern/error.h object_tracing.o: $(hdrdir)/ruby/internal/intern/eval.h object_tracing.o: $(hdrdir)/ruby/internal/intern/file.h -object_tracing.o: $(hdrdir)/ruby/internal/intern/gc.h object_tracing.o: $(hdrdir)/ruby/internal/intern/hash.h object_tracing.o: $(hdrdir)/ruby/internal/intern/io.h object_tracing.o: $(hdrdir)/ruby/internal/intern/load.h @@ -142,12 +154,12 @@ object_tracing.o: $(hdrdir)/ruby/internal/memory.h object_tracing.o: $(hdrdir)/ruby/internal/method.h object_tracing.o: $(hdrdir)/ruby/internal/module.h object_tracing.o: $(hdrdir)/ruby/internal/newobj.h -object_tracing.o: $(hdrdir)/ruby/internal/rgengc.h object_tracing.o: $(hdrdir)/ruby/internal/scan_args.h object_tracing.o: $(hdrdir)/ruby/internal/special_consts.h object_tracing.o: $(hdrdir)/ruby/internal/static_assert.h object_tracing.o: $(hdrdir)/ruby/internal/stdalign.h object_tracing.o: $(hdrdir)/ruby/internal/stdbool.h +object_tracing.o: $(hdrdir)/ruby/internal/stdckdint.h object_tracing.o: $(hdrdir)/ruby/internal/symbol.h object_tracing.o: $(hdrdir)/ruby/internal/value.h object_tracing.o: $(hdrdir)/ruby/internal/value_type.h @@ -155,15 +167,42 @@ object_tracing.o: $(hdrdir)/ruby/internal/variable.h object_tracing.o: $(hdrdir)/ruby/internal/warning_push.h object_tracing.o: $(hdrdir)/ruby/internal/xmalloc.h object_tracing.o: $(hdrdir)/ruby/missing.h +object_tracing.o: $(hdrdir)/ruby/onigmo.h +object_tracing.o: $(hdrdir)/ruby/oniguruma.h object_tracing.o: $(hdrdir)/ruby/ruby.h object_tracing.o: $(hdrdir)/ruby/st.h object_tracing.o: $(hdrdir)/ruby/subst.h +object_tracing.o: $(hdrdir)/ruby/thread_native.h +object_tracing.o: $(top_srcdir)/ccan/check_type/check_type.h +object_tracing.o: $(top_srcdir)/ccan/container_of/container_of.h +object_tracing.o: $(top_srcdir)/ccan/list/list.h +object_tracing.o: $(top_srcdir)/ccan/str/str.h object_tracing.o: $(top_srcdir)/internal.h +object_tracing.o: $(top_srcdir)/internal/array.h +object_tracing.o: $(top_srcdir)/internal/basic_operators.h +object_tracing.o: $(top_srcdir)/internal/compilers.h +object_tracing.o: $(top_srcdir)/internal/gc.h +object_tracing.o: $(top_srcdir)/internal/imemo.h +object_tracing.o: $(top_srcdir)/internal/sanitizers.h +object_tracing.o: $(top_srcdir)/internal/serial.h +object_tracing.o: $(top_srcdir)/internal/static_assert.h +object_tracing.o: $(top_srcdir)/internal/vm.h +object_tracing.o: $(top_srcdir)/internal/warnings.h +object_tracing.o: $(top_srcdir)/method.h +object_tracing.o: $(top_srcdir)/node.h +object_tracing.o: $(top_srcdir)/ruby_assert.h +object_tracing.o: $(top_srcdir)/ruby_atomic.h +object_tracing.o: $(top_srcdir)/rubyparser.h +object_tracing.o: $(top_srcdir)/thread_pthread.h +object_tracing.o: $(top_srcdir)/vm_core.h +object_tracing.o: $(top_srcdir)/vm_opts.h object_tracing.o: object_tracing.c object_tracing.o: objspace.h +object_tracing.o: {$(VPATH)}id.h objspace.o: $(RUBY_EXTCONF_H) objspace.o: $(arch_hdrdir)/ruby/config.h objspace.o: $(hdrdir)/ruby/assert.h +objspace.o: $(hdrdir)/ruby/atomic.h objspace.o: $(hdrdir)/ruby/backward.h objspace.o: $(hdrdir)/ruby/backward/2/assume.h objspace.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -215,6 +254,7 @@ objspace.o: $(hdrdir)/ruby/internal/attr/noexcept.h objspace.o: $(hdrdir)/ruby/internal/attr/noinline.h objspace.o: $(hdrdir)/ruby/internal/attr/nonnull.h objspace.o: $(hdrdir)/ruby/internal/attr/noreturn.h +objspace.o: $(hdrdir)/ruby/internal/attr/packed_struct.h objspace.o: $(hdrdir)/ruby/internal/attr/pure.h objspace.o: $(hdrdir)/ruby/internal/attr/restrict.h objspace.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -284,7 +324,6 @@ objspace.o: $(hdrdir)/ruby/internal/intern/enumerator.h objspace.o: $(hdrdir)/ruby/internal/intern/error.h objspace.o: $(hdrdir)/ruby/internal/intern/eval.h objspace.o: $(hdrdir)/ruby/internal/intern/file.h -objspace.o: $(hdrdir)/ruby/internal/intern/gc.h objspace.o: $(hdrdir)/ruby/internal/intern/hash.h objspace.o: $(hdrdir)/ruby/internal/intern/io.h objspace.o: $(hdrdir)/ruby/internal/intern/load.h @@ -315,12 +354,12 @@ objspace.o: $(hdrdir)/ruby/internal/memory.h objspace.o: $(hdrdir)/ruby/internal/method.h objspace.o: $(hdrdir)/ruby/internal/module.h objspace.o: $(hdrdir)/ruby/internal/newobj.h -objspace.o: $(hdrdir)/ruby/internal/rgengc.h objspace.o: $(hdrdir)/ruby/internal/scan_args.h objspace.o: $(hdrdir)/ruby/internal/special_consts.h objspace.o: $(hdrdir)/ruby/internal/static_assert.h objspace.o: $(hdrdir)/ruby/internal/stdalign.h objspace.o: $(hdrdir)/ruby/internal/stdbool.h +objspace.o: $(hdrdir)/ruby/internal/stdckdint.h objspace.o: $(hdrdir)/ruby/internal/symbol.h objspace.o: $(hdrdir)/ruby/internal/value.h objspace.o: $(hdrdir)/ruby/internal/value_type.h @@ -336,10 +375,17 @@ objspace.o: $(hdrdir)/ruby/regex.h objspace.o: $(hdrdir)/ruby/ruby.h objspace.o: $(hdrdir)/ruby/st.h objspace.o: $(hdrdir)/ruby/subst.h -objspace.o: $(top_srcdir)/gc.h +objspace.o: $(hdrdir)/ruby/thread_native.h +objspace.o: $(top_srcdir)/ccan/check_type/check_type.h +objspace.o: $(top_srcdir)/ccan/container_of/container_of.h +objspace.o: $(top_srcdir)/ccan/list/list.h +objspace.o: $(top_srcdir)/ccan/str/str.h +objspace.o: $(top_srcdir)/constant.h +objspace.o: $(top_srcdir)/debug_counter.h objspace.o: $(top_srcdir)/id_table.h objspace.o: $(top_srcdir)/internal.h objspace.o: $(top_srcdir)/internal/array.h +objspace.o: $(top_srcdir)/internal/basic_operators.h objspace.o: $(top_srcdir)/internal/class.h objspace.o: $(top_srcdir)/internal/compilers.h objspace.o: $(top_srcdir)/internal/gc.h @@ -348,10 +394,21 @@ objspace.o: $(top_srcdir)/internal/imemo.h objspace.o: $(top_srcdir)/internal/sanitizers.h objspace.o: $(top_srcdir)/internal/serial.h objspace.o: $(top_srcdir)/internal/static_assert.h +objspace.o: $(top_srcdir)/internal/variable.h +objspace.o: $(top_srcdir)/internal/vm.h objspace.o: $(top_srcdir)/internal/warnings.h +objspace.o: $(top_srcdir)/method.h objspace.o: $(top_srcdir)/node.h +objspace.o: $(top_srcdir)/ruby_assert.h +objspace.o: $(top_srcdir)/ruby_atomic.h +objspace.o: $(top_srcdir)/rubyparser.h objspace.o: $(top_srcdir)/shape.h objspace.o: $(top_srcdir)/symbol.h +objspace.o: $(top_srcdir)/thread_pthread.h +objspace.o: $(top_srcdir)/vm_core.h +objspace.o: $(top_srcdir)/vm_debug.h +objspace.o: $(top_srcdir)/vm_opts.h +objspace.o: $(top_srcdir)/vm_sync.h objspace.o: objspace.c objspace.o: {$(VPATH)}id.h objspace_dump.o: $(RUBY_EXTCONF_H) @@ -410,6 +467,7 @@ objspace_dump.o: $(hdrdir)/ruby/internal/attr/noexcept.h objspace_dump.o: $(hdrdir)/ruby/internal/attr/noinline.h objspace_dump.o: $(hdrdir)/ruby/internal/attr/nonnull.h objspace_dump.o: $(hdrdir)/ruby/internal/attr/noreturn.h +objspace_dump.o: $(hdrdir)/ruby/internal/attr/packed_struct.h objspace_dump.o: $(hdrdir)/ruby/internal/attr/pure.h objspace_dump.o: $(hdrdir)/ruby/internal/attr/restrict.h objspace_dump.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -478,7 +536,6 @@ objspace_dump.o: $(hdrdir)/ruby/internal/intern/enumerator.h objspace_dump.o: $(hdrdir)/ruby/internal/intern/error.h objspace_dump.o: $(hdrdir)/ruby/internal/intern/eval.h objspace_dump.o: $(hdrdir)/ruby/internal/intern/file.h -objspace_dump.o: $(hdrdir)/ruby/internal/intern/gc.h objspace_dump.o: $(hdrdir)/ruby/internal/intern/hash.h objspace_dump.o: $(hdrdir)/ruby/internal/intern/io.h objspace_dump.o: $(hdrdir)/ruby/internal/intern/load.h @@ -509,12 +566,12 @@ objspace_dump.o: $(hdrdir)/ruby/internal/memory.h objspace_dump.o: $(hdrdir)/ruby/internal/method.h objspace_dump.o: $(hdrdir)/ruby/internal/module.h objspace_dump.o: $(hdrdir)/ruby/internal/newobj.h -objspace_dump.o: $(hdrdir)/ruby/internal/rgengc.h objspace_dump.o: $(hdrdir)/ruby/internal/scan_args.h objspace_dump.o: $(hdrdir)/ruby/internal/special_consts.h objspace_dump.o: $(hdrdir)/ruby/internal/static_assert.h objspace_dump.o: $(hdrdir)/ruby/internal/stdalign.h objspace_dump.o: $(hdrdir)/ruby/internal/stdbool.h +objspace_dump.o: $(hdrdir)/ruby/internal/stdckdint.h objspace_dump.o: $(hdrdir)/ruby/internal/symbol.h objspace_dump.o: $(hdrdir)/ruby/internal/value.h objspace_dump.o: $(hdrdir)/ruby/internal/value_type.h @@ -535,14 +592,17 @@ objspace_dump.o: $(top_srcdir)/ccan/container_of/container_of.h objspace_dump.o: $(top_srcdir)/ccan/list/list.h objspace_dump.o: $(top_srcdir)/ccan/str/str.h objspace_dump.o: $(top_srcdir)/constant.h -objspace_dump.o: $(top_srcdir)/gc.h +objspace_dump.o: $(top_srcdir)/debug_counter.h objspace_dump.o: $(top_srcdir)/id_table.h objspace_dump.o: $(top_srcdir)/internal.h objspace_dump.o: $(top_srcdir)/internal/array.h +objspace_dump.o: $(top_srcdir)/internal/basic_operators.h +objspace_dump.o: $(top_srcdir)/internal/class.h objspace_dump.o: $(top_srcdir)/internal/compilers.h objspace_dump.o: $(top_srcdir)/internal/gc.h objspace_dump.o: $(top_srcdir)/internal/hash.h objspace_dump.o: $(top_srcdir)/internal/imemo.h +objspace_dump.o: $(top_srcdir)/internal/io.h objspace_dump.o: $(top_srcdir)/internal/sanitizers.h objspace_dump.o: $(top_srcdir)/internal/serial.h objspace_dump.o: $(top_srcdir)/internal/static_assert.h @@ -554,10 +614,15 @@ objspace_dump.o: $(top_srcdir)/method.h objspace_dump.o: $(top_srcdir)/node.h objspace_dump.o: $(top_srcdir)/ruby_assert.h objspace_dump.o: $(top_srcdir)/ruby_atomic.h +objspace_dump.o: $(top_srcdir)/rubyparser.h objspace_dump.o: $(top_srcdir)/shape.h +objspace_dump.o: $(top_srcdir)/symbol.h objspace_dump.o: $(top_srcdir)/thread_pthread.h +objspace_dump.o: $(top_srcdir)/vm_callinfo.h objspace_dump.o: $(top_srcdir)/vm_core.h +objspace_dump.o: $(top_srcdir)/vm_debug.h objspace_dump.o: $(top_srcdir)/vm_opts.h +objspace_dump.o: $(top_srcdir)/vm_sync.h objspace_dump.o: objspace.h objspace_dump.o: objspace_dump.c objspace_dump.o: {$(VPATH)}id.h diff --git a/ext/objspace/lib/objspace.rb b/ext/objspace/lib/objspace.rb index 0298b0646c..47873f5112 100644 --- a/ext/objspace/lib/objspace.rb +++ b/ext/objspace/lib/objspace.rb @@ -6,17 +6,21 @@ module ObjectSpace class << self private :_dump private :_dump_all + private :_dump_shapes end module_function - # call-seq: - # ObjectSpace.dump(obj[, output: :string]) # => "{ ... }" - # ObjectSpace.dump(obj, output: :file) # => #<File:/tmp/rubyobj20131125-88733-1xkfmpv.json> - # ObjectSpace.dump(obj, output: :stdout) # => nil - # # Dump the contents of a ruby object as JSON. # + # _output_ can be one of: +:stdout+, +:file+, +:string+, or IO object. + # + # * +:file+ means dumping to a tempfile and returning corresponding File object; + # * +:stdout+ means printing the dump and returning +nil+; + # * +:string+ means returning a string with the dump; + # * if an instance of IO object is provided, the output goes there, and the object + # is returned. + # # 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 @@ -42,38 +46,78 @@ module ObjectSpace end - # call-seq: - # ObjectSpace.dump_all([output: :file]) # => #<File:/tmp/rubyheap20131125-88469-laoj3v.json> - # ObjectSpace.dump_all(output: :stdout) # => nil - # ObjectSpace.dump_all(output: :string) # => "{...}\n{...}\n..." - # ObjectSpace.dump_all(output: - # File.open('heap.json','w')) # => #<File:heap.json> - # ObjectSpace.dump_all(output: :string, - # since: 42) # => "{...}\n{...}\n..." + # Dump the contents of the ruby heap as JSON. + # + # _output_ argument is the same as for #dump. + # + # _full_ must be a boolean. If true, all heap slots are dumped including the empty ones (+T_NONE+). # - # Dump the contents of the ruby heap as JSON. + # _since_ must be a non-negative integer or +nil+. # - # _since_ must be a non-negative integer or +nil+. + # If _since_ is a positive integer, only objects of that generation and + # newer generations are dumped. The current generation can be accessed using + # GC::count. Objects that were allocated without object allocation tracing enabled + # are ignored. See ::trace_object_allocations for more information and + # examples. # - # If _since_ is a positive integer, only objects of that generation and - # newer generations are dumped. The current generation can be accessed using - # GC::count. + # If _since_ is omitted or is +nil+, all objects are dumped. # - # Objects that were allocated without object allocation tracing enabled - # are ignored. See ::trace_object_allocations for more information and - # examples. + # _shapes_ must be a boolean or a non-negative integer. # - # If _since_ is omitted or is +nil+, all objects are dumped. + # If _shapes_ is a positive integer, only shapes newer than the provided + # shape id are dumped. The current shape_id can be accessed using <tt>RubyVM.stat(:next_shape_id)</tt>. + # + # If _shapes_ is +false+, no shapes are dumped. + # + # To only dump objects allocated past a certain point you can combine _since_ and _shapes_: + # ObjectSpace.trace_object_allocations + # GC.start + # gc_generation = GC.count + # shape_generation = RubyVM.stat(:next_shape_id) + # call_method_to_instrument + # ObjectSpace.dump_all(since: gc_generation, shapes: shape_generation) + # + # 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. + def dump_all(output: :file, full: false, since: nil, shapes: true) + out = case output + when :file, nil + require 'tempfile' + Tempfile.create(%w(rubyheap .json)) + when :stdout + STDOUT + when :string + +'' + when IO + output + else + raise ArgumentError, "wrong output option: #{output.inspect}" + end + + shapes = 0 if shapes == true + ret = _dump_all(out, full, since, shapes) + return nil if output == :stdout + ret + end + + # Dump the contents of the ruby shape tree as JSON. + # + # _output_ argument is the same as for #dump. + # + # If _since_ is a positive integer, only shapes newer than the provided + # shape id are dumped. The current shape_id can be accessed using <tt>RubyVM.stat(:next_shape_id)</tt>. # # 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. - def dump_all(output: :file, full: false, since: nil) + def dump_shapes(output: :file, since: 0) out = case output when :file, nil require 'tempfile' - Tempfile.create(%w(rubyheap .json)) + Tempfile.create(%w(rubyshapes .json)) when :stdout STDOUT when :string @@ -84,7 +128,7 @@ module ObjectSpace raise ArgumentError, "wrong output option: #{output.inspect}" end - ret = _dump_all(out, full, since) + ret = _dump_shapes(out, since) return nil if output == :stdout ret end diff --git a/ext/objspace/object_tracing.c b/ext/objspace/object_tracing.c index 0bf866a8f1..c1c93c51f5 100644 --- a/ext/objspace/object_tracing.c +++ b/ext/objspace/object_tracing.c @@ -14,6 +14,7 @@ **********************************************************************/ #include "internal.h" +#include "internal/gc.h" #include "ruby/debug.h" #include "objspace.h" @@ -121,6 +122,10 @@ freeobj_i(VALUE tpval, void *data) st_data_t v; struct allocation_info *info; + /* Modifying the st table can cause allocations, which can trigger GC. + * Since freeobj_i is called during GC, it must not trigger another GC. */ + VALUE gc_disabled = rb_gc_disable_no_rest(); + if (arg->keep_remains) { if (st_lookup(arg->object_table, obj, &v)) { info = (struct allocation_info *)v; @@ -135,6 +140,8 @@ freeobj_i(VALUE tpval, void *data) ruby_xfree(info); } } + + if (gc_disabled == Qfalse) rb_gc_enable(); } static int diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c index ca08604c95..24d7bd419f 100644 --- a/ext/objspace/objspace.c +++ b/ext/objspace/objspace.c @@ -12,14 +12,13 @@ **********************************************************************/ -#include "gc.h" #include "internal.h" #include "internal/class.h" #include "internal/compilers.h" +#include "internal/gc.h" #include "internal/hash.h" #include "internal/imemo.h" #include "internal/sanitizers.h" -#include "node.h" #include "ruby/io.h" #include "ruby/re.h" #include "ruby/st.h" @@ -170,8 +169,7 @@ setup_hash(int argc, VALUE *argv) hash = rb_hash_new(); } else if (!RHASH_EMPTY_P(hash)) { - /* WB: no new reference */ - st_foreach(RHASH_TBL_RAW(hash), set_zero_i, hash); + rb_hash_foreach(hash, set_zero_i, (st_data_t)hash); } return hash; @@ -337,17 +335,6 @@ count_symbols(int argc, VALUE *argv, VALUE os) return hash; } -static void -cn_i(VALUE v, void *n) -{ - size_t *nodes = (size_t *)n; - - if (BUILTIN_TYPE(v) == T_NODE) { - size_t s = nd_type((NODE *)v); - nodes[s]++; - } -} - /* * call-seq: * ObjectSpace.count_nodes([result_hash]) -> hash @@ -374,135 +361,7 @@ cn_i(VALUE v, void *n) static VALUE count_nodes(int argc, VALUE *argv, VALUE os) { - size_t nodes[NODE_LAST+1]; - enum node_type i; - VALUE hash = setup_hash(argc, argv); - - for (i = 0; i <= NODE_LAST; i++) { - nodes[i] = 0; - } - - each_object_with_flags(cn_i, &nodes[0]); - - for (i=0; i<NODE_LAST; i++) { - if (nodes[i] != 0) { - VALUE node; - switch (i) { -#define COUNT_NODE(n) case n: node = ID2SYM(rb_intern(#n)); goto set - COUNT_NODE(NODE_SCOPE); - COUNT_NODE(NODE_BLOCK); - COUNT_NODE(NODE_IF); - COUNT_NODE(NODE_UNLESS); - COUNT_NODE(NODE_CASE); - COUNT_NODE(NODE_CASE2); - COUNT_NODE(NODE_CASE3); - COUNT_NODE(NODE_WHEN); - COUNT_NODE(NODE_IN); - COUNT_NODE(NODE_WHILE); - COUNT_NODE(NODE_UNTIL); - COUNT_NODE(NODE_ITER); - COUNT_NODE(NODE_FOR); - COUNT_NODE(NODE_FOR_MASGN); - COUNT_NODE(NODE_BREAK); - COUNT_NODE(NODE_NEXT); - COUNT_NODE(NODE_REDO); - COUNT_NODE(NODE_RETRY); - COUNT_NODE(NODE_BEGIN); - COUNT_NODE(NODE_RESCUE); - COUNT_NODE(NODE_RESBODY); - COUNT_NODE(NODE_ENSURE); - COUNT_NODE(NODE_AND); - COUNT_NODE(NODE_OR); - COUNT_NODE(NODE_MASGN); - COUNT_NODE(NODE_LASGN); - COUNT_NODE(NODE_DASGN); - COUNT_NODE(NODE_GASGN); - COUNT_NODE(NODE_IASGN); - COUNT_NODE(NODE_CDECL); - COUNT_NODE(NODE_CVASGN); - COUNT_NODE(NODE_OP_ASGN1); - 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_OPCALL); - COUNT_NODE(NODE_FCALL); - COUNT_NODE(NODE_VCALL); - COUNT_NODE(NODE_QCALL); - COUNT_NODE(NODE_SUPER); - COUNT_NODE(NODE_ZSUPER); - COUNT_NODE(NODE_LIST); - COUNT_NODE(NODE_ZLIST); - COUNT_NODE(NODE_VALUES); - COUNT_NODE(NODE_HASH); - COUNT_NODE(NODE_RETURN); - COUNT_NODE(NODE_YIELD); - COUNT_NODE(NODE_LVAR); - COUNT_NODE(NODE_DVAR); - COUNT_NODE(NODE_GVAR); - COUNT_NODE(NODE_IVAR); - COUNT_NODE(NODE_CONST); - COUNT_NODE(NODE_CVAR); - COUNT_NODE(NODE_NTH_REF); - COUNT_NODE(NODE_BACK_REF); - COUNT_NODE(NODE_MATCH); - COUNT_NODE(NODE_MATCH2); - COUNT_NODE(NODE_MATCH3); - COUNT_NODE(NODE_LIT); - COUNT_NODE(NODE_STR); - COUNT_NODE(NODE_DSTR); - COUNT_NODE(NODE_XSTR); - COUNT_NODE(NODE_DXSTR); - COUNT_NODE(NODE_EVSTR); - COUNT_NODE(NODE_DREGX); - COUNT_NODE(NODE_ONCE); - 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); - COUNT_NODE(NODE_SPLAT); - COUNT_NODE(NODE_BLOCK_PASS); - COUNT_NODE(NODE_DEFN); - COUNT_NODE(NODE_DEFS); - COUNT_NODE(NODE_ALIAS); - COUNT_NODE(NODE_VALIAS); - COUNT_NODE(NODE_UNDEF); - COUNT_NODE(NODE_CLASS); - COUNT_NODE(NODE_MODULE); - COUNT_NODE(NODE_SCLASS); - COUNT_NODE(NODE_COLON2); - COUNT_NODE(NODE_COLON3); - COUNT_NODE(NODE_DOT2); - COUNT_NODE(NODE_DOT3); - COUNT_NODE(NODE_FLIP2); - COUNT_NODE(NODE_FLIP3); - COUNT_NODE(NODE_SELF); - COUNT_NODE(NODE_NIL); - COUNT_NODE(NODE_TRUE); - COUNT_NODE(NODE_FALSE); - COUNT_NODE(NODE_ERRINFO); - COUNT_NODE(NODE_DEFINED); - COUNT_NODE(NODE_POSTEXE); - COUNT_NODE(NODE_DSYM); - COUNT_NODE(NODE_ATTRASGN); - COUNT_NODE(NODE_LAMBDA); - COUNT_NODE(NODE_ARYPTN); - COUNT_NODE(NODE_FNDPTN); - COUNT_NODE(NODE_HSHPTN); - COUNT_NODE(NODE_ERROR); -#undef COUNT_NODE - case NODE_LAST: break; - } - UNREACHABLE; - set: - rb_hash_aset(hash, node, SIZET2NUM(nodes[i])); - } - } - return hash; + return setup_hash(argc, argv); } static void @@ -764,7 +623,7 @@ collect_values(st_data_t key, st_data_t value, st_data_t data) * * With this method, you can find memory leaks. * - * This method is only expected to work except with C Ruby. + * This method is only expected to work with C Ruby. * * Example: * ObjectSpace.reachable_objects_from(['a', 'b', 'c']) @@ -954,7 +813,7 @@ void Init_objspace_dump(VALUE rb_mObjSpace); * * You need to <code>require 'objspace'</code> to use this extension module. * - * Generally, you *SHOULD NOT* use this library if you do not know + * 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 about MRI * memory usage. diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c index 61fa0f04ac..bb479b91c5 100644 --- a/ext/objspace/objspace_dump.c +++ b/ext/objspace/objspace_dump.c @@ -12,17 +12,23 @@ **********************************************************************/ -#include "gc.h" +#include "id_table.h" #include "internal.h" #include "internal/array.h" +#include "internal/class.h" +#include "internal/gc.h" #include "internal/hash.h" +#include "internal/io.h" #include "internal/string.h" #include "internal/sanitizers.h" +#include "symbol.h" +#include "shape.h" #include "node.h" #include "objspace.h" #include "ruby/debug.h" #include "ruby/util.h" #include "ruby/io.h" +#include "vm_callinfo.h" #include "vm_core.h" RUBY_EXTERN const char ruby_hexdigits[]; @@ -42,6 +48,7 @@ struct dump_config { unsigned int full_heap: 1; unsigned int partial_dump; size_t since; + size_t shapes_since; unsigned long buffer_len; char buffer[BUFFER_CAPACITY]; }; @@ -161,10 +168,8 @@ dump_append_c(struct dump_config *dc, unsigned char c) } static void -dump_append_ref(struct dump_config *dc, VALUE ref) +dump_append_ptr(struct dump_config *dc, VALUE ref) { - RUBY_ASSERT(ref > 0); - char buffer[roomof(sizeof(VALUE) * CHAR_BIT, 4) + rb_strlen_lit("\"0x\"")]; char *buffer_start, *buffer_end; @@ -181,6 +186,14 @@ dump_append_ref(struct dump_config *dc, VALUE ref) } static void +dump_append_ref(struct dump_config *dc, VALUE ref) +{ + RUBY_ASSERT(ref > 0); + dump_append_ptr(dc, ref); +} + + +static void dump_append_string_value(struct dump_config *dc, VALUE obj) { long i; @@ -350,6 +363,21 @@ dump_append_string_content(struct dump_config *dc, VALUE obj) } } +static inline void +dump_append_id(struct dump_config *dc, ID id) +{ + VALUE str = rb_sym2str(ID2SYM(id)); + if (RTEST(str)) { + dump_append_string_value(dc, str); + } + else { + dump_append(dc, "\"ID_INTERNAL("); + dump_append_sizet(dc, rb_id_to_serial(id)); + dump_append(dc, ")\""); + } +} + + static void dump_object(VALUE obj, struct dump_config *dc) { @@ -358,6 +386,7 @@ dump_object(VALUE obj, struct dump_config *dc) rb_io_t *fptr; ID flags[RB_OBJ_GC_FLAGS_MAX]; size_t n, i; + ID mid; if (SPECIAL_CONST_P(obj)) { dump_append_special_const(dc, obj); @@ -366,7 +395,11 @@ dump_object(VALUE obj, struct dump_config *dc) dc->cur_obj = obj; dc->cur_obj_references = 0; - dc->cur_obj_klass = BUILTIN_TYPE(obj) == T_NODE ? 0 : RBASIC_CLASS(obj); + if (BUILTIN_TYPE(obj) == T_NODE || BUILTIN_TYPE(obj) == T_IMEMO) { + dc->cur_obj_klass = 0; + } else { + dc->cur_obj_klass = RBASIC_CLASS(obj); + } if (dc->partial_dump && (!ainfo || ainfo->generation < dc->since)) { return; @@ -382,6 +415,10 @@ dump_object(VALUE obj, struct dump_config *dc) dump_append(dc, obj_type(obj)); dump_append(dc, "\""); + size_t shape_id = rb_shape_get_shape_id(obj); + dump_append(dc, ", \"shape_id\":"); + dump_append_sizet(dc, shape_id); + dump_append(dc, ", \"slot_size\":"); dump_append_sizet(dc, dc->cur_page_slot_size); @@ -401,6 +438,33 @@ dump_object(VALUE obj, struct dump_config *dc) dump_append(dc, ", \"imemo_type\":\""); dump_append(dc, rb_imemo_name(imemo_type(obj))); dump_append(dc, "\""); + + switch (imemo_type(obj)) { + case imemo_callinfo: + mid = vm_ci_mid((const struct rb_callinfo *)obj); + if (mid != 0) { + dump_append(dc, ", \"mid\":"); + dump_append_id(dc, mid); + } + break; + + case imemo_callcache: + mid = vm_cc_cme((const struct rb_callcache *)obj)->called_id; + if (mid != 0) { + dump_append(dc, ", \"called_id\":"); + dump_append_id(dc, mid); + + VALUE klass = ((const struct rb_callcache *)obj)->klass; + if (klass != 0) { + dump_append(dc, ", \"receiver_class\":"); + dump_append_ref(dc, klass); + } + } + break; + + default: + break; + } break; case T_SYMBOL: @@ -412,6 +476,8 @@ dump_object(VALUE obj, struct dump_config *dc) dump_append(dc, ", \"embedded\":true"); if (FL_TEST(obj, RSTRING_FSTR)) dump_append(dc, ", \"fstring\":true"); + if (CHILLED_STRING_P(obj)) + dump_append(dc, ", \"chilled\":true"); if (STR_SHARED_P(obj)) dump_append(dc, ", \"shared\":true"); else @@ -471,6 +537,9 @@ dump_object(VALUE obj, struct dump_config *dc) break; case T_CLASS: + dump_append(dc, ", \"variation_count\":"); + dump_append_d(dc, RCLASS_EXT(obj)->variation_count); + case T_MODULE: if (rb_class_get_superclass(obj)) { dump_append(dc, ", \"superclass\":"); @@ -493,7 +562,7 @@ dump_object(VALUE obj, struct dump_config *dc) } } - if (FL_TEST(obj, FL_SINGLETON)) { + if (RCLASS_SINGLETON_P(obj)) { dump_append(dc, ", \"singleton\":true"); } } @@ -514,8 +583,15 @@ dump_object(VALUE obj, struct dump_config *dc) break; case T_OBJECT: + if (FL_TEST(obj, ROBJECT_EMBED)) { + dump_append(dc, ", \"embedded\":true"); + } + dump_append(dc, ", \"ivars\":"); - dump_append_lu(dc, ROBJECT_IV_CAPACITY(obj)); + dump_append_lu(dc, ROBJECT_IV_COUNT(obj)); + if (rb_shape_obj_too_complex(obj)) { + dump_append(dc, ", \"too_complex_shape\":true"); + } break; case T_FILE: @@ -619,7 +695,7 @@ root_obj_i(const char *category, VALUE obj, void *data) } static void -dump_output(struct dump_config *dc, VALUE output, VALUE full, VALUE since) +dump_output(struct dump_config *dc, VALUE output, VALUE full, VALUE since, VALUE shapes) { dc->full_heap = 0; @@ -645,6 +721,8 @@ dump_output(struct dump_config *dc, VALUE output, VALUE full, VALUE since) else { dc->partial_dump = 0; } + + dc->shapes_since = RTEST(shapes) ? NUM2SIZET(shapes) : 0; } static VALUE @@ -661,6 +739,7 @@ dump_result(struct dump_config *dc) } } +/* :nodoc: */ static VALUE objspace_dump(VALUE os, VALUE obj, VALUE output) { @@ -669,18 +748,77 @@ objspace_dump(VALUE os, VALUE obj, VALUE output) dc.cur_page_slot_size = rb_gc_obj_slot_size(obj); } - dump_output(&dc, output, Qnil, Qnil); + dump_output(&dc, output, Qnil, Qnil, Qnil); dump_object(obj, &dc); return dump_result(&dc); } +static void +shape_i(rb_shape_t *shape, void *data) +{ + struct dump_config *dc = (struct dump_config *)data; + + size_t shape_id = rb_shape_id(shape); + if (shape_id < dc->shapes_since) { + return; + } + + dump_append(dc, "{\"address\":"); + dump_append_ref(dc, (VALUE)shape); + + dump_append(dc, ", \"type\":\"SHAPE\", \"id\":"); + dump_append_sizet(dc, shape_id); + + if (shape->type != SHAPE_ROOT) { + dump_append(dc, ", \"parent_id\":"); + dump_append_lu(dc, shape->parent_id); + } + + dump_append(dc, ", \"depth\":"); + dump_append_sizet(dc, rb_shape_depth(shape)); + + dump_append(dc, ", \"shape_type\":"); + switch((enum shape_type)shape->type) { + case SHAPE_ROOT: + dump_append(dc, "\"ROOT\""); + break; + case SHAPE_IVAR: + dump_append(dc, "\"IVAR\""); + + dump_append(dc, ",\"edge_name\":"); + dump_append_id(dc, shape->edge_name); + + break; + case SHAPE_FROZEN: + dump_append(dc, "\"FROZEN\""); + break; + case SHAPE_T_OBJECT: + dump_append(dc, "\"T_OBJECT\""); + break; + case SHAPE_OBJ_TOO_COMPLEX: + dump_append(dc, "\"OBJ_TOO_COMPLEX\""); + break; + default: + rb_bug("[objspace] unexpected shape type"); + } + + dump_append(dc, ", \"edges\":"); + dump_append_sizet(dc, rb_shape_edges_count(shape)); + + dump_append(dc, ", \"memsize\":"); + dump_append_sizet(dc, rb_shape_memsize(shape)); + + dump_append(dc, "}\n"); +} + +/* :nodoc: */ static VALUE -objspace_dump_all(VALUE os, VALUE output, VALUE full, VALUE since) +objspace_dump_all(VALUE os, VALUE output, VALUE full, VALUE since, VALUE shapes) { struct dump_config dc = {0,}; - dump_output(&dc, output, full, since); + dump_output(&dc, output, full, since, shapes); if (!dc.partial_dump || dc.since == 0) { /* dump roots */ @@ -688,12 +826,29 @@ objspace_dump_all(VALUE os, VALUE output, VALUE full, VALUE since) if (dc.roots) dump_append(&dc, "]}\n"); } + if (RTEST(shapes)) { + rb_shape_each_shape(shape_i, &dc); + } + /* dump all objects */ rb_objspace_each_objects(heap_i, &dc); return dump_result(&dc); } +/* :nodoc: */ +static VALUE +objspace_dump_shapes(VALUE os, VALUE output, VALUE shapes) +{ + struct dump_config dc = {0,}; + dump_output(&dc, output, Qfalse, Qnil, shapes); + + if (RTEST(shapes)) { + rb_shape_each_shape(shape_i, &dc); + } + return dump_result(&dc); +} + void Init_objspace_dump(VALUE rb_mObjSpace) { @@ -703,7 +858,8 @@ Init_objspace_dump(VALUE rb_mObjSpace) #endif rb_define_module_function(rb_mObjSpace, "_dump", objspace_dump, 2); - rb_define_module_function(rb_mObjSpace, "_dump_all", objspace_dump_all, 3); + rb_define_module_function(rb_mObjSpace, "_dump_all", objspace_dump_all, 4); + rb_define_module_function(rb_mObjSpace, "_dump_shapes", objspace_dump_shapes, 2); /* force create static IDs */ rb_obj_gc_flags(rb_mObjSpace, 0, 0); diff --git a/ext/openssl/History.md b/ext/openssl/History.md index a4f6bd7fd6..3249f6617a 100644 --- a/ext/openssl/History.md +++ b/ext/openssl/History.md @@ -1,3 +1,93 @@ +Version 3.2.0 +============= + +Compatibility +------------- + +* Ruby >= 2.7 + - Support for Ruby 2.6 has been removed. Note that Ruby 2.6 reached the + end-of-life in 2022-04. + [[GitHub #639]](https://github.com/ruby/openssl/pull/639) +* OpenSSL >= 1.0.2 or LibreSSL >= 3.1 + +Notable changes +--------------- + +* Add a stub gemspec for JRuby, which depends on the `jruby-openssl` gem. + [[GitHub #598]](https://github.com/ruby/openssl/pull/598) +* Add support for the FIPS module in OpenSSL 3.0/3.1. + [[GitHub #608]](https://github.com/ruby/openssl/pull/608) +* Rework `OpenSSL::PKey` routines for loading DER or PEM encoded keys for better + compatibility with OpenSSL 3.0/3.1 with the FIPS module. + [[GitHub #615]](https://github.com/ruby/openssl/pull/615) + [[GitHub #669]](https://github.com/ruby/openssl/pull/669) +* Add `OpenSSL::Provider` module for loading and unloading OpenSSL 3 providers. + [[GitHub #635]](https://github.com/ruby/openssl/pull/635) +* Add `OpenSSL::PKey.new_raw_private_key`, `.new_raw_public_key`, + `OpenSSL::PKey::PKey#raw_private_key`, and `#raw_public_key` for public key + algorithms that use "raw private/public key", such as X25519 and Ed25519. + [[GitHub #646]](https://github.com/ruby/openssl/pull/646) +* Improve OpenSSL error messages to include additional information when + it is available in OpenSSL's error queue. + [[GitHub #648]](https://github.com/ruby/openssl/pull/648) +* Change `OpenSSL::SSL::SSLContext#ca_file=` and `#ca_path=` to raise + `OpenSSL::SSL::SSLError` instead of printing a warning message. + [[GitHub #659]](https://github.com/ruby/openssl/pull/659) +* Allow `OpenSSL::X509::ExtensionFactory#create_extension` to take OIDs in the + dotted-decimal notation. + [[GitHub #141]](https://github.com/ruby/openssl/pull/141) + + +Version 3.1.0 +============= + +Ruby/OpenSSL 3.1 will be maintained for the lifetime of Ruby 3.2. + +Merged bug fixes in 2.2.3 and 3.0.2. Among the new features and changes are: + +Notable changes +--------------- + +* Add `OpenSSL::SSL::SSLContext#ciphersuites=` to allow setting TLS 1.3 cipher + suites. + [[GitHub #493]](https://github.com/ruby/openssl/pull/493) +* Add `OpenSSL::SSL::SSLSocket#export_keying_material` for exporting keying + material of the session, as defined in RFC 5705. + [[GitHub #530]](https://github.com/ruby/openssl/pull/530) +* Add `OpenSSL::SSL::SSLContext#keylog_cb=` for setting the TLS key logging + callback, which is useful for supporting NSS's SSLKEYLOGFILE debugging output. + [[GitHub #536]](https://github.com/ruby/openssl/pull/536) +* Remove the default digest algorithm from `OpenSSL::OCSP::BasicResponse#sign` + and `OpenSSL::OCSP::Request#sign`. Omitting the 5th parameter of these + methods used to be equivalent of specifying SHA-1. This default value is now + removed and we will let the underlying OpenSSL library decide instead. + [[GitHub #507]](https://github.com/ruby/openssl/pull/507) +* Add `OpenSSL::BN#mod_sqrt`. + [[GitHub #553]](https://github.com/ruby/openssl/pull/553) +* Allow calling `OpenSSL::Cipher#update` with an empty string. This was + prohibited to workaround an ancient bug in OpenSSL. + [[GitHub #568]](https://github.com/ruby/openssl/pull/568) +* Fix build on platforms without socket support, such as WASI. `OpenSSL::SSL` + will not be defined if OpenSSL is compiled with `OPENSSL_NO_SOCK`. + [[GitHub #558]](https://github.com/ruby/openssl/pull/558) +* Improve support for recent LibreSSL versions. This includes HKDF support in + LibreSSL 3.6 and Ed25519 support in LibreSSL 3.7. + + +Version 3.0.2 +============= + +Merged changes in 2.2.3. Additionally, the following issues are fixed by this +release. + +Bug fixes +--------- + +* Fix OpenSSL::PKey::EC#check_key not working correctly on OpenSSL 3.0. + [[GitHub #563]](https://github.com/ruby/openssl/issues/563) + [[GitHub #580]](https://github.com/ruby/openssl/pull/580) + + Version 3.0.1 ============= @@ -124,6 +214,21 @@ Notable changes [[GitHub #342]](https://github.com/ruby/openssl/issues/342) +Version 2.2.3 +============= + +Bug fixes +--------- + +* Fix serveral methods in OpenSSL::PKey::EC::Point attempting to raise an error + with an incorrect class, which would end up with a TypeError. + [[GitHub #570]](https://github.com/ruby/openssl/pull/570) +* Fix OpenSSL::PKey::EC::Point#eql? and OpenSSL::PKey::EC::Group#eql? + incorrectly treated OpenSSL's internal errors as "not equal". + [[GitHub #564]](https://github.com/ruby/openssl/pull/564) +* Fix build with LibreSSL 3.5 or later. + + Version 2.2.2 ============= @@ -352,7 +457,7 @@ Security fixes Bug fixes --------- -* Fixed OpenSSL::PKey::*.{new,generate} immediately aborting if the thread is +* Fixed OpenSSL::PKey::\*.{new,generate} immediately aborting if the thread is interrupted. [[Bug #14882]](https://bugs.ruby-lang.org/issues/14882) [[GitHub #205]](https://github.com/ruby/openssl/pull/205) diff --git a/ext/openssl/depend b/ext/openssl/depend index c38d224c85..12c6793939 100644 --- a/ext/openssl/depend +++ b/ext/openssl/depend @@ -57,6 +57,7 @@ ossl.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl.o: $(hdrdir)/ruby/internal/attr/pure.h ossl.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -125,7 +126,6 @@ ossl.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl.o: $(hdrdir)/ruby/internal/intern/error.h ossl.o: $(hdrdir)/ruby/internal/intern/eval.h ossl.o: $(hdrdir)/ruby/internal/intern/file.h -ossl.o: $(hdrdir)/ruby/internal/intern/gc.h ossl.o: $(hdrdir)/ruby/internal/intern/hash.h ossl.o: $(hdrdir)/ruby/internal/intern/io.h ossl.o: $(hdrdir)/ruby/internal/intern/load.h @@ -156,12 +156,12 @@ ossl.o: $(hdrdir)/ruby/internal/memory.h ossl.o: $(hdrdir)/ruby/internal/method.h ossl.o: $(hdrdir)/ruby/internal/module.h ossl.o: $(hdrdir)/ruby/internal/newobj.h -ossl.o: $(hdrdir)/ruby/internal/rgengc.h ossl.o: $(hdrdir)/ruby/internal/scan_args.h ossl.o: $(hdrdir)/ruby/internal/special_consts.h ossl.o: $(hdrdir)/ruby/internal/static_assert.h ossl.o: $(hdrdir)/ruby/internal/stdalign.h ossl.o: $(hdrdir)/ruby/internal/stdbool.h +ossl.o: $(hdrdir)/ruby/internal/stdckdint.h ossl.o: $(hdrdir)/ruby/internal/symbol.h ossl.o: $(hdrdir)/ruby/internal/value.h ossl.o: $(hdrdir)/ruby/internal/value_type.h @@ -193,6 +193,7 @@ ossl.o: ossl_ocsp.h ossl.o: ossl_pkcs12.h ossl.o: ossl_pkcs7.h ossl.o: ossl_pkey.h +ossl.o: ossl_provider.h ossl.o: ossl_rand.h ossl.o: ossl_ssl.h ossl.o: ossl_ts.h @@ -251,6 +252,7 @@ ossl_asn1.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_asn1.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_asn1.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_asn1.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_asn1.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_asn1.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_asn1.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_asn1.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -319,7 +321,6 @@ ossl_asn1.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_asn1.o: $(hdrdir)/ruby/internal/intern/error.h ossl_asn1.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_asn1.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_asn1.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_asn1.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_asn1.o: $(hdrdir)/ruby/internal/intern/io.h ossl_asn1.o: $(hdrdir)/ruby/internal/intern/load.h @@ -350,12 +351,12 @@ ossl_asn1.o: $(hdrdir)/ruby/internal/memory.h ossl_asn1.o: $(hdrdir)/ruby/internal/method.h ossl_asn1.o: $(hdrdir)/ruby/internal/module.h ossl_asn1.o: $(hdrdir)/ruby/internal/newobj.h -ossl_asn1.o: $(hdrdir)/ruby/internal/rgengc.h ossl_asn1.o: $(hdrdir)/ruby/internal/scan_args.h ossl_asn1.o: $(hdrdir)/ruby/internal/special_consts.h ossl_asn1.o: $(hdrdir)/ruby/internal/static_assert.h ossl_asn1.o: $(hdrdir)/ruby/internal/stdalign.h ossl_asn1.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_asn1.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_asn1.o: $(hdrdir)/ruby/internal/symbol.h ossl_asn1.o: $(hdrdir)/ruby/internal/value.h ossl_asn1.o: $(hdrdir)/ruby/internal/value_type.h @@ -387,6 +388,7 @@ ossl_asn1.o: ossl_ocsp.h ossl_asn1.o: ossl_pkcs12.h ossl_asn1.o: ossl_pkcs7.h ossl_asn1.o: ossl_pkey.h +ossl_asn1.o: ossl_provider.h ossl_asn1.o: ossl_rand.h ossl_asn1.o: ossl_ssl.h ossl_asn1.o: ossl_ts.h @@ -445,6 +447,7 @@ ossl_bio.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_bio.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_bio.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_bio.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_bio.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_bio.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_bio.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_bio.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -513,7 +516,6 @@ ossl_bio.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_bio.o: $(hdrdir)/ruby/internal/intern/error.h ossl_bio.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_bio.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_bio.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_bio.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_bio.o: $(hdrdir)/ruby/internal/intern/io.h ossl_bio.o: $(hdrdir)/ruby/internal/intern/load.h @@ -544,12 +546,12 @@ ossl_bio.o: $(hdrdir)/ruby/internal/memory.h ossl_bio.o: $(hdrdir)/ruby/internal/method.h ossl_bio.o: $(hdrdir)/ruby/internal/module.h ossl_bio.o: $(hdrdir)/ruby/internal/newobj.h -ossl_bio.o: $(hdrdir)/ruby/internal/rgengc.h ossl_bio.o: $(hdrdir)/ruby/internal/scan_args.h ossl_bio.o: $(hdrdir)/ruby/internal/special_consts.h ossl_bio.o: $(hdrdir)/ruby/internal/static_assert.h ossl_bio.o: $(hdrdir)/ruby/internal/stdalign.h ossl_bio.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_bio.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_bio.o: $(hdrdir)/ruby/internal/symbol.h ossl_bio.o: $(hdrdir)/ruby/internal/value.h ossl_bio.o: $(hdrdir)/ruby/internal/value_type.h @@ -581,6 +583,7 @@ ossl_bio.o: ossl_ocsp.h ossl_bio.o: ossl_pkcs12.h ossl_bio.o: ossl_pkcs7.h ossl_bio.o: ossl_pkey.h +ossl_bio.o: ossl_provider.h ossl_bio.o: ossl_rand.h ossl_bio.o: ossl_ssl.h ossl_bio.o: ossl_ts.h @@ -639,6 +642,7 @@ ossl_bn.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_bn.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_bn.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_bn.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_bn.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_bn.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_bn.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_bn.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -707,7 +711,6 @@ ossl_bn.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_bn.o: $(hdrdir)/ruby/internal/intern/error.h ossl_bn.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_bn.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_bn.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_bn.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_bn.o: $(hdrdir)/ruby/internal/intern/io.h ossl_bn.o: $(hdrdir)/ruby/internal/intern/load.h @@ -738,12 +741,12 @@ ossl_bn.o: $(hdrdir)/ruby/internal/memory.h ossl_bn.o: $(hdrdir)/ruby/internal/method.h ossl_bn.o: $(hdrdir)/ruby/internal/module.h ossl_bn.o: $(hdrdir)/ruby/internal/newobj.h -ossl_bn.o: $(hdrdir)/ruby/internal/rgengc.h ossl_bn.o: $(hdrdir)/ruby/internal/scan_args.h ossl_bn.o: $(hdrdir)/ruby/internal/special_consts.h ossl_bn.o: $(hdrdir)/ruby/internal/static_assert.h ossl_bn.o: $(hdrdir)/ruby/internal/stdalign.h ossl_bn.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_bn.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_bn.o: $(hdrdir)/ruby/internal/symbol.h ossl_bn.o: $(hdrdir)/ruby/internal/value.h ossl_bn.o: $(hdrdir)/ruby/internal/value_type.h @@ -776,6 +779,7 @@ ossl_bn.o: ossl_ocsp.h ossl_bn.o: ossl_pkcs12.h ossl_bn.o: ossl_pkcs7.h ossl_bn.o: ossl_pkey.h +ossl_bn.o: ossl_provider.h ossl_bn.o: ossl_rand.h ossl_bn.o: ossl_ssl.h ossl_bn.o: ossl_ts.h @@ -834,6 +838,7 @@ ossl_cipher.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_cipher.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_cipher.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_cipher.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_cipher.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_cipher.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_cipher.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_cipher.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -902,7 +907,6 @@ ossl_cipher.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_cipher.o: $(hdrdir)/ruby/internal/intern/error.h ossl_cipher.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_cipher.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_cipher.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_cipher.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_cipher.o: $(hdrdir)/ruby/internal/intern/io.h ossl_cipher.o: $(hdrdir)/ruby/internal/intern/load.h @@ -933,12 +937,12 @@ ossl_cipher.o: $(hdrdir)/ruby/internal/memory.h ossl_cipher.o: $(hdrdir)/ruby/internal/method.h ossl_cipher.o: $(hdrdir)/ruby/internal/module.h ossl_cipher.o: $(hdrdir)/ruby/internal/newobj.h -ossl_cipher.o: $(hdrdir)/ruby/internal/rgengc.h ossl_cipher.o: $(hdrdir)/ruby/internal/scan_args.h ossl_cipher.o: $(hdrdir)/ruby/internal/special_consts.h ossl_cipher.o: $(hdrdir)/ruby/internal/static_assert.h ossl_cipher.o: $(hdrdir)/ruby/internal/stdalign.h ossl_cipher.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_cipher.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_cipher.o: $(hdrdir)/ruby/internal/symbol.h ossl_cipher.o: $(hdrdir)/ruby/internal/value.h ossl_cipher.o: $(hdrdir)/ruby/internal/value_type.h @@ -970,6 +974,7 @@ ossl_cipher.o: ossl_ocsp.h ossl_cipher.o: ossl_pkcs12.h ossl_cipher.o: ossl_pkcs7.h ossl_cipher.o: ossl_pkey.h +ossl_cipher.o: ossl_provider.h ossl_cipher.o: ossl_rand.h ossl_cipher.o: ossl_ssl.h ossl_cipher.o: ossl_ts.h @@ -1028,6 +1033,7 @@ ossl_config.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_config.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_config.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_config.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_config.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_config.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_config.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_config.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1096,7 +1102,6 @@ ossl_config.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_config.o: $(hdrdir)/ruby/internal/intern/error.h ossl_config.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_config.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_config.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_config.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_config.o: $(hdrdir)/ruby/internal/intern/io.h ossl_config.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1127,12 +1132,12 @@ ossl_config.o: $(hdrdir)/ruby/internal/memory.h ossl_config.o: $(hdrdir)/ruby/internal/method.h ossl_config.o: $(hdrdir)/ruby/internal/module.h ossl_config.o: $(hdrdir)/ruby/internal/newobj.h -ossl_config.o: $(hdrdir)/ruby/internal/rgengc.h ossl_config.o: $(hdrdir)/ruby/internal/scan_args.h ossl_config.o: $(hdrdir)/ruby/internal/special_consts.h ossl_config.o: $(hdrdir)/ruby/internal/static_assert.h ossl_config.o: $(hdrdir)/ruby/internal/stdalign.h ossl_config.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_config.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_config.o: $(hdrdir)/ruby/internal/symbol.h ossl_config.o: $(hdrdir)/ruby/internal/value.h ossl_config.o: $(hdrdir)/ruby/internal/value_type.h @@ -1164,6 +1169,7 @@ ossl_config.o: ossl_ocsp.h ossl_config.o: ossl_pkcs12.h ossl_config.o: ossl_pkcs7.h ossl_config.o: ossl_pkey.h +ossl_config.o: ossl_provider.h ossl_config.o: ossl_rand.h ossl_config.o: ossl_ssl.h ossl_config.o: ossl_ts.h @@ -1222,6 +1228,7 @@ ossl_digest.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_digest.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_digest.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_digest.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_digest.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_digest.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_digest.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_digest.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1290,7 +1297,6 @@ ossl_digest.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_digest.o: $(hdrdir)/ruby/internal/intern/error.h ossl_digest.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_digest.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_digest.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_digest.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_digest.o: $(hdrdir)/ruby/internal/intern/io.h ossl_digest.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1321,12 +1327,12 @@ ossl_digest.o: $(hdrdir)/ruby/internal/memory.h ossl_digest.o: $(hdrdir)/ruby/internal/method.h ossl_digest.o: $(hdrdir)/ruby/internal/module.h ossl_digest.o: $(hdrdir)/ruby/internal/newobj.h -ossl_digest.o: $(hdrdir)/ruby/internal/rgengc.h ossl_digest.o: $(hdrdir)/ruby/internal/scan_args.h ossl_digest.o: $(hdrdir)/ruby/internal/special_consts.h ossl_digest.o: $(hdrdir)/ruby/internal/static_assert.h ossl_digest.o: $(hdrdir)/ruby/internal/stdalign.h ossl_digest.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_digest.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_digest.o: $(hdrdir)/ruby/internal/symbol.h ossl_digest.o: $(hdrdir)/ruby/internal/value.h ossl_digest.o: $(hdrdir)/ruby/internal/value_type.h @@ -1358,6 +1364,7 @@ ossl_digest.o: ossl_ocsp.h ossl_digest.o: ossl_pkcs12.h ossl_digest.o: ossl_pkcs7.h ossl_digest.o: ossl_pkey.h +ossl_digest.o: ossl_provider.h ossl_digest.o: ossl_rand.h ossl_digest.o: ossl_ssl.h ossl_digest.o: ossl_ts.h @@ -1416,6 +1423,7 @@ ossl_engine.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_engine.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_engine.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_engine.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_engine.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_engine.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_engine.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_engine.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1484,7 +1492,6 @@ ossl_engine.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_engine.o: $(hdrdir)/ruby/internal/intern/error.h ossl_engine.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_engine.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_engine.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_engine.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_engine.o: $(hdrdir)/ruby/internal/intern/io.h ossl_engine.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1515,12 +1522,12 @@ ossl_engine.o: $(hdrdir)/ruby/internal/memory.h ossl_engine.o: $(hdrdir)/ruby/internal/method.h ossl_engine.o: $(hdrdir)/ruby/internal/module.h ossl_engine.o: $(hdrdir)/ruby/internal/newobj.h -ossl_engine.o: $(hdrdir)/ruby/internal/rgengc.h ossl_engine.o: $(hdrdir)/ruby/internal/scan_args.h ossl_engine.o: $(hdrdir)/ruby/internal/special_consts.h ossl_engine.o: $(hdrdir)/ruby/internal/static_assert.h ossl_engine.o: $(hdrdir)/ruby/internal/stdalign.h ossl_engine.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_engine.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_engine.o: $(hdrdir)/ruby/internal/symbol.h ossl_engine.o: $(hdrdir)/ruby/internal/value.h ossl_engine.o: $(hdrdir)/ruby/internal/value_type.h @@ -1552,6 +1559,7 @@ ossl_engine.o: ossl_ocsp.h ossl_engine.o: ossl_pkcs12.h ossl_engine.o: ossl_pkcs7.h ossl_engine.o: ossl_pkey.h +ossl_engine.o: ossl_provider.h ossl_engine.o: ossl_rand.h ossl_engine.o: ossl_ssl.h ossl_engine.o: ossl_ts.h @@ -1610,6 +1618,7 @@ ossl_hmac.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_hmac.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_hmac.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_hmac.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_hmac.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_hmac.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_hmac.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_hmac.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1678,7 +1687,6 @@ ossl_hmac.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_hmac.o: $(hdrdir)/ruby/internal/intern/error.h ossl_hmac.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_hmac.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_hmac.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_hmac.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_hmac.o: $(hdrdir)/ruby/internal/intern/io.h ossl_hmac.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1709,12 +1717,12 @@ ossl_hmac.o: $(hdrdir)/ruby/internal/memory.h ossl_hmac.o: $(hdrdir)/ruby/internal/method.h ossl_hmac.o: $(hdrdir)/ruby/internal/module.h ossl_hmac.o: $(hdrdir)/ruby/internal/newobj.h -ossl_hmac.o: $(hdrdir)/ruby/internal/rgengc.h ossl_hmac.o: $(hdrdir)/ruby/internal/scan_args.h ossl_hmac.o: $(hdrdir)/ruby/internal/special_consts.h ossl_hmac.o: $(hdrdir)/ruby/internal/static_assert.h ossl_hmac.o: $(hdrdir)/ruby/internal/stdalign.h ossl_hmac.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_hmac.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_hmac.o: $(hdrdir)/ruby/internal/symbol.h ossl_hmac.o: $(hdrdir)/ruby/internal/value.h ossl_hmac.o: $(hdrdir)/ruby/internal/value_type.h @@ -1746,6 +1754,7 @@ ossl_hmac.o: ossl_ocsp.h ossl_hmac.o: ossl_pkcs12.h ossl_hmac.o: ossl_pkcs7.h ossl_hmac.o: ossl_pkey.h +ossl_hmac.o: ossl_provider.h ossl_hmac.o: ossl_rand.h ossl_hmac.o: ossl_ssl.h ossl_hmac.o: ossl_ts.h @@ -1804,6 +1813,7 @@ ossl_kdf.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_kdf.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_kdf.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_kdf.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_kdf.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_kdf.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_kdf.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_kdf.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1872,7 +1882,6 @@ ossl_kdf.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_kdf.o: $(hdrdir)/ruby/internal/intern/error.h ossl_kdf.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_kdf.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_kdf.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_kdf.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_kdf.o: $(hdrdir)/ruby/internal/intern/io.h ossl_kdf.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1903,12 +1912,12 @@ ossl_kdf.o: $(hdrdir)/ruby/internal/memory.h ossl_kdf.o: $(hdrdir)/ruby/internal/method.h ossl_kdf.o: $(hdrdir)/ruby/internal/module.h ossl_kdf.o: $(hdrdir)/ruby/internal/newobj.h -ossl_kdf.o: $(hdrdir)/ruby/internal/rgengc.h ossl_kdf.o: $(hdrdir)/ruby/internal/scan_args.h ossl_kdf.o: $(hdrdir)/ruby/internal/special_consts.h ossl_kdf.o: $(hdrdir)/ruby/internal/static_assert.h ossl_kdf.o: $(hdrdir)/ruby/internal/stdalign.h ossl_kdf.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_kdf.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_kdf.o: $(hdrdir)/ruby/internal/symbol.h ossl_kdf.o: $(hdrdir)/ruby/internal/value.h ossl_kdf.o: $(hdrdir)/ruby/internal/value_type.h @@ -1940,6 +1949,7 @@ ossl_kdf.o: ossl_ocsp.h ossl_kdf.o: ossl_pkcs12.h ossl_kdf.o: ossl_pkcs7.h ossl_kdf.o: ossl_pkey.h +ossl_kdf.o: ossl_provider.h ossl_kdf.o: ossl_rand.h ossl_kdf.o: ossl_ssl.h ossl_kdf.o: ossl_ts.h @@ -1998,6 +2008,7 @@ ossl_ns_spki.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_ns_spki.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2066,7 +2077,6 @@ ossl_ns_spki.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/intern/error.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_ns_spki.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/intern/io.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2097,12 +2107,12 @@ ossl_ns_spki.o: $(hdrdir)/ruby/internal/memory.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/method.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/module.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/newobj.h -ossl_ns_spki.o: $(hdrdir)/ruby/internal/rgengc.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/scan_args.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/special_consts.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/static_assert.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/stdalign.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_ns_spki.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/symbol.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/value.h ossl_ns_spki.o: $(hdrdir)/ruby/internal/value_type.h @@ -2134,6 +2144,7 @@ ossl_ns_spki.o: ossl_ocsp.h ossl_ns_spki.o: ossl_pkcs12.h ossl_ns_spki.o: ossl_pkcs7.h ossl_ns_spki.o: ossl_pkey.h +ossl_ns_spki.o: ossl_provider.h ossl_ns_spki.o: ossl_rand.h ossl_ns_spki.o: ossl_ssl.h ossl_ns_spki.o: ossl_ts.h @@ -2192,6 +2203,7 @@ ossl_ocsp.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_ocsp.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_ocsp.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_ocsp.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_ocsp.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_ocsp.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_ocsp.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_ocsp.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2260,7 +2272,6 @@ ossl_ocsp.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_ocsp.o: $(hdrdir)/ruby/internal/intern/error.h ossl_ocsp.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_ocsp.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_ocsp.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_ocsp.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_ocsp.o: $(hdrdir)/ruby/internal/intern/io.h ossl_ocsp.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2291,12 +2302,12 @@ ossl_ocsp.o: $(hdrdir)/ruby/internal/memory.h ossl_ocsp.o: $(hdrdir)/ruby/internal/method.h ossl_ocsp.o: $(hdrdir)/ruby/internal/module.h ossl_ocsp.o: $(hdrdir)/ruby/internal/newobj.h -ossl_ocsp.o: $(hdrdir)/ruby/internal/rgengc.h ossl_ocsp.o: $(hdrdir)/ruby/internal/scan_args.h ossl_ocsp.o: $(hdrdir)/ruby/internal/special_consts.h ossl_ocsp.o: $(hdrdir)/ruby/internal/static_assert.h ossl_ocsp.o: $(hdrdir)/ruby/internal/stdalign.h ossl_ocsp.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_ocsp.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_ocsp.o: $(hdrdir)/ruby/internal/symbol.h ossl_ocsp.o: $(hdrdir)/ruby/internal/value.h ossl_ocsp.o: $(hdrdir)/ruby/internal/value_type.h @@ -2328,6 +2339,7 @@ ossl_ocsp.o: ossl_ocsp.h ossl_ocsp.o: ossl_pkcs12.h ossl_ocsp.o: ossl_pkcs7.h ossl_ocsp.o: ossl_pkey.h +ossl_ocsp.o: ossl_provider.h ossl_ocsp.o: ossl_rand.h ossl_ocsp.o: ossl_ssl.h ossl_ocsp.o: ossl_ts.h @@ -2386,6 +2398,7 @@ ossl_pkcs12.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_pkcs12.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2454,7 +2467,6 @@ ossl_pkcs12.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/intern/error.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_pkcs12.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/intern/io.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2485,12 +2497,12 @@ ossl_pkcs12.o: $(hdrdir)/ruby/internal/memory.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/method.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/module.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/newobj.h -ossl_pkcs12.o: $(hdrdir)/ruby/internal/rgengc.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/scan_args.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/special_consts.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/static_assert.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/stdalign.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_pkcs12.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/symbol.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/value.h ossl_pkcs12.o: $(hdrdir)/ruby/internal/value_type.h @@ -2522,6 +2534,7 @@ ossl_pkcs12.o: ossl_pkcs12.c ossl_pkcs12.o: ossl_pkcs12.h ossl_pkcs12.o: ossl_pkcs7.h ossl_pkcs12.o: ossl_pkey.h +ossl_pkcs12.o: ossl_provider.h ossl_pkcs12.o: ossl_rand.h ossl_pkcs12.o: ossl_ssl.h ossl_pkcs12.o: ossl_ts.h @@ -2580,6 +2593,7 @@ ossl_pkcs7.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_pkcs7.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2648,7 +2662,6 @@ ossl_pkcs7.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/intern/error.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_pkcs7.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/intern/io.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2679,12 +2692,12 @@ ossl_pkcs7.o: $(hdrdir)/ruby/internal/memory.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/method.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/module.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/newobj.h -ossl_pkcs7.o: $(hdrdir)/ruby/internal/rgengc.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/scan_args.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/special_consts.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/static_assert.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/stdalign.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_pkcs7.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/symbol.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/value.h ossl_pkcs7.o: $(hdrdir)/ruby/internal/value_type.h @@ -2716,6 +2729,7 @@ ossl_pkcs7.o: ossl_pkcs12.h ossl_pkcs7.o: ossl_pkcs7.c ossl_pkcs7.o: ossl_pkcs7.h ossl_pkcs7.o: ossl_pkey.h +ossl_pkcs7.o: ossl_provider.h ossl_pkcs7.o: ossl_rand.h ossl_pkcs7.o: ossl_ssl.h ossl_pkcs7.o: ossl_ts.h @@ -2774,6 +2788,7 @@ ossl_pkey.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_pkey.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_pkey.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_pkey.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_pkey.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_pkey.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_pkey.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_pkey.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2842,7 +2857,6 @@ ossl_pkey.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_pkey.o: $(hdrdir)/ruby/internal/intern/error.h ossl_pkey.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_pkey.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_pkey.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_pkey.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_pkey.o: $(hdrdir)/ruby/internal/intern/io.h ossl_pkey.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2873,12 +2887,12 @@ ossl_pkey.o: $(hdrdir)/ruby/internal/memory.h ossl_pkey.o: $(hdrdir)/ruby/internal/method.h ossl_pkey.o: $(hdrdir)/ruby/internal/module.h ossl_pkey.o: $(hdrdir)/ruby/internal/newobj.h -ossl_pkey.o: $(hdrdir)/ruby/internal/rgengc.h ossl_pkey.o: $(hdrdir)/ruby/internal/scan_args.h ossl_pkey.o: $(hdrdir)/ruby/internal/special_consts.h ossl_pkey.o: $(hdrdir)/ruby/internal/static_assert.h ossl_pkey.o: $(hdrdir)/ruby/internal/stdalign.h ossl_pkey.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_pkey.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_pkey.o: $(hdrdir)/ruby/internal/symbol.h ossl_pkey.o: $(hdrdir)/ruby/internal/value.h ossl_pkey.o: $(hdrdir)/ruby/internal/value_type.h @@ -2910,6 +2924,7 @@ ossl_pkey.o: ossl_pkcs12.h ossl_pkey.o: ossl_pkcs7.h ossl_pkey.o: ossl_pkey.c ossl_pkey.o: ossl_pkey.h +ossl_pkey.o: ossl_provider.h ossl_pkey.o: ossl_rand.h ossl_pkey.o: ossl_ssl.h ossl_pkey.o: ossl_ts.h @@ -2968,6 +2983,7 @@ ossl_pkey_dh.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_pkey_dh.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -3036,7 +3052,6 @@ ossl_pkey_dh.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/intern/error.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_pkey_dh.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/intern/io.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/intern/load.h @@ -3067,12 +3082,12 @@ ossl_pkey_dh.o: $(hdrdir)/ruby/internal/memory.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/method.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/module.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/newobj.h -ossl_pkey_dh.o: $(hdrdir)/ruby/internal/rgengc.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/scan_args.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/special_consts.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/static_assert.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/stdalign.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_pkey_dh.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/symbol.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/value.h ossl_pkey_dh.o: $(hdrdir)/ruby/internal/value_type.h @@ -3104,6 +3119,7 @@ ossl_pkey_dh.o: ossl_pkcs12.h ossl_pkey_dh.o: ossl_pkcs7.h ossl_pkey_dh.o: ossl_pkey.h ossl_pkey_dh.o: ossl_pkey_dh.c +ossl_pkey_dh.o: ossl_provider.h ossl_pkey_dh.o: ossl_rand.h ossl_pkey_dh.o: ossl_ssl.h ossl_pkey_dh.o: ossl_ts.h @@ -3162,6 +3178,7 @@ ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -3230,7 +3247,6 @@ ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/intern/error.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/intern/io.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/intern/load.h @@ -3261,12 +3277,12 @@ ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/memory.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/method.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/module.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/newobj.h -ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/rgengc.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/scan_args.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/special_consts.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/static_assert.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/stdalign.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/symbol.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/value.h ossl_pkey_dsa.o: $(hdrdir)/ruby/internal/value_type.h @@ -3298,6 +3314,7 @@ ossl_pkey_dsa.o: ossl_pkcs12.h ossl_pkey_dsa.o: ossl_pkcs7.h ossl_pkey_dsa.o: ossl_pkey.h ossl_pkey_dsa.o: ossl_pkey_dsa.c +ossl_pkey_dsa.o: ossl_provider.h ossl_pkey_dsa.o: ossl_rand.h ossl_pkey_dsa.o: ossl_ssl.h ossl_pkey_dsa.o: ossl_ts.h @@ -3356,6 +3373,7 @@ ossl_pkey_ec.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_pkey_ec.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -3424,7 +3442,6 @@ ossl_pkey_ec.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/intern/error.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_pkey_ec.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/intern/io.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/intern/load.h @@ -3455,12 +3472,12 @@ ossl_pkey_ec.o: $(hdrdir)/ruby/internal/memory.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/method.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/module.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/newobj.h -ossl_pkey_ec.o: $(hdrdir)/ruby/internal/rgengc.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/scan_args.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/special_consts.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/static_assert.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/stdalign.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_pkey_ec.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/symbol.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/value.h ossl_pkey_ec.o: $(hdrdir)/ruby/internal/value_type.h @@ -3492,6 +3509,7 @@ ossl_pkey_ec.o: ossl_pkcs12.h ossl_pkey_ec.o: ossl_pkcs7.h ossl_pkey_ec.o: ossl_pkey.h ossl_pkey_ec.o: ossl_pkey_ec.c +ossl_pkey_ec.o: ossl_provider.h ossl_pkey_ec.o: ossl_rand.h ossl_pkey_ec.o: ossl_ssl.h ossl_pkey_ec.o: ossl_ts.h @@ -3550,6 +3568,7 @@ ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -3618,7 +3637,6 @@ ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/intern/error.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/intern/io.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/intern/load.h @@ -3649,12 +3667,12 @@ ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/memory.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/method.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/module.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/newobj.h -ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/rgengc.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/scan_args.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/special_consts.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/static_assert.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/stdalign.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/symbol.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/value.h ossl_pkey_rsa.o: $(hdrdir)/ruby/internal/value_type.h @@ -3686,10 +3704,206 @@ ossl_pkey_rsa.o: ossl_pkcs12.h ossl_pkey_rsa.o: ossl_pkcs7.h ossl_pkey_rsa.o: ossl_pkey.h ossl_pkey_rsa.o: ossl_pkey_rsa.c +ossl_pkey_rsa.o: ossl_provider.h ossl_pkey_rsa.o: ossl_rand.h ossl_pkey_rsa.o: ossl_ssl.h ossl_pkey_rsa.o: ossl_ts.h ossl_pkey_rsa.o: ossl_x509.h +ossl_provider.o: $(RUBY_EXTCONF_H) +ossl_provider.o: $(arch_hdrdir)/ruby/config.h +ossl_provider.o: $(hdrdir)/ruby.h +ossl_provider.o: $(hdrdir)/ruby/assert.h +ossl_provider.o: $(hdrdir)/ruby/backward.h +ossl_provider.o: $(hdrdir)/ruby/backward/2/assume.h +ossl_provider.o: $(hdrdir)/ruby/backward/2/attributes.h +ossl_provider.o: $(hdrdir)/ruby/backward/2/bool.h +ossl_provider.o: $(hdrdir)/ruby/backward/2/inttypes.h +ossl_provider.o: $(hdrdir)/ruby/backward/2/limits.h +ossl_provider.o: $(hdrdir)/ruby/backward/2/long_long.h +ossl_provider.o: $(hdrdir)/ruby/backward/2/stdalign.h +ossl_provider.o: $(hdrdir)/ruby/backward/2/stdarg.h +ossl_provider.o: $(hdrdir)/ruby/defines.h +ossl_provider.o: $(hdrdir)/ruby/encoding.h +ossl_provider.o: $(hdrdir)/ruby/intern.h +ossl_provider.o: $(hdrdir)/ruby/internal/abi.h +ossl_provider.o: $(hdrdir)/ruby/internal/anyargs.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/char.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/double.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/int.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/long.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/short.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +ossl_provider.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +ossl_provider.o: $(hdrdir)/ruby/internal/assume.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/artificial.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/cold.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/const.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/constexpr.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/deprecated.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/error.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/forceinline.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/format.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/noalias.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/noexcept.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/noinline.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/nonnull.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/pure.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/restrict.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/warning.h +ossl_provider.o: $(hdrdir)/ruby/internal/attr/weakref.h +ossl_provider.o: $(hdrdir)/ruby/internal/cast.h +ossl_provider.o: $(hdrdir)/ruby/internal/compiler_is.h +ossl_provider.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +ossl_provider.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +ossl_provider.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +ossl_provider.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +ossl_provider.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +ossl_provider.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +ossl_provider.o: $(hdrdir)/ruby/internal/compiler_since.h +ossl_provider.o: $(hdrdir)/ruby/internal/config.h +ossl_provider.o: $(hdrdir)/ruby/internal/constant_p.h +ossl_provider.o: $(hdrdir)/ruby/internal/core.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rarray.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rbasic.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rbignum.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rclass.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rdata.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rfile.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rhash.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/robject.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rregexp.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rstring.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rstruct.h +ossl_provider.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +ossl_provider.o: $(hdrdir)/ruby/internal/ctype.h +ossl_provider.o: $(hdrdir)/ruby/internal/dllexport.h +ossl_provider.o: $(hdrdir)/ruby/internal/dosish.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/coderange.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/ctype.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/encoding.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/pathname.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/re.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/sprintf.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/string.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/symbol.h +ossl_provider.o: $(hdrdir)/ruby/internal/encoding/transcode.h +ossl_provider.o: $(hdrdir)/ruby/internal/error.h +ossl_provider.o: $(hdrdir)/ruby/internal/eval.h +ossl_provider.o: $(hdrdir)/ruby/internal/event.h +ossl_provider.o: $(hdrdir)/ruby/internal/fl_type.h +ossl_provider.o: $(hdrdir)/ruby/internal/gc.h +ossl_provider.o: $(hdrdir)/ruby/internal/glob.h +ossl_provider.o: $(hdrdir)/ruby/internal/globals.h +ossl_provider.o: $(hdrdir)/ruby/internal/has/attribute.h +ossl_provider.o: $(hdrdir)/ruby/internal/has/builtin.h +ossl_provider.o: $(hdrdir)/ruby/internal/has/c_attribute.h +ossl_provider.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +ossl_provider.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +ossl_provider.o: $(hdrdir)/ruby/internal/has/extension.h +ossl_provider.o: $(hdrdir)/ruby/internal/has/feature.h +ossl_provider.o: $(hdrdir)/ruby/internal/has/warning.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/array.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/bignum.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/class.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/compar.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/complex.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/cont.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/dir.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/enum.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/enumerator.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/error.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/eval.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/file.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/hash.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/io.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/load.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/marshal.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/numeric.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/object.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/parse.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/proc.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/process.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/random.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/range.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/rational.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/re.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/ruby.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/select.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/signal.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/sprintf.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/string.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/struct.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/thread.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/time.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/variable.h +ossl_provider.o: $(hdrdir)/ruby/internal/intern/vm.h +ossl_provider.o: $(hdrdir)/ruby/internal/interpreter.h +ossl_provider.o: $(hdrdir)/ruby/internal/iterator.h +ossl_provider.o: $(hdrdir)/ruby/internal/memory.h +ossl_provider.o: $(hdrdir)/ruby/internal/method.h +ossl_provider.o: $(hdrdir)/ruby/internal/module.h +ossl_provider.o: $(hdrdir)/ruby/internal/newobj.h +ossl_provider.o: $(hdrdir)/ruby/internal/scan_args.h +ossl_provider.o: $(hdrdir)/ruby/internal/special_consts.h +ossl_provider.o: $(hdrdir)/ruby/internal/static_assert.h +ossl_provider.o: $(hdrdir)/ruby/internal/stdalign.h +ossl_provider.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_provider.o: $(hdrdir)/ruby/internal/stdckdint.h +ossl_provider.o: $(hdrdir)/ruby/internal/symbol.h +ossl_provider.o: $(hdrdir)/ruby/internal/value.h +ossl_provider.o: $(hdrdir)/ruby/internal/value_type.h +ossl_provider.o: $(hdrdir)/ruby/internal/variable.h +ossl_provider.o: $(hdrdir)/ruby/internal/warning_push.h +ossl_provider.o: $(hdrdir)/ruby/internal/xmalloc.h +ossl_provider.o: $(hdrdir)/ruby/io.h +ossl_provider.o: $(hdrdir)/ruby/missing.h +ossl_provider.o: $(hdrdir)/ruby/onigmo.h +ossl_provider.o: $(hdrdir)/ruby/oniguruma.h +ossl_provider.o: $(hdrdir)/ruby/ruby.h +ossl_provider.o: $(hdrdir)/ruby/st.h +ossl_provider.o: $(hdrdir)/ruby/subst.h +ossl_provider.o: $(hdrdir)/ruby/thread.h +ossl_provider.o: openssl_missing.h +ossl_provider.o: ossl.h +ossl_provider.o: ossl_asn1.h +ossl_provider.o: ossl_bio.h +ossl_provider.o: ossl_bn.h +ossl_provider.o: ossl_cipher.h +ossl_provider.o: ossl_config.h +ossl_provider.o: ossl_digest.h +ossl_provider.o: ossl_engine.h +ossl_provider.o: ossl_hmac.h +ossl_provider.o: ossl_kdf.h +ossl_provider.o: ossl_ns_spki.h +ossl_provider.o: ossl_ocsp.h +ossl_provider.o: ossl_pkcs12.h +ossl_provider.o: ossl_pkcs7.h +ossl_provider.o: ossl_pkey.h +ossl_provider.o: ossl_provider.c +ossl_provider.o: ossl_provider.h +ossl_provider.o: ossl_rand.h +ossl_provider.o: ossl_ssl.h +ossl_provider.o: ossl_ts.h +ossl_provider.o: ossl_x509.h ossl_rand.o: $(RUBY_EXTCONF_H) ossl_rand.o: $(arch_hdrdir)/ruby/config.h ossl_rand.o: $(hdrdir)/ruby.h @@ -3744,6 +3958,7 @@ ossl_rand.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_rand.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_rand.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_rand.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_rand.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_rand.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_rand.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_rand.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -3812,7 +4027,6 @@ ossl_rand.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_rand.o: $(hdrdir)/ruby/internal/intern/error.h ossl_rand.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_rand.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_rand.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_rand.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_rand.o: $(hdrdir)/ruby/internal/intern/io.h ossl_rand.o: $(hdrdir)/ruby/internal/intern/load.h @@ -3843,12 +4057,12 @@ ossl_rand.o: $(hdrdir)/ruby/internal/memory.h ossl_rand.o: $(hdrdir)/ruby/internal/method.h ossl_rand.o: $(hdrdir)/ruby/internal/module.h ossl_rand.o: $(hdrdir)/ruby/internal/newobj.h -ossl_rand.o: $(hdrdir)/ruby/internal/rgengc.h ossl_rand.o: $(hdrdir)/ruby/internal/scan_args.h ossl_rand.o: $(hdrdir)/ruby/internal/special_consts.h ossl_rand.o: $(hdrdir)/ruby/internal/static_assert.h ossl_rand.o: $(hdrdir)/ruby/internal/stdalign.h ossl_rand.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_rand.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_rand.o: $(hdrdir)/ruby/internal/symbol.h ossl_rand.o: $(hdrdir)/ruby/internal/value.h ossl_rand.o: $(hdrdir)/ruby/internal/value_type.h @@ -3879,6 +4093,7 @@ ossl_rand.o: ossl_ocsp.h ossl_rand.o: ossl_pkcs12.h ossl_rand.o: ossl_pkcs7.h ossl_rand.o: ossl_pkey.h +ossl_rand.o: ossl_provider.h ossl_rand.o: ossl_rand.c ossl_rand.o: ossl_rand.h ossl_rand.o: ossl_ssl.h @@ -3938,6 +4153,7 @@ ossl_ssl.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_ssl.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_ssl.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_ssl.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_ssl.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_ssl.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_ssl.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_ssl.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -4006,7 +4222,6 @@ ossl_ssl.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_ssl.o: $(hdrdir)/ruby/internal/intern/error.h ossl_ssl.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_ssl.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_ssl.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_ssl.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_ssl.o: $(hdrdir)/ruby/internal/intern/io.h ossl_ssl.o: $(hdrdir)/ruby/internal/intern/load.h @@ -4037,12 +4252,12 @@ ossl_ssl.o: $(hdrdir)/ruby/internal/memory.h ossl_ssl.o: $(hdrdir)/ruby/internal/method.h ossl_ssl.o: $(hdrdir)/ruby/internal/module.h ossl_ssl.o: $(hdrdir)/ruby/internal/newobj.h -ossl_ssl.o: $(hdrdir)/ruby/internal/rgengc.h ossl_ssl.o: $(hdrdir)/ruby/internal/scan_args.h ossl_ssl.o: $(hdrdir)/ruby/internal/special_consts.h ossl_ssl.o: $(hdrdir)/ruby/internal/static_assert.h ossl_ssl.o: $(hdrdir)/ruby/internal/stdalign.h ossl_ssl.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_ssl.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_ssl.o: $(hdrdir)/ruby/internal/symbol.h ossl_ssl.o: $(hdrdir)/ruby/internal/value.h ossl_ssl.o: $(hdrdir)/ruby/internal/value_type.h @@ -4073,6 +4288,7 @@ ossl_ssl.o: ossl_ocsp.h ossl_ssl.o: ossl_pkcs12.h ossl_ssl.o: ossl_pkcs7.h ossl_ssl.o: ossl_pkey.h +ossl_ssl.o: ossl_provider.h ossl_ssl.o: ossl_rand.h ossl_ssl.o: ossl_ssl.c ossl_ssl.o: ossl_ssl.h @@ -4132,6 +4348,7 @@ ossl_ssl_session.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_ssl_session.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -4200,7 +4417,6 @@ ossl_ssl_session.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/intern/error.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_ssl_session.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/intern/io.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/intern/load.h @@ -4231,12 +4447,12 @@ ossl_ssl_session.o: $(hdrdir)/ruby/internal/memory.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/method.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/module.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/newobj.h -ossl_ssl_session.o: $(hdrdir)/ruby/internal/rgengc.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/scan_args.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/special_consts.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/static_assert.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/stdalign.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_ssl_session.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/symbol.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/value.h ossl_ssl_session.o: $(hdrdir)/ruby/internal/value_type.h @@ -4267,6 +4483,7 @@ ossl_ssl_session.o: ossl_ocsp.h ossl_ssl_session.o: ossl_pkcs12.h ossl_ssl_session.o: ossl_pkcs7.h ossl_ssl_session.o: ossl_pkey.h +ossl_ssl_session.o: ossl_provider.h ossl_ssl_session.o: ossl_rand.h ossl_ssl_session.o: ossl_ssl.h ossl_ssl_session.o: ossl_ssl_session.c @@ -4326,6 +4543,7 @@ ossl_ts.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_ts.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_ts.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_ts.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_ts.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_ts.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_ts.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_ts.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -4394,7 +4612,6 @@ ossl_ts.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_ts.o: $(hdrdir)/ruby/internal/intern/error.h ossl_ts.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_ts.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_ts.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_ts.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_ts.o: $(hdrdir)/ruby/internal/intern/io.h ossl_ts.o: $(hdrdir)/ruby/internal/intern/load.h @@ -4425,12 +4642,12 @@ ossl_ts.o: $(hdrdir)/ruby/internal/memory.h ossl_ts.o: $(hdrdir)/ruby/internal/method.h ossl_ts.o: $(hdrdir)/ruby/internal/module.h ossl_ts.o: $(hdrdir)/ruby/internal/newobj.h -ossl_ts.o: $(hdrdir)/ruby/internal/rgengc.h ossl_ts.o: $(hdrdir)/ruby/internal/scan_args.h ossl_ts.o: $(hdrdir)/ruby/internal/special_consts.h ossl_ts.o: $(hdrdir)/ruby/internal/static_assert.h ossl_ts.o: $(hdrdir)/ruby/internal/stdalign.h ossl_ts.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_ts.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_ts.o: $(hdrdir)/ruby/internal/symbol.h ossl_ts.o: $(hdrdir)/ruby/internal/value.h ossl_ts.o: $(hdrdir)/ruby/internal/value_type.h @@ -4461,6 +4678,7 @@ ossl_ts.o: ossl_ocsp.h ossl_ts.o: ossl_pkcs12.h ossl_ts.o: ossl_pkcs7.h ossl_ts.o: ossl_pkey.h +ossl_ts.o: ossl_provider.h ossl_ts.o: ossl_rand.h ossl_ts.o: ossl_ssl.h ossl_ts.o: ossl_ts.c @@ -4520,6 +4738,7 @@ ossl_x509.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -4588,7 +4807,6 @@ ossl_x509.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509.o: $(hdrdir)/ruby/internal/intern/load.h @@ -4619,12 +4837,12 @@ ossl_x509.o: $(hdrdir)/ruby/internal/memory.h ossl_x509.o: $(hdrdir)/ruby/internal/method.h ossl_x509.o: $(hdrdir)/ruby/internal/module.h ossl_x509.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509.o: $(hdrdir)/ruby/internal/value.h ossl_x509.o: $(hdrdir)/ruby/internal/value_type.h @@ -4655,6 +4873,7 @@ ossl_x509.o: ossl_ocsp.h ossl_x509.o: ossl_pkcs12.h ossl_x509.o: ossl_pkcs7.h ossl_x509.o: ossl_pkey.h +ossl_x509.o: ossl_provider.h ossl_x509.o: ossl_rand.h ossl_x509.o: ossl_ssl.h ossl_x509.o: ossl_ts.h @@ -4714,6 +4933,7 @@ ossl_x509attr.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509attr.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509attr.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509attr.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509attr.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509attr.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509attr.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509attr.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -4782,7 +5002,6 @@ ossl_x509attr.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509attr.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509attr.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509attr.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509attr.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509attr.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509attr.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509attr.o: $(hdrdir)/ruby/internal/intern/load.h @@ -4813,12 +5032,12 @@ ossl_x509attr.o: $(hdrdir)/ruby/internal/memory.h ossl_x509attr.o: $(hdrdir)/ruby/internal/method.h ossl_x509attr.o: $(hdrdir)/ruby/internal/module.h ossl_x509attr.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509attr.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509attr.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509attr.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509attr.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509attr.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509attr.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509attr.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509attr.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509attr.o: $(hdrdir)/ruby/internal/value.h ossl_x509attr.o: $(hdrdir)/ruby/internal/value_type.h @@ -4849,6 +5068,7 @@ ossl_x509attr.o: ossl_ocsp.h ossl_x509attr.o: ossl_pkcs12.h ossl_x509attr.o: ossl_pkcs7.h ossl_x509attr.o: ossl_pkey.h +ossl_x509attr.o: ossl_provider.h ossl_x509attr.o: ossl_rand.h ossl_x509attr.o: ossl_ssl.h ossl_x509attr.o: ossl_ts.h @@ -4908,6 +5128,7 @@ ossl_x509cert.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509cert.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509cert.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509cert.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509cert.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509cert.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509cert.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509cert.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -4976,7 +5197,6 @@ ossl_x509cert.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509cert.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509cert.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509cert.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509cert.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509cert.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509cert.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509cert.o: $(hdrdir)/ruby/internal/intern/load.h @@ -5007,12 +5227,12 @@ ossl_x509cert.o: $(hdrdir)/ruby/internal/memory.h ossl_x509cert.o: $(hdrdir)/ruby/internal/method.h ossl_x509cert.o: $(hdrdir)/ruby/internal/module.h ossl_x509cert.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509cert.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509cert.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509cert.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509cert.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509cert.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509cert.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509cert.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509cert.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509cert.o: $(hdrdir)/ruby/internal/value.h ossl_x509cert.o: $(hdrdir)/ruby/internal/value_type.h @@ -5043,6 +5263,7 @@ ossl_x509cert.o: ossl_ocsp.h ossl_x509cert.o: ossl_pkcs12.h ossl_x509cert.o: ossl_pkcs7.h ossl_x509cert.o: ossl_pkey.h +ossl_x509cert.o: ossl_provider.h ossl_x509cert.o: ossl_rand.h ossl_x509cert.o: ossl_ssl.h ossl_x509cert.o: ossl_ts.h @@ -5102,6 +5323,7 @@ ossl_x509crl.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509crl.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509crl.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509crl.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509crl.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509crl.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509crl.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509crl.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -5170,7 +5392,6 @@ ossl_x509crl.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509crl.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509crl.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509crl.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509crl.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509crl.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509crl.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509crl.o: $(hdrdir)/ruby/internal/intern/load.h @@ -5201,12 +5422,12 @@ ossl_x509crl.o: $(hdrdir)/ruby/internal/memory.h ossl_x509crl.o: $(hdrdir)/ruby/internal/method.h ossl_x509crl.o: $(hdrdir)/ruby/internal/module.h ossl_x509crl.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509crl.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509crl.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509crl.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509crl.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509crl.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509crl.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509crl.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509crl.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509crl.o: $(hdrdir)/ruby/internal/value.h ossl_x509crl.o: $(hdrdir)/ruby/internal/value_type.h @@ -5237,6 +5458,7 @@ ossl_x509crl.o: ossl_ocsp.h ossl_x509crl.o: ossl_pkcs12.h ossl_x509crl.o: ossl_pkcs7.h ossl_x509crl.o: ossl_pkey.h +ossl_x509crl.o: ossl_provider.h ossl_x509crl.o: ossl_rand.h ossl_x509crl.o: ossl_ssl.h ossl_x509crl.o: ossl_ts.h @@ -5296,6 +5518,7 @@ ossl_x509ext.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509ext.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509ext.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509ext.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509ext.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509ext.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509ext.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509ext.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -5364,7 +5587,6 @@ ossl_x509ext.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509ext.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509ext.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509ext.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509ext.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509ext.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509ext.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509ext.o: $(hdrdir)/ruby/internal/intern/load.h @@ -5395,12 +5617,12 @@ ossl_x509ext.o: $(hdrdir)/ruby/internal/memory.h ossl_x509ext.o: $(hdrdir)/ruby/internal/method.h ossl_x509ext.o: $(hdrdir)/ruby/internal/module.h ossl_x509ext.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509ext.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509ext.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509ext.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509ext.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509ext.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509ext.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509ext.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509ext.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509ext.o: $(hdrdir)/ruby/internal/value.h ossl_x509ext.o: $(hdrdir)/ruby/internal/value_type.h @@ -5431,6 +5653,7 @@ ossl_x509ext.o: ossl_ocsp.h ossl_x509ext.o: ossl_pkcs12.h ossl_x509ext.o: ossl_pkcs7.h ossl_x509ext.o: ossl_pkey.h +ossl_x509ext.o: ossl_provider.h ossl_x509ext.o: ossl_rand.h ossl_x509ext.o: ossl_ssl.h ossl_x509ext.o: ossl_ts.h @@ -5490,6 +5713,7 @@ ossl_x509name.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509name.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509name.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509name.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509name.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509name.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509name.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509name.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -5558,7 +5782,6 @@ ossl_x509name.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509name.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509name.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509name.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509name.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509name.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509name.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509name.o: $(hdrdir)/ruby/internal/intern/load.h @@ -5589,12 +5812,12 @@ ossl_x509name.o: $(hdrdir)/ruby/internal/memory.h ossl_x509name.o: $(hdrdir)/ruby/internal/method.h ossl_x509name.o: $(hdrdir)/ruby/internal/module.h ossl_x509name.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509name.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509name.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509name.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509name.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509name.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509name.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509name.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509name.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509name.o: $(hdrdir)/ruby/internal/value.h ossl_x509name.o: $(hdrdir)/ruby/internal/value_type.h @@ -5625,6 +5848,7 @@ ossl_x509name.o: ossl_ocsp.h ossl_x509name.o: ossl_pkcs12.h ossl_x509name.o: ossl_pkcs7.h ossl_x509name.o: ossl_pkey.h +ossl_x509name.o: ossl_provider.h ossl_x509name.o: ossl_rand.h ossl_x509name.o: ossl_ssl.h ossl_x509name.o: ossl_ts.h @@ -5684,6 +5908,7 @@ ossl_x509req.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509req.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509req.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509req.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509req.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509req.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509req.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509req.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -5752,7 +5977,6 @@ ossl_x509req.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509req.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509req.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509req.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509req.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509req.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509req.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509req.o: $(hdrdir)/ruby/internal/intern/load.h @@ -5783,12 +6007,12 @@ ossl_x509req.o: $(hdrdir)/ruby/internal/memory.h ossl_x509req.o: $(hdrdir)/ruby/internal/method.h ossl_x509req.o: $(hdrdir)/ruby/internal/module.h ossl_x509req.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509req.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509req.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509req.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509req.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509req.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509req.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509req.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509req.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509req.o: $(hdrdir)/ruby/internal/value.h ossl_x509req.o: $(hdrdir)/ruby/internal/value_type.h @@ -5819,6 +6043,7 @@ ossl_x509req.o: ossl_ocsp.h ossl_x509req.o: ossl_pkcs12.h ossl_x509req.o: ossl_pkcs7.h ossl_x509req.o: ossl_pkey.h +ossl_x509req.o: ossl_provider.h ossl_x509req.o: ossl_rand.h ossl_x509req.o: ossl_ssl.h ossl_x509req.o: ossl_ts.h @@ -5878,6 +6103,7 @@ ossl_x509revoked.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509revoked.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -5946,7 +6172,6 @@ ossl_x509revoked.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509revoked.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/intern/load.h @@ -5977,12 +6202,12 @@ ossl_x509revoked.o: $(hdrdir)/ruby/internal/memory.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/method.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/module.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509revoked.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509revoked.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/value.h ossl_x509revoked.o: $(hdrdir)/ruby/internal/value_type.h @@ -6013,6 +6238,7 @@ ossl_x509revoked.o: ossl_ocsp.h ossl_x509revoked.o: ossl_pkcs12.h ossl_x509revoked.o: ossl_pkcs7.h ossl_x509revoked.o: ossl_pkey.h +ossl_x509revoked.o: ossl_provider.h ossl_x509revoked.o: ossl_rand.h ossl_x509revoked.o: ossl_ssl.h ossl_x509revoked.o: ossl_ts.h @@ -6072,6 +6298,7 @@ ossl_x509store.o: $(hdrdir)/ruby/internal/attr/noexcept.h ossl_x509store.o: $(hdrdir)/ruby/internal/attr/noinline.h ossl_x509store.o: $(hdrdir)/ruby/internal/attr/nonnull.h ossl_x509store.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ossl_x509store.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ossl_x509store.o: $(hdrdir)/ruby/internal/attr/pure.h ossl_x509store.o: $(hdrdir)/ruby/internal/attr/restrict.h ossl_x509store.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -6140,7 +6367,6 @@ ossl_x509store.o: $(hdrdir)/ruby/internal/intern/enumerator.h ossl_x509store.o: $(hdrdir)/ruby/internal/intern/error.h ossl_x509store.o: $(hdrdir)/ruby/internal/intern/eval.h ossl_x509store.o: $(hdrdir)/ruby/internal/intern/file.h -ossl_x509store.o: $(hdrdir)/ruby/internal/intern/gc.h ossl_x509store.o: $(hdrdir)/ruby/internal/intern/hash.h ossl_x509store.o: $(hdrdir)/ruby/internal/intern/io.h ossl_x509store.o: $(hdrdir)/ruby/internal/intern/load.h @@ -6171,12 +6397,12 @@ ossl_x509store.o: $(hdrdir)/ruby/internal/memory.h ossl_x509store.o: $(hdrdir)/ruby/internal/method.h ossl_x509store.o: $(hdrdir)/ruby/internal/module.h ossl_x509store.o: $(hdrdir)/ruby/internal/newobj.h -ossl_x509store.o: $(hdrdir)/ruby/internal/rgengc.h ossl_x509store.o: $(hdrdir)/ruby/internal/scan_args.h ossl_x509store.o: $(hdrdir)/ruby/internal/special_consts.h ossl_x509store.o: $(hdrdir)/ruby/internal/static_assert.h ossl_x509store.o: $(hdrdir)/ruby/internal/stdalign.h ossl_x509store.o: $(hdrdir)/ruby/internal/stdbool.h +ossl_x509store.o: $(hdrdir)/ruby/internal/stdckdint.h ossl_x509store.o: $(hdrdir)/ruby/internal/symbol.h ossl_x509store.o: $(hdrdir)/ruby/internal/value.h ossl_x509store.o: $(hdrdir)/ruby/internal/value_type.h @@ -6207,6 +6433,7 @@ ossl_x509store.o: ossl_ocsp.h ossl_x509store.o: ossl_pkcs12.h ossl_x509store.o: ossl_pkcs7.h ossl_x509store.o: ossl_pkey.h +ossl_x509store.o: ossl_provider.h ossl_x509store.o: ossl_rand.h ossl_x509store.o: ossl_ssl.h ossl_x509store.o: ossl_ts.h diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb index fd96533569..dd3732d0a8 100644 --- a/ext/openssl/extconf.rb +++ b/ext/openssl/extconf.rb @@ -13,20 +13,36 @@ require "mkmf" -dir_config_given = dir_config("openssl").any? +ssl_dirs = dir_config("openssl") +dir_config_given = ssl_dirs.any? + +_, ssl_ldir = ssl_dirs +if ssl_ldir&.split(File::PATH_SEPARATOR)&.none? { |dir| File.directory?(dir) } + # According to the `mkmf.rb#dir_config`, the `--with-openssl-dir=<dir>` uses + # the value of the `File.basename(RbConfig::MAKEFILE_CONFIG["libdir"])` as a + # loaded library directory name. + ruby_ldir_name = File.basename(RbConfig::MAKEFILE_CONFIG["libdir"]) + + raise "OpenSSL library directory could not be found in '#{ssl_ldir}'. " \ + "You might want to fix this error in one of the following ways.\n" \ + " * Recompile OpenSSL by configuring it with --libdir=#{ruby_ldir_name} " \ + " to specify the OpenSSL library directory.\n" \ + " * Recompile Ruby by configuring it with --libdir=<dir> to specify the " \ + "Ruby library directory.\n" \ + " * Compile this openssl gem with --with-openssl-include=<dir> and " \ + "--with-openssl-lib=<dir> options to specify the OpenSSL include and " \ + "library directories." +end + dir_config("kerberos") Logging::message "=== OpenSSL for Ruby configurator ===\n" -## -# 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") -end +$defs.push("-D""OPENSSL_SUPPRESS_DEPRECATED") -have_func("rb_io_maybe_wait") # Ruby 3.1 +have_func("rb_io_descriptor") +have_func("rb_io_maybe_wait(0, Qnil, Qnil, Qnil)", "ruby/io.h") # Ruby 3.1 +have_func("rb_io_timeout", "ruby/io.h") Logging::message "=== Checking for system dependent stuff... ===\n" have_library("nsl", "t_open") @@ -126,7 +142,7 @@ ts_h = "openssl/ts.h".freeze ssl_h = "openssl/ssl.h".freeze # compile options -have_func("RAND_egd", "openssl/rand.h") +have_func("RAND_egd()", "openssl/rand.h") engines = %w{dynamic 4758cca aep atalla chil cswift nuron sureware ubsec padlock capi gmp gost cryptodev} engines.each { |name| @@ -137,65 +153,64 @@ engines.each { |name| if !have_struct_member("SSL", "ctx", "openssl/ssl.h") || is_libressl $defs.push("-DHAVE_OPAQUE_OPENSSL") end -have_func("EVP_MD_CTX_new", evp_h) -have_func("EVP_MD_CTX_free", evp_h) -have_func("EVP_MD_CTX_pkey_ctx", evp_h) -have_func("X509_STORE_get_ex_data", x509_h) -have_func("X509_STORE_set_ex_data", x509_h) +have_func("EVP_MD_CTX_new()", evp_h) +have_func("EVP_MD_CTX_free(NULL)", evp_h) +have_func("EVP_MD_CTX_pkey_ctx(NULL)", evp_h) +have_func("X509_STORE_get_ex_data(NULL, 0)", x509_h) +have_func("X509_STORE_set_ex_data(NULL, 0, NULL)", x509_h) have_func("X509_STORE_get_ex_new_index(0, NULL, NULL, NULL, NULL)", x509_h) -have_func("X509_CRL_get0_signature", x509_h) -have_func("X509_REQ_get0_signature", x509_h) -have_func("X509_REVOKED_get0_serialNumber", x509_h) -have_func("X509_REVOKED_get0_revocationDate", x509_h) -have_func("X509_get0_tbs_sigalg", x509_h) -have_func("X509_STORE_CTX_get0_untrusted", x509_h) -have_func("X509_STORE_CTX_get0_cert", x509_h) -have_func("X509_STORE_CTX_get0_chain", x509_h) -have_func("OCSP_SINGLERESP_get0_id", "openssl/ocsp.h") -have_func("SSL_CTX_get_ciphers", ssl_h) -have_func("X509_up_ref", x509_h) -have_func("X509_CRL_up_ref", x509_h) -have_func("X509_STORE_up_ref", x509_h) -have_func("SSL_SESSION_up_ref", ssl_h) -have_func("EVP_PKEY_up_ref", evp_h) +have_func("X509_CRL_get0_signature(NULL, NULL, NULL)", x509_h) +have_func("X509_REQ_get0_signature(NULL, NULL, NULL)", x509_h) +have_func("X509_REVOKED_get0_serialNumber(NULL)", x509_h) +have_func("X509_REVOKED_get0_revocationDate(NULL)", x509_h) +have_func("X509_get0_tbs_sigalg(NULL)", x509_h) +have_func("X509_STORE_CTX_get0_untrusted(NULL)", x509_h) +have_func("X509_STORE_CTX_get0_cert(NULL)", x509_h) +have_func("X509_STORE_CTX_get0_chain(NULL)", x509_h) +have_func("OCSP_SINGLERESP_get0_id(NULL)", "openssl/ocsp.h") +have_func("SSL_CTX_get_ciphers(NULL)", ssl_h) +have_func("X509_up_ref(NULL)", x509_h) +have_func("X509_CRL_up_ref(NULL)", x509_h) +have_func("X509_STORE_up_ref(NULL)", x509_h) +have_func("SSL_SESSION_up_ref(NULL)", ssl_h) +have_func("EVP_PKEY_up_ref(NULL)", evp_h) have_func("SSL_CTX_set_min_proto_version(NULL, 0)", ssl_h) -have_func("SSL_CTX_get_security_level", ssl_h) -have_func("X509_get0_notBefore", x509_h) -have_func("SSL_SESSION_get_protocol_version", ssl_h) -have_func("TS_STATUS_INFO_get0_status", ts_h) -have_func("TS_STATUS_INFO_get0_text", ts_h) -have_func("TS_STATUS_INFO_get0_failure_info", ts_h) +have_func("SSL_CTX_get_security_level(NULL)", ssl_h) +have_func("X509_get0_notBefore(NULL)", x509_h) +have_func("SSL_SESSION_get_protocol_version(NULL)", ssl_h) +have_func("TS_STATUS_INFO_get0_status(NULL)", ts_h) +have_func("TS_STATUS_INFO_get0_text(NULL)", ts_h) +have_func("TS_STATUS_INFO_get0_failure_info(NULL)", ts_h) have_func("TS_VERIFY_CTS_set_certs(NULL, NULL)", ts_h) -have_func("TS_VERIFY_CTX_set_store", ts_h) -have_func("TS_VERIFY_CTX_add_flags", ts_h) -have_func("TS_RESP_CTX_set_time_cb", ts_h) -have_func("EVP_PBE_scrypt", evp_h) -have_func("SSL_CTX_set_post_handshake_auth", ssl_h) +have_func("TS_VERIFY_CTX_set_store(NULL, NULL)", ts_h) +have_func("TS_VERIFY_CTX_add_flags(NULL, 0)", ts_h) +have_func("TS_RESP_CTX_set_time_cb(NULL, NULL, NULL)", ts_h) +have_func("EVP_PBE_scrypt(\"\", 0, (unsigned char *)\"\", 0, 0, 0, 0, 0, NULL, 0)", evp_h) +have_func("SSL_CTX_set_post_handshake_auth(NULL, 0)", ssl_h) # added in 1.1.1 -have_func("EVP_PKEY_check", evp_h) -have_func("EVP_PKEY_new_raw_private_key", evp_h) -have_func("SSL_CTX_set_ciphersuites", ssl_h) +have_func("EVP_PKEY_check(NULL)", evp_h) +have_func("EVP_PKEY_new_raw_private_key(0, NULL, (unsigned char *)\"\", 0)", evp_h) +have_func("SSL_CTX_set_ciphersuites(NULL, \"\")", ssl_h) # added in 3.0.0 -openssl_3 = -have_func("SSL_set0_tmp_dh_pkey", ssl_h) -have_func("ERR_get_error_all", "openssl/err.h") +have_func("SSL_set0_tmp_dh_pkey(NULL, NULL)", ssl_h) +have_func("ERR_get_error_all(NULL, NULL, NULL, NULL, NULL)", "openssl/err.h") have_func("TS_VERIFY_CTX_set_certs(NULL, NULL)", ts_h) -have_func("SSL_CTX_load_verify_file", ssl_h) -have_func("BN_check_prime", "openssl/bn.h") -have_func("EVP_MD_CTX_get0_md", evp_h) -have_func("EVP_MD_CTX_get_pkey_ctx", evp_h) -have_func("EVP_PKEY_eq", evp_h) -have_func("EVP_PKEY_dup", evp_h) +have_func("SSL_CTX_load_verify_file(NULL, \"\")", ssl_h) +have_func("BN_check_prime(NULL, NULL, NULL)", "openssl/bn.h") +have_func("EVP_MD_CTX_get0_md(NULL)", evp_h) +have_func("EVP_MD_CTX_get_pkey_ctx(NULL)", evp_h) +have_func("EVP_PKEY_eq(NULL, NULL)", evp_h) +have_func("EVP_PKEY_dup(NULL)", evp_h) Logging::message "=== Checking done. ===\n" -if openssl_3 - if $warnflags&.sub!(/-W\K(?=deprecated-declarations)/, 'no-') - $warnflags << " -Wno-incompatible-pointer-types-discards-qualifiers" - end -end +# Append flags from environment variables. +extcflags = ENV["RUBY_OPENSSL_EXTCFLAGS"] +append_cflags(extcflags.split) if extcflags +extldflags = ENV["RUBY_OPENSSL_EXTLDFLAGS"] +append_ldflags(extldflags.split) if extldflags create_header create_makefile("openssl") diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb index d47e1082ef..216c51e3be 100644 --- a/ext/openssl/lib/openssl/buffering.rb +++ b/ext/openssl/lib/openssl/buffering.rb @@ -93,9 +93,7 @@ module OpenSSL::Buffering nil else size = @rbuffer.size unless size - ret = @rbuffer[0, size] - @rbuffer[0, size] = "" - ret + @rbuffer.slice!(0, size) end end @@ -106,8 +104,7 @@ module OpenSSL::Buffering # # Get the next 8bit byte from `ssl`. Returns `nil` on EOF def getbyte - byte = read(1) - byte && byte.unpack1("C") + read(1)&.ord end ## @@ -232,7 +229,7 @@ module OpenSSL::Buffering # # Unlike IO#gets the separator must be provided if a limit is provided. - def gets(eol=$/, limit=nil) + def gets(eol=$/, limit=nil, chomp: false) idx = @rbuffer.index(eol) until @eof break if idx @@ -247,7 +244,11 @@ module OpenSSL::Buffering if size && limit && limit >= 0 size = [size, limit].min end - consume_rbuff(size) + line = consume_rbuff(size) + if chomp && line + line.chomp!(eol) + end + line end ## @@ -348,13 +349,18 @@ module OpenSSL::Buffering @wbuffer << s @wbuffer.force_encoding(Encoding::BINARY) @sync ||= false - if @sync or @wbuffer.size > BLOCK_SIZE - until @wbuffer.empty? - begin - nwrote = syswrite(@wbuffer) - rescue Errno::EAGAIN - retry + buffer_size = @wbuffer.size + if @sync or buffer_size > BLOCK_SIZE + nwrote = 0 + begin + while nwrote < buffer_size do + begin + nwrote += syswrite(@wbuffer[nwrote, buffer_size - nwrote]) + rescue Errno::EAGAIN + retry + end end + ensure @wbuffer[0, nwrote] = "" end end diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb index 2ff8398e44..0f35ddadd3 100644 --- a/ext/openssl/lib/openssl/digest.rb +++ b/ext/openssl/lib/openssl/digest.rb @@ -18,13 +18,9 @@ module OpenSSL # Return the hash value computed with _name_ Digest. _name_ is either the # long name or short name of a supported digest algorithm. # - # === Examples + # === Example # # OpenSSL::Digest.digest("SHA256", "abc") - # - # which is equivalent to: - # - # OpenSSL::Digest.digest('SHA256', "abc") def self.digest(name, data) super(data, name) diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb index a9103ecd27..d28bf1a374 100644 --- a/ext/openssl/lib/openssl/ssl.rb +++ b/ext/openssl/lib/openssl/ssl.rb @@ -11,6 +11,9 @@ =end require "openssl/buffering" + +if defined?(OpenSSL::SSL) + require "io/nonblock" require "ipaddr" require "socket" @@ -19,7 +22,6 @@ module OpenSSL module SSL class SSLContext DEFAULT_PARAMS = { # :nodoc: - :min_version => OpenSSL::SSL::TLS1_VERSION, :verify_mode => OpenSSL::SSL::VERIFY_PEER, :verify_hostname => true, :options => -> { @@ -31,27 +33,28 @@ module OpenSSL } if defined?(OpenSSL::PKey::DH) - DEFAULT_2048 = OpenSSL::PKey::DH.new <<-_end_of_pem_ + DH_ffdhe2048 = OpenSSL::PKey::DH.new <<-_end_of_pem_ -----BEGIN DH PARAMETERS----- -MIIBCAKCAQEA7E6kBrYiyvmKAMzQ7i8WvwVk9Y/+f8S7sCTN712KkK3cqd1jhJDY -JbrYeNV3kUIKhPxWHhObHKpD1R84UpL+s2b55+iMd6GmL7OYmNIT/FccKhTcveab -VBmZT86BZKYyf45hUF9FOuUM9xPzuK3Vd8oJQvfYMCd7LPC0taAEljQLR4Edf8E6 -YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3 -1bNveX5wInh5GDx1FGhKBZ+s1H+aedudCm7sCgRwv8lKWYGiHzObSma8A86KG+MD -7Lo5JquQ3DlBodj3IDyPrxIv96lvRPFtAwIBAg== +MIIBCAKCAQEA//////////+t+FRYortKmq/cViAnPTzx2LnFg84tNpWp4TZBFGQz ++8yTnc4kmz75fS/jY2MMddj2gbICrsRhetPfHtXV/WVhJDP1H18GbtCFY2VVPe0a +87VXE15/V8k1mE8McODmi3fipona8+/och3xWKE2rec1MKzKT0g6eXq8CrGCsyT7 +YdEIqUuyyOP7uWrat2DX9GgdT0Kj3jlN9K5W7edjcrsZCwenyO4KbXCeAvzhzffi +7MA0BM0oNC9hkXL+nOmFg/+OTxIy7vKBg8P+OxtMb61zO7X8vC7CIAXFjvGDfRaD +ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg== -----END DH PARAMETERS----- _end_of_pem_ - private_constant :DEFAULT_2048 + private_constant :DH_ffdhe2048 DEFAULT_TMP_DH_CALLBACK = lambda { |ctx, is_export, keylen| # :nodoc: warn "using default DH parameters." if $VERBOSE - DEFAULT_2048 + DH_ffdhe2048 } end if !(OpenSSL::OPENSSL_VERSION.start_with?("OpenSSL") && OpenSSL::OPENSSL_VERSION_NUMBER >= 0x10100000) DEFAULT_PARAMS.merge!( + min_version: OpenSSL::SSL::TLS1_VERSION, ciphers: %w{ ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256 @@ -249,6 +252,14 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3 to_io.peeraddr end + def local_address + to_io.local_address + end + + def remote_address + to_io.remote_address + end + def setsockopt(level, optname, optval) to_io.setsockopt(level, optname, optval) end @@ -268,6 +279,36 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3 def do_not_reverse_lookup=(flag) to_io.do_not_reverse_lookup = flag end + + def close_on_exec=(value) + to_io.close_on_exec = value + end + + def close_on_exec? + to_io.close_on_exec? + end + + def wait(*args) + to_io.wait(*args) + end + + def wait_readable(*args) + to_io.wait_readable(*args) + end + + def wait_writable(*args) + to_io.wait_writable(*args) + end + + if IO.method_defined?(:timeout) + def timeout + to_io.timeout + end + + def timeout=(value) + to_io.timeout=(value) + end + end end def verify_certificate_identity(cert, hostname) @@ -418,6 +459,32 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3 nil end + # Close the stream for reading. + # This method is ignored by OpenSSL as there is no reasonable way to + # implement it, but exists for compatibility with IO. + def close_read + # Unsupported and ignored. + # Just don't read any more. + end + + # Closes the stream for writing. The behavior of this method depends on + # the version of OpenSSL and the TLS protocol in use. + # + # - Sends a 'close_notify' alert to the peer. + # - Does not wait for the peer's 'close_notify' alert in response. + # + # In TLS 1.2 and earlier: + # - On receipt of a 'close_notify' alert, responds with a 'close_notify' + # alert of its own and close down the connection immediately, + # discarding any pending writes. + # + # Therefore, on TLS 1.2, this method will cause the connection to be + # completely shut down. On TLS 1.3, the connection will remain open for + # reading only. + def close_write + stop + end + private def using_anon_cipher? @@ -491,7 +558,7 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3 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] + session_id = prng.bytes(16).unpack1('H*') @ctx.session_id_context = session_id end @start_immediately = true @@ -540,3 +607,5 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3 end end end + +end diff --git a/ext/openssl/lib/openssl/version.rb b/ext/openssl/lib/openssl/version.rb index 80597c0743..9315a79381 100644 --- a/ext/openssl/lib/openssl/version.rb +++ b/ext/openssl/lib/openssl/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenSSL - VERSION = "3.1.0.pre" + VERSION = "3.2.0" end diff --git a/ext/openssl/openssl.gemspec b/ext/openssl/openssl.gemspec index d3d8be05db..2765f55401 100644 --- a/ext/openssl/openssl.gemspec +++ b/ext/openssl/openssl.gemspec @@ -1,21 +1,27 @@ Gem::Specification.new do |spec| spec.name = "openssl" - spec.version = "3.1.0.pre" + spec.version = "3.2.0" spec.authors = ["Martin Bosslet", "SHIBATA Hiroshi", "Zachary Scott", "Kazuki Yamaguchi"] spec.email = ["ruby-core@ruby-lang.org"] - spec.summary = %q{OpenSSL provides SSL, TLS and general purpose cryptography.} - spec.description = %q{It wraps the OpenSSL library.} + spec.summary = %q{SSL/TLS and general-purpose cryptography for Ruby} + spec.description = %q{OpenSSL for Ruby provides access to SSL/TLS and general-purpose cryptography based on the OpenSSL library.} spec.homepage = "https://github.com/ruby/openssl" spec.license = "Ruby" - spec.files = Dir["lib/**/*.rb", "ext/**/*.{c,h,rb}", "*.md", "BSDL", "LICENSE.txt"] - spec.require_paths = ["lib"] - spec.extensions = ["ext/openssl/extconf.rb"] + if Gem::Platform === spec.platform and spec.platform =~ 'java' or RUBY_ENGINE == 'jruby' + spec.platform = "java" + spec.files = [] + spec.add_runtime_dependency('jruby-openssl', '~> 0.14') + else + spec.files = Dir["lib/**/*.rb", "ext/**/*.{c,h,rb}", "*.md", "BSDL", "LICENSE.txt"] + spec.require_paths = ["lib"] + spec.extensions = ["ext/openssl/extconf.rb"] + end spec.extra_rdoc_files = Dir["*.md"] spec.rdoc_options = ["--main", "README.md"] - spec.required_ruby_version = ">= 2.6.0" + spec.required_ruby_version = ">= 2.7.0" spec.metadata["msys2_mingw_dependencies"] = "openssl" end diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 6c532aca94..00eded55cb 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -207,7 +207,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_) while (1) { /* - * when the flag is nonzero, this passphrase + * when the flag is nonzero, this password * will be used to perform encryption; otherwise it will * be used to perform decryption. */ @@ -272,23 +272,28 @@ VALUE ossl_make_error(VALUE exc, VALUE str) { unsigned long e; + const char *data; + int flags; - e = ERR_peek_last_error(); + if (NIL_P(str)) + str = rb_str_new(NULL, 0); + +#ifdef HAVE_ERR_GET_ERROR_ALL + e = ERR_peek_last_error_all(NULL, NULL, NULL, &data, &flags); +#else + e = ERR_peek_last_error_line_data(NULL, NULL, &data, &flags); +#endif if (e) { - const char *msg = ERR_reason_error_string(e); + const char *msg = ERR_reason_error_string(e); - if (NIL_P(str)) { - if (msg) str = rb_str_new_cstr(msg); - } - else { - if (RSTRING_LEN(str)) rb_str_cat2(str, ": "); - rb_str_cat2(str, msg ? msg : "(null)"); - } - ossl_clear_error(); + if (RSTRING_LEN(str)) rb_str_cat_cstr(str, ": "); + rb_str_cat_cstr(str, msg ? msg : "(null)"); + if (flags & ERR_TXT_STRING && data) + rb_str_catf(str, " (%s)", data); + ossl_clear_error(); } - if (NIL_P(str)) str = rb_str_new(0, 0); - return rb_exc_new3(exc, str); + return rb_exc_new_str(exc, str); } void @@ -369,22 +374,6 @@ ossl_get_errors(VALUE _) */ VALUE dOSSL; -#if !defined(HAVE_VA_ARGS_MACRO) -void -ossl_debug(const char *fmt, ...) -{ - va_list args; - - if (dOSSL == Qtrue) { - fprintf(stderr, "OSSL_DEBUG: "); - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, " [CONTEXT N/A]\n"); - } -} -#endif - /* * call-seq: * OpenSSL.debug -> true | false @@ -418,7 +407,11 @@ static VALUE ossl_fips_mode_get(VALUE self) { -#ifdef OPENSSL_FIPS +#if OSSL_OPENSSL_PREREQ(3, 0, 0) + VALUE enabled; + enabled = EVP_default_properties_is_fips_enabled(NULL) ? Qtrue : Qfalse; + return enabled; +#elif defined(OPENSSL_FIPS) VALUE enabled; enabled = FIPS_mode() ? Qtrue : Qfalse; return enabled; @@ -442,8 +435,18 @@ ossl_fips_mode_get(VALUE self) static VALUE ossl_fips_mode_set(VALUE self, VALUE enabled) { - -#ifdef OPENSSL_FIPS +#if OSSL_OPENSSL_PREREQ(3, 0, 0) + if (RTEST(enabled)) { + if (!EVP_default_properties_enable_fips(NULL, 1)) { + ossl_raise(eOSSLError, "Turning on FIPS mode failed"); + } + } else { + if (!EVP_default_properties_enable_fips(NULL, 0)) { + ossl_raise(eOSSLError, "Turning off FIPS mode failed"); + } + } + return enabled; +#elif defined(OPENSSL_FIPS) if (RTEST(enabled)) { int mode = FIPS_mode(); if(!mode && !FIPS_mode_set(1)) /* turning on twice leads to an error */ @@ -460,75 +463,6 @@ ossl_fips_mode_set(VALUE self, VALUE enabled) #endif } -#if defined(OSSL_DEBUG) -#if !defined(LIBRESSL_VERSION_NUMBER) && \ - (OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(OPENSSL_NO_CRYPTO_MDEBUG) || \ - defined(CRYPTO_malloc_debug_init)) -/* - * call-seq: - * OpenSSL.mem_check_start -> nil - * - * Calls CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON). Starts tracking memory - * allocations. See also OpenSSL.print_mem_leaks. - * - * This is available only when built with a capable OpenSSL and --enable-debug - * configure option. - */ -static VALUE -mem_check_start(VALUE self) -{ - CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); - return Qnil; -} - -/* - * call-seq: - * OpenSSL.print_mem_leaks -> true | false - * - * For debugging the Ruby/OpenSSL library. Calls CRYPTO_mem_leaks_fp(stderr). - * Prints detected memory leaks to standard error. This cleans the global state - * up thus you cannot use any methods of the library after calling this. - * - * Returns +true+ if leaks detected, +false+ otherwise. - * - * This is available only when built with a capable OpenSSL and --enable-debug - * configure option. - * - * === Example - * OpenSSL.mem_check_start - * NOT_GCED = OpenSSL::PKey::RSA.new(256) - * - * END { - * GC.start - * OpenSSL.print_mem_leaks # will print the leakage - * } - */ -static VALUE -print_mem_leaks(VALUE self) -{ -#if OPENSSL_VERSION_NUMBER >= 0x10100000 - int ret; -#endif - -#ifndef HAVE_RB_EXT_RACTOR_SAFE - // for Ruby 2.x - void ossl_bn_ctx_free(void); // ossl_bn.c - ossl_bn_ctx_free(); -#endif - -#if OPENSSL_VERSION_NUMBER >= 0x10100000 - ret = CRYPTO_mem_leaks_fp(stderr); - if (ret < 0) - ossl_raise(eOSSLError, "CRYPTO_mem_leaks_fp"); - return ret ? Qfalse : Qtrue; -#else - CRYPTO_mem_leaks_fp(stderr); - return Qnil; -#endif -} -#endif -#endif - #if !defined(HAVE_OPENSSL_110_THREADING_API) /** * Stores locks needed for OpenSSL thread safety @@ -671,23 +605,21 @@ ossl_crypto_fixed_length_secure_compare(VALUE dummy, VALUE str1, VALUE str2) * * key = OpenSSL::PKey::RSA.new 2048 * - * open 'private_key.pem', 'w' do |io| io.write key.to_pem end - * open 'public_key.pem', 'w' do |io| io.write key.public_key.to_pem end + * File.write 'private_key.pem', key.private_to_pem + * File.write 'public_key.pem', key.public_to_pem * * === Exporting a Key * * Keys saved to disk without encryption are not secure as anyone who gets * 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. + * export a key you may export it with a password. * * cipher = OpenSSL::Cipher.new 'aes-256-cbc' - * pass_phrase = 'my secure pass phrase goes here' + * password = 'my secure password goes here' * - * key_secure = key.export cipher, pass_phrase + * key_secure = key.private_to_pem cipher, password * - * open 'private.secure.pem', 'w' do |io| - * io.write key_secure - * end + * File.write 'private.secure.pem', key_secure * * OpenSSL::Cipher.ciphers returns a list of available ciphers. * @@ -707,13 +639,13 @@ ossl_crypto_fixed_length_secure_compare(VALUE dummy, VALUE str1, VALUE str2) * * === Loading an Encrypted Key * - * OpenSSL will prompt you for your pass phrase when loading an encrypted key. - * If you will not be able to type in the pass phrase you may provide it when + * OpenSSL will prompt you for your password when loading an encrypted key. + * If you will not be able to type in the password you may provide it when * loading the key: * * key4_pem = File.read 'private.secure.pem' - * pass_phrase = 'my secure pass phrase goes here' - * key4 = OpenSSL::PKey.read key4_pem, pass_phrase + * password = 'my secure password goes here' + * key4 = OpenSSL::PKey.read key4_pem, password * * == RSA Encryption * @@ -829,45 +761,6 @@ ossl_crypto_fixed_length_secure_compare(VALUE dummy, VALUE str1, VALUE str2) * 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. 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. - * - * pass_phrase = 'my secure pass phrase goes here' - * salt = '8 octets' - * - * === Encryption - * - * First set up the cipher for encryption - * - * encryptor = OpenSSL::Cipher.new 'aes-256-cbc' - * encryptor.encrypt - * encryptor.pkcs5_keyivgen pass_phrase, salt - * - * Then pass the data you want to encrypt through - * - * encrypted = encryptor.update 'top secret document' - * encrypted << encryptor.final - * - * === Decryption - * - * Use a new Cipher instance set up for decryption - * - * decryptor = OpenSSL::Cipher.new 'aes-256-cbc' - * decryptor.decrypt - * decryptor.pkcs5_keyivgen pass_phrase, salt - * - * Then pass the data you want to decrypt through - * - * plain = decryptor.update encrypted - * plain << decryptor.final - * * == X509 Certificates * * === Creating a Certificate @@ -945,12 +838,12 @@ ossl_crypto_fixed_length_secure_compare(VALUE dummy, VALUE str1, VALUE str2) * not readable by other users. * * ca_key = OpenSSL::PKey::RSA.new 2048 - * pass_phrase = 'my secure pass phrase goes here' + * password = 'my secure password goes here' * - * cipher = OpenSSL::Cipher.new 'aes-256-cbc' + * cipher = 'aes-256-cbc' * * open 'ca_key.pem', 'w', 0400 do |io| - * io.write ca_key.export(cipher, pass_phrase) + * io.write ca_key.private_to_pem(cipher, password) * end * * === CA Certificate @@ -1170,8 +1063,8 @@ Init_openssl(void) /* * Init main module */ - mOSSL = rb_define_module("OpenSSL"); rb_global_variable(&mOSSL); + mOSSL = rb_define_module("OpenSSL"); rb_define_singleton_method(mOSSL, "fixed_length_secure_compare", ossl_crypto_fixed_length_secure_compare, 2); /* @@ -1190,15 +1083,35 @@ Init_openssl(void) /* * Version number of OpenSSL the ruby OpenSSL extension was built with - * (base 16) + * (base 16). The formats are below. + * + * [OpenSSL 3] <tt>0xMNN00PP0 (major minor 00 patch 0)</tt> + * [OpenSSL before 3] <tt>0xMNNFFPPS (major minor fix patch status)</tt> + * [LibreSSL] <tt>0x20000000 (fixed value)</tt> + * + * See also the man page OPENSSL_VERSION_NUMBER(3). */ rb_define_const(mOSSL, "OPENSSL_VERSION_NUMBER", INT2NUM(OPENSSL_VERSION_NUMBER)); +#if defined(LIBRESSL_VERSION_NUMBER) + /* + * Version number of LibreSSL the ruby OpenSSL extension was built with + * (base 16). The format is <tt>0xMNNFF00f (major minor fix 00 + * status)</tt>. This constant is only defined in LibreSSL cases. + * + * See also the man page LIBRESSL_VERSION_NUMBER(3). + */ + rb_define_const(mOSSL, "LIBRESSL_VERSION_NUMBER", INT2NUM(LIBRESSL_VERSION_NUMBER)); +#endif + /* * Boolean indicating whether OpenSSL is FIPS-capable or not */ rb_define_const(mOSSL, "OPENSSL_FIPS", -#ifdef OPENSSL_FIPS +/* OpenSSL 3 is FIPS-capable even when it is installed without fips option */ +#if OSSL_OPENSSL_PREREQ(3, 0, 0) + Qtrue +#elif defined(OPENSSL_FIPS) Qtrue #else Qfalse @@ -1208,12 +1121,12 @@ Init_openssl(void) rb_define_module_function(mOSSL, "fips_mode", ossl_fips_mode_get, 0); rb_define_module_function(mOSSL, "fips_mode=", ossl_fips_mode_set, 1); + rb_global_variable(&eOSSLError); /* * Generic error, * common for all classes under OpenSSL module */ eOSSLError = rb_define_class_under(mOSSL,"OpenSSLError",rb_eStandardError); - rb_global_variable(&eOSSLError); /* * Init debug core @@ -1254,42 +1167,7 @@ Init_openssl(void) Init_ossl_x509(); Init_ossl_ocsp(); Init_ossl_engine(); + Init_ossl_provider(); Init_ossl_asn1(); Init_ossl_kdf(); - -#if defined(OSSL_DEBUG) - /* - * For debugging Ruby/OpenSSL. Enable only when built with --enable-debug - */ -#if !defined(LIBRESSL_VERSION_NUMBER) && \ - (OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(OPENSSL_NO_CRYPTO_MDEBUG) || \ - defined(CRYPTO_malloc_debug_init)) - rb_define_module_function(mOSSL, "mem_check_start", mem_check_start, 0); - rb_define_module_function(mOSSL, "print_mem_leaks", print_mem_leaks, 0); - -#if defined(CRYPTO_malloc_debug_init) /* <= 1.0.2 */ - CRYPTO_malloc_debug_init(); -#endif - -#if defined(V_CRYPTO_MDEBUG_ALL) /* <= 1.0.2 */ - CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL); -#endif - -#if OPENSSL_VERSION_NUMBER < 0x10100000 /* <= 1.0.2 */ - { - int i; - /* - * See crypto/ex_data.c; call def_get_class() immediately to avoid - * allocations. 15 is the maximum number that is used as the class index - * in OpenSSL 1.0.2. - */ - for (i = 0; i <= 15; i++) { - if (CRYPTO_get_ex_new_index(i, 0, (void *)"ossl-mdebug-dummy", 0, 0, 0) < 0) - rb_raise(rb_eRuntimeError, "CRYPTO_get_ex_new_index for " - "class index %d failed", i); - } - } -#endif -#endif -#endif } diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h index 2ab8aeaebb..68d42b71e2 100644 --- a/ext/openssl/ossl.h +++ b/ext/openssl/ossl.h @@ -52,10 +52,20 @@ (LIBRESSL_VERSION_NUMBER >= ((maj << 28) | (min << 20) | (pat << 12))) #endif +#if OSSL_OPENSSL_PREREQ(3, 0, 0) +# define OSSL_3_const const +#else +# define OSSL_3_const /* const */ +#endif + #if !defined(OPENSSL_NO_ENGINE) && !OSSL_OPENSSL_PREREQ(3, 0, 0) # define OSSL_USE_ENGINE #endif +#if OSSL_OPENSSL_PREREQ(3, 0, 0) +# define OSSL_USE_PROVIDER +#endif + /* * Common Module */ @@ -151,7 +161,6 @@ VALUE ossl_to_der_if_possible(VALUE); */ extern VALUE dOSSL; -#if defined(HAVE_VA_ARGS_MACRO) #define OSSL_Debug(...) do { \ if (dOSSL == Qtrue) { \ fprintf(stderr, "OSSL_DEBUG: "); \ @@ -160,11 +169,6 @@ extern VALUE dOSSL; } \ } while (0) -#else -void ossl_debug(const char *, ...); -#define OSSL_Debug ossl_debug -#endif - /* * Include all parts */ @@ -188,6 +192,7 @@ void ossl_debug(const char *, ...); #endif #include "ossl_x509.h" #include "ossl_engine.h" +#include "ossl_provider.h" #include "ossl_kdf.h" void Init_openssl(void); diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index 71c452c88a..0533342077 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -1163,9 +1163,12 @@ ossl_asn1prim_to_der(VALUE self) rb_jump_tag(state); } p0 = p1 = (unsigned char *)RSTRING_PTR(str); - i2d_ASN1_TYPE(asn1, &p0); + if (i2d_ASN1_TYPE(asn1, &p0) < 0) { + ASN1_TYPE_free(asn1); + ossl_raise(eASN1Error, "i2d_ASN1_TYPE"); + } ASN1_TYPE_free(asn1); - assert(p0 - p1 == alllen); + ossl_str_adjust(str, p0); /* Strip header since to_der_internal() wants only the payload */ j = ASN1_get_object((const unsigned char **)&p1, &bodylen, &tag, &tc, alllen); diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c index bf2bac3679..ce0d3ec7ee 100644 --- a/ext/openssl/ossl_bn.c +++ b/ext/openssl/ossl_bn.c @@ -41,7 +41,7 @@ static const rb_data_type_t ossl_bn_type = { { 0, ossl_bn_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c index d9c7891433..6f74c925c0 100644 --- a/ext/openssl/ossl_cipher.c +++ b/ext/openssl/ossl_cipher.c @@ -42,7 +42,7 @@ static const rb_data_type_t ossl_cipher_type = { { 0, ossl_cipher_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* @@ -384,14 +384,25 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self) StringValue(data); in = (unsigned char *)RSTRING_PTR(data); - if ((in_len = RSTRING_LEN(data)) == 0) - ossl_raise(rb_eArgError, "data must not be empty"); + in_len = RSTRING_LEN(data); GetCipher(self, ctx); - out_len = in_len+EVP_CIPHER_CTX_block_size(ctx); - if (out_len <= 0) { + + /* + * As of OpenSSL 3.2, there is no reliable way to determine the required + * output buffer size for arbitrary cipher modes. + * https://github.com/openssl/openssl/issues/22628 + * + * in_len+block_size is usually sufficient, but AES key wrap with padding + * ciphers require in_len+15 even though they have a block size of 8 bytes. + * + * Using EVP_MAX_BLOCK_LENGTH (32) as a safe upper bound for ciphers + * currently implemented in OpenSSL, but this can change in the future. + */ + if (in_len > LONG_MAX - EVP_MAX_BLOCK_LENGTH) { ossl_raise(rb_eRangeError, "data too big to make output buffer: %ld bytes", in_len); } + out_len = in_len + EVP_MAX_BLOCK_LENGTH; if (NIL_P(str)) { str = rb_str_new(0, out_len); @@ -402,7 +413,7 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self) if (!ossl_cipher_update_long(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len)) ossl_raise(eCipherError, NULL); - assert(out_len < RSTRING_LEN(str)); + assert(out_len <= RSTRING_LEN(str)); rb_str_set_len(str, out_len); return str; @@ -443,8 +454,8 @@ ossl_cipher_final(VALUE self) * call-seq: * cipher.name -> string * - * Returns the name of the cipher which may differ slightly from the original - * name provided. + * Returns the short name of the cipher which may differ slightly from the + * original name provided. */ static VALUE ossl_cipher_name(VALUE self) diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c index 0bac027487..0e598b4d51 100644 --- a/ext/openssl/ossl_config.c +++ b/ext/openssl/ossl_config.c @@ -22,7 +22,7 @@ static const rb_data_type_t ossl_config_type = { { 0, nconf_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; CONF * diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c index fc326ec14a..1ae26a2355 100644 --- a/ext/openssl/ossl_digest.c +++ b/ext/openssl/ossl_digest.c @@ -35,7 +35,7 @@ static const rb_data_type_t ossl_digest_type = { { 0, ossl_digest_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* @@ -103,7 +103,8 @@ VALUE ossl_digest_update(VALUE, VALUE); * Digest.new(string [, data]) -> Digest * * Creates a Digest instance based on _string_, which is either the ln - * (long name) or sn (short name) of a supported digest algorithm. + * (long name) or sn (short name) of a supported digest algorithm. A list of + * supported algorithms can be obtained by calling OpenSSL::Digest.digests. * * If _data_ (a String) is given, it is used as the initial input to the * Digest instance, i.e. @@ -162,6 +163,32 @@ ossl_digest_copy(VALUE self, VALUE other) return self; } +static void +add_digest_name_to_ary(const OBJ_NAME *name, void *arg) +{ + VALUE ary = (VALUE)arg; + rb_ary_push(ary, rb_str_new2(name->name)); +} + +/* + * call-seq: + * OpenSSL::Digest.digests -> array[string...] + * + * Returns the names of all available digests in an array. + */ +static VALUE +ossl_s_digests(VALUE self) +{ + VALUE ary; + + ary = rb_ary_new(); + OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH, + add_digest_name_to_ary, + (void*)ary); + + return ary; +} + /* * call-seq: * digest.reset -> self @@ -245,7 +272,8 @@ ossl_digest_finish(int argc, VALUE *argv, VALUE self) * call-seq: * digest.name -> string * - * Returns the sn of this Digest algorithm. + * Returns the short name of this Digest algorithm which may differ slightly + * from the original name provided. * * === Example * digest = OpenSSL::Digest.new('SHA512') @@ -412,6 +440,7 @@ Init_ossl_digest(void) rb_define_alloc_func(cDigest, ossl_digest_alloc); + rb_define_module_function(cDigest, "digests", ossl_s_digests, 0); rb_define_method(cDigest, "initialize", ossl_digest_initialize, -1); rb_define_method(cDigest, "initialize_copy", ossl_digest_copy, 1); rb_define_method(cDigest, "reset", ossl_digest_reset, 0); diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c index 1abde7f766..9e86321d06 100644 --- a/ext/openssl/ossl_engine.c +++ b/ext/openssl/ossl_engine.c @@ -78,7 +78,7 @@ static const rb_data_type_t ossl_engine_type = { { 0, ossl_engine_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c index 1a5f471a27..c485ba7e67 100644 --- a/ext/openssl/ossl_hmac.c +++ b/ext/openssl/ossl_hmac.c @@ -42,7 +42,7 @@ static const rb_data_type_t ossl_hmac_type = { { 0, ossl_hmac_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE diff --git a/ext/openssl/ossl_kdf.c b/ext/openssl/ossl_kdf.c index 7fa38b865e..ba197a659e 100644 --- a/ext/openssl/ossl_kdf.c +++ b/ext/openssl/ossl_kdf.c @@ -3,7 +3,7 @@ * Copyright (C) 2007, 2017 Ruby/OpenSSL Project Authors */ #include "ossl.h" -#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER) +#if OSSL_OPENSSL_PREREQ(1, 1, 0) || OSSL_LIBRESSL_PREREQ(3, 6, 0) # include <openssl/kdf.h> #endif @@ -18,10 +18,10 @@ static VALUE mKDF, eKDF; * of _length_ bytes. * * For more information about PBKDF2, see RFC 2898 Section 5.2 - * (https://tools.ietf.org/html/rfc2898#section-5.2). + * (https://www.rfc-editor.org/rfc/rfc2898#section-5.2). * * === Parameters - * pass :: The passphrase. + * pass :: The password. * salt :: The salt. Salts prevent attacks based on dictionaries of common * passwords and attacks based on rainbow tables. It is a public * value that can be safely stored along with the password (e.g. @@ -81,10 +81,10 @@ kdf_pbkdf2_hmac(int argc, VALUE *argv, VALUE self) * bcrypt. * * The keyword arguments _N_, _r_ and _p_ can be used to tune scrypt. RFC 7914 - * (published on 2016-08, https://tools.ietf.org/html/rfc7914#section-2) states + * (published on 2016-08, https://www.rfc-editor.org/rfc/rfc7914#section-2) states * that using values r=8 and p=1 appears to yield good results. * - * See RFC 7914 (https://tools.ietf.org/html/rfc7914) for more information. + * See RFC 7914 (https://www.rfc-editor.org/rfc/rfc7914) for more information. * * === Parameters * pass :: Passphrase. @@ -141,13 +141,13 @@ kdf_scrypt(int argc, VALUE *argv, VALUE self) } #endif -#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER) +#if OSSL_OPENSSL_PREREQ(1, 1, 0) || OSSL_LIBRESSL_PREREQ(3, 6, 0) /* * call-seq: * KDF.hkdf(ikm, salt:, info:, length:, hash:) -> String * * HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as specified in - * {RFC 5869}[https://tools.ietf.org/html/rfc5869]. + * {RFC 5869}[https://www.rfc-editor.org/rfc/rfc5869]. * * New in OpenSSL 1.1.0. * @@ -165,7 +165,7 @@ kdf_scrypt(int argc, VALUE *argv, VALUE self) * The hash function. * * === Example - * # The values from https://datatracker.ietf.org/doc/html/rfc5869#appendix-A.1 + * # The values from https://www.rfc-editor.org/rfc/rfc5869#appendix-A.1 * ikm = ["0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"].pack("H*") * salt = ["000102030405060708090a0b0c"].pack("H*") * info = ["f0f1f2f3f4f5f6f7f8f9"].pack("H*") @@ -305,7 +305,7 @@ Init_ossl_kdf(void) #if defined(HAVE_EVP_PBE_SCRYPT) rb_define_module_function(mKDF, "scrypt", kdf_scrypt, -1); #endif -#if OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER) +#if OSSL_OPENSSL_PREREQ(1, 1, 0) || OSSL_LIBRESSL_PREREQ(3, 6, 0) rb_define_module_function(mKDF, "hkdf", kdf_hkdf, -1); #endif } diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c index 9b1147367a..9d70b5d87a 100644 --- a/ext/openssl/ossl_ns_spki.c +++ b/ext/openssl/ossl_ns_spki.c @@ -50,7 +50,7 @@ static const rb_data_type_t ossl_netscape_spki_type = { { 0, ossl_netscape_spki_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -365,8 +365,8 @@ ossl_spki_verify(VALUE self, VALUE key) * * 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. + * See {RFC 2692}[https://www.rfc-editor.org/rfc/rfc2692] and {RFC + * 2693}[https://www.rfc-editor.org/rfc/rfc2692] for details. */ /* Document-class: OpenSSL::Netscape::SPKIError diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c index 9c8d768d87..df986bb3ee 100644 --- a/ext/openssl/ossl_ocsp.c +++ b/ext/openssl/ossl_ocsp.c @@ -86,7 +86,7 @@ static const rb_data_type_t ossl_ocsp_request_type = { { 0, ossl_ocsp_request_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static void @@ -100,7 +100,7 @@ static const rb_data_type_t ossl_ocsp_response_type = { { 0, ossl_ocsp_response_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static void @@ -114,7 +114,7 @@ static const rb_data_type_t ossl_ocsp_basicresp_type = { { 0, ossl_ocsp_basicresp_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static void @@ -128,7 +128,7 @@ static const rb_data_type_t ossl_ocsp_singleresp_type = { { 0, ossl_ocsp_singleresp_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static void @@ -142,7 +142,7 @@ static const rb_data_type_t ossl_ocsp_certid_type = { { 0, ossl_ocsp_certid_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* @@ -1701,7 +1701,7 @@ Init_ossl_ocsp(void) * require 'net/http' * * http_response = - * Net::HTTP.start ocsp_uri.hostname, ocsp.port do |http| + * Net::HTTP.start ocsp_uri.hostname, ocsp_uri.port do |http| * http.post ocsp_uri.path, request.to_der, * 'content-type' => 'application/ocsp-request' * end diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c index fb947df1d0..164b2da465 100644 --- a/ext/openssl/ossl_pkcs12.c +++ b/ext/openssl/ossl_pkcs12.c @@ -44,7 +44,7 @@ static const rb_data_type_t ossl_pkcs12_type = { { 0, ossl_pkcs12_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c index dbe5347639..446df4c075 100644 --- a/ext/openssl/ossl_pkcs7.c +++ b/ext/openssl/ossl_pkcs7.c @@ -65,7 +65,7 @@ const rb_data_type_t ossl_pkcs7_type = { { 0, ossl_pkcs7_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static void @@ -79,7 +79,7 @@ static const rb_data_type_t ossl_pkcs7_signer_info_type = { { 0, ossl_pkcs7_signer_info_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static void @@ -93,7 +93,7 @@ static const rb_data_type_t ossl_pkcs7_recip_info_type = { { 0, ossl_pkcs7_recip_info_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* @@ -165,7 +165,11 @@ ossl_pkcs7_s_read_smime(VALUE klass, VALUE arg) out = NULL; pkcs7 = SMIME_read_PKCS7(in, &out); BIO_free(in); - if(!pkcs7) ossl_raise(ePKCS7Error, NULL); + if (!pkcs7) + ossl_raise(ePKCS7Error, "Could not parse the PKCS7"); + if (!pkcs7->d.ptr) + ossl_raise(ePKCS7Error, "No content in PKCS7"); + data = out ? ossl_membio2str(out) : Qnil; SetPKCS7(ret, pkcs7); ossl_pkcs7_set_data(ret, data); @@ -346,6 +350,8 @@ ossl_pkcs7_initialize(int argc, VALUE *argv, VALUE self) BIO_free(in); if (!p7) ossl_raise(rb_eArgError, "Could not parse the PKCS7"); + if (!p7->d.ptr) + ossl_raise(rb_eArgError, "No content in PKCS7"); RTYPEDDATA_DATA(self) = p7; PKCS7_free(p7_orig); @@ -842,6 +848,25 @@ ossl_pkcs7_to_der(VALUE self) } static VALUE +ossl_pkcs7_to_text(VALUE self) +{ + PKCS7 *pkcs7; + BIO *out; + VALUE str; + + GetPKCS7(self, pkcs7); + if(!(out = BIO_new(BIO_s_mem()))) + ossl_raise(ePKCS7Error, NULL); + if(!PKCS7_print_ctx(out, pkcs7, 0, NULL)) { + BIO_free(out); + ossl_raise(ePKCS7Error, NULL); + } + str = ossl_membio2str(out); + + return str; +} + +static VALUE ossl_pkcs7_to_pem(VALUE self) { PKCS7 *pkcs7; @@ -1050,6 +1075,7 @@ Init_ossl_pkcs7(void) rb_define_method(cPKCS7, "to_pem", ossl_pkcs7_to_pem, 0); rb_define_alias(cPKCS7, "to_s", "to_pem"); rb_define_method(cPKCS7, "to_der", ossl_pkcs7_to_der, 0); + rb_define_method(cPKCS7, "to_text", ossl_pkcs7_to_text, 0); cPKCS7Signer = rb_define_class_under(cPKCS7, "SignerInfo", rb_cObject); rb_define_const(cPKCS7, "Signer", cPKCS7Signer); diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index ec39e8bd77..013412c27f 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -35,7 +35,7 @@ const rb_data_type_t ossl_evp_pkey_type = { { 0, ossl_evp_pkey_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -82,31 +82,62 @@ ossl_pkey_new(EVP_PKEY *pkey) #if OSSL_OPENSSL_PREREQ(3, 0, 0) # include <openssl/decoder.h> -EVP_PKEY * -ossl_pkey_read_generic(BIO *bio, VALUE pass) +static EVP_PKEY * +ossl_pkey_read(BIO *bio, const char *input_type, int selection, VALUE pass) { void *ppass = (void *)pass; OSSL_DECODER_CTX *dctx; EVP_PKEY *pkey = NULL; int pos = 0, pos2; - dctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, "DER", NULL, NULL, 0, NULL, NULL); + dctx = OSSL_DECODER_CTX_new_for_pkey(&pkey, input_type, NULL, NULL, + selection, NULL, NULL); if (!dctx) goto out; - if (OSSL_DECODER_CTX_set_pem_password_cb(dctx, ossl_pem_passwd_cb, ppass) != 1) - goto out; - - /* First check DER */ - if (OSSL_DECODER_from_bio(dctx, bio) == 1) + if (OSSL_DECODER_CTX_set_pem_password_cb(dctx, ossl_pem_passwd_cb, + ppass) != 1) goto out; + while (1) { + if (OSSL_DECODER_from_bio(dctx, bio) == 1) + goto out; + if (BIO_eof(bio)) + break; + pos2 = BIO_tell(bio); + if (pos2 < 0 || pos2 <= pos) + break; + ossl_clear_error(); + pos = pos2; + } + out: OSSL_BIO_reset(bio); + OSSL_DECODER_CTX_free(dctx); + return pkey; +} - /* Then check PEM; multiple OSSL_DECODER_from_bio() calls may be needed */ - if (OSSL_DECODER_CTX_set_input_type(dctx, "PEM") != 1) - goto out; +EVP_PKEY * +ossl_pkey_read_generic(BIO *bio, VALUE pass) +{ + EVP_PKEY *pkey = NULL; + /* First check DER, then check PEM. */ + const char *input_types[] = {"DER", "PEM"}; + int input_type_num = (int)(sizeof(input_types) / sizeof(char *)); /* - * First check for private key formats. This is to keep compatibility with - * ruby/openssl < 3.0 which decoded the following as a private key. + * Non-zero selections to try to decode. + * + * See EVP_PKEY_fromdata(3) - Selections to see all the selections. + * + * This is a workaround for the decoder failing to decode or returning + * bogus keys with selection 0, if a key management provider is different + * from a decoder provider. The workaround is to avoid using selection 0. + * + * Affected OpenSSL versions: >= 3.1.0, <= 3.1.2, or >= 3.0.0, <= 3.0.10 + * Fixed OpenSSL versions: 3.2, next release of the 3.1.z and 3.0.z + * + * See https://github.com/openssl/openssl/pull/21519 for details. + * + * First check for private key formats (EVP_PKEY_KEYPAIR). This is to keep + * compatibility with ruby/openssl < 3.0 which decoded the following as a + * private key. * * $ openssl ecparam -name prime256v1 -genkey -outform PEM * -----BEGIN EC PARAMETERS----- @@ -124,36 +155,28 @@ ossl_pkey_read_generic(BIO *bio, VALUE pass) * * Note that normally, the input is supposed to contain a single decodable * PEM block only, so this special handling should not create a new problem. + * + * Note that we need to create the OSSL_DECODER_CTX variable each time when + * we use the different selection as a workaround. + * See https://github.com/openssl/openssl/issues/20657 for details. */ - OSSL_DECODER_CTX_set_selection(dctx, EVP_PKEY_KEYPAIR); - while (1) { - if (OSSL_DECODER_from_bio(dctx, bio) == 1) - goto out; - if (BIO_eof(bio)) - break; - pos2 = BIO_tell(bio); - if (pos2 < 0 || pos2 <= pos) - break; - ossl_clear_error(); - pos = pos2; - } - - OSSL_BIO_reset(bio); - OSSL_DECODER_CTX_set_selection(dctx, 0); - while (1) { - if (OSSL_DECODER_from_bio(dctx, bio) == 1) - goto out; - if (BIO_eof(bio)) - break; - pos2 = BIO_tell(bio); - if (pos2 < 0 || pos2 <= pos) - break; - ossl_clear_error(); - pos = pos2; + int selections[] = { + EVP_PKEY_KEYPAIR, + EVP_PKEY_KEY_PARAMETERS, + EVP_PKEY_PUBLIC_KEY + }; + int selection_num = (int)(sizeof(selections) / sizeof(int)); + int i, j; + + for (i = 0; i < input_type_num; i++) { + for (j = 0; j < selection_num; j++) { + pkey = ossl_pkey_read(bio, input_types[i], selections[j], pass); + if (pkey) { + goto out; + } + } } - out: - OSSL_DECODER_CTX_free(dctx); return pkey; } #else @@ -260,9 +283,9 @@ struct pkey_blocking_generate_arg { EVP_PKEY_CTX *ctx; EVP_PKEY *pkey; int state; - int yield: 1; - int genparam: 1; - int interrupted: 1; + unsigned int yield: 1; + unsigned int genparam: 1; + unsigned int interrupted: 1; }; static VALUE @@ -612,6 +635,72 @@ ossl_pkey_initialize_copy(VALUE self, VALUE other) } #endif +#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY +/* + * call-seq: + * OpenSSL::PKey.new_raw_private_key(algo, string) -> PKey + * + * See the OpenSSL documentation for EVP_PKEY_new_raw_private_key() + */ + +static VALUE +ossl_pkey_new_raw_private_key(VALUE self, VALUE type, VALUE key) +{ + EVP_PKEY *pkey; + const EVP_PKEY_ASN1_METHOD *ameth; + int pkey_id; + size_t keylen; + + StringValue(type); + StringValue(key); + ameth = EVP_PKEY_asn1_find_str(NULL, RSTRING_PTR(type), RSTRING_LENINT(type)); + if (!ameth) + ossl_raise(ePKeyError, "algorithm %"PRIsVALUE" not found", type); + EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth); + + keylen = RSTRING_LEN(key); + + pkey = EVP_PKEY_new_raw_private_key(pkey_id, NULL, (unsigned char *)RSTRING_PTR(key), keylen); + if (!pkey) + ossl_raise(ePKeyError, "EVP_PKEY_new_raw_private_key"); + + return ossl_pkey_new(pkey); +} +#endif + +#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY +/* + * call-seq: + * OpenSSL::PKey.new_raw_public_key(algo, string) -> PKey + * + * See the OpenSSL documentation for EVP_PKEY_new_raw_public_key() + */ + +static VALUE +ossl_pkey_new_raw_public_key(VALUE self, VALUE type, VALUE key) +{ + EVP_PKEY *pkey; + const EVP_PKEY_ASN1_METHOD *ameth; + int pkey_id; + size_t keylen; + + StringValue(type); + StringValue(key); + ameth = EVP_PKEY_asn1_find_str(NULL, RSTRING_PTR(type), RSTRING_LENINT(type)); + if (!ameth) + ossl_raise(ePKeyError, "algorithm %"PRIsVALUE" not found", type); + EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth); + + keylen = RSTRING_LEN(key); + + pkey = EVP_PKEY_new_raw_public_key(pkey_id, NULL, (unsigned char *)RSTRING_PTR(key), keylen); + if (!pkey) + ossl_raise(ePKeyError, "EVP_PKEY_new_raw_public_key"); + + return ossl_pkey_new(pkey); +} +#endif + /* * call-seq: * pkey.oid -> string @@ -793,6 +882,18 @@ ossl_pkey_private_to_der(int argc, VALUE *argv, VALUE self) * * Serializes the private key to PEM-encoded PKCS #8 format. See #private_to_der * for more details. + * + * An unencrypted PEM-encoded key will look like: + * + * -----BEGIN PRIVATE KEY----- + * [...] + * -----END PRIVATE KEY----- + * + * An encrypted PEM-encoded key will look like: + * + * -----BEGIN ENCRYPTED PRIVATE KEY----- + * [...] + * -----END ENCRYPTED PRIVATE KEY----- */ static VALUE ossl_pkey_private_to_pem(int argc, VALUE *argv, VALUE self) @@ -800,6 +901,35 @@ ossl_pkey_private_to_pem(int argc, VALUE *argv, VALUE self) return do_pkcs8_export(argc, argv, self, 0); } +#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY +/* + * call-seq: + * pkey.raw_private_key => string + * + * See the OpenSSL documentation for EVP_PKEY_get_raw_private_key() + */ + +static VALUE +ossl_pkey_raw_private_key(VALUE self) +{ + EVP_PKEY *pkey; + VALUE str; + size_t len; + + GetPKey(self, pkey); + if (EVP_PKEY_get_raw_private_key(pkey, NULL, &len) != 1) + ossl_raise(ePKeyError, "EVP_PKEY_get_raw_private_key"); + str = rb_str_new(NULL, len); + + if (EVP_PKEY_get_raw_private_key(pkey, (unsigned char *)RSTRING_PTR(str), &len) != 1) + ossl_raise(ePKeyError, "EVP_PKEY_get_raw_private_key"); + + rb_str_set_len(str, len); + + return str; +} +#endif + VALUE ossl_pkey_export_spki(VALUE self, int to_der) { @@ -842,6 +972,12 @@ ossl_pkey_public_to_der(VALUE self) * pkey.public_to_pem -> string * * Serializes the public key to PEM-encoded X.509 SubjectPublicKeyInfo format. + * + * A PEM-encoded key will look like: + * + * -----BEGIN PUBLIC KEY----- + * [...] + * -----END PUBLIC KEY----- */ static VALUE ossl_pkey_public_to_pem(VALUE self) @@ -849,6 +985,35 @@ ossl_pkey_public_to_pem(VALUE self) return ossl_pkey_export_spki(self, 0); } +#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY +/* + * call-seq: + * pkey.raw_public_key => string + * + * See the OpenSSL documentation for EVP_PKEY_get_raw_public_key() + */ + +static VALUE +ossl_pkey_raw_public_key(VALUE self) +{ + EVP_PKEY *pkey; + VALUE str; + size_t len; + + GetPKey(self, pkey); + if (EVP_PKEY_get_raw_public_key(pkey, NULL, &len) != 1) + ossl_raise(ePKeyError, "EVP_PKEY_get_raw_public_key"); + str = rb_str_new(NULL, len); + + if (EVP_PKEY_get_raw_public_key(pkey, (unsigned char *)RSTRING_PTR(str), &len) != 1) + ossl_raise(ePKeyError, "EVP_PKEY_get_raw_public_key"); + + rb_str_set_len(str, len); + + return str; +} +#endif + /* * call-seq: * pkey.compare?(another_pkey) -> true | false @@ -951,7 +1116,7 @@ ossl_pkey_sign(int argc, VALUE *argv, VALUE self) rb_jump_tag(state); } } -#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER) +#if OSSL_OPENSSL_PREREQ(1, 1, 1) || OSSL_LIBRESSL_PREREQ(3, 4, 0) if (EVP_DigestSign(ctx, NULL, &siglen, (unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data)) < 1) { EVP_MD_CTX_free(ctx); @@ -1056,7 +1221,7 @@ ossl_pkey_verify(int argc, VALUE *argv, VALUE self) rb_jump_tag(state); } } -#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(LIBRESSL_VERSION_NUMBER) +#if OSSL_OPENSSL_PREREQ(1, 1, 1) || OSSL_LIBRESSL_PREREQ(3, 4, 0) ret = EVP_DigestVerify(ctx, (unsigned char *)RSTRING_PTR(sig), RSTRING_LEN(sig), (unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data)); @@ -1586,6 +1751,10 @@ Init_ossl_pkey(void) rb_define_module_function(mPKey, "read", ossl_pkey_new_from_data, -1); rb_define_module_function(mPKey, "generate_parameters", ossl_pkey_s_generate_parameters, -1); rb_define_module_function(mPKey, "generate_key", ossl_pkey_s_generate_key, -1); +#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY + rb_define_module_function(mPKey, "new_raw_private_key", ossl_pkey_new_raw_private_key, 2); + rb_define_module_function(mPKey, "new_raw_public_key", ossl_pkey_new_raw_public_key, 2); +#endif rb_define_alloc_func(cPKey, ossl_pkey_alloc); rb_define_method(cPKey, "initialize", ossl_pkey_initialize, 0); @@ -1601,6 +1770,10 @@ Init_ossl_pkey(void) rb_define_method(cPKey, "private_to_pem", ossl_pkey_private_to_pem, -1); rb_define_method(cPKey, "public_to_der", ossl_pkey_public_to_der, 0); rb_define_method(cPKey, "public_to_pem", ossl_pkey_public_to_pem, 0); +#ifdef HAVE_EVP_PKEY_NEW_RAW_PRIVATE_KEY + rb_define_method(cPKey, "raw_private_key", ossl_pkey_raw_private_key, 0); + rb_define_method(cPKey, "raw_public_key", ossl_pkey_raw_public_key, 0); +#endif rb_define_method(cPKey, "compare?", ossl_pkey_compare, 1); rb_define_method(cPKey, "sign", ossl_pkey_sign, -1); diff --git a/ext/openssl/ossl_pkey.h b/ext/openssl/ossl_pkey.h index 38fb9fad10..10669b824c 100644 --- a/ext/openssl/ossl_pkey.h +++ b/ext/openssl/ossl_pkey.h @@ -92,7 +92,7 @@ void Init_ossl_ec(void); */ \ static VALUE ossl_##_keytype##_get_##_name(VALUE self) \ { \ - _type *obj; \ + const _type *obj; \ const BIGNUM *bn; \ \ Get##_type(self, obj); \ diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c index 696455dcfd..a231814a99 100644 --- a/ext/openssl/ossl_pkey_dh.c +++ b/ext/openssl/ossl_pkey_dh.c @@ -178,7 +178,7 @@ ossl_dh_initialize_copy(VALUE self, VALUE other) static VALUE ossl_dh_is_public(VALUE self) { - DH *dh; + OSSL_3_const DH *dh; const BIGNUM *bn; GetDH(self, dh); @@ -197,14 +197,14 @@ ossl_dh_is_public(VALUE self) static VALUE ossl_dh_is_private(VALUE self) { - DH *dh; + OSSL_3_const DH *dh; const BIGNUM *bn; GetDH(self, dh); DH_get0_key(dh, NULL, &bn); #if !defined(OPENSSL_NO_ENGINE) - return (bn || DH_get0_engine(dh)) ? Qtrue : Qfalse; + return (bn || DH_get0_engine((DH *)dh)) ? Qtrue : Qfalse; #else return bn ? Qtrue : Qfalse; #endif @@ -216,14 +216,25 @@ ossl_dh_is_private(VALUE self) * 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 - * parameters will be encoded. + * Serializes the DH parameters to a PEM-encoding. + * + * Note that any existing per-session public/private keys will *not* get + * encoded, just the Diffie-Hellman parameters will be encoded. + * + * PEM-encoded parameters will look like: + * + * -----BEGIN DH PARAMETERS----- + * [...] + * -----END DH PARAMETERS----- + * + * See also #public_to_pem (X.509 SubjectPublicKeyInfo) and + * #private_to_pem (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) for + * serialization with the private or public key components. */ static VALUE ossl_dh_export(VALUE self) { - DH *dh; + OSSL_3_const DH *dh; BIO *out; VALUE str; @@ -244,15 +255,19 @@ ossl_dh_export(VALUE self) * call-seq: * dh.to_der -> aString * - * Encodes this DH to its DER encoding. Note that any existing per-session - * public/private keys will *not* get encoded, just the Diffie-Hellman - * parameters will be encoded. - + * Serializes the DH parameters to a DER-encoding + * + * Note that any existing per-session public/private keys will *not* get + * encoded, just the Diffie-Hellman parameters will be encoded. + * + * See also #public_to_der (X.509 SubjectPublicKeyInfo) and + * #private_to_der (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) for + * serialization with the private or public key components. */ static VALUE ossl_dh_to_der(VALUE self) { - DH *dh; + OSSL_3_const DH *dh; unsigned char *p; long len; VALUE str; @@ -280,7 +295,7 @@ ossl_dh_to_der(VALUE self) static VALUE ossl_dh_get_params(VALUE self) { - DH *dh; + OSSL_3_const DH *dh; VALUE hash; const BIGNUM *p, *q, *g, *pub_key, *priv_key; diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c index 25404aa7f5..058ce73888 100644 --- a/ext/openssl/ossl_pkey_dsa.c +++ b/ext/openssl/ossl_pkey_dsa.c @@ -24,7 +24,7 @@ } while (0) static inline int -DSA_HAS_PRIVATE(DSA *dsa) +DSA_HAS_PRIVATE(OSSL_3_const DSA *dsa) { const BIGNUM *bn; DSA_get0_key(dsa, NULL, &bn); @@ -32,7 +32,7 @@ DSA_HAS_PRIVATE(DSA *dsa) } static inline int -DSA_PRIVATE(VALUE obj, DSA *dsa) +DSA_PRIVATE(VALUE obj, OSSL_3_const DSA *dsa) { return DSA_HAS_PRIVATE(dsa) || OSSL_PKEY_IS_PRIVATE(obj); } @@ -179,7 +179,7 @@ ossl_dsa_initialize_copy(VALUE self, VALUE other) static VALUE ossl_dsa_is_public(VALUE self) { - DSA *dsa; + const DSA *dsa; const BIGNUM *bn; GetDSA(self, dsa); @@ -198,7 +198,7 @@ ossl_dsa_is_public(VALUE self) static VALUE ossl_dsa_is_private(VALUE self) { - DSA *dsa; + OSSL_3_const DSA *dsa; GetDSA(self, dsa); @@ -211,21 +211,63 @@ ossl_dsa_is_private(VALUE self) * dsa.to_pem([cipher, password]) -> aString * dsa.to_s([cipher, password]) -> aString * - * Encodes this DSA to its PEM encoding. + * Serializes a private or public key to a PEM-encoding. + * + * [When the key contains public components only] + * + * Serializes it into an X.509 SubjectPublicKeyInfo. + * The parameters _cipher_ and _password_ are ignored. + * + * A PEM-encoded key will look like: + * + * -----BEGIN PUBLIC KEY----- + * [...] + * -----END PUBLIC KEY----- + * + * Consider using #public_to_pem instead. This serializes the key into an + * X.509 SubjectPublicKeyInfo regardless of whether it is a public key + * or a private key. + * + * [When the key contains private components, and no parameters are given] + * + * Serializes it into a traditional \OpenSSL DSAPrivateKey. + * + * A PEM-encoded key will look like: + * + * -----BEGIN DSA PRIVATE KEY----- + * [...] + * -----END DSA PRIVATE KEY----- * - * === Parameters - * * _cipher_ is an OpenSSL::Cipher. - * * _password_ is a string containing your password. + * [When the key contains private components, and _cipher_ and _password_ are given] * - * === Examples - * DSA.to_pem -> aString - * DSA.to_pem(cipher, 'mypassword') -> aString + * Serializes it into a traditional \OpenSSL DSAPrivateKey and encrypts it in + * OpenSSL's traditional PEM encryption format. + * _cipher_ must be a cipher name understood by OpenSSL::Cipher.new or an + * instance of OpenSSL::Cipher. * + * An encrypted PEM-encoded key will look like: + * + * -----BEGIN DSA PRIVATE KEY----- + * Proc-Type: 4,ENCRYPTED + * DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0 + * + * [...] + * -----END DSA PRIVATE KEY----- + * + * Note that this format uses MD5 to derive the encryption key, and hence + * will not be available on FIPS-compliant systems. + * + * <b>This method is kept for compatibility.</b> + * This should only be used when the traditional, non-standard \OpenSSL format + * is required. + * + * Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem + * (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead. */ static VALUE ossl_dsa_export(int argc, VALUE *argv, VALUE self) { - DSA *dsa; + OSSL_3_const DSA *dsa; GetDSA(self, dsa); if (DSA_HAS_PRIVATE(dsa)) @@ -238,13 +280,20 @@ ossl_dsa_export(int argc, VALUE *argv, VALUE self) * call-seq: * dsa.to_der -> aString * - * Encodes this DSA to its DER encoding. + * Serializes a private or public key to a DER-encoding. + * + * See #to_pem for details. + * + * <b>This method is kept for compatibility.</b> + * This should only be used when the traditional, non-standard \OpenSSL format + * is required. * + * Consider using #public_to_der or #private_to_der instead. */ static VALUE ossl_dsa_to_der(VALUE self) { - DSA *dsa; + OSSL_3_const DSA *dsa; GetDSA(self, dsa); if (DSA_HAS_PRIVATE(dsa)) @@ -265,7 +314,7 @@ ossl_dsa_to_der(VALUE self) static VALUE ossl_dsa_get_params(VALUE self) { - DSA *dsa; + OSSL_3_const DSA *dsa; VALUE hash; const BIGNUM *p, *q, *g, *pub_key, *priv_key; diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index 06d59c2a4f..4b3a1fd0fe 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -227,7 +227,7 @@ ossl_ec_key_initialize_copy(VALUE self, VALUE other) static VALUE ossl_ec_key_get_group(VALUE self) { - EC_KEY *ec; + OSSL_3_const EC_KEY *ec; const EC_GROUP *group; GetEC(self, ec); @@ -272,7 +272,7 @@ ossl_ec_key_set_group(VALUE self, VALUE group_v) */ static VALUE ossl_ec_key_get_private_key(VALUE self) { - EC_KEY *ec; + OSSL_3_const EC_KEY *ec; const BIGNUM *bn; GetEC(self, ec); @@ -323,7 +323,7 @@ static VALUE ossl_ec_key_set_private_key(VALUE self, VALUE private_key) */ static VALUE ossl_ec_key_get_public_key(VALUE self) { - EC_KEY *ec; + OSSL_3_const EC_KEY *ec; const EC_POINT *point; GetEC(self, ec); @@ -375,7 +375,7 @@ static VALUE ossl_ec_key_set_public_key(VALUE self, VALUE public_key) */ static VALUE ossl_ec_key_is_public(VALUE self) { - EC_KEY *ec; + OSSL_3_const EC_KEY *ec; GetEC(self, ec); @@ -391,7 +391,7 @@ static VALUE ossl_ec_key_is_public(VALUE self) */ static VALUE ossl_ec_key_is_private(VALUE self) { - EC_KEY *ec; + OSSL_3_const EC_KEY *ec; GetEC(self, ec); @@ -400,18 +400,66 @@ static VALUE ossl_ec_key_is_private(VALUE self) /* * call-seq: - * key.export([cipher, pass_phrase]) => String - * key.to_pem([cipher, pass_phrase]) => String + * key.export([cipher, password]) => String + * key.to_pem([cipher, password]) => String + * + * Serializes a private or public key to a PEM-encoding. + * + * [When the key contains public components only] + * + * Serializes it into an X.509 SubjectPublicKeyInfo. + * The parameters _cipher_ and _password_ are ignored. + * + * A PEM-encoded key will look like: + * + * -----BEGIN PUBLIC KEY----- + * [...] + * -----END PUBLIC KEY----- + * + * Consider using #public_to_pem instead. This serializes the key into an + * X.509 SubjectPublicKeyInfo regardless of whether it is a public key + * or a private key. + * + * [When the key contains private components, and no parameters are given] + * + * Serializes it into a SEC 1/RFC 5915 ECPrivateKey. + * + * A PEM-encoded key will look like: + * + * -----BEGIN EC PRIVATE KEY----- + * [...] + * -----END EC PRIVATE KEY----- + * + * [When the key contains private components, and _cipher_ and _password_ are given] + * + * Serializes it into a SEC 1/RFC 5915 ECPrivateKey + * and encrypts it in OpenSSL's traditional PEM encryption format. + * _cipher_ must be a cipher name understood by OpenSSL::Cipher.new or an + * instance of OpenSSL::Cipher. + * + * An encrypted PEM-encoded key will look like: + * + * -----BEGIN EC PRIVATE KEY----- + * Proc-Type: 4,ENCRYPTED + * DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0 + * + * [...] + * -----END EC PRIVATE KEY----- + * + * Note that this format uses MD5 to derive the encryption key, and hence + * will not be available on FIPS-compliant systems. * - * 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 OpenSSL::Cipher - * instance. Note that encryption will only be effective for a private key, - * public keys will always be encoded in plain text. + * <b>This method is kept for compatibility.</b> + * This should only be used when the SEC 1/RFC 5915 ECPrivateKey format is + * required. + * + * Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem + * (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead. */ static VALUE ossl_ec_key_export(int argc, VALUE *argv, VALUE self) { - EC_KEY *ec; + OSSL_3_const EC_KEY *ec; GetEC(self, ec); if (EC_KEY_get0_public_key(ec) == NULL) @@ -426,12 +474,20 @@ ossl_ec_key_export(int argc, VALUE *argv, VALUE self) * call-seq: * key.to_der => String * - * See the OpenSSL documentation for i2d_ECPrivateKey_bio() + * Serializes a private or public key to a DER-encoding. + * + * See #to_pem for details. + * + * <b>This method is kept for compatibility.</b> + * This should only be used when the SEC 1/RFC 5915 ECPrivateKey format is + * required. + * + * Consider using #public_to_der or #private_to_der instead. */ static VALUE ossl_ec_key_to_der(VALUE self) { - EC_KEY *ec; + OSSL_3_const EC_KEY *ec; GetEC(self, ec); if (EC_KEY_get0_public_key(ec) == NULL) @@ -483,16 +539,28 @@ static VALUE ossl_ec_key_check_key(VALUE self) #ifdef HAVE_EVP_PKEY_CHECK EVP_PKEY *pkey; EVP_PKEY_CTX *pctx; - int ret; + const EC_KEY *ec; GetPKey(self, pkey); + GetEC(self, ec); pctx = EVP_PKEY_CTX_new(pkey, /* engine */NULL); if (!pctx) - ossl_raise(eDHError, "EVP_PKEY_CTX_new"); - ret = EVP_PKEY_public_check(pctx); + ossl_raise(eECError, "EVP_PKEY_CTX_new"); + + if (EC_KEY_get0_private_key(ec) != NULL) { + if (EVP_PKEY_check(pctx) != 1) { + EVP_PKEY_CTX_free(pctx); + ossl_raise(eECError, "EVP_PKEY_check"); + } + } + else { + if (EVP_PKEY_public_check(pctx) != 1) { + EVP_PKEY_CTX_free(pctx); + ossl_raise(eECError, "EVP_PKEY_public_check"); + } + } + EVP_PKEY_CTX_free(pctx); - if (ret != 1) - ossl_raise(eECError, "EVP_PKEY_public_check"); #else EC_KEY *ec; @@ -518,7 +586,7 @@ static const rb_data_type_t ossl_ec_group_type = { { 0, ossl_ec_group_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -668,10 +736,11 @@ static VALUE ossl_ec_group_eql(VALUE a, VALUE b) GetECGroup(a, group1); GetECGroup(b, group2); - if (EC_GROUP_cmp(group1, group2, ossl_bn_ctx) == 1) - return Qfalse; - - return Qtrue; + switch (EC_GROUP_cmp(group1, group2, ossl_bn_ctx)) { + case 0: return Qtrue; + case 1: return Qfalse; + default: ossl_raise(eEC_GROUP, "EC_GROUP_cmp"); + } } /* @@ -1102,7 +1171,7 @@ static const rb_data_type_t ossl_ec_point_type = { { 0, ossl_ec_point_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -1232,10 +1301,13 @@ static VALUE ossl_ec_point_eql(VALUE a, VALUE b) GetECPoint(b, point2); GetECGroup(group_v1, group); - if (EC_POINT_cmp(group, point1, point2, ossl_bn_ctx) == 1) - return Qfalse; + switch (EC_POINT_cmp(group, point1, point2, ossl_bn_ctx)) { + case 0: return Qtrue; + case 1: return Qfalse; + default: ossl_raise(eEC_POINT, "EC_POINT_cmp"); + } - return Qtrue; + UNREACHABLE; } /* @@ -1253,7 +1325,7 @@ static VALUE ossl_ec_point_is_at_infinity(VALUE self) switch (EC_POINT_is_at_infinity(group, point)) { case 1: return Qtrue; case 0: return Qfalse; - default: ossl_raise(cEC_POINT, "EC_POINT_is_at_infinity"); + default: ossl_raise(eEC_POINT, "EC_POINT_is_at_infinity"); } UNREACHABLE; @@ -1274,7 +1346,7 @@ static VALUE ossl_ec_point_is_on_curve(VALUE self) switch (EC_POINT_is_on_curve(group, point, ossl_bn_ctx)) { case 1: return Qtrue; case 0: return Qfalse; - default: ossl_raise(cEC_POINT, "EC_POINT_is_on_curve"); + default: ossl_raise(eEC_POINT, "EC_POINT_is_on_curve"); } UNREACHABLE; @@ -1297,7 +1369,7 @@ static VALUE ossl_ec_point_make_affine(VALUE self) rb_warn("OpenSSL::PKey::EC::Point#make_affine! is deprecated"); #if !OSSL_OPENSSL_PREREQ(3, 0, 0) if (EC_POINT_make_affine(group, point, ossl_bn_ctx) != 1) - ossl_raise(cEC_POINT, "EC_POINT_make_affine"); + ossl_raise(eEC_POINT, "EC_POINT_make_affine"); #endif return self; @@ -1316,7 +1388,7 @@ static VALUE ossl_ec_point_invert(VALUE self) GetECPointGroup(self, group); if (EC_POINT_invert(group, point, ossl_bn_ctx) != 1) - ossl_raise(cEC_POINT, "EC_POINT_invert"); + ossl_raise(eEC_POINT, "EC_POINT_invert"); return self; } @@ -1334,7 +1406,7 @@ static VALUE ossl_ec_point_set_to_infinity(VALUE self) GetECPointGroup(self, group); if (EC_POINT_set_to_infinity(group, point) != 1) - ossl_raise(cEC_POINT, "EC_POINT_set_to_infinity"); + ossl_raise(eEC_POINT, "EC_POINT_set_to_infinity"); return self; } diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c index 4d66010f49..389f76f309 100644 --- a/ext/openssl/ossl_pkey_rsa.c +++ b/ext/openssl/ossl_pkey_rsa.c @@ -24,7 +24,7 @@ } while (0) static inline int -RSA_HAS_PRIVATE(RSA *rsa) +RSA_HAS_PRIVATE(OSSL_3_const RSA *rsa) { const BIGNUM *e, *d; @@ -33,7 +33,7 @@ RSA_HAS_PRIVATE(RSA *rsa) } static inline int -RSA_PRIVATE(VALUE obj, RSA *rsa) +RSA_PRIVATE(VALUE obj, OSSL_3_const RSA *rsa) { return RSA_HAS_PRIVATE(rsa) || OSSL_PKEY_IS_PRIVATE(obj); } @@ -50,8 +50,8 @@ VALUE eRSAError; /* * call-seq: * RSA.new -> rsa - * RSA.new(encoded_key [, passphrase]) -> rsa - * RSA.new(encoded_key) { passphrase } -> rsa + * RSA.new(encoded_key [, password ]) -> rsa + * RSA.new(encoded_key) { password } -> rsa * RSA.new(size [, exponent]) -> rsa * * Generates or loads an \RSA keypair. @@ -61,9 +61,9 @@ VALUE eRSAError; * #set_crt_params. * * If called with a String, tries to parse as DER or PEM encoding of an \RSA key. - * Note that, if _passphrase_ is not specified but the key is encrypted with a - * passphrase, \OpenSSL will prompt for it. - * See also OpenSSL::PKey.read which can parse keys of any kinds. + * Note that if _password_ is not specified, but the key is encrypted with a + * password, \OpenSSL will prompt for it. + * See also OpenSSL::PKey.read which can parse keys of any kind. * * If called with a number, generates a new key pair. This form works as an * alias of RSA.generate. @@ -71,7 +71,7 @@ VALUE eRSAError; * Examples: * OpenSSL::PKey::RSA.new 2048 * OpenSSL::PKey::RSA.new File.read 'rsa.pem' - * OpenSSL::PKey::RSA.new File.read('rsa.pem'), 'my pass phrase' + * OpenSSL::PKey::RSA.new File.read('rsa.pem'), 'my password' */ static VALUE ossl_rsa_initialize(int argc, VALUE *argv, VALUE self) @@ -174,7 +174,7 @@ ossl_rsa_initialize_copy(VALUE self, VALUE other) static VALUE ossl_rsa_is_public(VALUE self) { - RSA *rsa; + OSSL_3_const RSA *rsa; GetRSA(self, rsa); /* @@ -193,7 +193,7 @@ ossl_rsa_is_public(VALUE self) static VALUE ossl_rsa_is_private(VALUE self) { - RSA *rsa; + OSSL_3_const RSA *rsa; GetRSA(self, rsa); @@ -203,7 +203,7 @@ ossl_rsa_is_private(VALUE self) static int can_export_rsaprivatekey(VALUE self) { - RSA *rsa; + OSSL_3_const RSA *rsa; const BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; GetRSA(self, rsa); @@ -217,13 +217,61 @@ can_export_rsaprivatekey(VALUE self) /* * call-seq: - * 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 + * rsa.export([cipher, password]) => PEM-format String + * rsa.to_pem([cipher, password]) => PEM-format String + * rsa.to_s([cipher, password]) => PEM-format String + * + * Serializes a private or public key to a PEM-encoding. + * + * [When the key contains public components only] + * + * Serializes it into an X.509 SubjectPublicKeyInfo. + * The parameters _cipher_ and _password_ are ignored. + * + * A PEM-encoded key will look like: + * + * -----BEGIN PUBLIC KEY----- + * [...] + * -----END PUBLIC KEY----- + * + * Consider using #public_to_pem instead. This serializes the key into an + * X.509 SubjectPublicKeyInfo regardless of whether the key is a public key + * or a private key. + * + * [When the key contains private components, and no parameters are given] + * + * Serializes it into a PKCS #1 RSAPrivateKey. + * + * A PEM-encoded key will look like: * - * 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 - * OpenSSL::Cipher instance. + * -----BEGIN RSA PRIVATE KEY----- + * [...] + * -----END RSA PRIVATE KEY----- + * + * [When the key contains private components, and _cipher_ and _password_ are given] + * + * Serializes it into a PKCS #1 RSAPrivateKey + * and encrypts it in OpenSSL's traditional PEM encryption format. + * _cipher_ must be a cipher name understood by OpenSSL::Cipher.new or an + * instance of OpenSSL::Cipher. + * + * An encrypted PEM-encoded key will look like: + * + * -----BEGIN RSA PRIVATE KEY----- + * Proc-Type: 4,ENCRYPTED + * DEK-Info: AES-128-CBC,733F5302505B34701FC41F5C0746E4C0 + * + * [...] + * -----END RSA PRIVATE KEY----- + * + * Note that this format uses MD5 to derive the encryption key, and hence + * will not be available on FIPS-compliant systems. + * + * <b>This method is kept for compatibility.</b> + * This should only be used when the PKCS #1 RSAPrivateKey format is required. + * + * Consider using #public_to_pem (X.509 SubjectPublicKeyInfo) or #private_to_pem + * (PKCS #8 PrivateKeyInfo or EncryptedPrivateKeyInfo) instead. */ static VALUE ossl_rsa_export(int argc, VALUE *argv, VALUE self) @@ -238,7 +286,14 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self) * call-seq: * rsa.to_der => DER-format String * - * Outputs this keypair in DER encoding. + * Serializes a private or public key to a DER-encoding. + * + * See #to_pem for details. + * + * <b>This method is kept for compatibility.</b> + * This should only be used when the PKCS #1 RSAPrivateKey format is required. + * + * Consider using #public_to_der or #private_to_der instead. */ static VALUE ossl_rsa_to_der(VALUE self) @@ -453,7 +508,7 @@ ossl_rsa_verify_pss(int argc, VALUE *argv, VALUE self) static VALUE ossl_rsa_get_params(VALUE self) { - RSA *rsa; + OSSL_3_const RSA *rsa; VALUE hash; const BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; diff --git a/ext/openssl/ossl_provider.c b/ext/openssl/ossl_provider.c new file mode 100644 index 0000000000..981c6ccdc7 --- /dev/null +++ b/ext/openssl/ossl_provider.c @@ -0,0 +1,211 @@ +/* + * This program is licensed under the same licence as Ruby. + * (See the file 'LICENCE'.) + */ +#include "ossl.h" + +#ifdef OSSL_USE_PROVIDER +# include <openssl/provider.h> + +#define NewProvider(klass) \ + TypedData_Wrap_Struct((klass), &ossl_provider_type, 0) +#define SetProvider(obj, provider) do { \ + if (!(provider)) { \ + ossl_raise(rb_eRuntimeError, "Provider wasn't initialized."); \ + } \ + RTYPEDDATA_DATA(obj) = (provider); \ +} while(0) +#define GetProvider(obj, provider) do { \ + TypedData_Get_Struct((obj), OSSL_PROVIDER, &ossl_provider_type, (provider)); \ + if (!(provider)) { \ + ossl_raise(rb_eRuntimeError, "PROVIDER wasn't initialized."); \ + } \ +} while (0) + +static const rb_data_type_t ossl_provider_type = { + "OpenSSL/Provider", + { + 0, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, +}; + +/* + * Classes + */ +/* Document-class: OpenSSL::Provider + * + * This class is the access to openssl's Provider + * See also, https://www.openssl.org/docs/manmaster/man7/provider.html + */ +static VALUE cProvider; +/* Document-class: OpenSSL::Provider::ProviderError + * + * This is the generic exception for OpenSSL::Provider related errors + */ +static VALUE eProviderError; + +/* + * call-seq: + * OpenSSL::Provider.load(name) -> provider + * + * This method loads and initializes a provider + */ +static VALUE +ossl_provider_s_load(VALUE klass, VALUE name) +{ + OSSL_PROVIDER *provider = NULL; + VALUE obj; + + const char *provider_name_ptr = StringValueCStr(name); + + provider = OSSL_PROVIDER_load(NULL, provider_name_ptr); + if (provider == NULL) { + ossl_raise(eProviderError, "Failed to load %s provider", provider_name_ptr); + } + obj = NewProvider(klass); + SetProvider(obj, provider); + + return obj; +} + +struct ary_with_state { VALUE ary; int state; }; +struct rb_push_provider_name_args { OSSL_PROVIDER *prov; VALUE ary; }; + +static VALUE +rb_push_provider_name(VALUE rb_push_provider_name_args) +{ + struct rb_push_provider_name_args *args = (struct rb_push_provider_name_args *)rb_push_provider_name_args; + + VALUE name = rb_str_new2(OSSL_PROVIDER_get0_name(args->prov)); + return rb_ary_push(args->ary, name); +} + +static int +push_provider(OSSL_PROVIDER *prov, void *cbdata) +{ + struct ary_with_state *ary_with_state = (struct ary_with_state *)cbdata; + struct rb_push_provider_name_args args = { prov, ary_with_state->ary }; + + rb_protect(rb_push_provider_name, (VALUE)&args, &ary_with_state->state); + if (ary_with_state->state) { + return 0; + } else { + return 1; + } +} + +/* + * call-seq: + * OpenSSL::Provider.provider_names -> [provider_name, ...] + * + * Returns an array of currently loaded provider names. + */ +static VALUE +ossl_provider_s_provider_names(VALUE klass) +{ + VALUE ary = rb_ary_new(); + struct ary_with_state cbdata = { ary, 0 }; + + int result = OSSL_PROVIDER_do_all(NULL, &push_provider, (void*)&cbdata); + if (result != 1 ) { + if (cbdata.state) { + rb_jump_tag(cbdata.state); + } else { + ossl_raise(eProviderError, "Failed to load provider names"); + } + } + + return ary; +} + +/* + * call-seq: + * provider.unload -> true + * + * This method unloads this provider. + * + * if provider unload fails or already unloaded, it raises OpenSSL::Provider::ProviderError + */ +static VALUE +ossl_provider_unload(VALUE self) +{ + OSSL_PROVIDER *prov; + if (RTYPEDDATA_DATA(self) == NULL) { + ossl_raise(eProviderError, "Provider already unloaded."); + } + GetProvider(self, prov); + + int result = OSSL_PROVIDER_unload(prov); + + if (result != 1) { + ossl_raise(eProviderError, "Failed to unload provider"); + } + RTYPEDDATA_DATA(self) = NULL; + return Qtrue; +} + +/* + * call-seq: + * provider.name -> string + * + * Get the name of this provider. + * + * if this provider is already unloaded, it raises OpenSSL::Provider::ProviderError + */ +static VALUE +ossl_provider_get_name(VALUE self) +{ + OSSL_PROVIDER *prov; + if (RTYPEDDATA_DATA(self) == NULL) { + ossl_raise(eProviderError, "Provider already unloaded."); + } + GetProvider(self, prov); + + return rb_str_new2(OSSL_PROVIDER_get0_name(prov)); +} + +/* + * call-seq: + * provider.inspect -> string + * + * Pretty prints this provider. + */ +static VALUE +ossl_provider_inspect(VALUE self) +{ + OSSL_PROVIDER *prov; + if (RTYPEDDATA_DATA(self) == NULL ) { + return rb_sprintf("#<%"PRIsVALUE" unloaded provider>", rb_obj_class(self)); + } + GetProvider(self, prov); + + return rb_sprintf("#<%"PRIsVALUE" name=\"%s\">", + rb_obj_class(self), OSSL_PROVIDER_get0_name(prov)); +} + +void +Init_ossl_provider(void) +{ +#if 0 + mOSSL = rb_define_module("OpenSSL"); + eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); +#endif + + cProvider = rb_define_class_under(mOSSL, "Provider", rb_cObject); + eProviderError = rb_define_class_under(cProvider, "ProviderError", eOSSLError); + + rb_undef_alloc_func(cProvider); + rb_define_singleton_method(cProvider, "load", ossl_provider_s_load, 1); + rb_define_singleton_method(cProvider, "provider_names", ossl_provider_s_provider_names, 0); + + rb_define_method(cProvider, "unload", ossl_provider_unload, 0); + rb_define_method(cProvider, "name", ossl_provider_get_name, 0); + rb_define_method(cProvider, "inspect", ossl_provider_inspect, 0); +} +#else +void +Init_ossl_provider(void) +{ +} +#endif diff --git a/ext/openssl/ossl_provider.h b/ext/openssl/ossl_provider.h new file mode 100644 index 0000000000..1d69cb1e44 --- /dev/null +++ b/ext/openssl/ossl_provider.h @@ -0,0 +1,5 @@ +#if !defined(OSSL_PROVIDER_H) +#define OSSL_PROVIDER_H + +void Init_ossl_provider(void); +#endif diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 478ff869a4..d68c64d5fb 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -11,11 +11,15 @@ */ #include "ossl.h" +#ifndef OPENSSL_NO_SOCK #define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0])) +#if !defined(OPENSSL_NO_NEXTPROTONEG) && !OSSL_IS_LIBRESSL +# define OSSL_USE_NEXTPROTONEG +#endif + #if !defined(TLS1_3_VERSION) && \ - defined(LIBRESSL_VERSION_NUMBER) && \ - LIBRESSL_VERSION_NUMBER >= 0x3020000fL + OSSL_LIBRESSL_PREREQ(3, 2, 0) && !OSSL_LIBRESSL_PREREQ(3, 4, 0) # define TLS1_3_VERSION 0x0304 #endif @@ -30,7 +34,6 @@ } while (0) VALUE mSSL; -static VALUE mSSLExtConfig; static VALUE eSSLError; VALUE cSSLContext; VALUE cSSLSocket; @@ -74,7 +77,7 @@ static const rb_data_type_t ossl_sslctx_type = { { ossl_sslctx_mark, ossl_sslctx_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -291,7 +294,7 @@ ossl_tmp_dh_callback(SSL *ssl, int is_export, int keylength) if (!pkey) return NULL; - return EVP_PKEY_get0_DH(pkey); + return (DH *)EVP_PKEY_get0_DH(pkey); } #endif /* OPENSSL_NO_DH */ @@ -703,7 +706,7 @@ ssl_npn_select_cb_common(SSL *ssl, VALUE cb, const unsigned char **out, return SSL_TLSEXT_ERR_OK; } -#ifndef OPENSSL_NO_NEXTPROTONEG +#ifdef OSSL_USE_NEXTPROTONEG static int ssl_npn_advertise_cb(SSL *ssl, const unsigned char **out, unsigned int *outlen, void *arg) @@ -882,9 +885,9 @@ ossl_sslctx_setup(VALUE self) if (ca_path && !SSL_CTX_load_verify_dir(ctx, ca_path)) ossl_raise(eSSLError, "SSL_CTX_load_verify_dir"); #else - if(ca_file || ca_path){ - if (!SSL_CTX_load_verify_locations(ctx, ca_file, ca_path)) - rb_warning("can't set verify locations"); + if (ca_file || ca_path) { + if (!SSL_CTX_load_verify_locations(ctx, ca_file, ca_path)) + ossl_raise(eSSLError, "SSL_CTX_load_verify_locations"); } #endif @@ -900,7 +903,7 @@ ossl_sslctx_setup(VALUE self) val = rb_attr_get(self, id_i_verify_depth); if(!NIL_P(val)) SSL_CTX_set_verify_depth(ctx, NUM2INT(val)); -#ifndef OPENSSL_NO_NEXTPROTONEG +#ifdef OSSL_USE_NEXTPROTONEG val = rb_attr_get(self, id_i_npn_protocols); if (!NIL_P(val)) { VALUE encoded = ssl_encode_npn_protocols(val); @@ -1538,7 +1541,6 @@ ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self) /* * SSLSocket class */ -#ifndef OPENSSL_NO_SOCK static inline int ssl_started(SSL *ssl) { @@ -1551,6 +1553,10 @@ ossl_ssl_mark(void *ptr) { SSL *ssl = ptr; rb_gc_mark((VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_ptr_idx)); + + // Note: this reference is stored as @verify_callback so we don't need to mark it. + // However we do need to ensure GC compaction won't move it, hence why + // we call rb_gc_mark here. rb_gc_mark((VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_vcb_idx)); } @@ -1565,7 +1571,7 @@ const rb_data_type_t ossl_ssl_type = { { ossl_ssl_mark, ossl_ssl_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -1644,6 +1650,8 @@ ossl_ssl_initialize(int argc, VALUE *argv, VALUE self) SSL_set_ex_data(ssl, ossl_ssl_ex_ptr_idx, (void *)self); SSL_set_info_callback(ssl, ssl_info_cb); verify_cb = rb_attr_get(v_ctx, id_i_verify_callback); + // We don't need to trigger a write barrier because it's already + // an instance variable of this object. SSL_set_ex_data(ssl, ossl_ssl_ex_vcb_idx, (void *)verify_cb); rb_call_super(0, NULL); @@ -1651,6 +1659,17 @@ ossl_ssl_initialize(int argc, VALUE *argv, VALUE self) return self; } +#ifndef HAVE_RB_IO_DESCRIPTOR +static int +io_descriptor_fallback(VALUE io) +{ + rb_io_t *fptr; + GetOpenFile(io, fptr); + return fptr->fd; +} +#define rb_io_descriptor io_descriptor_fallback +#endif + static VALUE ossl_ssl_setup(VALUE self) { @@ -1666,8 +1685,8 @@ ossl_ssl_setup(VALUE self) GetOpenFile(io, fptr); rb_io_check_readable(fptr); rb_io_check_writable(fptr); - if (!SSL_set_fd(ssl, TO_SOCKET(fptr->fd))) - ossl_raise(eSSLError, "SSL_set_fd"); + if (!SSL_set_fd(ssl, TO_SOCKET(rb_io_descriptor(io)))) + ossl_raise(eSSLError, "SSL_set_fd"); return Qtrue; } @@ -1706,22 +1725,37 @@ no_exception_p(VALUE opts) #define RUBY_IO_TIMEOUT_DEFAULT Qnil #endif +#ifdef HAVE_RB_IO_TIMEOUT +#define IO_TIMEOUT_ERROR rb_eIOTimeoutError +#else +#define IO_TIMEOUT_ERROR rb_eIOError +#endif + + static void -io_wait_writable(rb_io_t *fptr) +io_wait_writable(VALUE io) { #ifdef HAVE_RB_IO_MAYBE_WAIT - rb_io_maybe_wait_writable(errno, fptr->self, RUBY_IO_TIMEOUT_DEFAULT); + if (!rb_io_maybe_wait_writable(errno, io, RUBY_IO_TIMEOUT_DEFAULT)) { + rb_raise(IO_TIMEOUT_ERROR, "Timed out while waiting to become writable!"); + } #else + rb_io_t *fptr; + GetOpenFile(io, fptr); rb_io_wait_writable(fptr->fd); #endif } static void -io_wait_readable(rb_io_t *fptr) +io_wait_readable(VALUE io) { #ifdef HAVE_RB_IO_MAYBE_WAIT - rb_io_maybe_wait_readable(errno, fptr->self, RUBY_IO_TIMEOUT_DEFAULT); + if (!rb_io_maybe_wait_readable(errno, io, RUBY_IO_TIMEOUT_DEFAULT)) { + rb_raise(IO_TIMEOUT_ERROR, "Timed out while waiting to become readable!"); + } #else + rb_io_t *fptr; + GetOpenFile(io, fptr); rb_io_wait_readable(fptr->fd); #endif } @@ -1730,75 +1764,74 @@ static VALUE ossl_start_ssl(VALUE self, int (*func)(SSL *), const char *funcname, VALUE opts) { SSL *ssl; - rb_io_t *fptr; int ret, ret2; VALUE cb_state; int nonblock = opts != Qfalse; -#if defined(SSL_R_CERTIFICATE_VERIFY_FAILED) - unsigned long err; -#endif rb_ivar_set(self, ID_callback_state, Qnil); GetSSL(self, ssl); - GetOpenFile(rb_attr_get(self, id_i_io), fptr); - for(;;){ - ret = func(ssl); + VALUE io = rb_attr_get(self, id_i_io); + for (;;) { + ret = func(ssl); - cb_state = rb_attr_get(self, ID_callback_state); + cb_state = rb_attr_get(self, ID_callback_state); if (!NIL_P(cb_state)) { - /* must cleanup OpenSSL error stack before re-raising */ - ossl_clear_error(); - rb_jump_tag(NUM2INT(cb_state)); - } + /* must cleanup OpenSSL error stack before re-raising */ + ossl_clear_error(); + rb_jump_tag(NUM2INT(cb_state)); + } - if (ret > 0) - break; + if (ret > 0) + break; - switch((ret2 = ssl_get_error(ssl, ret))){ - case SSL_ERROR_WANT_WRITE: + switch ((ret2 = ssl_get_error(ssl, ret))) { + case SSL_ERROR_WANT_WRITE: if (no_exception_p(opts)) { return sym_wait_writable; } write_would_block(nonblock); - io_wait_writable(fptr); + io_wait_writable(io); continue; - case SSL_ERROR_WANT_READ: + case SSL_ERROR_WANT_READ: if (no_exception_p(opts)) { return sym_wait_readable; } read_would_block(nonblock); - io_wait_readable(fptr); + io_wait_readable(io); continue; - case SSL_ERROR_SYSCALL: + case SSL_ERROR_SYSCALL: #ifdef __APPLE__ /* See ossl_ssl_write_internal() */ if (errno == EPROTOTYPE) continue; #endif - if (errno) rb_sys_fail(funcname); - ossl_raise(eSSLError, "%s SYSCALL returned=%d errno=%d peeraddr=%"PRIsVALUE" state=%s", - funcname, ret2, errno, peeraddr_ip_str(self), SSL_state_string_long(ssl)); - + if (errno) rb_sys_fail(funcname); + /* fallthrough */ + default: { + VALUE error_append = Qnil; #if defined(SSL_R_CERTIFICATE_VERIFY_FAILED) - case SSL_ERROR_SSL: - err = ERR_peek_last_error(); - if (ERR_GET_LIB(err) == ERR_LIB_SSL && - ERR_GET_REASON(err) == SSL_R_CERTIFICATE_VERIFY_FAILED) { - const char *err_msg = ERR_reason_error_string(err), - *verify_msg = X509_verify_cert_error_string(SSL_get_verify_result(ssl)); - if (!err_msg) - err_msg = "(null)"; - if (!verify_msg) - verify_msg = "(null)"; - ossl_clear_error(); /* let ossl_raise() not append message */ - ossl_raise(eSSLError, "%s returned=%d errno=%d peeraddr=%"PRIsVALUE" state=%s: %s (%s)", - funcname, ret2, errno, peeraddr_ip_str(self), SSL_state_string_long(ssl), - err_msg, verify_msg); - } + unsigned long err = ERR_peek_last_error(); + if (ERR_GET_LIB(err) == ERR_LIB_SSL && + ERR_GET_REASON(err) == SSL_R_CERTIFICATE_VERIFY_FAILED) { + const char *err_msg = ERR_reason_error_string(err), + *verify_msg = X509_verify_cert_error_string(SSL_get_verify_result(ssl)); + if (!err_msg) + err_msg = "(null)"; + if (!verify_msg) + verify_msg = "(null)"; + ossl_clear_error(); /* let ossl_raise() not append message */ + error_append = rb_sprintf(": %s (%s)", err_msg, verify_msg); + } #endif - /* fallthrough */ - default: - ossl_raise(eSSLError, "%s returned=%d errno=%d peeraddr=%"PRIsVALUE" state=%s", - funcname, ret2, errno, peeraddr_ip_str(self), SSL_state_string_long(ssl)); - } + ossl_raise(eSSLError, + "%s%s returned=%d errno=%d peeraddr=%"PRIsVALUE" state=%s%"PRIsVALUE, + funcname, + ret2 == SSL_ERROR_SYSCALL ? " SYSCALL" : "", + ret2, + errno, + peeraddr_ip_str(self), + SSL_state_string_long(ssl), + error_append); + } + } } return self; @@ -1904,8 +1937,7 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock) SSL *ssl; int ilen; VALUE len, str; - rb_io_t *fptr; - VALUE io, opts = Qnil; + VALUE opts = Qnil; if (nonblock) { rb_scan_args(argc, argv, "11:", &len, &str, &opts); @@ -1926,12 +1958,13 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock) else rb_str_modify_expand(str, ilen - RSTRING_LEN(str)); } - rb_str_set_len(str, 0); - if (ilen == 0) - return str; - io = rb_attr_get(self, id_i_io); - GetOpenFile(io, fptr); + if (ilen == 0) { + rb_str_set_len(str, 0); + return str; + } + + VALUE io = rb_attr_get(self, id_i_io); rb_str_locktmp(str); for (;;) { @@ -1951,7 +1984,7 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock) if (no_exception_p(opts)) { return sym_wait_writable; } write_would_block(nonblock); } - io_wait_writable(fptr); + io_wait_writable(io); continue; case SSL_ERROR_WANT_READ: if (nonblock) { @@ -1959,7 +1992,7 @@ ossl_ssl_read_internal(int argc, VALUE *argv, VALUE self, int nonblock) if (no_exception_p(opts)) { return sym_wait_readable; } read_would_block(nonblock); } - io_wait_readable(fptr); + io_wait_readable(io); continue; case SSL_ERROR_SYSCALL: if (!ERR_peek_error()) { @@ -2025,14 +2058,14 @@ ossl_ssl_write_internal(VALUE self, VALUE str, VALUE opts) SSL *ssl; rb_io_t *fptr; int num, nonblock = opts != Qfalse; - VALUE tmp, io; + VALUE tmp; GetSSL(self, ssl); if (!ssl_started(ssl)) rb_raise(eSSLError, "SSL session is not started yet"); tmp = rb_str_new_frozen(StringValue(str)); - io = rb_attr_get(self, id_i_io); + VALUE io = rb_attr_get(self, id_i_io); GetOpenFile(io, fptr); /* SSL_write(3ssl) manpage states num == 0 is undefined */ @@ -2048,12 +2081,12 @@ ossl_ssl_write_internal(VALUE self, VALUE str, VALUE opts) case SSL_ERROR_WANT_WRITE: if (no_exception_p(opts)) { return sym_wait_writable; } write_would_block(nonblock); - io_wait_writable(fptr); + io_wait_writable(io); continue; case SSL_ERROR_WANT_READ: if (no_exception_p(opts)) { return sym_wait_readable; } read_would_block(nonblock); - io_wait_readable(fptr); + io_wait_readable(io); continue; case SSL_ERROR_SYSCALL: #ifdef __APPLE__ @@ -2446,7 +2479,7 @@ ossl_ssl_get_client_ca_list(VALUE self) return ossl_x509name_sk2ary(ca); } -# ifndef OPENSSL_NO_NEXTPROTONEG +# ifdef OSSL_USE_NEXTPROTONEG /* * call-seq: * ssl.npn_protocol => String | nil @@ -2566,6 +2599,7 @@ Init_ossl_ssl(void) rb_mWaitWritable = rb_define_module_under(rb_cIO, "WaitWritable"); #endif +#ifndef OPENSSL_NO_SOCK id_call = rb_intern_const("call"); ID_callback_state = rb_intern_const("callback_state"); @@ -2588,16 +2622,6 @@ Init_ossl_ssl(void) */ mSSL = rb_define_module_under(mOSSL, "SSL"); - /* Document-module: OpenSSL::ExtConfig - * - * This module contains configuration information about the SSL extension, - * for example if socket support is enabled, or the host name TLS extension - * is enabled. Constants in this module will always be defined, but contain - * +true+ or +false+ values depending on the configuration of your OpenSSL - * installation. - */ - mSSLExtConfig = rb_define_module_under(mOSSL, "ExtConfig"); - /* Document-class: OpenSSL::SSL::SSLError * * Generic error class raised by SSLSocket and SSLContext. @@ -2760,8 +2784,6 @@ Init_ossl_ssl(void) */ rb_attr(cSSLContext, rb_intern_const("session_remove_cb"), 1, 1, Qfalse); - rb_define_const(mSSLExtConfig, "HAVE_TLSEXT_HOST_NAME", Qtrue); - /* * A callback invoked whenever a new handshake is initiated on an * established connection. May be used to disable renegotiation entirely. @@ -2782,7 +2804,7 @@ Init_ossl_ssl(void) * end */ rb_attr(cSSLContext, rb_intern_const("renegotiation_cb"), 1, 1, Qfalse); -#ifndef OPENSSL_NO_NEXTPROTONEG +#ifdef OSSL_USE_NEXTPROTONEG /* * An Enumerable of Strings. Each String represents a protocol to be * advertised as the list of supported protocols for Next Protocol @@ -2952,11 +2974,6 @@ Init_ossl_ssl(void) * Document-class: OpenSSL::SSL::SSLSocket */ cSSLSocket = rb_define_class_under(mSSL, "SSLSocket", rb_cObject); -#ifdef OPENSSL_NO_SOCK - rb_define_const(mSSLExtConfig, "OPENSSL_NO_SOCK", Qtrue); - rb_define_method(cSSLSocket, "initialize", rb_f_notimplement, -1); -#else - rb_define_const(mSSLExtConfig, "OPENSSL_NO_SOCK", Qfalse); rb_define_alloc_func(cSSLSocket, ossl_ssl_s_alloc); rb_define_method(cSSLSocket, "initialize", ossl_ssl_initialize, -1); rb_undef_method(cSSLSocket, "initialize_copy"); @@ -2988,10 +3005,9 @@ Init_ossl_ssl(void) rb_define_method(cSSLSocket, "tmp_key", ossl_ssl_tmp_key, 0); rb_define_method(cSSLSocket, "alpn_protocol", ossl_ssl_alpn_protocol, 0); rb_define_method(cSSLSocket, "export_keying_material", ossl_ssl_export_keying_material, -1); -# ifndef OPENSSL_NO_NEXTPROTONEG +# ifdef OSSL_USE_NEXTPROTONEG rb_define_method(cSSLSocket, "npn_protocol", ossl_ssl_npn_protocol, 0); # endif -#endif rb_define_const(mSSL, "VERIFY_NONE", INT2NUM(SSL_VERIFY_NONE)); rb_define_const(mSSL, "VERIFY_PEER", INT2NUM(SSL_VERIFY_PEER)); @@ -3153,4 +3169,5 @@ Init_ossl_ssl(void) DefIVarID(io); DefIVarID(context); DefIVarID(hostname); +#endif /* !defined(OPENSSL_NO_SOCK) */ } diff --git a/ext/openssl/ossl_ssl_session.c b/ext/openssl/ossl_ssl_session.c index 92eb1365fe..c5df902c60 100644 --- a/ext/openssl/ossl_ssl_session.c +++ b/ext/openssl/ossl_ssl_session.c @@ -4,6 +4,7 @@ #include "ossl.h" +#ifndef OPENSSL_NO_SOCK VALUE cSSLSession; static VALUE eSSLSession; @@ -18,7 +19,7 @@ const rb_data_type_t ossl_ssl_session_type = { { 0, ossl_ssl_session_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE ossl_ssl_session_alloc(VALUE klass) @@ -299,6 +300,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self) return ossl_membio2str(out); } +#endif /* !defined(OPENSSL_NO_SOCK) */ void Init_ossl_ssl_session(void) { @@ -307,6 +309,7 @@ void Init_ossl_ssl_session(void) mSSL = rb_define_module_under(mOSSL, "SSL"); eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); #endif +#ifndef OPENSSL_NO_SOCK cSSLSession = rb_define_class_under(mSSL, "Session", rb_cObject); eSSLSession = rb_define_class_under(cSSLSession, "SessionError", eOSSLError); @@ -324,4 +327,5 @@ void Init_ossl_ssl_session(void) rb_define_method(cSSLSession, "to_der", ossl_ssl_session_to_der, 0); rb_define_method(cSSLSession, "to_pem", ossl_ssl_session_to_pem, 0); rb_define_method(cSSLSession, "to_text", ossl_ssl_session_to_text, 0); +#endif /* !defined(OPENSSL_NO_SOCK) */ } diff --git a/ext/openssl/ossl_ts.c b/ext/openssl/ossl_ts.c index b33ff10c10..b18a86aad9 100644 --- a/ext/openssl/ossl_ts.c +++ b/ext/openssl/ossl_ts.c @@ -83,7 +83,7 @@ static const rb_data_type_t ossl_ts_req_type = { { 0, ossl_ts_req_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static void @@ -97,7 +97,7 @@ static const rb_data_type_t ossl_ts_resp_type = { { 0, ossl_ts_resp_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static void @@ -111,7 +111,7 @@ static const rb_data_type_t ossl_ts_token_info_type = { { 0, ossl_ts_token_info_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -504,6 +504,25 @@ ossl_ts_req_to_der(VALUE self) } static VALUE +ossl_ts_req_to_text(VALUE self) +{ + TS_REQ *req; + BIO *out; + + GetTSRequest(self, req); + + out = BIO_new(BIO_s_mem()); + if (!out) ossl_raise(eTimestampError, NULL); + + if (!TS_REQ_print_bio(out, req)) { + BIO_free(out); + ossl_raise(eTimestampError, NULL); + } + + return ossl_membio2str(out); +} + +static VALUE ossl_ts_resp_alloc(VALUE klass) { TS_RESP *resp; @@ -757,6 +776,25 @@ ossl_ts_resp_to_der(VALUE self) return asn1_to_der((void *)resp, (int (*)(void *, unsigned char **))i2d_TS_RESP); } +static VALUE +ossl_ts_resp_to_text(VALUE self) +{ + TS_RESP *resp; + BIO *out; + + GetTSResponse(self, resp); + + out = BIO_new(BIO_s_mem()); + if (!out) ossl_raise(eTimestampError, NULL); + + if (!TS_RESP_print_bio(out, resp)) { + BIO_free(out); + ossl_raise(eTimestampError, NULL); + } + + return ossl_membio2str(out); +} + /* * Verifies a timestamp token by checking the signature, validating the * certificate chain implied by tsa_certificate and by checking conformance to @@ -1073,6 +1111,25 @@ ossl_ts_token_info_to_der(VALUE self) return asn1_to_der((void *)info, (int (*)(void *, unsigned char **))i2d_TS_TST_INFO); } +static VALUE +ossl_ts_token_info_to_text(VALUE self) +{ + TS_TST_INFO *info; + BIO *out; + + GetTSTokenInfo(self, info); + + out = BIO_new(BIO_s_mem()); + if (!out) ossl_raise(eTimestampError, NULL); + + if (!TS_TST_INFO_print_bio(out, info)) { + BIO_free(out); + ossl_raise(eTimestampError, NULL); + } + + return ossl_membio2str(out); +} + static ASN1_INTEGER * ossl_tsfac_serial_cb(struct TS_resp_ctx *ctx, void *data) { @@ -1356,6 +1413,7 @@ Init_ossl_ts(void) rb_define_method(cTimestampResponse, "token_info", ossl_ts_resp_get_token_info, 0); rb_define_method(cTimestampResponse, "tsa_certificate", ossl_ts_resp_get_tsa_certificate, 0); rb_define_method(cTimestampResponse, "to_der", ossl_ts_resp_to_der, 0); + rb_define_method(cTimestampResponse, "to_text", ossl_ts_resp_to_text, 0); rb_define_method(cTimestampResponse, "verify", ossl_ts_resp_verify, -1); /* Document-class: OpenSSL::Timestamp::TokenInfo @@ -1374,6 +1432,7 @@ Init_ossl_ts(void) rb_define_method(cTimestampTokenInfo, "ordering", ossl_ts_token_info_get_ordering, 0); rb_define_method(cTimestampTokenInfo, "nonce", ossl_ts_token_info_get_nonce, 0); rb_define_method(cTimestampTokenInfo, "to_der", ossl_ts_token_info_to_der, 0); + rb_define_method(cTimestampTokenInfo, "to_text", ossl_ts_token_info_to_text, 0); /* Document-class: OpenSSL::Timestamp::Request * Allows to create timestamp requests or parse existing ones. A Request is @@ -1399,6 +1458,7 @@ Init_ossl_ts(void) rb_define_method(cTimestampRequest, "cert_requested=", ossl_ts_req_set_cert_requested, 1); rb_define_method(cTimestampRequest, "cert_requested?", ossl_ts_req_get_cert_requested, 0); rb_define_method(cTimestampRequest, "to_der", ossl_ts_req_to_der, 0); + rb_define_method(cTimestampRequest, "to_text", ossl_ts_req_to_text, 0); /* * Indicates a successful response. Equal to +0+. diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c index 60846cfe9d..d1d8bb5e95 100644 --- a/ext/openssl/ossl_x509attr.c +++ b/ext/openssl/ossl_x509attr.c @@ -41,7 +41,7 @@ static const rb_data_type_t ossl_x509attr_type = { { 0, ossl_x509attr_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c index 9443541645..aa6b9bb7ce 100644 --- a/ext/openssl/ossl_x509cert.c +++ b/ext/openssl/ossl_x509cert.c @@ -41,7 +41,7 @@ static const rb_data_type_t ossl_x509_type = { { 0, ossl_x509_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c index 6c1d915370..80e29f9df2 100644 --- a/ext/openssl/ossl_x509crl.c +++ b/ext/openssl/ossl_x509crl.c @@ -41,7 +41,7 @@ static const rb_data_type_t ossl_x509crl_type = { { 0, ossl_x509crl_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c index e54102c771..192d09bd3f 100644 --- a/ext/openssl/ossl_x509ext.c +++ b/ext/openssl/ossl_x509ext.c @@ -55,7 +55,7 @@ static const rb_data_type_t ossl_x509ext_type = { { 0, ossl_x509ext_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* @@ -108,7 +108,7 @@ static const rb_data_type_t ossl_x509extfactory_type = { { 0, ossl_x509extfactory_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -209,15 +209,16 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self) int nid; VALUE rconf; CONF *conf; + const char *oid_cstr = NULL; rb_scan_args(argc, argv, "21", &oid, &value, &critical); - StringValueCStr(oid); StringValue(value); if(NIL_P(critical)) critical = Qfalse; - nid = OBJ_ln2nid(RSTRING_PTR(oid)); - if(!nid) nid = OBJ_sn2nid(RSTRING_PTR(oid)); - if(!nid) ossl_raise(eX509ExtError, "unknown OID `%"PRIsVALUE"'", oid); + oid_cstr = StringValueCStr(oid); + nid = OBJ_ln2nid(oid_cstr); + if (nid != NID_undef) + oid_cstr = OBJ_nid2sn(nid); valstr = rb_str_new2(RTEST(critical) ? "critical," : ""); rb_str_append(valstr, value); @@ -228,7 +229,12 @@ ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self) rconf = rb_iv_get(self, "@config"); conf = NIL_P(rconf) ? NULL : GetConfig(rconf); X509V3_set_nconf(ctx, conf); - ext = X509V3_EXT_nconf_nid(conf, ctx, nid, RSTRING_PTR(valstr)); + +#if OSSL_OPENSSL_PREREQ(1, 1, 0) || OSSL_IS_LIBRESSL + ext = X509V3_EXT_nconf(conf, ctx, oid_cstr, RSTRING_PTR(valstr)); +#else + ext = X509V3_EXT_nconf(conf, ctx, (char *)oid_cstr, RSTRING_PTR(valstr)); +#endif X509V3_set_ctx_nodb(ctx); if (!ext){ ossl_raise(eX509ExtError, "%"PRIsVALUE" = %"PRIsVALUE, oid, valstr); diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c index 13a2b2c030..9591912f70 100644 --- a/ext/openssl/ossl_x509name.c +++ b/ext/openssl/ossl_x509name.c @@ -46,7 +46,7 @@ static const rb_data_type_t ossl_x509name_type = { { 0, ossl_x509name_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c index 77a7d3f2ff..f058185151 100644 --- a/ext/openssl/ossl_x509req.c +++ b/ext/openssl/ossl_x509req.c @@ -41,7 +41,7 @@ static const rb_data_type_t ossl_x509req_type = { { 0, ossl_x509req_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c index 10b8aa4ad6..108447c868 100644 --- a/ext/openssl/ossl_x509revoked.c +++ b/ext/openssl/ossl_x509revoked.c @@ -41,7 +41,7 @@ static const rb_data_type_t ossl_x509rev_type = { { 0, ossl_x509rev_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c index 7c546187c3..f27381ca90 100644 --- a/ext/openssl/ossl_x509store.c +++ b/ext/openssl/ossl_x509store.c @@ -116,6 +116,9 @@ static void ossl_x509store_mark(void *ptr) { X509_STORE *store = ptr; + // Note: this reference is stored as @verify_callback so we don't need to mark it. + // However we do need to ensure GC compaction won't move it, hence why + // we call rb_gc_mark here. rb_gc_mark((VALUE)X509_STORE_get_ex_data(store, store_ex_verify_cb_idx)); } @@ -130,7 +133,7 @@ static const rb_data_type_t ossl_x509store_type = { { ossl_x509store_mark, ossl_x509store_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; /* @@ -187,8 +190,9 @@ ossl_x509store_set_vfy_cb(VALUE self, VALUE cb) X509_STORE *store; GetX509Store(self, store); - X509_STORE_set_ex_data(store, store_ex_verify_cb_idx, (void *)cb); rb_iv_set(self, "@verify_callback", cb); + // We don't need to trigger a write barrier because `rb_iv_set` did it. + X509_STORE_set_ex_data(store, store_ex_verify_cb_idx, (void *)cb); return cb; } @@ -507,6 +511,9 @@ static void ossl_x509stctx_mark(void *ptr) { X509_STORE_CTX *ctx = ptr; + // Note: this reference is stored as @verify_callback so we don't need to mark it. + // However we do need to ensure GC compaction won't move it, hence why + // we call rb_gc_mark here. rb_gc_mark((VALUE)X509_STORE_CTX_get_ex_data(ctx, stctx_ex_verify_cb_idx)); } @@ -526,7 +533,7 @@ static const rb_data_type_t ossl_x509stctx_type = { { ossl_x509stctx_mark, ossl_x509stctx_free, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, }; static VALUE @@ -614,8 +621,8 @@ ossl_x509stctx_verify(VALUE self) X509_STORE_CTX *ctx; GetX509StCtx(self, ctx); - X509_STORE_CTX_set_ex_data(ctx, stctx_ex_verify_cb_idx, - (void *)rb_iv_get(self, "@verify_callback")); + VALUE cb = rb_iv_get(self, "@verify_callback"); + X509_STORE_CTX_set_ex_data(ctx, stctx_ex_verify_cb_idx, (void *)cb); switch (X509_verify_cert(ctx)) { case 1: diff --git a/ext/pathname/depend b/ext/pathname/depend index a6b000e305..cca7877dad 100644 --- a/ext/pathname/depend +++ b/ext/pathname/depend @@ -53,6 +53,7 @@ pathname.o: $(hdrdir)/ruby/internal/attr/noexcept.h pathname.o: $(hdrdir)/ruby/internal/attr/noinline.h pathname.o: $(hdrdir)/ruby/internal/attr/nonnull.h pathname.o: $(hdrdir)/ruby/internal/attr/noreturn.h +pathname.o: $(hdrdir)/ruby/internal/attr/packed_struct.h pathname.o: $(hdrdir)/ruby/internal/attr/pure.h pathname.o: $(hdrdir)/ruby/internal/attr/restrict.h pathname.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ pathname.o: $(hdrdir)/ruby/internal/intern/enumerator.h pathname.o: $(hdrdir)/ruby/internal/intern/error.h pathname.o: $(hdrdir)/ruby/internal/intern/eval.h pathname.o: $(hdrdir)/ruby/internal/intern/file.h -pathname.o: $(hdrdir)/ruby/internal/intern/gc.h pathname.o: $(hdrdir)/ruby/internal/intern/hash.h pathname.o: $(hdrdir)/ruby/internal/intern/io.h pathname.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ pathname.o: $(hdrdir)/ruby/internal/memory.h pathname.o: $(hdrdir)/ruby/internal/method.h pathname.o: $(hdrdir)/ruby/internal/module.h pathname.o: $(hdrdir)/ruby/internal/newobj.h -pathname.o: $(hdrdir)/ruby/internal/rgengc.h pathname.o: $(hdrdir)/ruby/internal/scan_args.h pathname.o: $(hdrdir)/ruby/internal/special_consts.h pathname.o: $(hdrdir)/ruby/internal/static_assert.h pathname.o: $(hdrdir)/ruby/internal/stdalign.h pathname.o: $(hdrdir)/ruby/internal/stdbool.h +pathname.o: $(hdrdir)/ruby/internal/stdckdint.h pathname.o: $(hdrdir)/ruby/internal/symbol.h pathname.o: $(hdrdir)/ruby/internal/value.h pathname.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/pathname/extconf.rb b/ext/pathname/extconf.rb index 84e68277aa..b4e1617b9e 100644 --- a/ext/pathname/extconf.rb +++ b/ext/pathname/extconf.rb @@ -1,4 +1,3 @@ # frozen_string_literal: false require 'mkmf' -have_func("rb_file_s_birthtime") create_makefile('pathname') diff --git a/ext/pathname/lib/pathname.rb b/ext/pathname/lib/pathname.rb index 9a297529ca..dc639174d5 100644 --- a/ext/pathname/lib/pathname.rb +++ b/ext/pathname/lib/pathname.rb @@ -14,6 +14,8 @@ require 'pathname.so' class Pathname + VERSION = "0.3.0" + # :stopdoc: # to_path is implemented so Pathname objects are usable with File.open, etc. @@ -338,6 +340,8 @@ class Pathname # # Appends a pathname fragment to +self+ to produce a new Pathname object. + # Since +other+ is considered as a path relative to +self+, if +other+ is + # an absolute path, the new Pathname object is created from just +other+. # # p1 = Pathname.new("/usr") # Pathname:/usr # p2 = p1 + "bin/ruby" # Pathname:/usr/bin/ruby @@ -399,6 +403,8 @@ class Pathname # # Joins the given pathnames onto +self+ to create a new Pathname object. + # This is effectively the same as using Pathname#+ to append +self+ and + # all arguments sequentially. # # path0 = Pathname.new("/usr") # Pathname:/usr # path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby @@ -574,14 +580,13 @@ class Pathname # * Find * end -autoload(:FileUtils, 'fileutils') - class Pathname # * FileUtils * # Creates a full path, including any intermediate directories that don't yet # exist. # # See FileUtils.mkpath and FileUtils.mkdir_p def mkpath(mode: nil) + require 'fileutils' FileUtils.mkpath(@path, mode: mode) nil end diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c index 8ee4bcec5b..cdecb3f897 100644 --- a/ext/pathname/pathname.c +++ b/ext/pathname/pathname.c @@ -131,32 +131,6 @@ path_freeze(VALUE self) } /* - * call-seq: - * pathname.taint -> obj - * - * Returns pathname. This method is deprecated and will be removed in Ruby 3.2. - */ -static VALUE -path_taint(VALUE self) -{ - rb_warn("Pathname#taint is deprecated and will be removed in Ruby 3.2."); - return self; -} - -/* - * call-seq: - * pathname.untaint -> obj - * - * Returns pathname. This method is deprecated and will be removed in Ruby 3.2. - */ -static VALUE -path_untaint(VALUE self) -{ - rb_warn("Pathname#untaint is deprecated and will be removed in Ruby 3.2."); - return self; -} - -/* * Compare this pathname with +other+. The comparison is string-based. * Be aware that two different paths (<tt>foo.txt</tt> and <tt>./foo.txt</tt>) * can refer to the same file. @@ -505,7 +479,6 @@ path_atime(VALUE self) return rb_funcall(rb_cFile, id_atime, 1, get_strpath(self)); } -#if defined(HAVE_RB_FILE_S_BIRTHTIME) /* * call-seq: * pathname.birthtime -> time @@ -520,10 +493,6 @@ path_birthtime(VALUE self) { return rb_funcall(rb_cFile, id_birthtime, 1, get_strpath(self)); } -#else -/* check at compilation time for `respond_to?` */ -# define path_birthtime rb_f_notimplement -#endif /* * call-seq: @@ -1537,8 +1506,6 @@ Init_pathname(void) rb_cPathname = rb_define_class("Pathname", rb_cObject); rb_define_method(rb_cPathname, "initialize", path_initialize, 1); rb_define_method(rb_cPathname, "freeze", path_freeze, 0); - rb_define_method(rb_cPathname, "taint", path_taint, 0); - rb_define_method(rb_cPathname, "untaint", path_untaint, 0); rb_define_method(rb_cPathname, "==", path_eq, 1); rb_define_method(rb_cPathname, "===", path_eq, 1); rb_define_method(rb_cPathname, "eql?", path_eq, 1); diff --git a/ext/pathname/pathname.gemspec b/ext/pathname/pathname.gemspec index c9c0b84e69..890bc2fde9 100644 --- a/ext/pathname/pathname.gemspec +++ b/ext/pathname/pathname.gemspec @@ -1,6 +1,13 @@ +name = File.basename(__FILE__, ".gemspec") +version = ["lib", "ext/lib"].find do |dir| + break File.foreach(File.join(__dir__, dir, "#{name}.rb")) do |line| + /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 + end rescue nil +end + Gem::Specification.new do |spec| - spec.name = "pathname" - spec.version = "0.2.0" + spec.name = name + spec.version = version spec.authors = ["Tanaka Akira"] spec.email = ["akr@fsij.org"] diff --git a/ext/psych/depend b/ext/psych/depend index 78bde9a53d..a4d9ca9a6a 100644 --- a/ext/psych/depend +++ b/ext/psych/depend @@ -67,6 +67,7 @@ psych.o: $(hdrdir)/ruby/internal/attr/noexcept.h psych.o: $(hdrdir)/ruby/internal/attr/noinline.h psych.o: $(hdrdir)/ruby/internal/attr/nonnull.h psych.o: $(hdrdir)/ruby/internal/attr/noreturn.h +psych.o: $(hdrdir)/ruby/internal/attr/packed_struct.h psych.o: $(hdrdir)/ruby/internal/attr/pure.h psych.o: $(hdrdir)/ruby/internal/attr/restrict.h psych.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -135,7 +136,6 @@ psych.o: $(hdrdir)/ruby/internal/intern/enumerator.h psych.o: $(hdrdir)/ruby/internal/intern/error.h psych.o: $(hdrdir)/ruby/internal/intern/eval.h psych.o: $(hdrdir)/ruby/internal/intern/file.h -psych.o: $(hdrdir)/ruby/internal/intern/gc.h psych.o: $(hdrdir)/ruby/internal/intern/hash.h psych.o: $(hdrdir)/ruby/internal/intern/io.h psych.o: $(hdrdir)/ruby/internal/intern/load.h @@ -166,12 +166,12 @@ psych.o: $(hdrdir)/ruby/internal/memory.h psych.o: $(hdrdir)/ruby/internal/method.h psych.o: $(hdrdir)/ruby/internal/module.h psych.o: $(hdrdir)/ruby/internal/newobj.h -psych.o: $(hdrdir)/ruby/internal/rgengc.h psych.o: $(hdrdir)/ruby/internal/scan_args.h psych.o: $(hdrdir)/ruby/internal/special_consts.h psych.o: $(hdrdir)/ruby/internal/static_assert.h psych.o: $(hdrdir)/ruby/internal/stdalign.h psych.o: $(hdrdir)/ruby/internal/stdbool.h +psych.o: $(hdrdir)/ruby/internal/stdckdint.h psych.o: $(hdrdir)/ruby/internal/symbol.h psych.o: $(hdrdir)/ruby/internal/value.h psych.o: $(hdrdir)/ruby/internal/value_type.h @@ -244,6 +244,7 @@ psych_emitter.o: $(hdrdir)/ruby/internal/attr/noexcept.h psych_emitter.o: $(hdrdir)/ruby/internal/attr/noinline.h psych_emitter.o: $(hdrdir)/ruby/internal/attr/nonnull.h psych_emitter.o: $(hdrdir)/ruby/internal/attr/noreturn.h +psych_emitter.o: $(hdrdir)/ruby/internal/attr/packed_struct.h psych_emitter.o: $(hdrdir)/ruby/internal/attr/pure.h psych_emitter.o: $(hdrdir)/ruby/internal/attr/restrict.h psych_emitter.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -312,7 +313,6 @@ psych_emitter.o: $(hdrdir)/ruby/internal/intern/enumerator.h psych_emitter.o: $(hdrdir)/ruby/internal/intern/error.h psych_emitter.o: $(hdrdir)/ruby/internal/intern/eval.h psych_emitter.o: $(hdrdir)/ruby/internal/intern/file.h -psych_emitter.o: $(hdrdir)/ruby/internal/intern/gc.h psych_emitter.o: $(hdrdir)/ruby/internal/intern/hash.h psych_emitter.o: $(hdrdir)/ruby/internal/intern/io.h psych_emitter.o: $(hdrdir)/ruby/internal/intern/load.h @@ -343,12 +343,12 @@ psych_emitter.o: $(hdrdir)/ruby/internal/memory.h psych_emitter.o: $(hdrdir)/ruby/internal/method.h psych_emitter.o: $(hdrdir)/ruby/internal/module.h psych_emitter.o: $(hdrdir)/ruby/internal/newobj.h -psych_emitter.o: $(hdrdir)/ruby/internal/rgengc.h psych_emitter.o: $(hdrdir)/ruby/internal/scan_args.h psych_emitter.o: $(hdrdir)/ruby/internal/special_consts.h psych_emitter.o: $(hdrdir)/ruby/internal/static_assert.h psych_emitter.o: $(hdrdir)/ruby/internal/stdalign.h psych_emitter.o: $(hdrdir)/ruby/internal/stdbool.h +psych_emitter.o: $(hdrdir)/ruby/internal/stdckdint.h psych_emitter.o: $(hdrdir)/ruby/internal/symbol.h psych_emitter.o: $(hdrdir)/ruby/internal/value.h psych_emitter.o: $(hdrdir)/ruby/internal/value_type.h @@ -421,6 +421,7 @@ psych_parser.o: $(hdrdir)/ruby/internal/attr/noexcept.h psych_parser.o: $(hdrdir)/ruby/internal/attr/noinline.h psych_parser.o: $(hdrdir)/ruby/internal/attr/nonnull.h psych_parser.o: $(hdrdir)/ruby/internal/attr/noreturn.h +psych_parser.o: $(hdrdir)/ruby/internal/attr/packed_struct.h psych_parser.o: $(hdrdir)/ruby/internal/attr/pure.h psych_parser.o: $(hdrdir)/ruby/internal/attr/restrict.h psych_parser.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -489,7 +490,6 @@ psych_parser.o: $(hdrdir)/ruby/internal/intern/enumerator.h psych_parser.o: $(hdrdir)/ruby/internal/intern/error.h psych_parser.o: $(hdrdir)/ruby/internal/intern/eval.h psych_parser.o: $(hdrdir)/ruby/internal/intern/file.h -psych_parser.o: $(hdrdir)/ruby/internal/intern/gc.h psych_parser.o: $(hdrdir)/ruby/internal/intern/hash.h psych_parser.o: $(hdrdir)/ruby/internal/intern/io.h psych_parser.o: $(hdrdir)/ruby/internal/intern/load.h @@ -520,12 +520,12 @@ psych_parser.o: $(hdrdir)/ruby/internal/memory.h psych_parser.o: $(hdrdir)/ruby/internal/method.h psych_parser.o: $(hdrdir)/ruby/internal/module.h psych_parser.o: $(hdrdir)/ruby/internal/newobj.h -psych_parser.o: $(hdrdir)/ruby/internal/rgengc.h psych_parser.o: $(hdrdir)/ruby/internal/scan_args.h psych_parser.o: $(hdrdir)/ruby/internal/special_consts.h psych_parser.o: $(hdrdir)/ruby/internal/static_assert.h psych_parser.o: $(hdrdir)/ruby/internal/stdalign.h psych_parser.o: $(hdrdir)/ruby/internal/stdbool.h +psych_parser.o: $(hdrdir)/ruby/internal/stdckdint.h psych_parser.o: $(hdrdir)/ruby/internal/symbol.h psych_parser.o: $(hdrdir)/ruby/internal/value.h psych_parser.o: $(hdrdir)/ruby/internal/value_type.h @@ -598,6 +598,7 @@ psych_to_ruby.o: $(hdrdir)/ruby/internal/attr/noexcept.h psych_to_ruby.o: $(hdrdir)/ruby/internal/attr/noinline.h psych_to_ruby.o: $(hdrdir)/ruby/internal/attr/nonnull.h psych_to_ruby.o: $(hdrdir)/ruby/internal/attr/noreturn.h +psych_to_ruby.o: $(hdrdir)/ruby/internal/attr/packed_struct.h psych_to_ruby.o: $(hdrdir)/ruby/internal/attr/pure.h psych_to_ruby.o: $(hdrdir)/ruby/internal/attr/restrict.h psych_to_ruby.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -666,7 +667,6 @@ psych_to_ruby.o: $(hdrdir)/ruby/internal/intern/enumerator.h psych_to_ruby.o: $(hdrdir)/ruby/internal/intern/error.h psych_to_ruby.o: $(hdrdir)/ruby/internal/intern/eval.h psych_to_ruby.o: $(hdrdir)/ruby/internal/intern/file.h -psych_to_ruby.o: $(hdrdir)/ruby/internal/intern/gc.h psych_to_ruby.o: $(hdrdir)/ruby/internal/intern/hash.h psych_to_ruby.o: $(hdrdir)/ruby/internal/intern/io.h psych_to_ruby.o: $(hdrdir)/ruby/internal/intern/load.h @@ -697,12 +697,12 @@ psych_to_ruby.o: $(hdrdir)/ruby/internal/memory.h psych_to_ruby.o: $(hdrdir)/ruby/internal/method.h psych_to_ruby.o: $(hdrdir)/ruby/internal/module.h psych_to_ruby.o: $(hdrdir)/ruby/internal/newobj.h -psych_to_ruby.o: $(hdrdir)/ruby/internal/rgengc.h psych_to_ruby.o: $(hdrdir)/ruby/internal/scan_args.h psych_to_ruby.o: $(hdrdir)/ruby/internal/special_consts.h psych_to_ruby.o: $(hdrdir)/ruby/internal/static_assert.h psych_to_ruby.o: $(hdrdir)/ruby/internal/stdalign.h psych_to_ruby.o: $(hdrdir)/ruby/internal/stdbool.h +psych_to_ruby.o: $(hdrdir)/ruby/internal/stdckdint.h psych_to_ruby.o: $(hdrdir)/ruby/internal/symbol.h psych_to_ruby.o: $(hdrdir)/ruby/internal/value.h psych_to_ruby.o: $(hdrdir)/ruby/internal/value_type.h @@ -775,6 +775,7 @@ psych_yaml_tree.o: $(hdrdir)/ruby/internal/attr/noexcept.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/attr/noinline.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/attr/nonnull.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/attr/noreturn.h +psych_yaml_tree.o: $(hdrdir)/ruby/internal/attr/packed_struct.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/attr/pure.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/attr/restrict.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -843,7 +844,6 @@ psych_yaml_tree.o: $(hdrdir)/ruby/internal/intern/enumerator.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/intern/error.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/intern/eval.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/intern/file.h -psych_yaml_tree.o: $(hdrdir)/ruby/internal/intern/gc.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/intern/hash.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/intern/io.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/intern/load.h @@ -874,12 +874,12 @@ psych_yaml_tree.o: $(hdrdir)/ruby/internal/memory.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/method.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/module.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/newobj.h -psych_yaml_tree.o: $(hdrdir)/ruby/internal/rgengc.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/scan_args.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/special_consts.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/static_assert.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/stdalign.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/stdbool.h +psych_yaml_tree.o: $(hdrdir)/ruby/internal/stdckdint.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/symbol.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/value.h psych_yaml_tree.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb index 41daf8c238..e7dd0bb60a 100644 --- a/ext/psych/extconf.rb +++ b/ext/psych/extconf.rb @@ -22,7 +22,7 @@ if yaml_source args = [ yaml_configure, "--enable-#{shared ? 'shared' : 'static'}", - "--host=#{RbConfig::CONFIG['host'].sub(/-unknown-/, '-')}", + "--host=#{RbConfig::CONFIG['host'].sub(/-unknown-/, '-').sub(/arm64/, 'arm')}", "CC=#{RbConfig::CONFIG['CC']}", *(["CFLAGS=-w"] if RbConfig::CONFIG["GCC"] == "yes"), ] diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 4a2ab58514..d87bd9040a 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/lib/psych.rb @@ -489,6 +489,10 @@ module Psych # # Default: <tt>false</tt>. # + # [<tt>:stringify_names</tt>] Dump symbol keys in Hash objects as string. + # + # Default: <tt>false</tt>. + # # Example: # # # Dump an array, get back a YAML string @@ -502,6 +506,9 @@ module Psych # # # Dump an array to an IO with indentation set # Psych.dump(['a', ['b']], StringIO.new, indentation: 3) + # + # # Dump hash with symbol keys as string + # Psych.dump({a: "b"}, stringify_names: true) # => "---\na: b\n" def self.dump o, io = nil, options = {} if Hash === io options = io @@ -562,6 +569,10 @@ module Psych # # Default: <tt>false</tt>. # + # [<tt>:stringify_names</tt>] Dump symbol keys in Hash objects as string. + # + # Default: <tt>false</tt>. + # # Example: # # # Dump an array, get back a YAML string @@ -575,6 +586,9 @@ module Psych # # # Dump an array to an IO with indentation set # Psych.safe_dump(['a', ['b']], StringIO.new, indentation: 3) + # + # # Dump hash with symbol keys as string + # Psych.dump({a: "b"}, stringify_names: true) # => "---\na: b\n" def self.safe_dump o, io = nil, options = {} if Hash === io options = io @@ -694,26 +708,8 @@ module Psych dump_tags[klass] = tag end - # Workaround for emulating `warn '...', uplevel: 1` in Ruby 2.4 or lower. - def self.warn_with_uplevel(message, uplevel: 1) - at = parse_caller(caller[uplevel]).join(':') - warn "#{at}: #{message}" - end - - def self.parse_caller(at) - if /^(.+?):(\d+)(?::in `.*')?/ =~ at - file = $1 - line = $2.to_i - [file, line] - end - end - private_class_method :warn_with_uplevel, :parse_caller - class << self if defined?(Ractor) - require 'forwardable' - extend Forwardable - class Config attr_accessor :load_tags, :dump_tags, :domain_types def initialize @@ -727,7 +723,29 @@ module Psych Ractor.current[:PsychConfig] ||= Config.new end - def_delegators :config, :load_tags, :dump_tags, :domain_types, :load_tags=, :dump_tags=, :domain_types= + def load_tags + config.load_tags + end + + def dump_tags + config.dump_tags + end + + def domain_types + config.domain_types + end + + def load_tags=(value) + config.load_tags = value + end + + def dump_tags=(value) + config.dump_tags = value + end + + def domain_types=(value) + config.domain_types = value + end else attr_accessor :load_tags attr_accessor :dump_tags diff --git a/ext/psych/lib/psych/class_loader.rb b/ext/psych/lib/psych/class_loader.rb index c2e4ea4c93..50efc35ee2 100644 --- a/ext/psych/lib/psych/class_loader.rb +++ b/ext/psych/lib/psych/class_loader.rb @@ -35,7 +35,7 @@ module Psych constants.each do |const| konst = const_get const - class_eval <<~RUBY + class_eval <<~RUBY, __FILE__, __LINE__ + 1 def #{const.to_s.downcase} load #{konst.inspect} end diff --git a/ext/psych/lib/psych/tree_builder.rb b/ext/psych/lib/psych/tree_builder.rb index 414ca02bf7..83115bd721 100644 --- a/ext/psych/lib/psych/tree_builder.rb +++ b/ext/psych/lib/psych/tree_builder.rb @@ -41,7 +41,7 @@ module Psych Sequence Mapping }.each do |node| - class_eval %{ + class_eval <<~RUBY, __FILE__, __LINE__ + 1 def start_#{node.downcase}(anchor, tag, implicit, style) n = Nodes::#{node}.new(anchor, tag, implicit, style) set_start_location(n) @@ -54,7 +54,7 @@ module Psych set_end_location(n) n end - } + RUBY end ### diff --git a/ext/psych/lib/psych/versions.rb b/ext/psych/lib/psych/versions.rb index a9585c887f..b9e8d9ef11 100644 --- a/ext/psych/lib/psych/versions.rb +++ b/ext/psych/lib/psych/versions.rb @@ -2,9 +2,9 @@ module Psych # The version of Psych you are using - VERSION = '5.0.0.dev' + VERSION = '5.1.2' if RUBY_ENGINE == 'jruby' - DEFAULT_SNAKEYAML_VERSION = '1.33'.freeze + DEFAULT_SNAKEYAML_VERSION = '2.7'.freeze end end diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index 8614251ca9..f0fda9bdbc 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -101,7 +101,7 @@ module Psych source = $1 options = 0 lang = nil - ($2 || '').split('').each do |option| + $2&.each_char do |option| case option when 'x' then options |= Regexp::EXTENDED when 'i' then options |= Regexp::IGNORECASE diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index 31858798e4..a2ebc4d781 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -15,30 +15,25 @@ module Psych class YAMLTree < Psych::Visitors::Visitor class Registrar # :nodoc: def initialize - @obj_to_id = {} - @obj_to_node = {} - @targets = [] + @obj_to_id = {}.compare_by_identity + @obj_to_node = {}.compare_by_identity @counter = 0 end def register target, node - return unless target.respond_to? :object_id - @targets << target - @obj_to_node[target.object_id] = node + @obj_to_node[target] = node end def key? target - @obj_to_node.key? target.object_id - rescue NoMethodError - false + @obj_to_node.key? target end def id_for target - @obj_to_id[target.object_id] ||= (@counter += 1) + @obj_to_id[target] ||= (@counter += 1) end def node_for target - @obj_to_node[target.object_id] + @obj_to_node[target] end end @@ -70,6 +65,7 @@ module Psych fail(ArgumentError, "Invalid line_width #{@line_width}, must be non-negative or -1 for unlimited.") end end + @stringify_names = options[:stringify_names] @coders = [] @dispatch_cache = Hash.new do |h,klass| @@ -272,7 +268,7 @@ module Psych tag = 'tag:yaml.org,2002:str' plain = false quote = false - elsif o == 'y' || o == 'n' + elsif o == 'y' || o == 'Y' || o == 'n' || o == 'N' style = Nodes::Scalar::DOUBLE_QUOTED elsif @line_width && o.length > @line_width style = Nodes::Scalar::FOLDED @@ -328,7 +324,7 @@ module Psych if o.class == ::Hash register(o, @emitter.start_mapping(nil, nil, true, Psych::Nodes::Mapping::BLOCK)) o.each do |k,v| - accept k + accept(@stringify_names && Symbol === k ? k.to_s : k) accept v end @emitter.end_mapping @@ -341,7 +337,7 @@ module Psych register(o, @emitter.start_mapping(nil, '!set', false, Psych::Nodes::Mapping::BLOCK)) o.each do |k,v| - accept k + accept(@stringify_names && Symbol === k ? k.to_s : k) accept v end @@ -568,7 +564,7 @@ module Psych raise BadAlias, "Tried to dump an aliased object" end - unless @permitted_classes[target.class] + unless Symbol === target || @permitted_classes[target.class] raise DisallowedClass.new('dump', target.class.name || target.class.inspect) end @@ -576,7 +572,7 @@ module Psych end def visit_Symbol sym - unless @permitted_symbols[sym] + unless @permitted_classes[Symbol] || @permitted_symbols[sym] raise DisallowedClass.new('dump', "Symbol(#{sym.inspect})") end diff --git a/ext/psych/psych.gemspec b/ext/psych/psych.gemspec index 5f5168ddb0..a3fc53a8b9 100644 --- a/ext/psych/psych.gemspec +++ b/ext/psych/psych.gemspec @@ -21,28 +21,41 @@ DESCRIPTION s.licenses = ["MIT"] s.require_paths = ["lib"] - # for ruby core repository. It was generated by `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + # for ruby core repository. + # It was generated by + # `git ls-files -z`.split("\x0").reject { |f| + # f.match(%r{^\.git|^(test|spec|features|bin|tool)/|^[A-Z]\w+file$|/extlibs$|\.(gemspec|java)$|jar}) + # } s.files = [ - ".gitignore", "Gemfile", "LICENSE", "Mavenfile", "README.md", "Rakefile", "bin/console", - "bin/setup", "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", - "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", "lib/psych/core_ext.rb", "lib/psych/exception.rb", - "lib/psych/handler.rb", "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", - "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", "lib/psych/json/tree_builder.rb", - "lib/psych/json/yaml_events.rb", "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", "lib/psych/nodes/document.rb", - "lib/psych/nodes/mapping.rb", "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", "lib/psych/nodes/sequence.rb", - "lib/psych/nodes/stream.rb", "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", - "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", "lib/psych/syntax_error.rb", - "lib/psych/tree_builder.rb", "lib/psych/versions.rb", "lib/psych/visitors.rb","lib/psych/visitors/depth_first.rb", - "lib/psych/visitors/emitter.rb", "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", - "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", "lib/psych/y.rb", "psych.gemspec" + "CONTRIBUTING.md", "LICENSE", "README.md", "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", + "lib/psych.rb", "lib/psych/class_loader.rb", "lib/psych/coder.rb", + "lib/psych/core_ext.rb", "lib/psych/exception.rb", "lib/psych/handler.rb", + "lib/psych/handlers/document_stream.rb", "lib/psych/handlers/recorder.rb", + "lib/psych/json/ruby_events.rb", "lib/psych/json/stream.rb", + "lib/psych/json/tree_builder.rb", "lib/psych/json/yaml_events.rb", + "lib/psych/nodes.rb", "lib/psych/nodes/alias.rb", + "lib/psych/nodes/document.rb", "lib/psych/nodes/mapping.rb", + "lib/psych/nodes/node.rb", "lib/psych/nodes/scalar.rb", + "lib/psych/nodes/sequence.rb", "lib/psych/nodes/stream.rb", + "lib/psych/omap.rb", "lib/psych/parser.rb", "lib/psych/scalar_scanner.rb", + "lib/psych/set.rb", "lib/psych/stream.rb", "lib/psych/streaming.rb", + "lib/psych/syntax_error.rb", "lib/psych/tree_builder.rb", + "lib/psych/versions.rb", "lib/psych/visitors.rb", + "lib/psych/visitors/depth_first.rb", "lib/psych/visitors/emitter.rb", + "lib/psych/visitors/json_tree.rb", "lib/psych/visitors/to_ruby.rb", + "lib/psych/visitors/visitor.rb", "lib/psych/visitors/yaml_tree.rb", + "lib/psych/y.rb" ] s.rdoc_options = ["--main", "README.md"] s.extra_rdoc_files = ["README.md"] - s.required_ruby_version = Gem::Requirement.new(">= 2.4.0") + s.required_ruby_version = Gem::Requirement.new(">= 2.5.0") s.required_rubygems_version = Gem::Requirement.new(">= 0") if RUBY_ENGINE == 'jruby' @@ -52,15 +65,16 @@ DESCRIPTION "ext/java/org/jruby/ext/psych/PsychLibrary.java", "ext/java/org/jruby/ext/psych/PsychParser.java", "ext/java/org/jruby/ext/psych/PsychToRuby.java", - "ext/java/org/jruby/ext/psych/PsychYamlTree.java", "lib/psych_jars.rb", "lib/psych.jar" ] - s.requirements = "jar org.yaml:snakeyaml, #{version_module::Psych::DEFAULT_SNAKEYAML_VERSION}" + s.requirements = "jar org.snakeyaml:snakeyaml-engine, #{version_module::Psych::DEFAULT_SNAKEYAML_VERSION}" s.add_dependency 'jar-dependencies', '>= 0.1.7' else s.extensions = ["ext/psych/extconf.rb"] s.add_dependency 'stringio' end + s.metadata['msys2_mingw_dependencies'] = 'libyaml' + s.metadata['changelog_uri'] = s.homepage + '/releases' end diff --git a/ext/pty/depend b/ext/pty/depend index f251caae3f..adecfff862 100644 --- a/ext/pty/depend +++ b/ext/pty/depend @@ -53,6 +53,7 @@ pty.o: $(hdrdir)/ruby/internal/attr/noexcept.h pty.o: $(hdrdir)/ruby/internal/attr/noinline.h pty.o: $(hdrdir)/ruby/internal/attr/nonnull.h pty.o: $(hdrdir)/ruby/internal/attr/noreturn.h +pty.o: $(hdrdir)/ruby/internal/attr/packed_struct.h pty.o: $(hdrdir)/ruby/internal/attr/pure.h pty.o: $(hdrdir)/ruby/internal/attr/restrict.h pty.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ pty.o: $(hdrdir)/ruby/internal/intern/enumerator.h pty.o: $(hdrdir)/ruby/internal/intern/error.h pty.o: $(hdrdir)/ruby/internal/intern/eval.h pty.o: $(hdrdir)/ruby/internal/intern/file.h -pty.o: $(hdrdir)/ruby/internal/intern/gc.h pty.o: $(hdrdir)/ruby/internal/intern/hash.h pty.o: $(hdrdir)/ruby/internal/intern/io.h pty.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ pty.o: $(hdrdir)/ruby/internal/memory.h pty.o: $(hdrdir)/ruby/internal/method.h pty.o: $(hdrdir)/ruby/internal/module.h pty.o: $(hdrdir)/ruby/internal/newobj.h -pty.o: $(hdrdir)/ruby/internal/rgengc.h pty.o: $(hdrdir)/ruby/internal/scan_args.h pty.o: $(hdrdir)/ruby/internal/special_consts.h pty.o: $(hdrdir)/ruby/internal/static_assert.h pty.o: $(hdrdir)/ruby/internal/stdalign.h pty.o: $(hdrdir)/ruby/internal/stdbool.h +pty.o: $(hdrdir)/ruby/internal/stdckdint.h pty.o: $(hdrdir)/ruby/internal/symbol.h pty.o: $(hdrdir)/ruby/internal/value.h pty.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/pty/extconf.rb b/ext/pty/extconf.rb index ba0c4286fd..da3655cf4d 100644 --- a/ext/pty/extconf.rb +++ b/ext/pty/extconf.rb @@ -13,10 +13,13 @@ if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM have_header("util.h") # OpenBSD openpty util = have_library("util", "openpty") end - if have_func("posix_openpt") or + openpt = have_func("posix_openpt") + if openpt + have_func("ptsname_r") or have_func("ptsname") + end + if openpt or (util or have_func("openpty")) or have_func("_getpty") or - have_func("ptsname") or have_func("ioctl") create_makefile('pty') end diff --git a/ext/pty/pty.c b/ext/pty/pty.c index acec33f9bf..5ca55e41d6 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -92,9 +92,13 @@ struct pty_info { static void getDevice(int*, int*, char [DEVICELEN], int); +static int start_new_session(char *errbuf, size_t errbuf_len); +static int obtain_ctty(int master, int slave, const char *slavename, char *errbuf, size_t errbuf_len); +static int drop_privilige(char *errbuf, size_t errbuf_len); + struct child_info { int master, slave; - char *slavename; + const char *slavename; VALUE execarg_obj; struct rb_execarg *eargp; }; @@ -102,26 +106,42 @@ struct child_info { static int chfunc(void *data, char *errbuf, size_t errbuf_len) { - struct child_info *carg = data; + const struct child_info *carg = data; int master = carg->master; int slave = carg->slave; + const char *slavename = carg->slavename; + + if (start_new_session(errbuf, errbuf_len)) + return -1; + + if (obtain_ctty(master, slave, slavename, errbuf, errbuf_len)) + return -1; + + if (drop_privilige(errbuf, errbuf_len)) + return -1; + + return rb_exec_async_signal_safe(carg->eargp, errbuf, errbuf_len); +} #define ERROR_EXIT(str) do { \ strlcpy(errbuf, (str), errbuf_len); \ return -1; \ } while (0) - /* - * Set free from process group and controlling terminal - */ +/* + * Set free from process group and controlling terminal + */ +static int +start_new_session(char *errbuf, size_t errbuf_len) +{ #ifdef HAVE_SETSID (void) setsid(); #else /* HAS_SETSID */ # ifdef HAVE_SETPGRP -# ifdef SETGRP_VOID +# ifdef SETPGRP_VOID if (setpgrp() == -1) ERROR_EXIT("setpgrp()"); -# else /* SETGRP_VOID */ +# else /* SETPGRP_VOID */ if (setpgrp(0, getpid()) == -1) ERROR_EXIT("setpgrp()"); { @@ -132,20 +152,25 @@ chfunc(void *data, char *errbuf, size_t errbuf_len) ERROR_EXIT("ioctl(TIOCNOTTY)"); close(i); } -# endif /* SETGRP_VOID */ +# endif /* SETPGRP_VOID */ # endif /* HAVE_SETPGRP */ #endif /* HAS_SETSID */ + return 0; +} - /* - * obtain new controlling terminal - */ +/* + * obtain new controlling terminal + */ +static int +obtain_ctty(int master, int slave, const char *slavename, char *errbuf, size_t errbuf_len) +{ #if defined(TIOCSCTTY) close(master); (void) ioctl(slave, TIOCSCTTY, (char *)0); /* errors ignored for sun */ #else close(slave); - slave = rb_cloexec_open(carg->slavename, O_RDWR, 0); + slave = rb_cloexec_open(slavename, O_RDWR, 0); if (slave < 0) { ERROR_EXIT("open: pty slave"); } @@ -156,13 +181,19 @@ chfunc(void *data, char *errbuf, size_t errbuf_len) dup2(slave,1); dup2(slave,2); if (slave < 0 || slave > 2) (void)!close(slave); + return 0; +} + +static int +drop_privilige(char *errbuf, size_t errbuf_len) +{ #if defined(HAVE_SETEUID) || defined(HAVE_SETREUID) || defined(HAVE_SETRESUID) if (seteuid(getuid())) ERROR_EXIT("seteuid()"); #endif + return 0; +} - return rb_exec_async_signal_safe(carg->eargp, errbuf, sizeof(errbuf_len)); #undef ERROR_EXIT -} static void establishShell(int argc, VALUE *argv, struct pty_info *info, @@ -225,7 +256,21 @@ establishShell(int argc, VALUE *argv, struct pty_info *info, RB_GC_GUARD(carg.execarg_obj); } -#if defined(HAVE_POSIX_OPENPT) || defined(HAVE_OPENPTY) || defined(HAVE_PTSNAME) +#if (defined(HAVE_POSIX_OPENPT) || defined(HAVE_PTSNAME)) && !defined(HAVE_PTSNAME_R) +/* glibc only, not obsolete interface on Tru64 or HP-UX */ +static int +ptsname_r(int fd, char *buf, size_t buflen) +{ + extern char *ptsname(int); + char *name = ptsname(fd); + if (!name) return -1; + strlcpy(buf, name, buflen); + return 0; +} +# define HAVE_PTSNAME_R 1 +#endif + +#if defined(HAVE_POSIX_OPENPT) || defined(HAVE_OPENPTY) || defined(HAVE_PTSNAME_R) static int no_mesg(char *slavedevice, int nomesg) { @@ -258,13 +303,19 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, /* Unix98 PTY */ int masterfd = -1, slavefd = -1; char *slavedevice; + struct sigaction dfl, old; + + dfl.sa_handler = SIG_DFL; + dfl.sa_flags = 0; + sigemptyset(&dfl.sa_mask); #if defined(__sun) || defined(__OpenBSD__) || (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; - if (rb_grantpt(masterfd) == -1) goto error; + if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error; + if (grantpt(masterfd) == -1) goto grantpt_error; rb_fd_fix_cloexec(masterfd); #else { @@ -278,10 +329,13 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, if ((masterfd = posix_openpt(flags)) == -1) goto error; } rb_fd_fix_cloexec(masterfd); - if (rb_grantpt(masterfd) == -1) goto error; + 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 (ptsname_r(masterfd, SlaveName, DEVICELEN) != 0) goto error; + slavedevice = SlaveName; if (no_mesg(slavedevice, nomesg) == -1) goto error; if ((slavefd = rb_cloexec_open(slavedevice, O_RDWR|O_NOCTTY, 0)) == -1) goto error; rb_update_max_fd(slavefd); @@ -294,9 +348,10 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, *master = masterfd; *slave = slavefd; - strlcpy(SlaveName, slavedevice, DEVICELEN); return 0; + grantpt_error: + sigaction(SIGCHLD, &old, NULL); error: if (slavefd != -1) close(slavefd); if (masterfd != -1) close(masterfd); @@ -346,21 +401,25 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, char *slavedevice; void (*s)(); - extern char *ptsname(int); 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; - if(rb_grantpt(masterfd) == -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); - if(rb_grantpt(masterfd) == -1) goto error; + 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 (ptsname_r(masterfd, SlaveName, DEVICELEN) != 0) goto error; + slavedevice = SlaveName; if (no_mesg(slavedevice, nomesg) == -1) goto error; if((slavefd = rb_cloexec_open(slavedevice, O_RDWR, 0)) == -1) goto error; rb_update_max_fd(slavefd); @@ -371,7 +430,6 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, #endif *master = masterfd; *slave = slavefd; - strlcpy(SlaveName, slavedevice, DEVICELEN); return 0; error: @@ -448,8 +506,10 @@ pty_close_pty(VALUE assoc) for (i = 0; i < 2; i++) { io = rb_ary_entry(assoc, i); - if (RB_TYPE_P(io, T_FILE) && 0 <= RFILE(io)->fptr->fd) + if (RB_TYPE_P(io, T_FILE)) { + /* it's OK to call rb_io_close again even if it's already closed */ rb_io_close(io); + } } return Qnil; } @@ -499,28 +559,21 @@ pty_open(VALUE klass) { int master_fd, slave_fd; char slavename[DEVICELEN]; - VALUE master_io, slave_file; - rb_io_t *master_fptr, *slave_fptr; - VALUE assoc; getDevice(&master_fd, &slave_fd, slavename, 1); - master_io = rb_obj_alloc(rb_cIO); - MakeOpenFile(master_io, master_fptr); - master_fptr->mode = FMODE_READWRITE | FMODE_SYNC | FMODE_DUPLEX; - master_fptr->fd = master_fd; - master_fptr->pathv = rb_obj_freeze(rb_sprintf("masterpty:%s", slavename)); + VALUE master_path = rb_obj_freeze(rb_sprintf("masterpty:%s", slavename)); + VALUE master_io = rb_io_open_descriptor(rb_cIO, master_fd, FMODE_READWRITE | FMODE_SYNC | FMODE_DUPLEX, master_path, RUBY_IO_TIMEOUT_DEFAULT, NULL); + + VALUE slave_path = rb_obj_freeze(rb_str_new_cstr(slavename)); + VALUE slave_file = rb_io_open_descriptor(rb_cFile, slave_fd, FMODE_READWRITE | FMODE_SYNC | FMODE_DUPLEX | FMODE_TTY, slave_path, RUBY_IO_TIMEOUT_DEFAULT, NULL); - slave_file = rb_obj_alloc(rb_cFile); - MakeOpenFile(slave_file, slave_fptr); - slave_fptr->mode = FMODE_READWRITE | FMODE_SYNC | FMODE_DUPLEX | FMODE_TTY; - slave_fptr->fd = slave_fd; - slave_fptr->pathv = rb_obj_freeze(rb_str_new_cstr(slavename)); + VALUE assoc = rb_assoc_new(master_io, slave_file); - assoc = rb_assoc_new(master_io, slave_file); if (rb_block_given_p()) { return rb_ensure(rb_yield, assoc, pty_close_pty, assoc); } + return assoc; } @@ -577,30 +630,27 @@ pty_getpty(int argc, VALUE *argv, VALUE self) { VALUE res; struct pty_info info; - rb_io_t *wfptr,*rfptr; - VALUE rport = rb_obj_alloc(rb_cFile); - VALUE wport = rb_obj_alloc(rb_cFile); char SlaveName[DEVICELEN]; - MakeOpenFile(rport, rfptr); - MakeOpenFile(wport, wfptr); - establishShell(argc, argv, &info, SlaveName); - rfptr->mode = rb_io_modestr_fmode("r"); - rfptr->fd = info.fd; - rfptr->pathv = rb_obj_freeze(rb_str_new_cstr(SlaveName)); + VALUE pty_path = rb_obj_freeze(rb_str_new_cstr(SlaveName)); + VALUE rport = rb_io_open_descriptor( + rb_cFile, info.fd, FMODE_READABLE, pty_path, RUBY_IO_TIMEOUT_DEFAULT, NULL + ); - wfptr->mode = rb_io_modestr_fmode("w") | FMODE_SYNC; - wfptr->fd = rb_cloexec_dup(info.fd); - if (wfptr->fd == -1) + int wpty_fd = rb_cloexec_dup(info.fd); + if (wpty_fd == -1) { rb_sys_fail("dup()"); - rb_update_max_fd(wfptr->fd); - wfptr->pathv = rfptr->pathv; + } + VALUE wport = rb_io_open_descriptor( + rb_cFile, wpty_fd, FMODE_WRITABLE | FMODE_TRUNC | FMODE_CREATE | FMODE_SYNC, + pty_path, RUBY_IO_TIMEOUT_DEFAULT, NULL + ); res = rb_ary_new2(3); - rb_ary_store(res,0,(VALUE)rport); - rb_ary_store(res,1,(VALUE)wport); + rb_ary_store(res, 0, rport); + rb_ary_store(res, 1, wport); rb_ary_store(res,2,PIDT2NUM(info.child_pid)); if (rb_block_given_p()) { @@ -753,8 +803,13 @@ void Init_pty(void) { cPTY = rb_define_module("PTY"); - /* :nodoc: */ - rb_define_module_function(cPTY,"getpty",pty_getpty,-1); +#if 1 + rb_define_module_function(cPTY,"get""pty",pty_getpty,-1); +#else /* for RDoc */ + /* show getpty as an alias of spawn */ + VALUE sPTY = rb_singleton_class(cPTY); + rb_define_alias(sPTY, "getpty", "spawn"); +#endif rb_define_module_function(cPTY,"spawn",pty_getpty,-1); rb_define_singleton_method(cPTY,"check",pty_check,-1); rb_define_singleton_method(cPTY,"open",pty_open,0); diff --git a/ext/racc/cparse/README b/ext/racc/cparse/README deleted file mode 100644 index 550e8d49fe..0000000000 --- a/ext/racc/cparse/README +++ /dev/null @@ -1,11 +0,0 @@ -Racc Runtime README -=================== - -This directory contains a runtime library of -Racc parser generator. If you want to generate -your own parser, you must get Racc full package. -Get it from: - - - http://i.loveruby.net/en/projects/racc - - https://github.com/ruby/racc - diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c deleted file mode 100644 index f71ed2bba9..0000000000 --- a/ext/racc/cparse/cparse.c +++ /dev/null @@ -1,863 +0,0 @@ -/* - - cparse.c -- Racc Runtime Core - - Copyright (c) 1999-2006 Minero Aoki - - This library is free software. - You can distribute/modify this program under the same terms of ruby. - - $originalId: cparse.c,v 1.8 2006/07/06 11:39:46 aamine Exp $ - -*/ - -#include <ruby.h> - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -/* ----------------------------------------------------------------------- - Important Constants ------------------------------------------------------------------------ */ - -#define RACC_VERSION "1.4.15" - -#define DEFAULT_TOKEN -1 -#define ERROR_TOKEN 1 -#define FINAL_TOKEN 0 - -#define vDEFAULT_TOKEN INT2FIX(DEFAULT_TOKEN) -#define vERROR_TOKEN INT2FIX(ERROR_TOKEN) -#define vFINAL_TOKEN INT2FIX(FINAL_TOKEN) - -/* ----------------------------------------------------------------------- - File Local Variables ------------------------------------------------------------------------ */ - -static VALUE RaccBug; -static VALUE CparseParams; - -static ID id_yydebug; -static ID id_nexttoken; -static ID id_onerror; -static ID id_noreduce; -static ID id_errstatus; - -static ID id_d_shift; -static ID id_d_reduce; -static ID id_d_accept; -static ID id_d_read_token; -static ID id_d_next_state; -static ID id_d_e_pop; - -/* ----------------------------------------------------------------------- - Utils ------------------------------------------------------------------------ */ - -/* For backward compatibility */ -#ifndef ID2SYM -# define ID2SYM(i) ULONG2NUM(i) -#endif -#ifndef SYM2ID -# define SYM2ID(v) ((ID)NUM2ULONG(v)) -#endif -#ifndef SYMBOL_P -# define SYMBOL_P(v) FIXNUM_P(v) -#endif -#ifndef LONG2NUM -# define LONG2NUM(i) INT2NUM(i) -#endif - -#ifndef HAVE_RB_ARY_SUBSEQ -# define rb_ary_subseq(ary, beg, len) rb_ary_new4(len, RARRAY_PTR(ary) + beg) -#endif - -static ID value_to_id _((VALUE v)); -static inline long num_to_long _((VALUE n)); - -static ID -value_to_id(VALUE v) -{ - if (! SYMBOL_P(v)) { - rb_raise(rb_eTypeError, "not symbol"); - } - return SYM2ID(v); -} - -static inline long -num_to_long(VALUE n) -{ - return NUM2LONG(n); -} - -#define AREF(s, idx) \ - ((0 <= idx && idx < RARRAY_LEN(s)) ? rb_ary_entry(s, idx) : Qnil) - -/* ----------------------------------------------------------------------- - Parser Stack Interfaces ------------------------------------------------------------------------ */ - -static VALUE get_stack_tail _((VALUE stack, long len)); -static void cut_stack_tail _((VALUE stack, long len)); - -static VALUE -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_subseq(stack, RARRAY_LEN(stack) - len, len); -} - -static void -cut_stack_tail(VALUE stack, long len) -{ - while (len > 0) { - rb_ary_pop(stack); - len--; - } -} - -#define STACK_INIT_LEN 64 -#define NEW_STACK() rb_ary_new2(STACK_INIT_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) ? 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) - -/* ----------------------------------------------------------------------- - struct cparse_params ------------------------------------------------------------------------ */ - -struct cparse_params { - VALUE value_v; /* VALUE version of this struct */ - - VALUE parser; /* parser object */ - - int lex_is_iterator; - VALUE lexer; /* scanner object */ - ID lexmid; /* name of scanner method (must be an iterator) */ - - /* State transition tables (immutable) - Data structure is from Dragon Book 4.9 */ - /* action table */ - VALUE action_table; - VALUE action_check; - VALUE action_default; - VALUE action_pointer; - /* goto table */ - VALUE goto_table; - VALUE goto_check; - VALUE goto_default; - VALUE goto_pointer; - - long nt_base; /* NonTerminal BASE index */ - VALUE reduce_table; /* reduce data table */ - VALUE token_table; /* token conversion table */ - - /* parser stacks and parameters */ - VALUE state; - long curstate; - VALUE vstack; - VALUE tstack; - VALUE t; - long shift_n; - long reduce_n; - long ruleno; - - long errstatus; /* nonzero in error recovering mode */ - long nerr; /* number of error */ - - int use_result_var; - - VALUE retval; /* return value of parser routine */ - long fin; /* parse result status */ -#define CP_FIN_ACCEPT 1 -#define CP_FIN_EOT 2 -#define CP_FIN_CANTPOP 3 - - int debug; /* user level debug */ - int sys_debug; /* system level debug */ - - long i; /* table index */ -}; - -/* ----------------------------------------------------------------------- - Parser Main Routines ------------------------------------------------------------------------ */ - -static VALUE racc_cparse _((VALUE parser, VALUE arg, VALUE sysdebug)); -static VALUE racc_yyparse _((VALUE parser, VALUE lexer, VALUE lexmid, - VALUE arg, VALUE sysdebug)); - -static void call_lexer _((struct cparse_params *v)); -static VALUE lexer_i _((RB_BLOCK_CALL_FUNC_ARGLIST(block_args, data))); - -static VALUE assert_array _((VALUE a)); -static long assert_integer _((VALUE n)); -static VALUE assert_hash _((VALUE h)); -static VALUE initialize_params _((VALUE vparams, VALUE parser, VALUE arg, - VALUE lexer, VALUE lexmid)); -static void cparse_params_mark _((void *ptr)); -static size_t cparse_params_memsize _((const void *ptr)); - -static void parse_main _((struct cparse_params *v, - VALUE tok, VALUE val, int resume)); -static void extract_user_token _((struct cparse_params *v, - VALUE block_args, VALUE *tok, VALUE *val)); -static void shift _((struct cparse_params* v, long act, VALUE tok, VALUE val)); -static int reduce _((struct cparse_params* v, long act)); -static rb_block_call_func reduce0; - -#ifdef DEBUG -# define D_puts(msg) if (v->sys_debug) puts(msg) -# define D_printf(fmt,arg) if (v->sys_debug) printf(fmt,arg) -#else -# define D_puts(msg) -# define D_printf(fmt,arg) -#endif - -#undef RUBY_UNTYPED_DATA_WARNING -#define RUBY_UNTYPED_DATA_WARNING 1 - -static const rb_data_type_t cparse_params_type = { - "racc/cparse", - { - cparse_params_mark, - RUBY_TYPED_DEFAULT_FREE, - cparse_params_memsize, - }, -#ifdef RUBY_TYPED_FREE_IMMEDIATELY - 0, 0, - RUBY_TYPED_FREE_IMMEDIATELY, -#endif -}; - -static VALUE -racc_cparse(VALUE parser, VALUE arg, VALUE sysdebug) -{ - VALUE vparams; - struct cparse_params *v; - - vparams = TypedData_Make_Struct(CparseParams, struct cparse_params, - &cparse_params_type, v); - D_puts("starting cparse"); - v->sys_debug = RTEST(sysdebug); - vparams = initialize_params(vparams, parser, arg, Qnil, Qnil); - v->lex_is_iterator = FALSE; - parse_main(v, Qnil, Qnil, 0); - - RB_GC_GUARD(vparams); - return v->retval; -} - -static VALUE -racc_yyparse(VALUE parser, VALUE lexer, VALUE lexmid, VALUE arg, VALUE sysdebug) -{ - VALUE vparams; - struct cparse_params *v; - - vparams = TypedData_Make_Struct(CparseParams, struct cparse_params, - &cparse_params_type, v); - v->sys_debug = RTEST(sysdebug); - D_puts("start C yyparse"); - vparams = initialize_params(vparams, parser, arg, lexer, lexmid); - v->lex_is_iterator = TRUE; - D_puts("params initialized"); - parse_main(v, Qnil, Qnil, 0); - call_lexer(v); - if (!v->fin) { - rb_raise(rb_eArgError, "%s() is finished before EndOfToken", - rb_id2name(v->lexmid)); - } - - RB_GC_GUARD(vparams); - return v->retval; -} - -#ifdef HAVE_RB_BLOCK_CALL -static void -call_lexer(struct cparse_params *v) -{ - rb_block_call(v->lexer, v->lexmid, 0, NULL, lexer_i, v->value_v); -} -#else -static VALUE -lexer_iter(VALUE data) -{ - struct cparse_params *v = rb_check_typeddata(data, &cparse_params_type); - - rb_funcall(v->lexer, v->lexmid, 0); - return Qnil; -} - -static void -call_lexer(struct cparse_params *v) -{ - rb_iterate(lexer_iter, v->value_v, lexer_i, v->value_v); -} -#endif - -static VALUE -lexer_i(RB_BLOCK_CALL_FUNC_ARGLIST(block_args, data)) -{ - struct cparse_params *v = rb_check_typeddata(data, &cparse_params_type); - VALUE tok, val; - - if (v->fin) - rb_raise(rb_eArgError, "extra token after EndOfToken"); - extract_user_token(v, block_args, &tok, &val); - parse_main(v, tok, val, 1); - if (v->fin && v->fin != CP_FIN_ACCEPT) - rb_iter_break(); - return Qnil; -} - -static VALUE -assert_array(VALUE a) -{ - Check_Type(a, T_ARRAY); - return a; -} - -static VALUE -assert_hash(VALUE h) -{ - Check_Type(h, T_HASH); - return h; -} - -static long -assert_integer(VALUE n) -{ - return NUM2LONG(n); -} - -static VALUE -initialize_params(VALUE vparams, VALUE parser, VALUE arg, VALUE lexer, VALUE lexmid) -{ - struct cparse_params *v = rb_check_typeddata(vparams, &cparse_params_type); - - v->value_v = vparams; - v->parser = parser; - v->lexer = lexer; - if (! NIL_P(lexmid)) - v->lexmid = value_to_id(lexmid); - - v->debug = RTEST(rb_ivar_get(parser, id_yydebug)); - - 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 (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(rb_ary_entry(arg, 13)); - } - else { - v->use_result_var = TRUE; - } - - v->tstack = v->debug ? NEW_STACK() : Qnil; - v->vstack = NEW_STACK(); - v->state = NEW_STACK(); - v->curstate = 0; - PUSH(v->state, INT2FIX(0)); - v->t = INT2FIX(FINAL_TOKEN + 1); /* must not init to FINAL_TOKEN */ - v->nerr = 0; - v->errstatus = 0; - rb_ivar_set(parser, id_errstatus, LONG2NUM(v->errstatus)); - - v->retval = Qnil; - v->fin = 0; - - v->lex_is_iterator = FALSE; - - rb_iv_set(parser, "@vstack", v->vstack); - if (v->debug) { - rb_iv_set(parser, "@tstack", v->tstack); - } - else { - rb_iv_set(parser, "@tstack", Qnil); - } - - return vparams; -} - -static void -cparse_params_mark(void *ptr) -{ - struct cparse_params *v = (struct cparse_params*)ptr; - - rb_gc_mark(v->value_v); - rb_gc_mark(v->parser); - rb_gc_mark(v->lexer); - rb_gc_mark(v->action_table); - rb_gc_mark(v->action_check); - rb_gc_mark(v->action_default); - rb_gc_mark(v->action_pointer); - rb_gc_mark(v->goto_table); - rb_gc_mark(v->goto_check); - rb_gc_mark(v->goto_default); - rb_gc_mark(v->goto_pointer); - rb_gc_mark(v->reduce_table); - rb_gc_mark(v->token_table); - rb_gc_mark(v->state); - rb_gc_mark(v->vstack); - rb_gc_mark(v->tstack); - rb_gc_mark(v->t); - rb_gc_mark(v->retval); -} - -static size_t -cparse_params_memsize(const void *ptr) -{ - return sizeof(struct cparse_params); -} - -static void -extract_user_token(struct cparse_params *v, VALUE block_args, - VALUE *tok, VALUE *val) -{ - if (NIL_P(block_args)) { - /* EOF */ - *tok = Qfalse; - *val = rb_str_new("$", 1); - return; - } - - if (!RB_TYPE_P(block_args, T_ARRAY)) { - rb_raise(rb_eTypeError, - "%s() %s %"PRIsVALUE" (must be Array[2])", - v->lex_is_iterator ? rb_id2name(v->lexmid) : "next_token", - v->lex_is_iterator ? "yielded" : "returned", - rb_obj_class(block_args)); - } - if (RARRAY_LEN(block_args) != 2) { - rb_raise(rb_eArgError, - "%s() %s wrong size of array (%ld for 2)", - v->lex_is_iterator ? rb_id2name(v->lexmid) : "next_token", - v->lex_is_iterator ? "yielded" : "returned", - RARRAY_LEN(block_args)); - } - *tok = AREF(block_args, 0); - *val = AREF(block_args, 1); -} - -#define SHIFT(v,act,tok,val) shift(v,act,tok,val) -#define REDUCE(v,act) do {\ - switch (reduce(v,act)) { \ - case 0: /* normal */ \ - break; \ - case 1: /* yyerror */ \ - goto user_yyerror; \ - case 2: /* yyaccept */ \ - D_puts("u accept"); \ - goto accept; \ - default: \ - break; \ - } \ -} while (0) - -static void -parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume) -{ - long i; /* table index */ - long act; /* action type */ - VALUE act_value; /* action type, VALUE version */ - int read_next = 1; /* true if we need to read next token */ - VALUE tmp; - - if (resume) - goto resume; - - while (1) { - D_puts(""); - D_puts("---- enter new loop ----"); - D_puts(""); - - D_printf("(act) k1=%ld\n", v->curstate); - tmp = AREF(v->action_pointer, v->curstate); - if (NIL_P(tmp)) goto notfound; - D_puts("(act) pointer[k1] ok"); - i = NUM2LONG(tmp); - - D_printf("read_next=%d\n", read_next); - if (read_next && (v->t != vFINAL_TOKEN)) { - if (v->lex_is_iterator) { - D_puts("resuming..."); - if (v->fin) rb_raise(rb_eArgError, "token given after EOF"); - v->i = i; /* save i */ - return; - resume: - D_puts("resumed"); - i = v->i; /* load i */ - } - else { - D_puts("next_token"); - tmp = rb_funcall(v->parser, id_nexttoken, 0); - extract_user_token(v, tmp, &tok, &val); - } - /* convert token */ - v->t = rb_hash_aref(v->token_table, tok); - if (NIL_P(v->t)) { - v->t = vERROR_TOKEN; - } - D_printf("(act) t(k2)=%ld\n", NUM2LONG(v->t)); - if (v->debug) { - rb_funcall(v->parser, id_d_read_token, - 3, v->t, tok, val); - } - } - read_next = 0; - - i += NUM2LONG(v->t); - D_printf("(act) i=%ld\n", i); - if (i < 0) goto notfound; - - act_value = AREF(v->action_table, i); - if (NIL_P(act_value)) goto notfound; - act = NUM2LONG(act_value); - D_printf("(act) table[i]=%ld\n", act); - - tmp = AREF(v->action_check, i); - if (NIL_P(tmp)) goto notfound; - if (NUM2LONG(tmp) != v->curstate) goto notfound; - D_printf("(act) check[i]=%ld\n", NUM2LONG(tmp)); - - D_puts("(act) found"); - act_fixed: - D_printf("act=%ld\n", act); - goto handle_act; - - notfound: - D_puts("(act) not found: use default"); - act_value = AREF(v->action_default, v->curstate); - act = NUM2LONG(act_value); - goto act_fixed; - - - handle_act: - if (act > 0 && act < v->shift_n) { - D_puts("shift"); - if (v->errstatus > 0) { - v->errstatus--; - rb_ivar_set(v->parser, id_errstatus, LONG2NUM(v->errstatus)); - } - SHIFT(v, act, v->t, val); - read_next = 1; - } - else if (act < 0 && act > -(v->reduce_n)) { - D_puts("reduce"); - REDUCE(v, act); - } - else if (act == -(v->reduce_n)) { - goto error; - error_recovered: - ; /* goto label requires stmt */ - } - else if (act == v->shift_n) { - D_puts("accept"); - goto accept; - } - else { - rb_raise(RaccBug, "[Racc Bug] unknown act value %ld", act); - } - - if (v->debug) { - rb_funcall(v->parser, id_d_next_state, - 2, LONG2NUM(v->curstate), v->state); - } - } - /* not reach */ - - - accept: - if (v->debug) rb_funcall(v->parser, id_d_accept, 0); - v->retval = rb_ary_entry(v->vstack, 0); - v->fin = CP_FIN_ACCEPT; - return; - - - error: - D_printf("error detected, status=%ld\n", v->errstatus); - if (v->errstatus == 0) { - v->nerr++; - rb_funcall(v->parser, id_onerror, - 3, v->t, val, v->vstack); - } - user_yyerror: - if (v->errstatus == 3) { - if (v->t == vFINAL_TOKEN) { - v->retval = Qnil; - v->fin = CP_FIN_EOT; - return; - } - read_next = 1; - } - v->errstatus = 3; - rb_ivar_set(v->parser, id_errstatus, LONG2NUM(v->errstatus)); - - /* check if we can shift/reduce error token */ - D_printf("(err) k1=%ld\n", v->curstate); - D_printf("(err) k2=%d (error)\n", ERROR_TOKEN); - while (1) { - tmp = AREF(v->action_pointer, v->curstate); - if (NIL_P(tmp)) goto error_pop; - D_puts("(err) pointer[k1] ok"); - - i = NUM2LONG(tmp) + ERROR_TOKEN; - D_printf("(err) i=%ld\n", i); - if (i < 0) goto error_pop; - - act_value = AREF(v->action_table, i); - if (NIL_P(act_value)) { - D_puts("(err) table[i] == nil"); - goto error_pop; - } - act = NUM2LONG(act_value); - D_printf("(err) table[i]=%ld\n", act); - - tmp = AREF(v->action_check, i); - if (NIL_P(tmp)) { - D_puts("(err) check[i] == nil"); - goto error_pop; - } - if (NUM2LONG(tmp) != v->curstate) { - D_puts("(err) check[i] != k1"); - goto error_pop; - } - - D_puts("(err) found: can handle error token"); - break; - - error_pop: - D_puts("(err) act not found: can't handle error token; pop"); - - if (RARRAY_LEN(v->state) <= 1) { - v->retval = Qnil; - v->fin = CP_FIN_CANTPOP; - return; - } - POP(v->state); - POP(v->vstack); - v->curstate = num_to_long(LAST_I(v->state)); - if (v->debug) { - POP(v->tstack); - rb_funcall(v->parser, id_d_e_pop, - 3, v->state, v->tstack, v->vstack); - } - } - - /* shift/reduce error token */ - if (act > 0 && act < v->shift_n) { - D_puts("e shift"); - SHIFT(v, act, ERROR_TOKEN, val); - } - else if (act < 0 && act > -(v->reduce_n)) { - D_puts("e reduce"); - REDUCE(v, act); - } - else if (act == v->shift_n) { - D_puts("e accept"); - goto accept; - } - else { - rb_raise(RaccBug, "[Racc Bug] unknown act value %ld", act); - } - goto error_recovered; -} - -static void -shift(struct cparse_params *v, long act, VALUE tok, VALUE val) -{ - PUSH(v->vstack, val); - if (v->debug) { - PUSH(v->tstack, tok); - rb_funcall(v->parser, id_d_shift, - 3, tok, v->tstack, v->vstack); - } - v->curstate = act; - PUSH(v->state, LONG2NUM(v->curstate)); -} - -static int -reduce(struct cparse_params *v, long act) -{ - VALUE code; - v->ruleno = -act * 3; - code = rb_catch("racc_jump", reduce0, v->value_v); - v->errstatus = num_to_long(rb_ivar_get(v->parser, id_errstatus)); - return NUM2INT(code); -} - -static VALUE -reduce0(RB_BLOCK_CALL_FUNC_ARGLIST(_, data)) -{ - struct cparse_params *v = rb_check_typeddata(data, &cparse_params_type); - VALUE reduce_to, reduce_len, method_id; - long len; - ID mid; - VALUE tmp, tmp_t = Qundef, tmp_v = Qundef; - long i, k1, k2; - VALUE goto_state; - - 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); - - /* call action */ - if (len == 0) { - tmp = Qnil; - if (mid != id_noreduce) - tmp_v = rb_ary_new(); - if (v->debug) - tmp_t = rb_ary_new(); - } - else { - if (mid != id_noreduce) { - tmp_v = GET_TAIL(v->vstack, len); - tmp = rb_ary_entry(tmp_v, 0); - } - else { - tmp = rb_ary_entry(v->vstack, RARRAY_LEN(v->vstack) - len); - } - CUT_TAIL(v->vstack, len); - if (v->debug) { - tmp_t = GET_TAIL(v->tstack, len); - CUT_TAIL(v->tstack, len); - } - CUT_TAIL(v->state, len); - } - if (mid != id_noreduce) { - if (v->use_result_var) { - tmp = rb_funcall(v->parser, mid, - 3, tmp_v, v->vstack, tmp); - } - else { - tmp = rb_funcall(v->parser, mid, - 2, tmp_v, v->vstack); - } - } - - /* then push result */ - PUSH(v->vstack, tmp); - if (v->debug) { - PUSH(v->tstack, reduce_to); - rb_funcall(v->parser, id_d_reduce, - 4, tmp_t, reduce_to, v->tstack, v->vstack); - } - - /* calculate transition state */ - if (RARRAY_LEN(v->state) == 0) - rb_raise(RaccBug, "state stack unexpectedly empty"); - k2 = num_to_long(LAST_I(v->state)); - k1 = num_to_long(reduce_to) - v->nt_base; - D_printf("(goto) k1=%ld\n", k1); - D_printf("(goto) k2=%ld\n", k2); - - tmp = AREF(v->goto_pointer, k1); - if (NIL_P(tmp)) goto notfound; - - i = NUM2LONG(tmp) + k2; - D_printf("(goto) i=%ld\n", i); - if (i < 0) goto notfound; - - goto_state = AREF(v->goto_table, i); - if (NIL_P(goto_state)) { - D_puts("(goto) table[i] == nil"); - goto notfound; - } - D_printf("(goto) table[i]=%ld (goto_state)\n", NUM2LONG(goto_state)); - - tmp = AREF(v->goto_check, i); - if (NIL_P(tmp)) { - D_puts("(goto) check[i] == nil"); - goto notfound; - } - if (tmp != LONG2NUM(k1)) { - D_puts("(goto) check[i] != table[i]"); - goto notfound; - } - D_printf("(goto) check[i]=%ld\n", NUM2LONG(tmp)); - - D_puts("(goto) found"); - transit: - PUSH(v->state, goto_state); - v->curstate = NUM2LONG(goto_state); - return INT2FIX(0); - - notfound: - D_puts("(goto) not found: use default"); - /* overwrite `goto-state' by default value */ - goto_state = AREF(v->goto_default, k1); - goto transit; -} - -/* ----------------------------------------------------------------------- - Ruby Interface ------------------------------------------------------------------------ */ - -void -Init_cparse(void) -{ -#ifdef HAVE_RB_EXT_RACTOR_SAFE - rb_ext_ractor_safe(true); -#endif - - VALUE Racc, Parser; - ID id_racc = rb_intern_const("Racc"); - - if (rb_const_defined(rb_cObject, id_racc)) { - Racc = rb_const_get(rb_cObject, id_racc); - Parser = rb_const_get_at(Racc, rb_intern_const("Parser")); - } - else { - Racc = rb_define_module("Racc"); - Parser = rb_define_class_under(Racc, "Parser", rb_cObject); - } - rb_define_private_method(Parser, "_racc_do_parse_c", racc_cparse, 2); - rb_define_private_method(Parser, "_racc_yyparse_c", racc_yyparse, 4); - rb_define_const(Parser, "Racc_Runtime_Core_Version_C", - rb_str_new2(RACC_VERSION)); - rb_define_const(Parser, "Racc_Runtime_Core_Id_C", - rb_str_new2("$originalId: cparse.c,v 1.8 2006/07/06 11:39:46 aamine Exp $")); - - CparseParams = rb_define_class_under(Racc, "CparseParams", rb_cObject); - rb_undef_alloc_func(CparseParams); - rb_undef_method(CparseParams, "initialize"); - rb_undef_method(CparseParams, "initialize_copy"); - - RaccBug = rb_eRuntimeError; - - id_yydebug = rb_intern_const("@yydebug"); - id_nexttoken = rb_intern_const("next_token"); - id_onerror = rb_intern_const("on_error"); - id_noreduce = rb_intern_const("_reduce_none"); - id_errstatus = rb_intern_const("@racc_error_status"); - - id_d_shift = rb_intern_const("racc_shift"); - id_d_reduce = rb_intern_const("racc_reduce"); - id_d_accept = rb_intern_const("racc_accept"); - id_d_read_token = rb_intern_const("racc_read_token"); - id_d_next_state = rb_intern_const("racc_next_state"); - id_d_e_pop = rb_intern_const("racc_e_pop"); -} diff --git a/ext/racc/cparse/depend b/ext/racc/cparse/depend deleted file mode 100644 index 9dc509dc7c..0000000000 --- a/ext/racc/cparse/depend +++ /dev/null @@ -1,162 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -cparse.o: $(RUBY_EXTCONF_H) -cparse.o: $(arch_hdrdir)/ruby/config.h -cparse.o: $(hdrdir)/ruby.h -cparse.o: $(hdrdir)/ruby/assert.h -cparse.o: $(hdrdir)/ruby/backward.h -cparse.o: $(hdrdir)/ruby/backward/2/assume.h -cparse.o: $(hdrdir)/ruby/backward/2/attributes.h -cparse.o: $(hdrdir)/ruby/backward/2/bool.h -cparse.o: $(hdrdir)/ruby/backward/2/inttypes.h -cparse.o: $(hdrdir)/ruby/backward/2/limits.h -cparse.o: $(hdrdir)/ruby/backward/2/long_long.h -cparse.o: $(hdrdir)/ruby/backward/2/stdalign.h -cparse.o: $(hdrdir)/ruby/backward/2/stdarg.h -cparse.o: $(hdrdir)/ruby/defines.h -cparse.o: $(hdrdir)/ruby/intern.h -cparse.o: $(hdrdir)/ruby/internal/abi.h -cparse.o: $(hdrdir)/ruby/internal/anyargs.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/char.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/double.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/int.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/long.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/short.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h -cparse.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h -cparse.o: $(hdrdir)/ruby/internal/assume.h -cparse.o: $(hdrdir)/ruby/internal/attr/alloc_size.h -cparse.o: $(hdrdir)/ruby/internal/attr/artificial.h -cparse.o: $(hdrdir)/ruby/internal/attr/cold.h -cparse.o: $(hdrdir)/ruby/internal/attr/const.h -cparse.o: $(hdrdir)/ruby/internal/attr/constexpr.h -cparse.o: $(hdrdir)/ruby/internal/attr/deprecated.h -cparse.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h -cparse.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h -cparse.o: $(hdrdir)/ruby/internal/attr/error.h -cparse.o: $(hdrdir)/ruby/internal/attr/flag_enum.h -cparse.o: $(hdrdir)/ruby/internal/attr/forceinline.h -cparse.o: $(hdrdir)/ruby/internal/attr/format.h -cparse.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h -cparse.o: $(hdrdir)/ruby/internal/attr/noalias.h -cparse.o: $(hdrdir)/ruby/internal/attr/nodiscard.h -cparse.o: $(hdrdir)/ruby/internal/attr/noexcept.h -cparse.o: $(hdrdir)/ruby/internal/attr/noinline.h -cparse.o: $(hdrdir)/ruby/internal/attr/nonnull.h -cparse.o: $(hdrdir)/ruby/internal/attr/noreturn.h -cparse.o: $(hdrdir)/ruby/internal/attr/pure.h -cparse.o: $(hdrdir)/ruby/internal/attr/restrict.h -cparse.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h -cparse.o: $(hdrdir)/ruby/internal/attr/warning.h -cparse.o: $(hdrdir)/ruby/internal/attr/weakref.h -cparse.o: $(hdrdir)/ruby/internal/cast.h -cparse.o: $(hdrdir)/ruby/internal/compiler_is.h -cparse.o: $(hdrdir)/ruby/internal/compiler_is/apple.h -cparse.o: $(hdrdir)/ruby/internal/compiler_is/clang.h -cparse.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h -cparse.o: $(hdrdir)/ruby/internal/compiler_is/intel.h -cparse.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h -cparse.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h -cparse.o: $(hdrdir)/ruby/internal/compiler_since.h -cparse.o: $(hdrdir)/ruby/internal/config.h -cparse.o: $(hdrdir)/ruby/internal/constant_p.h -cparse.o: $(hdrdir)/ruby/internal/core.h -cparse.o: $(hdrdir)/ruby/internal/core/rarray.h -cparse.o: $(hdrdir)/ruby/internal/core/rbasic.h -cparse.o: $(hdrdir)/ruby/internal/core/rbignum.h -cparse.o: $(hdrdir)/ruby/internal/core/rclass.h -cparse.o: $(hdrdir)/ruby/internal/core/rdata.h -cparse.o: $(hdrdir)/ruby/internal/core/rfile.h -cparse.o: $(hdrdir)/ruby/internal/core/rhash.h -cparse.o: $(hdrdir)/ruby/internal/core/robject.h -cparse.o: $(hdrdir)/ruby/internal/core/rregexp.h -cparse.o: $(hdrdir)/ruby/internal/core/rstring.h -cparse.o: $(hdrdir)/ruby/internal/core/rstruct.h -cparse.o: $(hdrdir)/ruby/internal/core/rtypeddata.h -cparse.o: $(hdrdir)/ruby/internal/ctype.h -cparse.o: $(hdrdir)/ruby/internal/dllexport.h -cparse.o: $(hdrdir)/ruby/internal/dosish.h -cparse.o: $(hdrdir)/ruby/internal/error.h -cparse.o: $(hdrdir)/ruby/internal/eval.h -cparse.o: $(hdrdir)/ruby/internal/event.h -cparse.o: $(hdrdir)/ruby/internal/fl_type.h -cparse.o: $(hdrdir)/ruby/internal/gc.h -cparse.o: $(hdrdir)/ruby/internal/glob.h -cparse.o: $(hdrdir)/ruby/internal/globals.h -cparse.o: $(hdrdir)/ruby/internal/has/attribute.h -cparse.o: $(hdrdir)/ruby/internal/has/builtin.h -cparse.o: $(hdrdir)/ruby/internal/has/c_attribute.h -cparse.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h -cparse.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h -cparse.o: $(hdrdir)/ruby/internal/has/extension.h -cparse.o: $(hdrdir)/ruby/internal/has/feature.h -cparse.o: $(hdrdir)/ruby/internal/has/warning.h -cparse.o: $(hdrdir)/ruby/internal/intern/array.h -cparse.o: $(hdrdir)/ruby/internal/intern/bignum.h -cparse.o: $(hdrdir)/ruby/internal/intern/class.h -cparse.o: $(hdrdir)/ruby/internal/intern/compar.h -cparse.o: $(hdrdir)/ruby/internal/intern/complex.h -cparse.o: $(hdrdir)/ruby/internal/intern/cont.h -cparse.o: $(hdrdir)/ruby/internal/intern/dir.h -cparse.o: $(hdrdir)/ruby/internal/intern/enum.h -cparse.o: $(hdrdir)/ruby/internal/intern/enumerator.h -cparse.o: $(hdrdir)/ruby/internal/intern/error.h -cparse.o: $(hdrdir)/ruby/internal/intern/eval.h -cparse.o: $(hdrdir)/ruby/internal/intern/file.h -cparse.o: $(hdrdir)/ruby/internal/intern/gc.h -cparse.o: $(hdrdir)/ruby/internal/intern/hash.h -cparse.o: $(hdrdir)/ruby/internal/intern/io.h -cparse.o: $(hdrdir)/ruby/internal/intern/load.h -cparse.o: $(hdrdir)/ruby/internal/intern/marshal.h -cparse.o: $(hdrdir)/ruby/internal/intern/numeric.h -cparse.o: $(hdrdir)/ruby/internal/intern/object.h -cparse.o: $(hdrdir)/ruby/internal/intern/parse.h -cparse.o: $(hdrdir)/ruby/internal/intern/proc.h -cparse.o: $(hdrdir)/ruby/internal/intern/process.h -cparse.o: $(hdrdir)/ruby/internal/intern/random.h -cparse.o: $(hdrdir)/ruby/internal/intern/range.h -cparse.o: $(hdrdir)/ruby/internal/intern/rational.h -cparse.o: $(hdrdir)/ruby/internal/intern/re.h -cparse.o: $(hdrdir)/ruby/internal/intern/ruby.h -cparse.o: $(hdrdir)/ruby/internal/intern/select.h -cparse.o: $(hdrdir)/ruby/internal/intern/select/largesize.h -cparse.o: $(hdrdir)/ruby/internal/intern/signal.h -cparse.o: $(hdrdir)/ruby/internal/intern/sprintf.h -cparse.o: $(hdrdir)/ruby/internal/intern/string.h -cparse.o: $(hdrdir)/ruby/internal/intern/struct.h -cparse.o: $(hdrdir)/ruby/internal/intern/thread.h -cparse.o: $(hdrdir)/ruby/internal/intern/time.h -cparse.o: $(hdrdir)/ruby/internal/intern/variable.h -cparse.o: $(hdrdir)/ruby/internal/intern/vm.h -cparse.o: $(hdrdir)/ruby/internal/interpreter.h -cparse.o: $(hdrdir)/ruby/internal/iterator.h -cparse.o: $(hdrdir)/ruby/internal/memory.h -cparse.o: $(hdrdir)/ruby/internal/method.h -cparse.o: $(hdrdir)/ruby/internal/module.h -cparse.o: $(hdrdir)/ruby/internal/newobj.h -cparse.o: $(hdrdir)/ruby/internal/rgengc.h -cparse.o: $(hdrdir)/ruby/internal/scan_args.h -cparse.o: $(hdrdir)/ruby/internal/special_consts.h -cparse.o: $(hdrdir)/ruby/internal/static_assert.h -cparse.o: $(hdrdir)/ruby/internal/stdalign.h -cparse.o: $(hdrdir)/ruby/internal/stdbool.h -cparse.o: $(hdrdir)/ruby/internal/symbol.h -cparse.o: $(hdrdir)/ruby/internal/value.h -cparse.o: $(hdrdir)/ruby/internal/value_type.h -cparse.o: $(hdrdir)/ruby/internal/variable.h -cparse.o: $(hdrdir)/ruby/internal/warning_push.h -cparse.o: $(hdrdir)/ruby/internal/xmalloc.h -cparse.o: $(hdrdir)/ruby/missing.h -cparse.o: $(hdrdir)/ruby/ruby.h -cparse.o: $(hdrdir)/ruby/st.h -cparse.o: $(hdrdir)/ruby/subst.h -cparse.o: cparse.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ext/racc/cparse/extconf.rb b/ext/racc/cparse/extconf.rb deleted file mode 100644 index 18c5689ad8..0000000000 --- a/ext/racc/cparse/extconf.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: false -# - -require 'mkmf' - -have_func('rb_block_call') -have_func('rb_ary_subseq') - -create_makefile 'racc/cparse' diff --git a/ext/rbconfig/sizeof/depend b/ext/rbconfig/sizeof/depend index 5b65b83772..5f75fa8c76 100644 --- a/ext/rbconfig/sizeof/depend +++ b/ext/rbconfig/sizeof/depend @@ -66,6 +66,7 @@ limits.o: $(hdrdir)/ruby/internal/attr/noexcept.h limits.o: $(hdrdir)/ruby/internal/attr/noinline.h limits.o: $(hdrdir)/ruby/internal/attr/nonnull.h limits.o: $(hdrdir)/ruby/internal/attr/noreturn.h +limits.o: $(hdrdir)/ruby/internal/attr/packed_struct.h limits.o: $(hdrdir)/ruby/internal/attr/pure.h limits.o: $(hdrdir)/ruby/internal/attr/restrict.h limits.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -125,7 +126,6 @@ limits.o: $(hdrdir)/ruby/internal/intern/enumerator.h limits.o: $(hdrdir)/ruby/internal/intern/error.h limits.o: $(hdrdir)/ruby/internal/intern/eval.h limits.o: $(hdrdir)/ruby/internal/intern/file.h -limits.o: $(hdrdir)/ruby/internal/intern/gc.h limits.o: $(hdrdir)/ruby/internal/intern/hash.h limits.o: $(hdrdir)/ruby/internal/intern/io.h limits.o: $(hdrdir)/ruby/internal/intern/load.h @@ -156,12 +156,12 @@ limits.o: $(hdrdir)/ruby/internal/memory.h limits.o: $(hdrdir)/ruby/internal/method.h limits.o: $(hdrdir)/ruby/internal/module.h limits.o: $(hdrdir)/ruby/internal/newobj.h -limits.o: $(hdrdir)/ruby/internal/rgengc.h limits.o: $(hdrdir)/ruby/internal/scan_args.h limits.o: $(hdrdir)/ruby/internal/special_consts.h limits.o: $(hdrdir)/ruby/internal/static_assert.h limits.o: $(hdrdir)/ruby/internal/stdalign.h limits.o: $(hdrdir)/ruby/internal/stdbool.h +limits.o: $(hdrdir)/ruby/internal/stdckdint.h limits.o: $(hdrdir)/ruby/internal/symbol.h limits.o: $(hdrdir)/ruby/internal/value.h limits.o: $(hdrdir)/ruby/internal/value_type.h @@ -225,6 +225,7 @@ sizes.o: $(hdrdir)/ruby/internal/attr/noexcept.h sizes.o: $(hdrdir)/ruby/internal/attr/noinline.h sizes.o: $(hdrdir)/ruby/internal/attr/nonnull.h sizes.o: $(hdrdir)/ruby/internal/attr/noreturn.h +sizes.o: $(hdrdir)/ruby/internal/attr/packed_struct.h sizes.o: $(hdrdir)/ruby/internal/attr/pure.h sizes.o: $(hdrdir)/ruby/internal/attr/restrict.h sizes.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -284,7 +285,6 @@ sizes.o: $(hdrdir)/ruby/internal/intern/enumerator.h sizes.o: $(hdrdir)/ruby/internal/intern/error.h sizes.o: $(hdrdir)/ruby/internal/intern/eval.h sizes.o: $(hdrdir)/ruby/internal/intern/file.h -sizes.o: $(hdrdir)/ruby/internal/intern/gc.h sizes.o: $(hdrdir)/ruby/internal/intern/hash.h sizes.o: $(hdrdir)/ruby/internal/intern/io.h sizes.o: $(hdrdir)/ruby/internal/intern/load.h @@ -315,12 +315,12 @@ sizes.o: $(hdrdir)/ruby/internal/memory.h sizes.o: $(hdrdir)/ruby/internal/method.h sizes.o: $(hdrdir)/ruby/internal/module.h sizes.o: $(hdrdir)/ruby/internal/newobj.h -sizes.o: $(hdrdir)/ruby/internal/rgengc.h sizes.o: $(hdrdir)/ruby/internal/scan_args.h sizes.o: $(hdrdir)/ruby/internal/special_consts.h sizes.o: $(hdrdir)/ruby/internal/static_assert.h sizes.o: $(hdrdir)/ruby/internal/stdalign.h sizes.o: $(hdrdir)/ruby/internal/stdbool.h +sizes.o: $(hdrdir)/ruby/internal/stdckdint.h sizes.o: $(hdrdir)/ruby/internal/symbol.h sizes.o: $(hdrdir)/ruby/internal/value.h sizes.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/readline/.gitignore b/ext/readline/.gitignore deleted file mode 100644 index 3d372989ae..0000000000 --- a/ext/readline/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/readline-[1-9]*.* diff --git a/ext/readline/README b/ext/readline/README deleted file mode 100644 index 57c51b5f5d..0000000000 --- a/ext/readline/README +++ /dev/null @@ -1,10 +0,0 @@ -The Readline module provides interface for GNU Readline. -This module defines a number of methods to facilitate completion -and accesses input history from the Ruby interpreter. -This module supported Edit Line(libedit) too. -libedit is compatible with GNU Readline. - -GNU Readline:: http://www.gnu.org/directory/readline.html -libedit:: http://www.thrysoee.dk/editline/ - -See RDoc for Readline module. diff --git a/ext/readline/README.ja b/ext/readline/README.ja deleted file mode 100644 index 57a6ee4126..0000000000 --- a/ext/readline/README.ja +++ /dev/null @@ -1,386 +0,0 @@ -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 のようなキー操作などができます。 - - require "readline" - while buf = Readline.readline("> ", true) - p buf - end - -ユーザが入力した内容を履歴(以下、ヒストリ)として記録することができます。 -定数 Readline::HISTORY を使用してヒストリにアクセスできます。 - - require "readline" - while buf = Readline.readline("> ", true) - p Readline::HISTORY.to_a - print("-> ", buf, "\n") - end - -使用するライブラリにより、いくつかのメソッドで例外 NotImplementedError -が発生します。 - -== Readline モジュール - -=== モジュール関数 - -readline([prompt, [add_hist]]) -> String | nil - - prompt を出力し、ユーザからのキー入力を待ちます。 - エンターキーの押下などでユーザが文字列を入力し終えると、 - 入力した文字列を返します。 - このとき、add_hist が true であれば、入力した文字列をヒストリに追加します。 - - 何も入力していない状態で EOF(UNIX では ^D) を入力するなどで、 - ユーザからの入力がない場合は nil を返します。 - - 次の条件を全て満たす場合、例外 IOError が発生します。 - 1. 標準入力が tty でない。 - 2. 標準入力をクローズしている。(isatty(2) の errno が EBADF である。) - - 本メソッドはスレッドに対応しています。 - 入力待ち状態のときはスレッドコンテキストの切替えが発生します。 - - 入力時には行内編集が可能で、vi モードと Emacs モードが用意されています。 - デフォルトは Emacs モードです。 - - 本メソッドには注意事項があります。 - 入力待ちの状態で ^C すると ruby インタプリタが終了し、端末状態を復帰しません。 - これを回避するための例を3つ挙げます。 - - * ^CによるInterrupt例外を補足して、端末状態を復帰します: - - require "readline" - - stty_save = `stty -g`.chomp - begin - while buf = Readline.readline - p buf - end - rescue Interrupt - system("stty", stty_save) - exit - end - end - end - - * INTシグナルを補足して、端末状態を復帰します: - - require "readline" - - stty_save = `stty -g`.chomp - trap("INT") { system "stty", stty_save; exit } - - while buf = Readline.readline - p buf - end - - * 単に ^C を無視する方法もあります: - - require "readline" - - trap("INT", "SIG_IGN") - - while buf = Readline.readline - p buf - end - - 入力履歴 Readline::HISTORY を使用して、空行や直前の入力と同じ内容は入力 - 履歴に残さないということもできます。 - - require "readline" - - while buf = Readline.readline("> ", true) - # p Readline::HISTORY.to_a - Readline::HISTORY.pop if /^\s*$/ =~ buf - - begin - if Readline::HISTORY[Readline::HISTORY.length-2] == buf - Readline::HISTORY.pop - end - rescue IndexError - end - - # p Readline::HISTORY.to_a - print "-> ", buf, "\n" - end - -=== クラスメソッド - -Readline.input = input - - Readline.readline メソッドで使用する入力用の File オブジェクト input - を指定します。 - -Readline.output = output - - Readline.readline メソッドで使用する出力用の File オブジェクト - output を指定します。 - -Readline.completion_proc = proc - - ユーザからの入力を補完する時の候補を取得する Proc オブジェクト proc を - 指定します。proc は、次のものを想定しています。 - 1. call メソッドを持ちます。 - call メソッドを持たない場合、例外 ArgumentError が発生します。 - 2. 引数にユーザからの入力文字列(注1)を取ります。 - 3. 候補の文字列の配列を返します。 - - 注1:「/var/lib /v」の後で補完を行うと、 - デフォルトでは proc の引数に「/v」が渡されます。 - このように、ユーザが入力した文字列を - Readline.completer_word_break_characters に含まれる文字で区切ったも - のを単語とすると、カーソルがある単語の最初の文字から現在のカーソル位 - 置までの文字列が proc の引数に渡されます。 - -Readline.completion_proc -> proc - - ユーザからの入力を補完する時の候補を取得する Proc オブジェクト proc - を取得します。 - -Readline.completion_case_fold = bool - - ユーザの入力を補完する際、大文字と小文字を区別する/しないを指定します。 - bool が真ならば区別しません。bool が偽ならば区別します。 - -Readline.completion_case_fold -> bool - - ユーザの入力を補完する際、大文字と小文字を区別する/しないを取得します。 - bool が真ならば区別しません。bool が偽ならば区別します。 - - なお、Readline.completion_case_fold= メソッドで指定したオブジェクトを - そのまま取得するので、次のような動作をします。 - - require "readline" - - Readline.completion_case_fold = "This is a String." - p Readline.completion_case_fold # => "This is a String." - -Readline.line_buffer -> string - - 入力中の行全体を返します。complete_proc の中で使用することを想定し - ています。Readline.line_buffer の長さは GNU Readline の rl_end 変数の - 値と一致します。 - -Readline.point -> int - - 現在のカーソルの位置を返します。 - Readline モジュールは補完対象の単語の開始位置の情報を提供していません。 - しかしながら、 completion_proc の中で入力した単語 text と - Readline.point を使用することで開始位置を導くことができます。 - - 開始位置 = 入力した単語の長さ - Readline.point - -Readline.vi_editing_mode -> nil - - 編集モードを vi モードにします。 - vi モードの詳細は、GNU Readline のマニュアルを参照してください。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.vi_editing_mode? -> bool - - 編集モードが vi モードの場合、true を返します。そうでなければ false - を返します。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.emacs_editing_mode -> nil - - 編集モードを Emacs モードにします。 - デフォルトは Emacs モードです。 - Emacs モードの詳細は、GNU Readline のマニュアルを参照してください。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.emacs_editing_mode? -> bool - - 編集モードが Emacs モードの場合、true を返します。そうでなければ false - を返します。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.completion_append_character = char - - ユーザの入力の補完が完了した場合に、最後に付加する文字 char を指定し - ます。半角スペース「" "」などの単語を区切る文字を指定すれば、連続して - 入力する際に便利です。 - - 使用例: - - require "readline" - - Readline.readline("> ", true) - Readline.completion_append_character = " " - - 実行例: - - > - ここで "/var/li" を入力します。 - - > /var/li - ここで TAB キーを入力します。 - - > /var/lib - "b" が補完され、最後に " " が追加されるので、"/usr" を連続して入力できます。 - - > /var/lib /usr - - なお、1文字しか指定することはできません。 - 例えば、"string"を指定した場合は最初の文字である"s"だけを使用します。 - - require "readline" - - Readline.completion_append_character = "string" - p Readline.completion_append_character # => "s" - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.completion_append_character -> char - - ユーザの入力の補完が完了した場合に、最後に付加する文字を取得します。 - デフォルトは空白 (" ") です。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.basic_word_break_characters = string - - ユーザの入力の補完を行う際、単語の区切りを示す複数の文字で構成される - 文字列 string を指定します。 - - GNU Readline のデフォルトの値は、Bash の補完処理で使用している文字列 - " \t\n\"\\'`@$><=;|&{(" (スペースを含む) になっています。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.basic_word_break_characters -> string - - ユーザの入力の補完を行う際、単語の区切りを示す複数の文字で構成される - 文字列を取得します。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.completer_word_break_characters = string - - ユーザの入力の補完を行う際、単語の区切りを示す複数の文字で構成される - 文字列 string を指定します。 - Readline.basic_word_break_characters= との違いは、 - GNU Readline の rl_complete_internal 関数で使用されることです。 - - GNU Readline のデフォルトの値は、 - Readline.basic_word_break_characters と同じです。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.completer_word_break_characters -> string - - ユーザの入力の補完を行う際、単語の区切りを示す複数の文字で構成された - 文字列を取得します。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.basic_quote_characters = string - - スペースなどの単語の区切りをクオートするための複数の文字で構成される - 文字列 string を指定します。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.basic_quote_characters -> string - - スペースなどの単語の区切りをクオートするための複数の文字で構成される - 文字列を取得します。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.completer_quote_characters = string - - ユーザの入力の補完を行う際、スペースなどの単語の区切りを - クオートするための複数の文字で構成される文字列 string を指定します。 - 指定した文字の間では、Readline.completer_word_break_characters= - で指定した文字列に含まれる文字も、普通の文字列として扱われます。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.completer_quote_characters -> string - - ユーザの入力の補完を行う際、スペースなどの単語の区切りを - クオートするための複数の文字で構成される文字列を取得します。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.filename_quote_characters = string - - ユーザの入力時にファイル名の補完を行う際、スペースなどの単語の区切りを - クオートするための複数の文字で構成される文字列 string を指定します。 - - GNU Readline のデフォルト値は nil です。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -Readline.filename_quote_characters -> string - - ユーザの入力時にファイル名の補完を行う際、スペースなどの単語の区切りを - クオートするための複数の文字で構成される文字列を取得します。 - - サポートしていない環境では、例外 NotImplementedError が発生します。 - -=== クラス定数 - -HISTORY - - 定数 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 - * HISTORY.push(string[, string, ...]) -> self - * HISTORY << string -> self - * HISTORY.pop -> string - * HISTORY.shift -> string - * HISTORY.each -> Enumerator - * HISTORY.each { |i| } -> [string] - * HISTORY.length -> Integer - * HISTORY.empty? -> true or false - * HISTORY.delete_at(index) -> string - * HISTORY.clear -> self - - サポートしていない環境では、次のメソッドで例外 NotImplementedError が - 発生します。 - * HISTORY[index] = string - * HISTORY.pop -> string - * HISTORY.shift -> string - * HISTORY.delete_at(index) -> string - * HISTORY.clear -> self - -FILENAME_COMPLETION_PROC - - ファイル名の補完を行う call メソッドを持つオブジェクトです。 - - Readline.completion_proc= により、ユーザの入力時にファイル名の補完を - 行うように設定するために使用することを想定してます。 - -USERNAME_COMPLETION_PROC - - ユーザ名の補完を行う call メソッドを持つオブジェクトです。 - - Readline.completion_proc= により、ユーザの入力時にユーザ名の補完を行 - うように設定するために使用することを想定してます。 - -VERSION - - 使用している GNU Readline または libedit のバージョンです。 diff --git a/ext/readline/depend b/ext/readline/depend deleted file mode 100644 index c62309622a..0000000000 --- a/ext/readline/depend +++ /dev/null @@ -1,175 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -readline.o: $(RUBY_EXTCONF_H) -readline.o: $(arch_hdrdir)/ruby/config.h -readline.o: $(hdrdir)/ruby/assert.h -readline.o: $(hdrdir)/ruby/backward.h -readline.o: $(hdrdir)/ruby/backward/2/assume.h -readline.o: $(hdrdir)/ruby/backward/2/attributes.h -readline.o: $(hdrdir)/ruby/backward/2/bool.h -readline.o: $(hdrdir)/ruby/backward/2/inttypes.h -readline.o: $(hdrdir)/ruby/backward/2/limits.h -readline.o: $(hdrdir)/ruby/backward/2/long_long.h -readline.o: $(hdrdir)/ruby/backward/2/stdalign.h -readline.o: $(hdrdir)/ruby/backward/2/stdarg.h -readline.o: $(hdrdir)/ruby/defines.h -readline.o: $(hdrdir)/ruby/encoding.h -readline.o: $(hdrdir)/ruby/intern.h -readline.o: $(hdrdir)/ruby/internal/abi.h -readline.o: $(hdrdir)/ruby/internal/anyargs.h -readline.o: $(hdrdir)/ruby/internal/arithmetic.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/char.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/double.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/int.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/long.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/short.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h -readline.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h -readline.o: $(hdrdir)/ruby/internal/assume.h -readline.o: $(hdrdir)/ruby/internal/attr/alloc_size.h -readline.o: $(hdrdir)/ruby/internal/attr/artificial.h -readline.o: $(hdrdir)/ruby/internal/attr/cold.h -readline.o: $(hdrdir)/ruby/internal/attr/const.h -readline.o: $(hdrdir)/ruby/internal/attr/constexpr.h -readline.o: $(hdrdir)/ruby/internal/attr/deprecated.h -readline.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h -readline.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h -readline.o: $(hdrdir)/ruby/internal/attr/error.h -readline.o: $(hdrdir)/ruby/internal/attr/flag_enum.h -readline.o: $(hdrdir)/ruby/internal/attr/forceinline.h -readline.o: $(hdrdir)/ruby/internal/attr/format.h -readline.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h -readline.o: $(hdrdir)/ruby/internal/attr/noalias.h -readline.o: $(hdrdir)/ruby/internal/attr/nodiscard.h -readline.o: $(hdrdir)/ruby/internal/attr/noexcept.h -readline.o: $(hdrdir)/ruby/internal/attr/noinline.h -readline.o: $(hdrdir)/ruby/internal/attr/nonnull.h -readline.o: $(hdrdir)/ruby/internal/attr/noreturn.h -readline.o: $(hdrdir)/ruby/internal/attr/pure.h -readline.o: $(hdrdir)/ruby/internal/attr/restrict.h -readline.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h -readline.o: $(hdrdir)/ruby/internal/attr/warning.h -readline.o: $(hdrdir)/ruby/internal/attr/weakref.h -readline.o: $(hdrdir)/ruby/internal/cast.h -readline.o: $(hdrdir)/ruby/internal/compiler_is.h -readline.o: $(hdrdir)/ruby/internal/compiler_is/apple.h -readline.o: $(hdrdir)/ruby/internal/compiler_is/clang.h -readline.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h -readline.o: $(hdrdir)/ruby/internal/compiler_is/intel.h -readline.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h -readline.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h -readline.o: $(hdrdir)/ruby/internal/compiler_since.h -readline.o: $(hdrdir)/ruby/internal/config.h -readline.o: $(hdrdir)/ruby/internal/constant_p.h -readline.o: $(hdrdir)/ruby/internal/core.h -readline.o: $(hdrdir)/ruby/internal/core/rarray.h -readline.o: $(hdrdir)/ruby/internal/core/rbasic.h -readline.o: $(hdrdir)/ruby/internal/core/rbignum.h -readline.o: $(hdrdir)/ruby/internal/core/rclass.h -readline.o: $(hdrdir)/ruby/internal/core/rdata.h -readline.o: $(hdrdir)/ruby/internal/core/rfile.h -readline.o: $(hdrdir)/ruby/internal/core/rhash.h -readline.o: $(hdrdir)/ruby/internal/core/robject.h -readline.o: $(hdrdir)/ruby/internal/core/rregexp.h -readline.o: $(hdrdir)/ruby/internal/core/rstring.h -readline.o: $(hdrdir)/ruby/internal/core/rstruct.h -readline.o: $(hdrdir)/ruby/internal/core/rtypeddata.h -readline.o: $(hdrdir)/ruby/internal/ctype.h -readline.o: $(hdrdir)/ruby/internal/dllexport.h -readline.o: $(hdrdir)/ruby/internal/dosish.h -readline.o: $(hdrdir)/ruby/internal/encoding/coderange.h -readline.o: $(hdrdir)/ruby/internal/encoding/ctype.h -readline.o: $(hdrdir)/ruby/internal/encoding/encoding.h -readline.o: $(hdrdir)/ruby/internal/encoding/pathname.h -readline.o: $(hdrdir)/ruby/internal/encoding/re.h -readline.o: $(hdrdir)/ruby/internal/encoding/sprintf.h -readline.o: $(hdrdir)/ruby/internal/encoding/string.h -readline.o: $(hdrdir)/ruby/internal/encoding/symbol.h -readline.o: $(hdrdir)/ruby/internal/encoding/transcode.h -readline.o: $(hdrdir)/ruby/internal/error.h -readline.o: $(hdrdir)/ruby/internal/eval.h -readline.o: $(hdrdir)/ruby/internal/event.h -readline.o: $(hdrdir)/ruby/internal/fl_type.h -readline.o: $(hdrdir)/ruby/internal/gc.h -readline.o: $(hdrdir)/ruby/internal/glob.h -readline.o: $(hdrdir)/ruby/internal/globals.h -readline.o: $(hdrdir)/ruby/internal/has/attribute.h -readline.o: $(hdrdir)/ruby/internal/has/builtin.h -readline.o: $(hdrdir)/ruby/internal/has/c_attribute.h -readline.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h -readline.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h -readline.o: $(hdrdir)/ruby/internal/has/extension.h -readline.o: $(hdrdir)/ruby/internal/has/feature.h -readline.o: $(hdrdir)/ruby/internal/has/warning.h -readline.o: $(hdrdir)/ruby/internal/intern/array.h -readline.o: $(hdrdir)/ruby/internal/intern/bignum.h -readline.o: $(hdrdir)/ruby/internal/intern/class.h -readline.o: $(hdrdir)/ruby/internal/intern/compar.h -readline.o: $(hdrdir)/ruby/internal/intern/complex.h -readline.o: $(hdrdir)/ruby/internal/intern/cont.h -readline.o: $(hdrdir)/ruby/internal/intern/dir.h -readline.o: $(hdrdir)/ruby/internal/intern/enum.h -readline.o: $(hdrdir)/ruby/internal/intern/enumerator.h -readline.o: $(hdrdir)/ruby/internal/intern/error.h -readline.o: $(hdrdir)/ruby/internal/intern/eval.h -readline.o: $(hdrdir)/ruby/internal/intern/file.h -readline.o: $(hdrdir)/ruby/internal/intern/gc.h -readline.o: $(hdrdir)/ruby/internal/intern/hash.h -readline.o: $(hdrdir)/ruby/internal/intern/io.h -readline.o: $(hdrdir)/ruby/internal/intern/load.h -readline.o: $(hdrdir)/ruby/internal/intern/marshal.h -readline.o: $(hdrdir)/ruby/internal/intern/numeric.h -readline.o: $(hdrdir)/ruby/internal/intern/object.h -readline.o: $(hdrdir)/ruby/internal/intern/parse.h -readline.o: $(hdrdir)/ruby/internal/intern/proc.h -readline.o: $(hdrdir)/ruby/internal/intern/process.h -readline.o: $(hdrdir)/ruby/internal/intern/random.h -readline.o: $(hdrdir)/ruby/internal/intern/range.h -readline.o: $(hdrdir)/ruby/internal/intern/rational.h -readline.o: $(hdrdir)/ruby/internal/intern/re.h -readline.o: $(hdrdir)/ruby/internal/intern/ruby.h -readline.o: $(hdrdir)/ruby/internal/intern/select.h -readline.o: $(hdrdir)/ruby/internal/intern/select/largesize.h -readline.o: $(hdrdir)/ruby/internal/intern/signal.h -readline.o: $(hdrdir)/ruby/internal/intern/sprintf.h -readline.o: $(hdrdir)/ruby/internal/intern/string.h -readline.o: $(hdrdir)/ruby/internal/intern/struct.h -readline.o: $(hdrdir)/ruby/internal/intern/thread.h -readline.o: $(hdrdir)/ruby/internal/intern/time.h -readline.o: $(hdrdir)/ruby/internal/intern/variable.h -readline.o: $(hdrdir)/ruby/internal/intern/vm.h -readline.o: $(hdrdir)/ruby/internal/interpreter.h -readline.o: $(hdrdir)/ruby/internal/iterator.h -readline.o: $(hdrdir)/ruby/internal/memory.h -readline.o: $(hdrdir)/ruby/internal/method.h -readline.o: $(hdrdir)/ruby/internal/module.h -readline.o: $(hdrdir)/ruby/internal/newobj.h -readline.o: $(hdrdir)/ruby/internal/rgengc.h -readline.o: $(hdrdir)/ruby/internal/scan_args.h -readline.o: $(hdrdir)/ruby/internal/special_consts.h -readline.o: $(hdrdir)/ruby/internal/static_assert.h -readline.o: $(hdrdir)/ruby/internal/stdalign.h -readline.o: $(hdrdir)/ruby/internal/stdbool.h -readline.o: $(hdrdir)/ruby/internal/symbol.h -readline.o: $(hdrdir)/ruby/internal/value.h -readline.o: $(hdrdir)/ruby/internal/value_type.h -readline.o: $(hdrdir)/ruby/internal/variable.h -readline.o: $(hdrdir)/ruby/internal/warning_push.h -readline.o: $(hdrdir)/ruby/internal/xmalloc.h -readline.o: $(hdrdir)/ruby/io.h -readline.o: $(hdrdir)/ruby/missing.h -readline.o: $(hdrdir)/ruby/onigmo.h -readline.o: $(hdrdir)/ruby/oniguruma.h -readline.o: $(hdrdir)/ruby/ruby.h -readline.o: $(hdrdir)/ruby/st.h -readline.o: $(hdrdir)/ruby/subst.h -readline.o: $(hdrdir)/ruby/thread.h -readline.o: readline.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ext/readline/depend-gem b/ext/readline/depend-gem deleted file mode 100644 index df01bd2a86..0000000000 --- a/ext/readline/depend-gem +++ /dev/null @@ -1,4 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -readline.o: $(RUBY_EXTCONF_H) -readline.o: readline.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ext/readline/extconf.rb b/ext/readline/extconf.rb deleted file mode 100644 index d3e7872e65..0000000000 --- a/ext/readline/extconf.rb +++ /dev/null @@ -1,112 +0,0 @@ -# frozen_string_literal: false -require "mkmf" - -readline = Struct.new(:headers, :extra_check).new(["stdio.h"]) - -def readline.have_header(header) - if super(header, &extra_check) - headers.push(header) - return true - else - return false - end -end - -def readline.have_var(var) - return super(var, headers) -end - -def readline.have_func(func) - return super(func, headers) -end - -def readline.have_type(type) - return super(type, headers) -end - -dir_config('curses') -dir_config('ncurses') -dir_config('termcap') -dir_config("readline") -enable_libedit = enable_config("libedit") - -have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM -have_library("ncurses", "tgetnum") || - have_library("termcap", "tgetnum") || - have_library("curses", "tgetnum") - -case enable_libedit -when true - # --enable-libedit - dir_config("libedit") - unless (readline.have_header("editline/readline.h") || - readline.have_header("readline/readline.h")) && - have_library("edit", "readline") - raise "libedit not found" - end -when false - # --disable-libedit - 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 ((readline.have_header("readline/readline.h") && - readline.have_header("readline/history.h")) && - (have_library("readline", "readline") || - have_library("edit", "readline"))) || - (readline.have_header("editline/readline.h") && - have_library("edit", "readline")) - raise "Neither readline nor libedit was found" - end -end - -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_completion_quote_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") -readline.have_var("rl_char_is_quoted_p") -# workaround for native windows. -/mswin|bccwin/ !~ RUBY_PLATFORM && readline.have_var("rl_event_hook") -/mswin|bccwin/ !~ RUBY_PLATFORM && readline.have_var("rl_catch_sigwinch") -/mswin|bccwin/ !~ 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") -unless readline.have_type("rl_hook_func_t*") - # rl_hook_func_t is available since readline-4.2 (2001). - # Function is removed at readline-6.3 (2014). - # However, editline (NetBSD 6.1.3, 2014) doesn't have rl_hook_func_t. - $defs << "-Drl_hook_func_t=Function" -end - -create_makefile("readline") diff --git a/ext/readline/readline-ext.gemspec b/ext/readline/readline-ext.gemspec deleted file mode 100644 index 0c6f70ba91..0000000000 --- a/ext/readline/readline-ext.gemspec +++ /dev/null @@ -1,22 +0,0 @@ -Gem::Specification.new do |spec| - spec.name = "readline-ext" - spec.version = "0.1.4" - spec.authors = ["Yukihiro Matsumoto"] - spec.email = ["matz@ruby-lang.org"] - - spec.summary = %q{Provides an interface for GNU Readline and Edit Line (libedit).} - spec.description = %q{Provides an interface for GNU Readline and Edit Line (libedit).} - spec.homepage = "https://github.com/ruby/readline-ext" - spec.licenses = ["Ruby", "BSD-2-Clause"] - spec.extensions = %w[ext/readline/extconf.rb] - - spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = spec.homepage - - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z 2>/dev/null`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - end - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] -end diff --git a/ext/readline/readline.c b/ext/readline/readline.c deleted file mode 100644 index fc254ce315..0000000000 --- a/ext/readline/readline.c +++ /dev/null @@ -1,2144 +0,0 @@ -/************************************************ - - readline.c - GNU Readline module - - $Author$ - created at: Wed Jan 20 13:59:32 JST 1999 - - Copyright (C) 1997-2008 Shugo Maeda - Copyright (C) 2008-2013 Kouji Takao - - $Id$ - - Contact: - - Kouji Takao <kouji dot takao at gmail dot com> (current maintainer) - -************************************************/ - -#ifdef RUBY_EXTCONF_H -#include RUBY_EXTCONF_H -#endif - -#include "ruby/config.h" -#include <errno.h> -#include <stdio.h> -#include <string.h> -#ifdef HAVE_READLINE_READLINE_H -#include <readline/readline.h> -#endif -#ifdef HAVE_READLINE_HISTORY_H -#include <readline/history.h> -#endif -#ifdef HAVE_EDITLINE_READLINE_H -#include <editline/readline.h> -#endif - -#include "ruby/io.h" -#include "ruby/thread.h" - -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifdef HAVE_SYS_STAT_H -#include <sys/stat.h> -#endif - -static VALUE mReadline; - -#define EDIT_LINE_LIBRARY_VERSION "EditLine wrapper" -#ifndef USE_INSERT_IGNORE_ESCAPE -# 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 -# endif -#endif - -#define COMPLETION_PROC "completion_proc" -#define COMPLETION_CASE_FOLD "completion_case_fold" -static ID id_call, completion_proc, completion_case_fold; -#if defined HAVE_RL_CHAR_IS_QUOTED_P -#define QUOTING_DETECTION_PROC "quoting_detection_proc" -static ID quoting_detection_proc; -#endif -#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 -#endif -#ifndef HAVE_RL_USERNAME_COMPLETION_FUNCTION -# define rl_username_completion_function username_completion_function -#else -RUBY_EXTERN char *rl_username_completion_function(const char *, int); -#endif -#ifndef HAVE_RL_COMPLETION_MATCHES -# define rl_completion_matches completion_matches -#endif - -static int (*history_get_offset_func)(int); -static int (*history_replace_offset_func)(int); -#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER -static int readline_completion_append_character; -#endif - -static char **readline_attempted_completion_function(const char *text, - int start, int end); - -#define OutputStringValue(str) do {\ - StringValueCStr(str);\ - (str) = rb_str_conv_enc((str), rb_enc_get(str), rb_locale_encoding());\ -} while (0)\ - - -/* - * Document-class: Readline - * - * The Readline module provides interface for GNU Readline. - * This module defines a number of methods to facilitate completion - * and accesses input history from the Ruby interpreter. - * This module supported Edit Line(libedit) too. - * libedit is compatible with GNU Readline. - * - * GNU Readline:: http://www.gnu.org/directory/readline.html - * libedit:: http://www.thrysoee.dk/editline/ - * - * Reads one inputted line with line edit by Readline.readline method. - * At this time, the facilitatation completion and the key - * bind like Emacs can be operated like GNU Readline. - * - * require "readline" - * while buf = Readline.readline("> ", true) - * p buf - * end - * - * The content that the user input can be recorded to the history. - * The history can be accessed by Readline::HISTORY constant. - * - * require "readline" - * while buf = Readline.readline("> ", true) - * p Readline::HISTORY.to_a - * print("-> ", buf, "\n") - * end - * - * Documented by Kouji Takao <kouji dot takao at gmail dot com>. - */ - -static VALUE readline_instream; -static VALUE readline_outstream; -static FILE *readline_rl_instream; -static FILE *readline_rl_outstream; - -static void -mustbe_callable(VALUE proc) -{ - if (!NIL_P(proc) && !rb_respond_to(proc, id_call)) - rb_raise(rb_eArgError, "argument must respond to `call'"); -} - -#if defined HAVE_RL_GETC_FUNCTION - -#ifndef HAVE_RL_GETC -#define rl_getc(f) EOF -#endif - -struct getc_struct { - FILE *input; - int fd; - int ret; - int err; -}; - -static int -getc_body(struct getc_struct *p) -{ - char ch; - ssize_t ss; - -#if defined(_WIN32) - { - INPUT_RECORD ir; - DWORD n; - static int prior_key = '0'; - for (;;) { - HANDLE h; - if (prior_key > 0xff) { - prior_key = rl_getc(p->input); - return prior_key; - } - h = (HANDLE)_get_osfhandle(p->fd); - if (PeekConsoleInput(h, &ir, 1, &n)) { - if (n == 1) { - if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown) { - prior_key = rl_getc(p->input); - return prior_key; - } else { - ReadConsoleInput(h, &ir, 1, &n); - } - } else { - rb_w32_wait_events_blocking(&h, 1, INFINITE); - } - } else { - break; - } - } - } -#endif - - 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"); - } - rb_syserr_fail(data.err, "read"); - } - return data.ret; -} - -#elif defined HAVE_RL_EVENT_HOOK -#define BUSY_WAIT 0 - -static int readline_event(void); -static int -readline_event(void) -{ -#if BUSY_WAIT - rb_thread_schedule(); -#else - rb_wait_for_single_fd(fileno(rl_instream), RB_WAITFD_IN, NULL); - return 0; -#endif -} -#endif - -#if USE_INSERT_IGNORE_ESCAPE -static VALUE -insert_ignore_escape(VALUE self, VALUE prompt) -{ - VALUE last_prompt, orig_prompt = rb_attr_get(self, id_orig_prompt); - int ignoring = 0; - const char *s0, *s, *e; - long len; - static const char ignore_code[2] = {RL_PROMPT_START_IGNORE, RL_PROMPT_END_IGNORE}; - - prompt = rb_str_new_shared(prompt); - last_prompt = rb_attr_get(self, id_last_prompt); - if (orig_prompt == prompt) return last_prompt; - len = RSTRING_LEN(prompt); - if (NIL_P(last_prompt)) { - 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(*(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); - } - rb_str_cat(last_prompt, s0, s - s0); - - rb_ivar_set(self, id_orig_prompt, prompt); - rb_ivar_set(self, id_last_prompt, last_prompt); - - return last_prompt; -} -#endif - -static VALUE -readline_get(VALUE prompt) -{ -#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER - readline_completion_append_character = rl_completion_append_character; -#endif - 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; -} - -static void -prepare_readline(void) -{ - static int initialized = 0; - if (!initialized) { - rl_initialize(); - initialized = 1; - } - - if (readline_instream) { - rb_io_t *ifp; - rb_io_check_initialized(ifp = RFILE(rb_io_taint_check(readline_instream))->fptr); - if (ifp->fd < 0) { - clear_rl_instream(); - rb_raise(rb_eIOError, "closed readline input"); - } - } - - if (readline_outstream) { - rb_io_t *ofp; - rb_io_check_initialized(ofp = RFILE(rb_io_taint_check(readline_outstream))->fptr); - if (ofp->fd < 0) { - clear_rl_outstream(); - rb_raise(rb_eIOError, "closed readline output"); - } - } -} - -/* - * call-seq: - * Readline.readline(prompt = "", add_hist = false) -> string or nil - * - * Shows the +prompt+ and reads the inputted line with line editing. - * The inputted line is added to the history if +add_hist+ is true. - * - * Returns nil when the inputted line is empty and user inputs EOF - * (Presses ^D on UNIX). - * - * Raises IOError exception if one of below conditions are satisfied. - * 1. stdin was closed. - * 2. stdout was closed. - * - * This method supports thread. Switches the thread context when waits - * inputting line. - * - * Supports line edit when inputs line. Provides VI and Emacs editing mode. - * Default is Emacs editing mode. - * - * NOTE: Terminates ruby interpreter and does not return the terminal - * status after user pressed '^C' when wait inputting line. - * Give 3 examples that avoid it. - * - * * Catches the Interrupt exception by pressed ^C after returns - * terminal status: - * - * require "readline" - * - * stty_save = `stty -g`.chomp - * begin - * while buf = Readline.readline - * p buf - * end - * rescue Interrupt - * system("stty", stty_save) - * exit - * end - * end - * end - * - * * Catches the INT signal by pressed ^C after returns terminal - * status: - * - * require "readline" - * - * stty_save = `stty -g`.chomp - * trap("INT") { system "stty", stty_save; exit } - * - * while buf = Readline.readline - * p buf - * end - * - * * Ignores pressing ^C: - * - * require "readline" - * - * trap("INT", "SIG_IGN") - * - * while buf = Readline.readline - * p buf - * end - * - * Can make as follows with Readline::HISTORY constant. - * It does not record to the history if the inputted line is empty or - * the same it as last one. - * - * require "readline" - * - * while buf = Readline.readline("> ", true) - * # p Readline::HISTORY.to_a - * Readline::HISTORY.pop if /^\s*$/ =~ buf - * - * begin - * if Readline::HISTORY[Readline::HISTORY.length-2] == buf - * Readline::HISTORY.pop - * end - * rescue IndexError - * end - * - * # p Readline::HISTORY.to_a - * print "-> ", buf, "\n" - * end - */ -static VALUE -readline_readline(int argc, VALUE *argv, VALUE self) -{ - VALUE tmp, add_hist, result; - char *prompt = NULL; - char *buff; - int status; - - if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) { - OutputStringValue(tmp); -#if USE_INSERT_IGNORE_ESCAPE - tmp = insert_ignore_escape(self, tmp); - rb_str_locktmp(tmp); -#endif - prompt = RSTRING_PTR(tmp); - } - - prepare_readline(); - -#ifdef _WIN32 - rl_prep_terminal(1); -#endif - buff = (char*)rb_protect(readline_get, (VALUE)prompt, &status); -#if USE_INSERT_IGNORE_ESCAPE - if (prompt) { - rb_str_unlocktmp(tmp); - } -#endif - if (status) { -#if defined HAVE_RL_CLEANUP_AFTER_SIGNAL - /* restore terminal mode and signal handler*/ -#if defined HAVE_RL_FREE_LINE_STATE - rl_free_line_state(); -#endif - 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 -#else - rl_deprep_terminal(); -#endif - rb_jump_tag(status); - } - - if (RTEST(add_hist) && buff) { - add_history(buff); - } - if (buff) { - result = rb_locale_str_new_cstr(buff); - } - else - result = Qnil; - if (buff) free(buff); - return result; -} - -/* - * call-seq: - * Readline.input = input - * - * Specifies a File object +input+ that is input stream for - * Readline.readline method. - */ -static VALUE -readline_s_set_input(VALUE self, VALUE input) -{ - rb_io_t *ifp; - int fd; - FILE *f; - - 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); - rb_syserr_fail(save_errno, "fdopen"); - } - rl_instream = readline_rl_instream = f; - readline_instream = input; - } - return input; -} - -/* - * call-seq: - * Readline.output = output - * - * Specifies a File object +output+ that is output stream for - * Readline.readline method. - */ -static VALUE -readline_s_set_output(VALUE self, VALUE output) -{ - rb_io_t *ofp; - int fd; - FILE *f; - - 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); - rb_syserr_fail(save_errno, "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) -{ - mustbe_callable(proc); - 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, id_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) -RUBY_EXTERN int rl_delete_text(int, int); -static const char * -str_subpos(const char *ptr, const char *end, long beg, long *sublen, rb_encoding *enc) -{ - VALUE str = rb_enc_str_new_static(ptr, end-ptr, enc); - OBJ_FREEZE(str); - ptr = rb_str_subpos(str, beg, sublen); - return ptr; -} - -/* - * 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) { - const char *p, *ptr = rl_line_buffer; - long beg = 0, len = strlen(ptr); - const char *end = ptr + len; - rb_encoding *enc = rb_locale_encoding(); - if (argc == 2) { - beg = NUM2LONG(argv[0]); - len = NUM2LONG(argv[1]); - num_pos: - p = str_subpos(ptr, end, beg, &len, enc); - if (!p) rb_raise(rb_eArgError, "invalid index"); - beg = p - ptr; - } - else if (argc == 1) { - len = rb_enc_strlen(ptr, ptr + len, enc); - 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 - * - * Specifies a Proc object +proc+ to determine completion behavior. It - * should take input string and return an array of completion candidates. - * - * The default completion is used if +proc+ is nil. - * - * The String that is passed to the Proc depends on the - * Readline.completer_word_break_characters property. By default the word - * under the cursor is passed to the Proc. For example, if the input is "foo - * bar" then only "bar" would be passed to the completion Proc. - * - * Upon successful completion the Readline.completion_append_character will be - * appended to the input so the user can start working on their next argument. - * - * = Examples - * - * == Completion for a Static List - * - * require 'readline' - * - * LIST = [ - * 'search', 'download', 'open', - * 'help', 'history', 'quit', - * 'url', 'next', 'clear', - * 'prev', 'past' - * ].sort - * - * comp = proc { |s| LIST.grep(/^#{Regexp.escape(s)}/) } - * - * Readline.completion_append_character = " " - * Readline.completion_proc = comp - * - * while line = Readline.readline('> ', true) - * p line - * end - * - * == Completion For Directory Contents - * - * require 'readline' - * - * Readline.completion_append_character = " " - * Readline.completion_proc = Proc.new do |str| - * Dir[str+'*'].grep(/^#{Regexp.escape(str)}/) - * end - * - * while line = Readline.readline('> ', true) - * p line - * end - * - * = Autocomplete strategies - * - * When working with auto-complete there are some strategies that work well. - * To get some ideas you can take a look at the - * completion.rb[https://git.ruby-lang.org/ruby.git/tree/lib/irb/completion.rb] - * file for irb. - * - * The common strategy is to take a list of possible completions and filter it - * down to those completions that start with the user input. In the above - * examples Enumerator.grep is used. The input is escaped to prevent Regexp - * special characters from interfering with the matching. - * - * It may also be helpful to use the Abbrev library to generate completions. - * - * Raises ArgumentError if +proc+ does not respond to the call method. - */ -static VALUE -readline_s_set_completion_proc(VALUE self, VALUE proc) -{ - mustbe_callable(proc); - return rb_ivar_set(mReadline, completion_proc, proc); -} - -/* - * call-seq: - * Readline.completion_proc -> proc - * - * Returns the completion Proc object. - */ -static VALUE -readline_s_get_completion_proc(VALUE self) -{ - return rb_attr_get(mReadline, completion_proc); -} - -#ifdef HAVE_RL_CHAR_IS_QUOTED_P -/* - * call-seq: - * Readline.quoting_detection_proc = proc - * - * Specifies a Proc object +proc+ to determine if a character in the user's - * input is escaped. It should take the user's input and the index of the - * character in question as input, and return a boolean (true if the specified - * character is escaped). - * - * Readline will only call this proc with characters specified in - * +completer_quote_characters+, to discover if they indicate the end of a - * quoted argument, or characters specified in - * +completer_word_break_characters+, to discover if they indicate a break - * between arguments. - * - * If +completer_quote_characters+ is not set, or if the user input doesn't - * contain one of the +completer_quote_characters+ or a +\+ character, - * Readline will not attempt to use this proc at all. - * - * Raises ArgumentError if +proc+ does not respond to the call method. - */ -static VALUE -readline_s_set_quoting_detection_proc(VALUE self, VALUE proc) -{ - mustbe_callable(proc); - return rb_ivar_set(mReadline, quoting_detection_proc, proc); -} - -/* - * call-seq: - * Readline.quoting_detection_proc -> proc - * - * Returns the quoting detection Proc object. - */ -static VALUE -readline_s_get_quoting_detection_proc(VALUE self) -{ - return rb_attr_get(mReadline, quoting_detection_proc); -} -#else -#define readline_s_set_quoting_detection_proc rb_f_notimplement -#define readline_s_get_quoting_detection_proc rb_f_notimplement -#endif - -/* - * call-seq: - * Readline.completion_case_fold = bool - * - * Sets whether or not to ignore case on completion. - */ -static VALUE -readline_s_set_completion_case_fold(VALUE self, VALUE val) -{ - return rb_ivar_set(mReadline, completion_case_fold, val); -} - -/* - * call-seq: - * Readline.completion_case_fold -> bool - * - * Returns true if completion ignores case. If no, returns false. - * - * NOTE: Returns the same object that is specified by - * Readline.completion_case_fold= method. - * - * require "readline" - * - * Readline.completion_case_fold = "This is a String." - * p Readline.completion_case_fold # => "This is a String." - */ -static VALUE -readline_s_get_completion_case_fold(VALUE self) -{ - return rb_attr_get(mReadline, completion_case_fold); -} - -#ifdef HAVE_RL_LINE_BUFFER -/* - * call-seq: - * Readline.line_buffer -> string - * - * Returns the full line that is being edited. This is useful from - * within the complete_proc for determining the context of the - * completion request. - * - * 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) -{ - if (rl_line_buffer == NULL) - return Qnil; - return rb_locale_str_new_cstr(rl_line_buffer); -} -#else -#define readline_s_get_line_buffer rb_f_notimplement -#endif - -#ifdef HAVE_RL_POINT -/* - * call-seq: - * Readline.point -> int - * - * Returns the index of the current cursor position in - * +Readline.line_buffer+. - * - * The index in +Readline.line_buffer+ which matches the start of - * input-string passed to completion_proc is computed by subtracting - * 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) -{ - 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 ** -readline_attempted_completion_function(const char *text, int start, int end) -{ - VALUE proc, ary, temp; - char **result; - int case_fold; - long i, matches; - rb_encoding *enc; - VALUE encobj; - - proc = rb_attr_get(mReadline, completion_proc); - if (NIL_P(proc)) - return NULL; -#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER - rl_completion_append_character = readline_completion_append_character; -#endif -#ifdef HAVE_RL_ATTEMPTED_COMPLETION_OVER - rl_attempted_completion_over = 1; -#endif - case_fold = RTEST(rb_attr_get(mReadline, completion_case_fold)); - ary = rb_funcall(proc, id_call, 1, rb_locale_str_new_cstr(text)); - if (!RB_TYPE_P(ary, T_ARRAY)) - ary = rb_Array(ary); - matches = RARRAY_LEN(ary); - if (matches == 0) return NULL; - result = (char**)malloc((matches + 2)*sizeof(char*)); - 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_AREF(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; - - if (matches == 1) { - result[0] = strdup(result[1]); - } - else { - const char *result1 = result[1]; - long low = strlen(result1); - - for (i = 1; i < matches; ++i) { - register int c1, c2; - long i1, i2, l2; - int n1, n2; - const char *p2 = result[i + 1]; - - l2 = strlen(p2); - for (i1 = i2 = 0; i1 < low && i2 < l2; i1 += n1, i2 += n2) { - c1 = rb_enc_codepoint_len(result1 + i1, result1 + low, &n1, enc); - c2 = rb_enc_codepoint_len(p2 + i2, p2 + l2, &n2, enc); - if (case_fold) { - c1 = rb_tolower(c1); - c2 = rb_tolower(c2); - } - if (c1 != c2) break; - } - - low = i1; - } - result[0] = (char*)malloc(low + 1); - if (result[0] == NULL) rb_memerror(); - strncpy(result[0], result[1], low); - result[0][low] = '\0'; - } - - return result; -} - -#ifdef HAVE_RL_CHAR_IS_QUOTED_P -static int -readline_char_is_quoted(char *text, int byte_index) -{ - VALUE proc, result, str; - long char_index; - size_t len; - - proc = rb_attr_get(mReadline, quoting_detection_proc); - if (NIL_P(proc)) { - return 0; - } - - len = strlen(text); - if (byte_index < 0 || len < (size_t)byte_index) { - rb_raise(rb_eIndexError, "invalid byte index (%d in %"PRIdSIZE")", - byte_index, len); - } - - str = rb_locale_str_new(text, len); - char_index = rb_str_sublen(str, byte_index); - result = rb_funcall(proc, id_call, 2, str, LONG2FIX(char_index)); - return RTEST(result); -} -#endif - -#ifdef HAVE_RL_SET_SCREEN_SIZE -/* - * call-seq: - * Readline.set_screen_size(rows, columns) -> self - * - * Set terminal size to +rows+ and +columns+. - * - * See GNU Readline's rl_set_screen_size function. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_set_screen_size(VALUE self, VALUE rows, VALUE columns) -{ - rl_set_screen_size(NUM2INT(rows), NUM2INT(columns)); - return self; -} -#else -#define readline_s_set_screen_size rb_f_notimplement -#endif - -#ifdef HAVE_RL_GET_SCREEN_SIZE -/* - * call-seq: - * Readline.get_screen_size -> [rows, columns] - * - * Returns the terminal's rows and columns. - * - * See GNU Readline's rl_get_screen_size function. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_get_screen_size(VALUE self) -{ - int rows, columns; - VALUE res; - - rl_get_screen_size(&rows, &columns); - res = rb_ary_new(); - rb_ary_push(res, INT2NUM(rows)); - rb_ary_push(res, INT2NUM(columns)); - return res; -} -#else -#define readline_s_get_screen_size rb_f_notimplement -#endif - -#ifdef HAVE_RL_VI_EDITING_MODE -RUBY_EXTERN int rl_vi_editing_mode(int, int); -/* - * call-seq: - * Readline.vi_editing_mode -> nil - * - * Specifies VI editing mode. See the manual of GNU Readline for - * details of VI editing mode. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_vi_editing_mode(VALUE self) -{ - rl_vi_editing_mode(1,0); - return Qnil; -} -#else -#define readline_s_vi_editing_mode rb_f_notimplement -#endif - -#ifdef HAVE_RL_EDITING_MODE -/* - * call-seq: - * Readline.vi_editing_mode? -> bool - * - * Returns true if vi mode is active. Returns false if not. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_vi_editing_mode_p(VALUE self) -{ - return rl_editing_mode == 0 ? Qtrue : Qfalse; -} -#else -#define readline_s_vi_editing_mode_p rb_f_notimplement -#endif - -#ifdef HAVE_RL_EMACS_EDITING_MODE -RUBY_EXTERN int rl_emacs_editing_mode(int, int); -/* - * call-seq: - * Readline.emacs_editing_mode -> nil - * - * Specifies Emacs editing mode. The default is this mode. See the - * manual of GNU Readline for details of Emacs editing mode. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_emacs_editing_mode(VALUE self) -{ - rl_emacs_editing_mode(1,0); - return Qnil; -} -#else -#define readline_s_emacs_editing_mode rb_f_notimplement -#endif - -#ifdef HAVE_RL_EDITING_MODE -/* - * call-seq: - * Readline.emacs_editing_mode? -> bool - * - * Returns true if emacs mode is active. Returns false if not. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_emacs_editing_mode_p(VALUE self) -{ - return rl_editing_mode == 1 ? Qtrue : Qfalse; -} -#else -#define readline_s_emacs_editing_mode_p rb_f_notimplement -#endif - -#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER -/* - * call-seq: - * Readline.completion_append_character = char - * - * Specifies a character to be appended on completion. - * Nothing will be appended if an empty string ("") or nil is - * specified. - * - * For example: - * require "readline" - * - * Readline.readline("> ", true) - * Readline.completion_append_character = " " - * - * Result: - * > - * Input "/var/li". - * - * > /var/li - * Press TAB key. - * - * > /var/lib - * Completes "b" and appends " ". So, you can continuously input "/usr". - * - * > /var/lib /usr - * - * NOTE: Only one character can be specified. When "string" is - * specified, sets only "s" that is the first. - * - * require "readline" - * - * Readline.completion_append_character = "string" - * p Readline.completion_append_character # => "s" - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_set_completion_append_character(VALUE self, VALUE str) -{ - if (NIL_P(str)) { - 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]; - } - } - return self; -} -#else -#define readline_s_set_completion_append_character rb_f_notimplement -#endif - -#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER -/* - * call-seq: - * Readline.completion_append_character -> char - * - * Returns a string containing a character to be appended on - * completion. The default is a space (" "). - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_get_completion_append_character(VALUE self) -{ - char buf[1]; - - if (rl_completion_append_character == '\0') - return Qnil; - - buf[0] = (char) rl_completion_append_character; - return rb_locale_str_new(buf, 1); -} -#else -#define readline_s_get_completion_append_character rb_f_notimplement -#endif - -#ifdef HAVE_RL_COMPLETION_QUOTE_CHARACTER -/* - * call-seq: - * Readline.completion_quote_character -> char - * - * When called during a completion (e.g. from within your completion_proc), - * it will return a string containing the character used to quote the - * argument being completed, or nil if the argument is unquoted. - * - * When called at other times, it will always return nil. - * - * Note that Readline.completer_quote_characters must be set, - * or this method will always return nil. - */ -static VALUE -readline_s_get_completion_quote_character(VALUE self) -{ - char buf[1]; - - if (rl_completion_quote_character == '\0') - return Qnil; - - buf[0] = (char) rl_completion_quote_character; - return rb_locale_str_new(buf, 1); -} -#else -#define readline_s_get_completion_quote_character rb_f_notimplement -#endif - -#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS -/* - * call-seq: - * Readline.basic_word_break_characters = string - * - * 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\"\\'`@$><=;|&{(". - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_set_basic_word_break_characters(VALUE self, VALUE str) -{ - static char *basic_word_break_characters = NULL; - - OutputStringValue(str); - if (basic_word_break_characters == NULL) { - basic_word_break_characters = - ALLOC_N(char, RSTRING_LEN(str) + 1); - } - else { - REALLOC_N(basic_word_break_characters, char, RSTRING_LEN(str) + 1); - } - strncpy(basic_word_break_characters, - 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; -} -#else -#define readline_s_set_basic_word_break_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_BASIC_WORD_BREAK_CHARACTERS -/* - * call-seq: - * Readline.basic_word_break_characters -> string - * - * Gets the basic list of characters that signal a break between words - * for the completer routine. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_get_basic_word_break_characters(VALUE self) -{ - if (rl_basic_word_break_characters == NULL) - return Qnil; - return rb_locale_str_new_cstr(rl_basic_word_break_characters); -} -#else -#define readline_s_get_basic_word_break_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -/* - * call-seq: - * Readline.completer_word_break_characters = string - * - * Sets the basic list of characters that signal a break between words - * for rl_complete_internal(). The default is the value of - * Readline.basic_word_break_characters. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_set_completer_word_break_characters(VALUE self, VALUE str) -{ - static char *completer_word_break_characters = NULL; - - OutputStringValue(str); - if (completer_word_break_characters == NULL) { - completer_word_break_characters = - ALLOC_N(char, RSTRING_LEN(str) + 1); - } - else { - REALLOC_N(completer_word_break_characters, char, RSTRING_LEN(str) + 1); - } - strncpy(completer_word_break_characters, - 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; -} -#else -#define readline_s_set_completer_word_break_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_COMPLETER_WORD_BREAK_CHARACTERS -/* - * call-seq: - * Readline.completer_word_break_characters -> string - * - * Gets the basic list of characters that signal a break between words - * for rl_complete_internal(). - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_get_completer_word_break_characters(VALUE self) -{ - if (rl_completer_word_break_characters == NULL) - 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: - * Readline.basic_quote_characters = string - * - * Sets a list of quote characters which can cause a word break. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_set_basic_quote_characters(VALUE self, VALUE str) -{ - static char *basic_quote_characters = NULL; - - OutputStringValue(str); - if (basic_quote_characters == NULL) { - basic_quote_characters = - ALLOC_N(char, RSTRING_LEN(str) + 1); - } - else { - REALLOC_N(basic_quote_characters, char, RSTRING_LEN(str) + 1); - } - strncpy(basic_quote_characters, - RSTRING_PTR(str), RSTRING_LEN(str)); - basic_quote_characters[RSTRING_LEN(str)] = '\0'; - rl_basic_quote_characters = basic_quote_characters; - - return self; -} -#else -#define readline_s_set_basic_quote_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_BASIC_QUOTE_CHARACTERS -/* - * call-seq: - * Readline.basic_quote_characters -> string - * - * Gets a list of quote characters which can cause a word break. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_get_basic_quote_characters(VALUE self) -{ - if (rl_basic_quote_characters == NULL) - return Qnil; - return rb_locale_str_new_cstr(rl_basic_quote_characters); -} -#else -#define readline_s_get_basic_quote_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS -/* - * call-seq: - * Readline.completer_quote_characters = string - * - * Sets a list of characters which can be used to quote a substring of - * the line. Completion occurs on the entire substring, and within - * the substring Readline.completer_word_break_characters are treated - * as any other character, unless they also appear within this list. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_set_completer_quote_characters(VALUE self, VALUE str) -{ - static char *completer_quote_characters = NULL; - - OutputStringValue(str); - if (completer_quote_characters == NULL) { - completer_quote_characters = - ALLOC_N(char, RSTRING_LEN(str) + 1); - } - else { - 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'; - rl_completer_quote_characters = completer_quote_characters; - - return self; -} -#else -#define readline_s_set_completer_quote_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_COMPLETER_QUOTE_CHARACTERS -/* - * call-seq: - * Readline.completer_quote_characters -> string - * - * Gets a list of characters which can be used to quote a substring of - * the line. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_get_completer_quote_characters(VALUE self) -{ - if (rl_completer_quote_characters == NULL) - return Qnil; - return rb_locale_str_new_cstr(rl_completer_quote_characters); -} -#else -#define readline_s_get_completer_quote_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS -/* - * call-seq: - * Readline.filename_quote_characters = string - * - * Sets a list of characters that cause a filename to be quoted by the completer - * when they appear in a completed filename. The default is nil. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_set_filename_quote_characters(VALUE self, VALUE str) -{ - static char *filename_quote_characters = NULL; - - OutputStringValue(str); - if (filename_quote_characters == NULL) { - filename_quote_characters = - ALLOC_N(char, RSTRING_LEN(str) + 1); - } - else { - 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'; - rl_filename_quote_characters = filename_quote_characters; - - return self; -} -#else -#define readline_s_set_filename_quote_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_FILENAME_QUOTE_CHARACTERS -/* - * call-seq: - * Readline.filename_quote_characters -> string - * - * Gets a list of characters that cause a filename to be quoted by the completer - * when they appear in a completed filename. - * - * Raises NotImplementedError if the using readline library does not support. - */ -static VALUE -readline_s_get_filename_quote_characters(VALUE self) -{ - if (rl_filename_quote_characters == NULL) - return Qnil; - return rb_locale_str_new_cstr(rl_filename_quote_characters); -} -#else -#define readline_s_get_filename_quote_characters rb_f_notimplement -#endif - -#ifdef HAVE_RL_REFRESH_LINE -RUBY_EXTERN int rl_refresh_line(int, int); -/* - * call-seq: - * Readline.refresh_line -> nil - * - * Clear the current input line. - */ -static VALUE -readline_s_refresh_line(VALUE self) -{ - prepare_readline(); - rl_refresh_line(0, 0); - return Qnil; -} -#else -#define readline_s_refresh_line rb_f_notimplement -#endif - -static VALUE -hist_to_s(VALUE self) -{ - return rb_str_new_cstr("HISTORY"); -} - -static int -history_get_offset_history_base(int offset) -{ - return history_base + offset; -} - -static int -history_get_offset_0(int offset) -{ - return offset; -} - -static VALUE -hist_get(VALUE self, VALUE index) -{ - HIST_ENTRY *entry = NULL; - int i; - - i = NUM2INT(index); - if (i < 0) { - i += history_length; - } - if (i >= 0) { - entry = history_get(history_get_offset_func(i)); - } - if (entry == NULL) { - rb_raise(rb_eIndexError, "invalid index"); - } - return rb_locale_str_new_cstr(entry->line); -} - -#ifdef HAVE_REPLACE_HISTORY_ENTRY -static VALUE -hist_set(VALUE self, VALUE index, VALUE str) -{ - HIST_ENTRY *entry = NULL; - int i; - - 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); - } - if (entry == NULL) { - rb_raise(rb_eIndexError, "invalid index"); - } - return str; -} -#else -#define hist_set rb_f_notimplement -#endif - -static VALUE -hist_push(VALUE self, VALUE str) -{ - OutputStringValue(str); - add_history(RSTRING_PTR(str)); - return self; -} - -static VALUE -hist_push_method(int argc, VALUE *argv, VALUE self) -{ - VALUE str; - - while (argc--) { - str = *argv++; - OutputStringValue(str); - add_history(RSTRING_PTR(str)); - } - return self; -} - -static VALUE -rb_remove_history(int index) -{ -#ifdef HAVE_REMOVE_HISTORY - HIST_ENTRY *entry; - VALUE val; - - entry = remove_history(index); - if (entry) { - val = rb_locale_str_new_cstr(entry->line); - free((void *) entry->line); - free(entry); - return val; - } - return Qnil; -#else - rb_notimplement(); - - UNREACHABLE_RETURN(Qnil); -#endif -} - -static VALUE -hist_pop(VALUE self) -{ - if (history_length > 0) { - return rb_remove_history(history_length - 1); - } else { - return Qnil; - } -} - -static VALUE -hist_shift(VALUE self) -{ - if (history_length > 0) { - return rb_remove_history(0); - } else { - return Qnil; - } -} - -static VALUE -hist_each(VALUE self) -{ - HIST_ENTRY *entry; - int i; - - RETURN_ENUMERATOR(self, 0, 0); - - 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)); - } - return self; -} - -static VALUE -hist_length(VALUE self) -{ - return INT2NUM(history_length); -} - -static VALUE -hist_empty_p(VALUE self) -{ - return history_length == 0 ? Qtrue : Qfalse; -} - -static VALUE -hist_delete_at(VALUE self, VALUE index) -{ - int i; - - i = NUM2INT(index); - if (i < 0) - i += history_length; - if (i < 0 || i > history_length - 1) { - rb_raise(rb_eIndexError, "invalid index"); - } - return rb_remove_history(i); -} - -#ifdef HAVE_CLEAR_HISTORY -static VALUE -hist_clear(VALUE self) -{ - clear_history(); - return self; -} -#else -#define hist_clear rb_f_notimplement -#endif - -static VALUE -filename_completion_proc_call(VALUE self, VALUE str) -{ - VALUE result; - char **matches; - int i; - - matches = rl_completion_matches(StringValuePtr(str), - 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); - } - else { - result = Qnil; - } - return result; -} - -static VALUE -username_completion_proc_call(VALUE self, VALUE str) -{ - VALUE result; - char **matches; - int i; - - matches = rl_completion_matches(StringValuePtr(str), - 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); - } - else { - result = Qnil; - } - return result; -} - -#ifdef HAVE_RL_CATCH_SIGNALS -RUBY_EXTERN int rl_catch_signals; -#endif -#ifdef HAVE_RL_CLEAR_SIGNALS -RUBY_EXTERN int rl_clear_signals(void); -#endif - -#undef rb_intern -void -Init_readline(void) -{ - VALUE history, fcomp, ucomp, version; - - /* Allow conditional parsing of the ~/.inputrc file. */ - rl_readline_name = (char *)"Ruby"; - -#if defined HAVE_RL_GETC_FUNCTION - /* 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() */ - rl_getc_function = readline_getc; -#elif defined HAVE_RL_EVENT_HOOK - rl_event_hook = readline_event; -#endif - - using_history(); - - id_call = rb_intern("call"); - 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 -#if defined HAVE_RL_CHAR_IS_QUOTED_P - quoting_detection_proc = rb_intern(QUOTING_DETECTION_PROC); -#endif - - mReadline = rb_define_module("Readline"); - rb_define_module_function(mReadline, "readline", - readline_readline, -1); - rb_define_singleton_method(mReadline, "input=", - readline_s_set_input, 1); - rb_define_singleton_method(mReadline, "output=", - readline_s_set_output, 1); - rb_define_singleton_method(mReadline, "completion_proc=", - readline_s_set_completion_proc, 1); - rb_define_singleton_method(mReadline, "completion_proc", - readline_s_get_completion_proc, 0); - rb_define_singleton_method(mReadline, "quoting_detection_proc=", - readline_s_set_quoting_detection_proc, 1); - rb_define_singleton_method(mReadline, "quoting_detection_proc", - readline_s_get_quoting_detection_proc, 0); - rb_define_singleton_method(mReadline, "completion_case_fold=", - readline_s_set_completion_case_fold, 1); - rb_define_singleton_method(mReadline, "completion_case_fold", - readline_s_get_completion_case_fold, 0); - rb_define_singleton_method(mReadline, "line_buffer", - readline_s_get_line_buffer, 0); - rb_define_singleton_method(mReadline, "point", - 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); - rb_define_singleton_method(mReadline, "get_screen_size", - readline_s_get_screen_size, 0); - rb_define_singleton_method(mReadline, "vi_editing_mode", - readline_s_vi_editing_mode, 0); - rb_define_singleton_method(mReadline, "vi_editing_mode?", - readline_s_vi_editing_mode_p, 0); - rb_define_singleton_method(mReadline, "emacs_editing_mode", - readline_s_emacs_editing_mode, 0); - rb_define_singleton_method(mReadline, "emacs_editing_mode?", - readline_s_emacs_editing_mode_p, 0); - rb_define_singleton_method(mReadline, "completion_append_character=", - readline_s_set_completion_append_character, 1); - rb_define_singleton_method(mReadline, "completion_append_character", - readline_s_get_completion_append_character, 0); - rb_define_singleton_method(mReadline, "completion_quote_character", - readline_s_get_completion_quote_character, 0); - rb_define_singleton_method(mReadline, "basic_word_break_characters=", - 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); - rb_define_singleton_method(mReadline, "completer_word_break_characters=", - 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); - rb_define_singleton_method(mReadline, "basic_quote_characters=", - readline_s_set_basic_quote_characters, 1); - rb_define_singleton_method(mReadline, "basic_quote_characters", - readline_s_get_basic_quote_characters, 0); - rb_define_singleton_method(mReadline, "completer_quote_characters=", - readline_s_set_completer_quote_characters, 1); - rb_define_singleton_method(mReadline, "completer_quote_characters", - readline_s_get_completer_quote_characters, 0); - rb_define_singleton_method(mReadline, "filename_quote_characters=", - readline_s_set_filename_quote_characters, 1); - rb_define_singleton_method(mReadline, "filename_quote_characters", - readline_s_get_filename_quote_characters, 0); - rb_define_singleton_method(mReadline, "refresh_line", - 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 - id_orig_prompt = rb_intern("orig_prompt"); - id_last_prompt = rb_intern("last_prompt"); -#endif - - history = rb_obj_alloc(rb_cObject); - rb_extend_object(history, rb_mEnumerable); - rb_define_singleton_method(history,"to_s", hist_to_s, 0); - rb_define_singleton_method(history,"[]", hist_get, 1); - rb_define_singleton_method(history,"[]=", hist_set, 2); - rb_define_singleton_method(history,"<<", hist_push, 1); - rb_define_singleton_method(history,"push", hist_push_method, -1); - rb_define_singleton_method(history,"pop", hist_pop, 0); - rb_define_singleton_method(history,"shift", hist_shift, 0); - rb_define_singleton_method(history,"each", hist_each, 0); - rb_define_singleton_method(history,"length", hist_length, 0); - rb_define_singleton_method(history,"size", hist_length, 0); - rb_define_singleton_method(history,"empty?", hist_empty_p, 0); - rb_define_singleton_method(history,"delete_at", hist_delete_at, 1); - rb_define_singleton_method(history,"clear", hist_clear, 0); - - /* - * The history buffer. It extends Enumerable module, so it behaves - * just like an array. - * For example, gets the fifth content that the user input by - * <code>HISTORY[4]</code>. - */ - rb_define_const(mReadline, "HISTORY", history); - - fcomp = rb_obj_alloc(rb_cObject); - rb_define_singleton_method(fcomp, "call", - 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. - */ - rb_define_const(mReadline, "FILENAME_COMPLETION_PROC", fcomp); - - ucomp = rb_obj_alloc(rb_cObject); - rb_define_singleton_method(ucomp, "call", - 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. - */ - rb_define_const(mReadline, "USERNAME_COMPLETION_PROC", ucomp); - history_get_offset_func = history_get_offset_history_base; - history_replace_offset_func = history_get_offset_0; -#if defined HAVE_RL_LIBRARY_VERSION - 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) { - prepare_readline(); - 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; - } -#endif -#ifdef HAVE_CLEAR_HISTORY - clear_history(); -#else - { - HIST_ENTRY *entry = remove_history(0); - if (entry) { - free((char *)entry->line); - free(entry); - } - } -#endif - } -#endif -#else - version = rb_str_new_cstr("2.0 or prior version"); -#endif - /* Version string of GNU Readline or libedit. */ - 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 = (rl_hook_func_t *)readline_pre_input_hook; -#endif -#if defined HAVE_RL_CHAR_IS_QUOTED_P - rl_char_is_quoted_p = &readline_char_is_quoted; -#endif -#ifdef HAVE_RL_CATCH_SIGNALS - rl_catch_signals = 0; -#endif -#ifdef HAVE_RL_CLEAR_SIGNALS - rl_clear_signals(); -#endif - - rb_gc_register_address(&readline_instream); - rb_gc_register_address(&readline_outstream); -} - -/* - * Local variables: - * indent-tabs-mode: nil - * end: - */ diff --git a/ext/ripper/README b/ext/ripper/README index 2ae2470e13..70fa208920 100644 --- a/ext/ripper/README +++ b/ext/ripper/README @@ -13,7 +13,6 @@ Requirements ------------ * ruby 1.9 (support CVS HEAD only) - * bison 1.28 or later (Other yaccs do not work) Usage ----- diff --git a/ext/ripper/depend b/ext/ripper/depend index 85520b032e..fe6bd872bd 100644 --- a/ext/ripper/depend +++ b/ext/ripper/depend @@ -1,27 +1,26 @@ GEN = $(srcdir)/tools/generate.rb SRC1 = $(top_srcdir)/parse.y SRC2 = $(srcdir)/eventids2.c +BISON = $(BASERUBY) $(top_srcdir)/tool/lrama/exe/lrama .SUFFIXES: .y -src: ripper.c eventids1.c eventids2table.c +src: ripper.c ripper_init.c eventids1.c eventids1.h eventids2table.c +ripper.c ripper_init.c eventids1.c eventids1.h eventids2table.c: depend ripper.o: ripper.c .y.c: $(ECHO) compiling compiler $< - $(Q) $(BISON) -t -v -oy.tab.c $< - $(Q) sed -e "/^#/s!y\.tab\.c!$@!" -f $(top_srcdir)/tool/ytab.sed y.tab.c > $@ - @$(RM) y.tab.c + $(Q) $(BISON) -t -v -o$@ - $< < $< all: check static: check ripper.y: $(srcdir)/tools/preproc.rb $(srcdir)/tools/dsl.rb $(top_srcdir)/parse.y $(top_srcdir)/defs/id.def $(ECHO) extracting $@ from $(top_srcdir)/parse.y - $(Q) $(RUBY) $(top_srcdir)/tool/id2token.rb $(top_srcdir)/parse.y > ripper.tmp.y - $(Q) $(RUBY) $(srcdir)/tools/preproc.rb ripper.tmp.y --output=$@ - $(Q) $(RM) ripper.tmp.y + $(Q) $(RUBY) $(top_srcdir)/tool/id2token.rb $(top_srcdir)/parse.y | \ + $(RUBY) $(srcdir)/tools/preproc.rb --output=$@ - ripper.y check: .eventids2-check @@ -30,6 +29,10 @@ check: .eventids2-check $(Q) $(RUBY) $(GEN) --mode=check --ids1src=$(SRC1) --ids2src=$(SRC2) @exit > $@ +eventids1.h: $(GEN) $(srcdir)/tools/dsl.rb $(SRC1) + $(ECHO) generating $@ from $(SRC1) + $(Q) $(RUBY) $(GEN) --mode=eventids1_h --ids1src=$(SRC1) --output=$@ + eventids1.c: $(GEN) $(srcdir)/tools/dsl.rb $(SRC1) $(ECHO) generating $@ from $(SRC1) $(Q) $(RUBY) $(GEN) --mode=eventids1 --ids1src=$(SRC1) --output=$@ @@ -38,6 +41,10 @@ eventids2table.c: $(GEN) $(srcdir)/tools/dsl.rb $(SRC2) $(ECHO) generating $@ from $(SRC2) $(Q) $(RUBY) $(GEN) --mode=eventids2table --ids2src=$(SRC2) --output=$@ +ripper_init.c: $(srcdir)/ripper_init.c.tmpl ripper.y $(srcdir)/tools/preproc.rb $(top_srcdir)/internal/ruby_parser.h + $(ECHO) generating $@ from $(srcdir)/ripper_init.c.tmpl + $(Q) $(RUBY) $(srcdir)/tools/preproc.rb --output=$@ --template=$(srcdir)/ripper_init.c.tmpl $(top_srcdir)/internal/ruby_parser.h + # Entries for Ripper maintainer preproc: ripper.E @@ -46,10 +53,349 @@ ripper.E: ripper.c $(Q) $(CC) -E $(INCFLAGS) $(CPPFLAGS) $< | $(RUBY) $(srcdir)/tools/strip.rb > $@ # AUTOGENERATED DEPENDENCIES START +eventids1.o: $(RUBY_EXTCONF_H) +eventids1.o: $(arch_hdrdir)/ruby/config.h +eventids1.o: $(hdrdir)/ruby/assert.h +eventids1.o: $(hdrdir)/ruby/backward.h +eventids1.o: $(hdrdir)/ruby/backward/2/assume.h +eventids1.o: $(hdrdir)/ruby/backward/2/attributes.h +eventids1.o: $(hdrdir)/ruby/backward/2/bool.h +eventids1.o: $(hdrdir)/ruby/backward/2/inttypes.h +eventids1.o: $(hdrdir)/ruby/backward/2/limits.h +eventids1.o: $(hdrdir)/ruby/backward/2/long_long.h +eventids1.o: $(hdrdir)/ruby/backward/2/stdalign.h +eventids1.o: $(hdrdir)/ruby/backward/2/stdarg.h +eventids1.o: $(hdrdir)/ruby/defines.h +eventids1.o: $(hdrdir)/ruby/intern.h +eventids1.o: $(hdrdir)/ruby/internal/abi.h +eventids1.o: $(hdrdir)/ruby/internal/anyargs.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/char.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/double.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/int.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/long.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/short.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +eventids1.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +eventids1.o: $(hdrdir)/ruby/internal/assume.h +eventids1.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +eventids1.o: $(hdrdir)/ruby/internal/attr/artificial.h +eventids1.o: $(hdrdir)/ruby/internal/attr/cold.h +eventids1.o: $(hdrdir)/ruby/internal/attr/const.h +eventids1.o: $(hdrdir)/ruby/internal/attr/constexpr.h +eventids1.o: $(hdrdir)/ruby/internal/attr/deprecated.h +eventids1.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +eventids1.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +eventids1.o: $(hdrdir)/ruby/internal/attr/error.h +eventids1.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +eventids1.o: $(hdrdir)/ruby/internal/attr/forceinline.h +eventids1.o: $(hdrdir)/ruby/internal/attr/format.h +eventids1.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +eventids1.o: $(hdrdir)/ruby/internal/attr/noalias.h +eventids1.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +eventids1.o: $(hdrdir)/ruby/internal/attr/noexcept.h +eventids1.o: $(hdrdir)/ruby/internal/attr/noinline.h +eventids1.o: $(hdrdir)/ruby/internal/attr/nonnull.h +eventids1.o: $(hdrdir)/ruby/internal/attr/noreturn.h +eventids1.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +eventids1.o: $(hdrdir)/ruby/internal/attr/pure.h +eventids1.o: $(hdrdir)/ruby/internal/attr/restrict.h +eventids1.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +eventids1.o: $(hdrdir)/ruby/internal/attr/warning.h +eventids1.o: $(hdrdir)/ruby/internal/attr/weakref.h +eventids1.o: $(hdrdir)/ruby/internal/cast.h +eventids1.o: $(hdrdir)/ruby/internal/compiler_is.h +eventids1.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +eventids1.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +eventids1.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +eventids1.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +eventids1.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +eventids1.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +eventids1.o: $(hdrdir)/ruby/internal/compiler_since.h +eventids1.o: $(hdrdir)/ruby/internal/config.h +eventids1.o: $(hdrdir)/ruby/internal/constant_p.h +eventids1.o: $(hdrdir)/ruby/internal/core.h +eventids1.o: $(hdrdir)/ruby/internal/core/rarray.h +eventids1.o: $(hdrdir)/ruby/internal/core/rbasic.h +eventids1.o: $(hdrdir)/ruby/internal/core/rbignum.h +eventids1.o: $(hdrdir)/ruby/internal/core/rclass.h +eventids1.o: $(hdrdir)/ruby/internal/core/rdata.h +eventids1.o: $(hdrdir)/ruby/internal/core/rfile.h +eventids1.o: $(hdrdir)/ruby/internal/core/rhash.h +eventids1.o: $(hdrdir)/ruby/internal/core/robject.h +eventids1.o: $(hdrdir)/ruby/internal/core/rregexp.h +eventids1.o: $(hdrdir)/ruby/internal/core/rstring.h +eventids1.o: $(hdrdir)/ruby/internal/core/rstruct.h +eventids1.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +eventids1.o: $(hdrdir)/ruby/internal/ctype.h +eventids1.o: $(hdrdir)/ruby/internal/dllexport.h +eventids1.o: $(hdrdir)/ruby/internal/dosish.h +eventids1.o: $(hdrdir)/ruby/internal/error.h +eventids1.o: $(hdrdir)/ruby/internal/eval.h +eventids1.o: $(hdrdir)/ruby/internal/event.h +eventids1.o: $(hdrdir)/ruby/internal/fl_type.h +eventids1.o: $(hdrdir)/ruby/internal/gc.h +eventids1.o: $(hdrdir)/ruby/internal/glob.h +eventids1.o: $(hdrdir)/ruby/internal/globals.h +eventids1.o: $(hdrdir)/ruby/internal/has/attribute.h +eventids1.o: $(hdrdir)/ruby/internal/has/builtin.h +eventids1.o: $(hdrdir)/ruby/internal/has/c_attribute.h +eventids1.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +eventids1.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +eventids1.o: $(hdrdir)/ruby/internal/has/extension.h +eventids1.o: $(hdrdir)/ruby/internal/has/feature.h +eventids1.o: $(hdrdir)/ruby/internal/has/warning.h +eventids1.o: $(hdrdir)/ruby/internal/intern/array.h +eventids1.o: $(hdrdir)/ruby/internal/intern/bignum.h +eventids1.o: $(hdrdir)/ruby/internal/intern/class.h +eventids1.o: $(hdrdir)/ruby/internal/intern/compar.h +eventids1.o: $(hdrdir)/ruby/internal/intern/complex.h +eventids1.o: $(hdrdir)/ruby/internal/intern/cont.h +eventids1.o: $(hdrdir)/ruby/internal/intern/dir.h +eventids1.o: $(hdrdir)/ruby/internal/intern/enum.h +eventids1.o: $(hdrdir)/ruby/internal/intern/enumerator.h +eventids1.o: $(hdrdir)/ruby/internal/intern/error.h +eventids1.o: $(hdrdir)/ruby/internal/intern/eval.h +eventids1.o: $(hdrdir)/ruby/internal/intern/file.h +eventids1.o: $(hdrdir)/ruby/internal/intern/hash.h +eventids1.o: $(hdrdir)/ruby/internal/intern/io.h +eventids1.o: $(hdrdir)/ruby/internal/intern/load.h +eventids1.o: $(hdrdir)/ruby/internal/intern/marshal.h +eventids1.o: $(hdrdir)/ruby/internal/intern/numeric.h +eventids1.o: $(hdrdir)/ruby/internal/intern/object.h +eventids1.o: $(hdrdir)/ruby/internal/intern/parse.h +eventids1.o: $(hdrdir)/ruby/internal/intern/proc.h +eventids1.o: $(hdrdir)/ruby/internal/intern/process.h +eventids1.o: $(hdrdir)/ruby/internal/intern/random.h +eventids1.o: $(hdrdir)/ruby/internal/intern/range.h +eventids1.o: $(hdrdir)/ruby/internal/intern/rational.h +eventids1.o: $(hdrdir)/ruby/internal/intern/re.h +eventids1.o: $(hdrdir)/ruby/internal/intern/ruby.h +eventids1.o: $(hdrdir)/ruby/internal/intern/select.h +eventids1.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +eventids1.o: $(hdrdir)/ruby/internal/intern/signal.h +eventids1.o: $(hdrdir)/ruby/internal/intern/sprintf.h +eventids1.o: $(hdrdir)/ruby/internal/intern/string.h +eventids1.o: $(hdrdir)/ruby/internal/intern/struct.h +eventids1.o: $(hdrdir)/ruby/internal/intern/thread.h +eventids1.o: $(hdrdir)/ruby/internal/intern/time.h +eventids1.o: $(hdrdir)/ruby/internal/intern/variable.h +eventids1.o: $(hdrdir)/ruby/internal/intern/vm.h +eventids1.o: $(hdrdir)/ruby/internal/interpreter.h +eventids1.o: $(hdrdir)/ruby/internal/iterator.h +eventids1.o: $(hdrdir)/ruby/internal/memory.h +eventids1.o: $(hdrdir)/ruby/internal/method.h +eventids1.o: $(hdrdir)/ruby/internal/module.h +eventids1.o: $(hdrdir)/ruby/internal/newobj.h +eventids1.o: $(hdrdir)/ruby/internal/scan_args.h +eventids1.o: $(hdrdir)/ruby/internal/special_consts.h +eventids1.o: $(hdrdir)/ruby/internal/static_assert.h +eventids1.o: $(hdrdir)/ruby/internal/stdalign.h +eventids1.o: $(hdrdir)/ruby/internal/stdbool.h +eventids1.o: $(hdrdir)/ruby/internal/stdckdint.h +eventids1.o: $(hdrdir)/ruby/internal/symbol.h +eventids1.o: $(hdrdir)/ruby/internal/value.h +eventids1.o: $(hdrdir)/ruby/internal/value_type.h +eventids1.o: $(hdrdir)/ruby/internal/variable.h +eventids1.o: $(hdrdir)/ruby/internal/warning_push.h +eventids1.o: $(hdrdir)/ruby/internal/xmalloc.h +eventids1.o: $(hdrdir)/ruby/missing.h +eventids1.o: $(hdrdir)/ruby/ruby.h +eventids1.o: $(hdrdir)/ruby/st.h +eventids1.o: $(hdrdir)/ruby/subst.h +eventids1.o: eventids1.h +eventids1.o: {$(VPATH)}eventids1.c +eventids1.o: {$(VPATH)}eventids1.h +eventids2.o: $(RUBY_EXTCONF_H) +eventids2.o: $(arch_hdrdir)/ruby/config.h +eventids2.o: $(hdrdir)/ruby/assert.h +eventids2.o: $(hdrdir)/ruby/backward.h +eventids2.o: $(hdrdir)/ruby/backward/2/assume.h +eventids2.o: $(hdrdir)/ruby/backward/2/attributes.h +eventids2.o: $(hdrdir)/ruby/backward/2/bool.h +eventids2.o: $(hdrdir)/ruby/backward/2/inttypes.h +eventids2.o: $(hdrdir)/ruby/backward/2/limits.h +eventids2.o: $(hdrdir)/ruby/backward/2/long_long.h +eventids2.o: $(hdrdir)/ruby/backward/2/stdalign.h +eventids2.o: $(hdrdir)/ruby/backward/2/stdarg.h +eventids2.o: $(hdrdir)/ruby/defines.h +eventids2.o: $(hdrdir)/ruby/encoding.h +eventids2.o: $(hdrdir)/ruby/intern.h +eventids2.o: $(hdrdir)/ruby/internal/abi.h +eventids2.o: $(hdrdir)/ruby/internal/anyargs.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/char.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/double.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/int.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/long.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/short.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +eventids2.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +eventids2.o: $(hdrdir)/ruby/internal/assume.h +eventids2.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +eventids2.o: $(hdrdir)/ruby/internal/attr/artificial.h +eventids2.o: $(hdrdir)/ruby/internal/attr/cold.h +eventids2.o: $(hdrdir)/ruby/internal/attr/const.h +eventids2.o: $(hdrdir)/ruby/internal/attr/constexpr.h +eventids2.o: $(hdrdir)/ruby/internal/attr/deprecated.h +eventids2.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +eventids2.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +eventids2.o: $(hdrdir)/ruby/internal/attr/error.h +eventids2.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +eventids2.o: $(hdrdir)/ruby/internal/attr/forceinline.h +eventids2.o: $(hdrdir)/ruby/internal/attr/format.h +eventids2.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +eventids2.o: $(hdrdir)/ruby/internal/attr/noalias.h +eventids2.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +eventids2.o: $(hdrdir)/ruby/internal/attr/noexcept.h +eventids2.o: $(hdrdir)/ruby/internal/attr/noinline.h +eventids2.o: $(hdrdir)/ruby/internal/attr/nonnull.h +eventids2.o: $(hdrdir)/ruby/internal/attr/noreturn.h +eventids2.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +eventids2.o: $(hdrdir)/ruby/internal/attr/pure.h +eventids2.o: $(hdrdir)/ruby/internal/attr/restrict.h +eventids2.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +eventids2.o: $(hdrdir)/ruby/internal/attr/warning.h +eventids2.o: $(hdrdir)/ruby/internal/attr/weakref.h +eventids2.o: $(hdrdir)/ruby/internal/cast.h +eventids2.o: $(hdrdir)/ruby/internal/compiler_is.h +eventids2.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +eventids2.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +eventids2.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +eventids2.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +eventids2.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +eventids2.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +eventids2.o: $(hdrdir)/ruby/internal/compiler_since.h +eventids2.o: $(hdrdir)/ruby/internal/config.h +eventids2.o: $(hdrdir)/ruby/internal/constant_p.h +eventids2.o: $(hdrdir)/ruby/internal/core.h +eventids2.o: $(hdrdir)/ruby/internal/core/rarray.h +eventids2.o: $(hdrdir)/ruby/internal/core/rbasic.h +eventids2.o: $(hdrdir)/ruby/internal/core/rbignum.h +eventids2.o: $(hdrdir)/ruby/internal/core/rclass.h +eventids2.o: $(hdrdir)/ruby/internal/core/rdata.h +eventids2.o: $(hdrdir)/ruby/internal/core/rfile.h +eventids2.o: $(hdrdir)/ruby/internal/core/rhash.h +eventids2.o: $(hdrdir)/ruby/internal/core/robject.h +eventids2.o: $(hdrdir)/ruby/internal/core/rregexp.h +eventids2.o: $(hdrdir)/ruby/internal/core/rstring.h +eventids2.o: $(hdrdir)/ruby/internal/core/rstruct.h +eventids2.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +eventids2.o: $(hdrdir)/ruby/internal/ctype.h +eventids2.o: $(hdrdir)/ruby/internal/dllexport.h +eventids2.o: $(hdrdir)/ruby/internal/dosish.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/coderange.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/ctype.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/encoding.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/pathname.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/re.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/sprintf.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/string.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/symbol.h +eventids2.o: $(hdrdir)/ruby/internal/encoding/transcode.h +eventids2.o: $(hdrdir)/ruby/internal/error.h +eventids2.o: $(hdrdir)/ruby/internal/eval.h +eventids2.o: $(hdrdir)/ruby/internal/event.h +eventids2.o: $(hdrdir)/ruby/internal/fl_type.h +eventids2.o: $(hdrdir)/ruby/internal/gc.h +eventids2.o: $(hdrdir)/ruby/internal/glob.h +eventids2.o: $(hdrdir)/ruby/internal/globals.h +eventids2.o: $(hdrdir)/ruby/internal/has/attribute.h +eventids2.o: $(hdrdir)/ruby/internal/has/builtin.h +eventids2.o: $(hdrdir)/ruby/internal/has/c_attribute.h +eventids2.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +eventids2.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +eventids2.o: $(hdrdir)/ruby/internal/has/extension.h +eventids2.o: $(hdrdir)/ruby/internal/has/feature.h +eventids2.o: $(hdrdir)/ruby/internal/has/warning.h +eventids2.o: $(hdrdir)/ruby/internal/intern/array.h +eventids2.o: $(hdrdir)/ruby/internal/intern/bignum.h +eventids2.o: $(hdrdir)/ruby/internal/intern/class.h +eventids2.o: $(hdrdir)/ruby/internal/intern/compar.h +eventids2.o: $(hdrdir)/ruby/internal/intern/complex.h +eventids2.o: $(hdrdir)/ruby/internal/intern/cont.h +eventids2.o: $(hdrdir)/ruby/internal/intern/dir.h +eventids2.o: $(hdrdir)/ruby/internal/intern/enum.h +eventids2.o: $(hdrdir)/ruby/internal/intern/enumerator.h +eventids2.o: $(hdrdir)/ruby/internal/intern/error.h +eventids2.o: $(hdrdir)/ruby/internal/intern/eval.h +eventids2.o: $(hdrdir)/ruby/internal/intern/file.h +eventids2.o: $(hdrdir)/ruby/internal/intern/hash.h +eventids2.o: $(hdrdir)/ruby/internal/intern/io.h +eventids2.o: $(hdrdir)/ruby/internal/intern/load.h +eventids2.o: $(hdrdir)/ruby/internal/intern/marshal.h +eventids2.o: $(hdrdir)/ruby/internal/intern/numeric.h +eventids2.o: $(hdrdir)/ruby/internal/intern/object.h +eventids2.o: $(hdrdir)/ruby/internal/intern/parse.h +eventids2.o: $(hdrdir)/ruby/internal/intern/proc.h +eventids2.o: $(hdrdir)/ruby/internal/intern/process.h +eventids2.o: $(hdrdir)/ruby/internal/intern/random.h +eventids2.o: $(hdrdir)/ruby/internal/intern/range.h +eventids2.o: $(hdrdir)/ruby/internal/intern/rational.h +eventids2.o: $(hdrdir)/ruby/internal/intern/re.h +eventids2.o: $(hdrdir)/ruby/internal/intern/ruby.h +eventids2.o: $(hdrdir)/ruby/internal/intern/select.h +eventids2.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +eventids2.o: $(hdrdir)/ruby/internal/intern/signal.h +eventids2.o: $(hdrdir)/ruby/internal/intern/sprintf.h +eventids2.o: $(hdrdir)/ruby/internal/intern/string.h +eventids2.o: $(hdrdir)/ruby/internal/intern/struct.h +eventids2.o: $(hdrdir)/ruby/internal/intern/thread.h +eventids2.o: $(hdrdir)/ruby/internal/intern/time.h +eventids2.o: $(hdrdir)/ruby/internal/intern/variable.h +eventids2.o: $(hdrdir)/ruby/internal/intern/vm.h +eventids2.o: $(hdrdir)/ruby/internal/interpreter.h +eventids2.o: $(hdrdir)/ruby/internal/iterator.h +eventids2.o: $(hdrdir)/ruby/internal/memory.h +eventids2.o: $(hdrdir)/ruby/internal/method.h +eventids2.o: $(hdrdir)/ruby/internal/module.h +eventids2.o: $(hdrdir)/ruby/internal/newobj.h +eventids2.o: $(hdrdir)/ruby/internal/scan_args.h +eventids2.o: $(hdrdir)/ruby/internal/special_consts.h +eventids2.o: $(hdrdir)/ruby/internal/static_assert.h +eventids2.o: $(hdrdir)/ruby/internal/stdalign.h +eventids2.o: $(hdrdir)/ruby/internal/stdbool.h +eventids2.o: $(hdrdir)/ruby/internal/stdckdint.h +eventids2.o: $(hdrdir)/ruby/internal/symbol.h +eventids2.o: $(hdrdir)/ruby/internal/value.h +eventids2.o: $(hdrdir)/ruby/internal/value_type.h +eventids2.o: $(hdrdir)/ruby/internal/variable.h +eventids2.o: $(hdrdir)/ruby/internal/warning_push.h +eventids2.o: $(hdrdir)/ruby/internal/xmalloc.h +eventids2.o: $(hdrdir)/ruby/missing.h +eventids2.o: $(hdrdir)/ruby/onigmo.h +eventids2.o: $(hdrdir)/ruby/oniguruma.h +eventids2.o: $(hdrdir)/ruby/ruby.h +eventids2.o: $(hdrdir)/ruby/st.h +eventids2.o: $(hdrdir)/ruby/subst.h +eventids2.o: $(top_srcdir)/internal.h +eventids2.o: $(top_srcdir)/internal/static_assert.h +eventids2.o: $(top_srcdir)/rubyparser.h +eventids2.o: eventids2.c +eventids2.o: eventids2.h +eventids2.o: {$(VPATH)}eventids2table.c +eventids2.o: {$(VPATH)}parse.h ripper.o: $(RUBY_EXTCONF_H) ripper.o: $(arch_hdrdir)/ruby/config.h ripper.o: $(hdrdir)/ruby.h ripper.o: $(hdrdir)/ruby/assert.h +ripper.o: $(hdrdir)/ruby/atomic.h ripper.o: $(hdrdir)/ruby/backward.h ripper.o: $(hdrdir)/ruby/backward/2/assume.h ripper.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -101,6 +447,7 @@ ripper.o: $(hdrdir)/ruby/internal/attr/noexcept.h ripper.o: $(hdrdir)/ruby/internal/attr/noinline.h ripper.o: $(hdrdir)/ruby/internal/attr/nonnull.h ripper.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ripper.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ripper.o: $(hdrdir)/ruby/internal/attr/pure.h ripper.o: $(hdrdir)/ruby/internal/attr/restrict.h ripper.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -169,7 +516,6 @@ ripper.o: $(hdrdir)/ruby/internal/intern/enumerator.h ripper.o: $(hdrdir)/ruby/internal/intern/error.h ripper.o: $(hdrdir)/ruby/internal/intern/eval.h ripper.o: $(hdrdir)/ruby/internal/intern/file.h -ripper.o: $(hdrdir)/ruby/internal/intern/gc.h ripper.o: $(hdrdir)/ruby/internal/intern/hash.h ripper.o: $(hdrdir)/ruby/internal/intern/io.h ripper.o: $(hdrdir)/ruby/internal/intern/load.h @@ -200,12 +546,12 @@ ripper.o: $(hdrdir)/ruby/internal/memory.h ripper.o: $(hdrdir)/ruby/internal/method.h ripper.o: $(hdrdir)/ruby/internal/module.h ripper.o: $(hdrdir)/ruby/internal/newobj.h -ripper.o: $(hdrdir)/ruby/internal/rgengc.h ripper.o: $(hdrdir)/ruby/internal/scan_args.h ripper.o: $(hdrdir)/ruby/internal/special_consts.h ripper.o: $(hdrdir)/ruby/internal/static_assert.h ripper.o: $(hdrdir)/ruby/internal/stdalign.h ripper.o: $(hdrdir)/ruby/internal/stdbool.h +ripper.o: $(hdrdir)/ruby/internal/stdckdint.h ripper.o: $(hdrdir)/ruby/internal/symbol.h ripper.o: $(hdrdir)/ruby/internal/value.h ripper.o: $(hdrdir)/ruby/internal/value_type.h @@ -221,16 +567,24 @@ ripper.o: $(hdrdir)/ruby/regex.h ripper.o: $(hdrdir)/ruby/ruby.h ripper.o: $(hdrdir)/ruby/st.h ripper.o: $(hdrdir)/ruby/subst.h +ripper.o: $(hdrdir)/ruby/thread_native.h ripper.o: $(hdrdir)/ruby/util.h +ripper.o: $(hdrdir)/ruby/version.h +ripper.o: $(top_srcdir)/ccan/check_type/check_type.h +ripper.o: $(top_srcdir)/ccan/container_of/container_of.h +ripper.o: $(top_srcdir)/ccan/list/list.h +ripper.o: $(top_srcdir)/ccan/str/str.h ripper.o: $(top_srcdir)/constant.h ripper.o: $(top_srcdir)/id_table.h ripper.o: $(top_srcdir)/internal.h ripper.o: $(top_srcdir)/internal/array.h +ripper.o: $(top_srcdir)/internal/basic_operators.h ripper.o: $(top_srcdir)/internal/bignum.h ripper.o: $(top_srcdir)/internal/bits.h ripper.o: $(top_srcdir)/internal/compile.h ripper.o: $(top_srcdir)/internal/compilers.h ripper.o: $(top_srcdir)/internal/complex.h +ripper.o: $(top_srcdir)/internal/encoding.h ripper.o: $(top_srcdir)/internal/error.h ripper.o: $(top_srcdir)/internal/fixnum.h ripper.o: $(top_srcdir)/internal/gc.h @@ -241,6 +595,8 @@ ripper.o: $(top_srcdir)/internal/numeric.h ripper.o: $(top_srcdir)/internal/parse.h ripper.o: $(top_srcdir)/internal/rational.h ripper.o: $(top_srcdir)/internal/re.h +ripper.o: $(top_srcdir)/internal/ruby_parser.h +ripper.o: $(top_srcdir)/internal/sanitizers.h ripper.o: $(top_srcdir)/internal/serial.h ripper.o: $(top_srcdir)/internal/static_assert.h ripper.o: $(top_srcdir)/internal/string.h @@ -249,14 +605,25 @@ ripper.o: $(top_srcdir)/internal/thread.h ripper.o: $(top_srcdir)/internal/variable.h ripper.o: $(top_srcdir)/internal/vm.h ripper.o: $(top_srcdir)/internal/warnings.h +ripper.o: $(top_srcdir)/method.h ripper.o: $(top_srcdir)/node.h +ripper.o: $(top_srcdir)/parser_node.h +ripper.o: $(top_srcdir)/parser_st.h ripper.o: $(top_srcdir)/regenc.h ripper.o: $(top_srcdir)/ruby_assert.h +ripper.o: $(top_srcdir)/ruby_atomic.h +ripper.o: $(top_srcdir)/rubyparser.h ripper.o: $(top_srcdir)/shape.h ripper.o: $(top_srcdir)/symbol.h +ripper.o: $(top_srcdir)/thread_pthread.h +ripper.o: $(top_srcdir)/vm_core.h +ripper.o: $(top_srcdir)/vm_opts.h ripper.o: ../../probes.h +ripper.o: eventids1.h ripper.o: eventids2.c +ripper.o: eventids2.h ripper.o: ripper.y +ripper.o: ripper_init.h ripper.o: {$(VPATH)}eventids1.c ripper.o: {$(VPATH)}eventids2table.c ripper.o: {$(VPATH)}id.h @@ -264,4 +631,198 @@ ripper.o: {$(VPATH)}lex.c ripper.o: {$(VPATH)}parse.h ripper.o: {$(VPATH)}probes.dmyh ripper.o: {$(VPATH)}ripper.c +ripper_init.o: $(RUBY_EXTCONF_H) +ripper_init.o: $(arch_hdrdir)/ruby/config.h +ripper_init.o: $(hdrdir)/ruby/assert.h +ripper_init.o: $(hdrdir)/ruby/backward.h +ripper_init.o: $(hdrdir)/ruby/backward/2/assume.h +ripper_init.o: $(hdrdir)/ruby/backward/2/attributes.h +ripper_init.o: $(hdrdir)/ruby/backward/2/bool.h +ripper_init.o: $(hdrdir)/ruby/backward/2/gcc_version_since.h +ripper_init.o: $(hdrdir)/ruby/backward/2/inttypes.h +ripper_init.o: $(hdrdir)/ruby/backward/2/limits.h +ripper_init.o: $(hdrdir)/ruby/backward/2/long_long.h +ripper_init.o: $(hdrdir)/ruby/backward/2/stdalign.h +ripper_init.o: $(hdrdir)/ruby/backward/2/stdarg.h +ripper_init.o: $(hdrdir)/ruby/defines.h +ripper_init.o: $(hdrdir)/ruby/encoding.h +ripper_init.o: $(hdrdir)/ruby/intern.h +ripper_init.o: $(hdrdir)/ruby/internal/abi.h +ripper_init.o: $(hdrdir)/ruby/internal/anyargs.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/char.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/double.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/int.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/long.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/short.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h +ripper_init.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h +ripper_init.o: $(hdrdir)/ruby/internal/assume.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/alloc_size.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/artificial.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/cold.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/const.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/constexpr.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/deprecated.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/error.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/flag_enum.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/forceinline.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/format.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/noalias.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/nodiscard.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/noexcept.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/noinline.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/nonnull.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/pure.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/restrict.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/warning.h +ripper_init.o: $(hdrdir)/ruby/internal/attr/weakref.h +ripper_init.o: $(hdrdir)/ruby/internal/cast.h +ripper_init.o: $(hdrdir)/ruby/internal/compiler_is.h +ripper_init.o: $(hdrdir)/ruby/internal/compiler_is/apple.h +ripper_init.o: $(hdrdir)/ruby/internal/compiler_is/clang.h +ripper_init.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h +ripper_init.o: $(hdrdir)/ruby/internal/compiler_is/intel.h +ripper_init.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h +ripper_init.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h +ripper_init.o: $(hdrdir)/ruby/internal/compiler_since.h +ripper_init.o: $(hdrdir)/ruby/internal/config.h +ripper_init.o: $(hdrdir)/ruby/internal/constant_p.h +ripper_init.o: $(hdrdir)/ruby/internal/core.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rarray.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rbasic.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rbignum.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rclass.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rdata.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rfile.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rhash.h +ripper_init.o: $(hdrdir)/ruby/internal/core/robject.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rregexp.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rstring.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rstruct.h +ripper_init.o: $(hdrdir)/ruby/internal/core/rtypeddata.h +ripper_init.o: $(hdrdir)/ruby/internal/ctype.h +ripper_init.o: $(hdrdir)/ruby/internal/dllexport.h +ripper_init.o: $(hdrdir)/ruby/internal/dosish.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/coderange.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/ctype.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/encoding.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/pathname.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/re.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/sprintf.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/string.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/symbol.h +ripper_init.o: $(hdrdir)/ruby/internal/encoding/transcode.h +ripper_init.o: $(hdrdir)/ruby/internal/error.h +ripper_init.o: $(hdrdir)/ruby/internal/eval.h +ripper_init.o: $(hdrdir)/ruby/internal/event.h +ripper_init.o: $(hdrdir)/ruby/internal/fl_type.h +ripper_init.o: $(hdrdir)/ruby/internal/gc.h +ripper_init.o: $(hdrdir)/ruby/internal/glob.h +ripper_init.o: $(hdrdir)/ruby/internal/globals.h +ripper_init.o: $(hdrdir)/ruby/internal/has/attribute.h +ripper_init.o: $(hdrdir)/ruby/internal/has/builtin.h +ripper_init.o: $(hdrdir)/ruby/internal/has/c_attribute.h +ripper_init.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h +ripper_init.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h +ripper_init.o: $(hdrdir)/ruby/internal/has/extension.h +ripper_init.o: $(hdrdir)/ruby/internal/has/feature.h +ripper_init.o: $(hdrdir)/ruby/internal/has/warning.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/array.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/bignum.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/class.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/compar.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/complex.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/cont.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/dir.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/enum.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/enumerator.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/error.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/eval.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/file.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/hash.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/io.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/load.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/marshal.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/numeric.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/object.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/parse.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/proc.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/process.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/random.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/range.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/rational.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/re.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/ruby.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/select.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/select/largesize.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/signal.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/sprintf.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/string.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/struct.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/thread.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/time.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/variable.h +ripper_init.o: $(hdrdir)/ruby/internal/intern/vm.h +ripper_init.o: $(hdrdir)/ruby/internal/interpreter.h +ripper_init.o: $(hdrdir)/ruby/internal/iterator.h +ripper_init.o: $(hdrdir)/ruby/internal/memory.h +ripper_init.o: $(hdrdir)/ruby/internal/method.h +ripper_init.o: $(hdrdir)/ruby/internal/module.h +ripper_init.o: $(hdrdir)/ruby/internal/newobj.h +ripper_init.o: $(hdrdir)/ruby/internal/scan_args.h +ripper_init.o: $(hdrdir)/ruby/internal/special_consts.h +ripper_init.o: $(hdrdir)/ruby/internal/static_assert.h +ripper_init.o: $(hdrdir)/ruby/internal/stdalign.h +ripper_init.o: $(hdrdir)/ruby/internal/stdbool.h +ripper_init.o: $(hdrdir)/ruby/internal/stdckdint.h +ripper_init.o: $(hdrdir)/ruby/internal/symbol.h +ripper_init.o: $(hdrdir)/ruby/internal/value.h +ripper_init.o: $(hdrdir)/ruby/internal/value_type.h +ripper_init.o: $(hdrdir)/ruby/internal/variable.h +ripper_init.o: $(hdrdir)/ruby/internal/warning_push.h +ripper_init.o: $(hdrdir)/ruby/internal/xmalloc.h +ripper_init.o: $(hdrdir)/ruby/missing.h +ripper_init.o: $(hdrdir)/ruby/onigmo.h +ripper_init.o: $(hdrdir)/ruby/oniguruma.h +ripper_init.o: $(hdrdir)/ruby/ruby.h +ripper_init.o: $(hdrdir)/ruby/st.h +ripper_init.o: $(hdrdir)/ruby/subst.h +ripper_init.o: $(top_srcdir)/internal.h +ripper_init.o: $(top_srcdir)/internal/array.h +ripper_init.o: $(top_srcdir)/internal/bignum.h +ripper_init.o: $(top_srcdir)/internal/bits.h +ripper_init.o: $(top_srcdir)/internal/compilers.h +ripper_init.o: $(top_srcdir)/internal/complex.h +ripper_init.o: $(top_srcdir)/internal/fixnum.h +ripper_init.o: $(top_srcdir)/internal/imemo.h +ripper_init.o: $(top_srcdir)/internal/numeric.h +ripper_init.o: $(top_srcdir)/internal/parse.h +ripper_init.o: $(top_srcdir)/internal/rational.h +ripper_init.o: $(top_srcdir)/internal/ruby_parser.h +ripper_init.o: $(top_srcdir)/internal/serial.h +ripper_init.o: $(top_srcdir)/internal/static_assert.h +ripper_init.o: $(top_srcdir)/internal/vm.h +ripper_init.o: $(top_srcdir)/node.h +ripper_init.o: $(top_srcdir)/ruby_assert.h +ripper_init.o: $(top_srcdir)/rubyparser.h +ripper_init.o: eventids1.h +ripper_init.o: eventids2.h +ripper_init.o: ripper_init.h +ripper_init.o: {$(VPATH)}parse.h +ripper_init.o: {$(VPATH)}ripper_init.c # AUTOGENERATED DEPENDENCIES END diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c index 05687497ac..439663f0fd 100644 --- a/ext/ripper/eventids2.c +++ b/ext/ripper/eventids2.c @@ -1,3 +1,11 @@ +#include "ruby/ruby.h" +#include "rubyparser.h" +#define YYSTYPE_IS_DECLARED +#include "parse.h" +#include "eventids2.h" +#include "internal.h" +#include "internal/static_assert.h" + typedef struct { ID ripper_id_backref; ID ripper_id_backtick; @@ -57,7 +65,9 @@ static ripper_scanner_ids_t ripper_scanner_ids; #include "eventids2table.c" -static void +STATIC_ASSERT(eventids2_table_size, RIPPER_EVENTIDS2_TABLE_SIZE == sizeof(ripper_scanner_ids)/sizeof(ID)); + +void ripper_init_eventids2(void) { #define set_id2(name) ripper_scanner_ids.ripper_id_##name = rb_intern_const("on_"#name) @@ -118,7 +128,7 @@ ripper_init_eventids2(void) STATIC_ASSERT(k__END___range, k__END__ < SHRT_MAX); STATIC_ASSERT(ripper_scanner_ids_size, sizeof(ripper_scanner_ids) < SHRT_MAX); -static ID +ID ripper_token2eventid(enum yytokentype tok) { #define O(member) (int)offsetof(ripper_scanner_ids_t, ripper_id_##member)+1 diff --git a/ext/ripper/eventids2.h b/ext/ripper/eventids2.h new file mode 100644 index 0000000000..49e46432b9 --- /dev/null +++ b/ext/ripper/eventids2.h @@ -0,0 +1,8 @@ +#ifndef RIPPER_EVENTIDS2 +#define RIPPER_EVENTIDS2 + +void ripper_init_eventids2(void); +void ripper_init_eventids2_table(VALUE self); +ID ripper_token2eventid(enum yytokentype tok); + +#endif /* RIPPER_EVENTIDS2 */ diff --git a/ext/ripper/extconf.rb b/ext/ripper/extconf.rb index 65cb5030d3..c3c56c27c5 100644 --- a/ext/ripper/extconf.rb +++ b/ext/ripper/extconf.rb @@ -5,23 +5,14 @@ require 'mkmf' require 'rbconfig' def main - yacc = ENV["YACC"] || "bison" - - unless find_executable(yacc) - unless File.exist?('ripper.c') or File.exist?("#{$srcdir}/ripper.c") - raise 'missing bison; abort' - end - end - $objs = %w(ripper.o) - $distcleanfiles.concat %w(ripper.y ripper.c eventids1.c eventids2table.c) + $objs = %w(eventids1.o eventids2.o ripper.o ripper_init.o) + $distcleanfiles.concat %w(ripper.y ripper.c eventids1.c eventids1.h eventids2table.c ripper_init.c) $cleanfiles.concat %w(ripper.E ripper.output y.output .eventids2-check) $defs << '-DRIPPER' $defs << '-DRIPPER_DEBUG' if $debug $VPATH << '$(topdir)' << '$(top_srcdir)' $INCFLAGS << ' -I$(topdir) -I$(top_srcdir)' - create_makefile 'ripper' do |conf| - conf << "BISON = #{yacc}" - end + create_makefile 'ripper' end main diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb index 19c59e2ccc..6a3c04af30 100644 --- a/ext/ripper/lib/ripper/lexer.rb +++ b/ext/ripper/lib/ripper/lexer.rb @@ -228,7 +228,7 @@ class Ripper def on_heredoc_end(tok) @buf.push Elem.new([lineno(), column()], __callee__, tok, state()) - @buf = @stack.pop + @buf = @stack.pop unless @stack.empty? end def _push_token(tok) diff --git a/ext/ripper/ripper_init.c.tmpl b/ext/ripper/ripper_init.c.tmpl new file mode 100644 index 0000000000..21f29bd79a --- /dev/null +++ b/ext/ripper/ripper_init.c.tmpl @@ -0,0 +1,672 @@ +%# -*- c -*- +#include "ruby/ruby.h" +#include "ruby/encoding.h" +#include "internal.h" +#include "rubyparser.h" +#define YYSTYPE_IS_DECLARED +#include "parse.h" +#include "internal/parse.h" +#include "internal/ruby_parser.h" +#include "node.h" +#include "eventids1.h" +#include "eventids2.h" +#include "ripper_init.h" + +#define STR_NEW2(ptr) rb_enc_str_new((ptr),strlen(ptr),rb_ruby_parser_enc(p)) +#define RIPPER_VERSION "0.1.0" + +ID id_warn, id_warning, id_gets, id_assoc; + +enum lex_type { + lex_type_str, + lex_type_io, + lex_type_generic, +}; + +struct ripper { + rb_parser_t *p; + enum lex_type type; + union { + struct lex_pointer_string ptr_str; + VALUE val; + } data; +}; + +static void +ripper_parser_mark2(void *ptr) +{ + struct ripper *r = (struct ripper*)ptr; + if (r->p) { + ripper_parser_mark(r->p); + + switch (r->type) { + case lex_type_str: + rb_gc_mark(r->data.ptr_str.str); + break; + case lex_type_io: + rb_gc_mark(r->data.val); + break; + case lex_type_generic: + rb_gc_mark(r->data.val); + break; + } + } +} + +static void +ripper_parser_free2(void *ptr) +{ + struct ripper *r = (struct ripper*)ptr; + if (r->p) ripper_parser_free(r->p); + xfree(r); +} + +static size_t +ripper_parser_memsize2(const void *ptr) +{ + struct ripper *r = (struct ripper*)ptr; + return (r->p) ? ripper_parser_memsize(r->p) : 0; +} + +static const rb_data_type_t parser_data_type = { + "ripper", + { + ripper_parser_mark2, + ripper_parser_free2, + ripper_parser_memsize2, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY +}; + +static rb_parser_string_t * +ripper_lex_get_generic(struct parser_params *p, rb_parser_input_data input, int line_count) +{ + VALUE src = (VALUE)input; + VALUE line = rb_funcallv_public(src, id_gets, 0, 0); + if (NIL_P(line)) return 0; + if (!RB_TYPE_P(line, T_STRING)) { + rb_raise(rb_eTypeError, + "gets returned %"PRIsVALUE" (expected String or nil)", + rb_obj_class(line)); + } + return rb_str_to_parser_string(p, line); +} + +void +ripper_compile_error(struct parser_params *p, const char *fmt, ...) +{ + VALUE str; + va_list args; + + va_start(args, fmt); + str = rb_vsprintf(fmt, args); + va_end(args); + rb_funcall(ripper_value(p), rb_intern("compile_error"), 1, str); + ripper_error(p); +} + +static rb_parser_string_t * +ripper_lex_io_get(struct parser_params *p, rb_parser_input_data input, int line_count) +{ + VALUE src = (VALUE)input; + VALUE line = rb_io_gets(src); + if (NIL_P(line)) return 0; + return rb_str_to_parser_string(p, line); +} + +static rb_parser_string_t * +ripper_lex_get_str(struct parser_params *p, rb_parser_input_data input, int line_count) +{ + return rb_parser_lex_get_str(p, (struct lex_pointer_string *)input); +} + +static VALUE +ripper_s_allocate(VALUE klass) +{ + struct ripper *r; + + VALUE self = TypedData_Make_Struct(klass, struct ripper, + &parser_data_type, r); + +#ifdef UNIVERSAL_PARSER + const rb_parser_config_t *config = rb_ruby_parser_config(); + r->p = rb_ripper_parser_params_allocate(config); +#else + r->p = rb_ruby_ripper_parser_allocate(); +#endif + rb_ruby_parser_set_value(r->p, self); + return self; +} + +static struct parser_params * +ripper_parser_params(VALUE self, bool initialized) +{ + struct ripper *r; + struct parser_params *p; + + TypedData_Get_Struct(self, struct ripper, &parser_data_type, r); + p = r->p; + if (initialized && !rb_ruby_ripper_initialized_p(p)) { + rb_raise(rb_eArgError, "method called for uninitialized object"); + } + return p; +} + +/* + * call-seq: + * ripper.error? -> Boolean + * + * Return true if parsed source has errors. + */ +static VALUE +ripper_error_p(VALUE vparser) +{ + struct parser_params *p = ripper_parser_params(vparser, false); + + return RBOOL(rb_ruby_parser_error_p(p)); +} + +/* + * call-seq: + * ripper.end_seen? -> Boolean + * + * Return true if parsed source ended by +\_\_END\_\_+. + */ +static VALUE +ripper_parser_end_seen_p(VALUE vparser) +{ + struct parser_params *p = ripper_parser_params(vparser, false); + + return RBOOL(rb_ruby_parser_end_seen_p(p)); +} + +/* + * call-seq: + * ripper.encoding -> encoding + * + * Return encoding of the source. + */ +static VALUE +ripper_parser_encoding(VALUE vparser) +{ + struct parser_params *p = ripper_parser_params(vparser, false); + + return rb_enc_from_encoding(rb_ruby_parser_encoding(p)); +} + +/* + * call-seq: + * ripper.yydebug -> true or false + * + * Get yydebug. + */ +static VALUE +ripper_parser_get_yydebug(VALUE self) +{ + struct parser_params *p = ripper_parser_params(self, false); + + return RBOOL(rb_ruby_parser_get_yydebug(p)); +} + +/* + * call-seq: + * ripper.yydebug = flag + * + * Set yydebug. + */ +static VALUE +ripper_parser_set_yydebug(VALUE self, VALUE flag) +{ + struct parser_params *p = ripper_parser_params(self, false); + + rb_ruby_parser_set_yydebug(p, RTEST(flag)); + return flag; +} + +/* + * call-seq: + * ripper.debug_output -> obj + * + * Get debug output. + */ +static VALUE +ripper_parser_get_debug_output(VALUE self) +{ + struct parser_params *p = ripper_parser_params(self, false); + + return rb_ruby_parser_debug_output(p); +} + +/* + * call-seq: + * ripper.debug_output = obj + * + * Set debug output. + */ +static VALUE +ripper_parser_set_debug_output(VALUE self, VALUE output) +{ + struct parser_params *p = ripper_parser_params(self, false); + + rb_ruby_parser_set_debug_output(p, output); + return output; +} + +#ifdef UNIVERSAL_PARSER +struct dedent_string_arg { + struct parser_params *p; + VALUE input; + VALUE width; +}; + +static VALUE +parser_dedent_string0(VALUE a) +{ + struct dedent_string_arg *arg = (void *)a; + int wid, col; + + StringValue(arg->input); + wid = NUM2UINT(arg->width); + col = rb_ruby_ripper_dedent_string(arg->p, arg->input, wid); + return INT2NUM(col); +} + +static VALUE +parser_free(VALUE a) +{ + struct parser_params *p = (void *)a; + + rb_ruby_parser_free(p); + return Qnil; +} +#endif + +/* + * call-seq: + * Ripper.dedent_string(input, width) -> Integer + * + * USE OF RIPPER LIBRARY ONLY. + * + * Strips up to +width+ leading whitespaces from +input+, + * and returns the stripped column width. + */ +#ifdef UNIVERSAL_PARSER +static VALUE +parser_dedent_string(VALUE self, VALUE input, VALUE width) +{ + struct parser_params *p; + struct dedent_string_arg args; + + p = rb_parser_params_new(); + + args.p = p; + args.input = input; + args.width = width; + return rb_ensure(parser_dedent_string0, (VALUE)&args, parser_free, (VALUE)p); +} +#else +static VALUE +parser_dedent_string(VALUE self, VALUE input, VALUE width) +{ + int wid, col; + + StringValue(input); + wid = NUM2UINT(width); + col = rb_ruby_ripper_dedent_string(0, input, wid); + return INT2NUM(col); +} +#endif + +/* + * call-seq: + * Ripper.new(src, filename="(ripper)", lineno=1) -> ripper + * + * Create a new Ripper object. + * _src_ must be a String, an IO, or an Object which has #gets method. + * + * This method does not starts parsing. + * See also Ripper#parse and Ripper.parse. + */ +static VALUE +ripper_initialize(int argc, VALUE *argv, VALUE self) +{ + struct ripper *r; + struct parser_params *p; + VALUE src, fname, lineno; + rb_parser_lex_gets_func *gets; + VALUE sourcefile_string; + const char *sourcefile; + int sourceline; + rb_parser_input_data input; + + p = ripper_parser_params(self, false); + TypedData_Get_Struct(self, struct ripper, &parser_data_type, r); + rb_scan_args(argc, argv, "12", &src, &fname, &lineno); + if (RB_TYPE_P(src, T_FILE)) { + gets = ripper_lex_io_get; + r->type = lex_type_io; + r->data.val = src; + input = (rb_parser_input_data)src; + } + else if (rb_respond_to(src, id_gets)) { + gets = ripper_lex_get_generic; + r->type = lex_type_generic; + r->data.val = src; + input = (rb_parser_input_data)src; + } + else { + StringValue(src); + gets = ripper_lex_get_str; + r->type = lex_type_str; + r->data.ptr_str.str = src; + r->data.ptr_str.ptr = 0; + input = (rb_parser_input_data)&r->data.ptr_str; + } + if (NIL_P(fname)) { + fname = STR_NEW2("(ripper)"); + OBJ_FREEZE(fname); + } + else { + StringValueCStr(fname); + fname = rb_str_new_frozen(fname); + } + rb_ruby_ripper_parser_initialize(p); + + sourcefile_string = fname; + sourcefile = RSTRING_PTR(fname); + sourceline = NIL_P(lineno) ? 0 : NUM2INT(lineno) - 1; + + rb_ruby_parser_ripper_initialize(p, gets, input, sourcefile_string, sourcefile, sourceline); + + return Qnil; +} + +static VALUE +ripper_parse0(VALUE vparser) +{ + struct parser_params *p = ripper_parser_params(vparser, false); + + rb_ruby_ripper_parse0(p); + return rb_ruby_parser_result(p); +} + +static VALUE +ripper_ensure(VALUE vparser) +{ + struct parser_params *p = ripper_parser_params(vparser, false); + + rb_ruby_parser_set_parsing_thread(p, Qnil); + return Qnil; +} + +/* + * call-seq: + * ripper.parse + * + * Start parsing and returns the value of the root action. + */ +static VALUE +ripper_parse(VALUE self) +{ + struct parser_params *p = ripper_parser_params(self, true); + VALUE result; + + if (!NIL_P(rb_ruby_parser_parsing_thread(p))) { + if (rb_ruby_parser_parsing_thread(p) == rb_thread_current()) + rb_raise(rb_eArgError, "Ripper#parse is not reentrant"); + else + rb_raise(rb_eArgError, "Ripper#parse is not multithread-safe"); + } + rb_ruby_parser_set_parsing_thread(p, rb_thread_current()); + result = rb_ensure(ripper_parse0, self, ripper_ensure, self); + RB_GC_GUARD(self); + + return result; +} + +/* + * call-seq: + * ripper.column -> Integer + * + * Return column number of current parsing line. + * This number starts from 0. + */ +static VALUE +ripper_column(VALUE self) +{ + struct parser_params *p = ripper_parser_params(self, true); + long col; + + if (NIL_P(rb_ruby_parser_parsing_thread(p))) return Qnil; + col = rb_ruby_ripper_column(p); + return LONG2NUM(col); +} + +/* + * call-seq: + * ripper.filename -> String + * + * Return current parsing filename. + */ +static VALUE +ripper_filename(VALUE self) +{ + struct parser_params *p = ripper_parser_params(self, true); + + return rb_ruby_parser_ruby_sourcefile_string(p); +} + +/* + * call-seq: + * ripper.lineno -> Integer + * + * Return line number of current parsing line. + * This number starts from 1. + */ +static VALUE +ripper_lineno(VALUE self) +{ + struct parser_params *p = ripper_parser_params(self, true); + + if (NIL_P(rb_ruby_parser_parsing_thread(p))) return Qnil; + return INT2NUM(rb_ruby_parser_ruby_sourceline(p)); +} + +/* + * call-seq: + * ripper.state -> Integer + * + * Return scanner state of current token. + */ +static VALUE +ripper_state(VALUE self) +{ + struct parser_params *p = ripper_parser_params(self, true); + + if (NIL_P(rb_ruby_parser_parsing_thread(p))) return Qnil; + return INT2NUM(rb_ruby_parser_lex_state(p)); +} + +/* + * call-seq: + * ripper.token -> String + * + * Return the current token string. + */ +static VALUE +ripper_token(VALUE self) +{ + struct parser_params *p = ripper_parser_params(self, true); + long pos, len; + VALUE str; + + if (NIL_P(rb_ruby_parser_parsing_thread(p))) return Qnil; + pos = rb_ruby_ripper_column(p); + len = rb_ruby_ripper_token_len(p); + str = rb_str_new_parser_string(rb_ruby_ripper_lex_lastline(p)); + return rb_str_subseq(str, pos, len); +} + +#ifdef RIPPER_DEBUG +/* :nodoc: */ +static VALUE +ripper_assert_Qundef(VALUE self, VALUE obj, VALUE msg) +{ + StringValue(msg); + if (UNDEF_P(obj)) { + rb_raise(rb_eArgError, "%"PRIsVALUE, msg); + } + return Qnil; +} + +/* :nodoc: */ +static VALUE +ripper_raw_value(VALUE self, VALUE obj) +{ + return ULONG2NUM(obj); +} + +/* :nodoc: */ +static VALUE +ripper_validate_object(VALUE self, VALUE x) +{ + if (x == Qfalse) return x; + if (x == Qtrue) return x; + if (NIL_P(x)) return x; + if (UNDEF_P(x)) + rb_raise(rb_eArgError, "Qundef given"); + if (FIXNUM_P(x)) return x; + if (SYMBOL_P(x)) return 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: + break; + default: + rb_raise(rb_eArgError, "wrong type of ruby object: %p (%s)", + (void *)x, rb_obj_classname(x)); + } + if (!RBASIC_CLASS(x)) { + rb_raise(rb_eArgError, "hidden ruby object: %p (%s)", + (void *)x, rb_builtin_type_name(TYPE(x))); + } + return x; +} +#endif + +#ifdef UNIVERSAL_PARSER +struct lex_state_name_arg { + struct parser_params *p; + VALUE state; +}; + +static VALUE +lex_state_name0(VALUE a) +{ + struct lex_state_name_arg *arg = (void *)a; + + return rb_ruby_ripper_lex_state_name(arg->p, NUM2INT(arg->state)); +} +#endif + +/* + * call-seq: + * Ripper.lex_state_name(integer) -> string + * + * Returns a string representation of lex_state. + */ +#ifdef UNIVERSAL_PARSER +static VALUE +ripper_lex_state_name(VALUE self, VALUE state) +{ + struct parser_params *p; + struct lex_state_name_arg args; + + p = rb_parser_params_new(); + + args.p = p; + args.state = state; + + return rb_ensure(lex_state_name0, (VALUE)&args, parser_free, (VALUE)p); +} +#else +static VALUE +ripper_lex_state_name(VALUE self, VALUE state) +{ + return rb_ruby_ripper_lex_state_name(0, NUM2INT(state)); +} +#endif + +void +Init_ripper(void) +{ + ripper_init_eventids1(); + ripper_init_eventids2(); + id_warn = rb_intern_const("warn"); + id_warning = rb_intern_const("warning"); + id_gets = rb_intern_const("gets"); + id_assoc = rb_intern_const("=>"); + + InitVM(ripper); +} + +void +InitVM_ripper(void) +{ + VALUE Ripper; + + Ripper = rb_define_class("Ripper", rb_cObject); + /* version of Ripper */ + rb_define_const(Ripper, "Version", rb_usascii_str_new2(RIPPER_VERSION)); + rb_define_alloc_func(Ripper, ripper_s_allocate); + rb_define_method(Ripper, "initialize", ripper_initialize, -1); + rb_define_method(Ripper, "parse", ripper_parse, 0); + rb_define_method(Ripper, "column", ripper_column, 0); + rb_define_method(Ripper, "filename", ripper_filename, 0); + rb_define_method(Ripper, "lineno", ripper_lineno, 0); + rb_define_method(Ripper, "state", ripper_state, 0); + rb_define_method(Ripper, "token", ripper_token, 0); + rb_define_method(Ripper, "end_seen?", ripper_parser_end_seen_p, 0); + rb_define_method(Ripper, "encoding", ripper_parser_encoding, 0); + rb_define_method(Ripper, "yydebug", ripper_parser_get_yydebug, 0); + rb_define_method(Ripper, "yydebug=", ripper_parser_set_yydebug, 1); + rb_define_method(Ripper, "debug_output", ripper_parser_get_debug_output, 0); + rb_define_method(Ripper, "debug_output=", ripper_parser_set_debug_output, 1); + rb_define_method(Ripper, "error?", ripper_error_p, 0); +#ifdef RIPPER_DEBUG + rb_define_method(Ripper, "assert_Qundef", ripper_assert_Qundef, 2); + rb_define_method(Ripper, "rawVALUE", ripper_raw_value, 1); + rb_define_method(Ripper, "validate_object", ripper_validate_object, 1); +#endif + + rb_define_singleton_method(Ripper, "dedent_string", parser_dedent_string, 2); + rb_define_private_method(Ripper, "dedent_string", parser_dedent_string, 2); + + rb_define_singleton_method(Ripper, "lex_state_name", ripper_lex_state_name, 1); + +<% @exprs.each do |expr, desc| -%> + /* <%=desc%> */ + rb_define_const(Ripper, "<%=expr%>", INT2NUM(<%=expr%>)); +<% end %> + ripper_init_eventids1_table(Ripper); + ripper_init_eventids2_table(Ripper); + +# if 0 + /* Hack to let RDoc document SCRIPT_LINES__ */ + + /* + * When a Hash is assigned to +SCRIPT_LINES__+ the contents of files loaded + * after the assignment will be added as an Array of lines with the file + * name as the key. + */ + rb_define_global_const("SCRIPT_LINES__", Qnil); +#endif + rb_ripper_none = rb_obj_alloc(rb_cObject); + rb_obj_freeze(rb_ripper_none); + rb_gc_register_mark_object(rb_ripper_none); + +} diff --git a/ext/ripper/ripper_init.h b/ext/ripper/ripper_init.h new file mode 100644 index 0000000000..664bb7bce3 --- /dev/null +++ b/ext/ripper/ripper_init.h @@ -0,0 +1,7 @@ +#ifndef RIPPER_INIT_H +#define RIPPER_INIT_H + +extern VALUE rb_ripper_none; +PRINTF_ARGS(void ripper_compile_error(struct parser_params*, const char *fmt, ...), 2, 3); + +#endif /* RIPPER_INIT_H */ diff --git a/ext/ripper/tools/dsl.rb b/ext/ripper/tools/dsl.rb index 49ff51711f..d0002d1ec3 100644 --- a/ext/ripper/tools/dsl.rb +++ b/ext/ripper/tools/dsl.rb @@ -1,37 +1,52 @@ +# frozen_string_literal: true + # Simple DSL implementation for Ripper code generation # -# input: /*% ripper: stmts_add(stmts_new, void_stmt) %*/ +# input: /*% ripper: stmts_add!(stmts_new!, void_stmt!) %*/ # output: # VALUE v1, v2; # v1 = dispatch0(stmts_new); # v2 = dispatch0(void_stmt); # $$ = dispatch2(stmts_add, v1, v2); - -$dollar = "$$" -alias $$ $dollar +# +# - The code must be a single line. +# +# - The code is basically Ruby code, even if it appears like in C and +# the result will be processed as C. e.g., comments need to be in +# Ruby style. class DSL - def initialize(code, options) + TAG_PATTERN = /(?><[a-zA-Z0-9_]+>)/.source + NAME_PATTERN = /(?>\$|\d+|[a-zA-Z_][a-zA-Z0-9_]*|\[[a-zA-Z_.][-a-zA-Z0-9_.]*\])(?>(?:\.|->)[a-zA-Z_][a-zA-Z0-9_]*)*/.source + NOT_REF_PATTERN = /(?>\#.*|[^\"$@]*|"(?>\\.|[^\"])*")/.source + + def self.line?(line, lineno = nil) + if %r</\*% *ripper(?:\[(.*?)\])?: *(.*?) *%\*/> =~ line + new($2, $1&.split(",") || [], lineno) + end + end + + def initialize(code, options, lineno = nil) + @lineno = lineno @events = {} @error = options.include?("error") @brace = options.include?("brace") if options.include?("final") @final = "p->result" else - @final = (options.grep(/\A\$(?:\$|\d+)\z/)[0] || "$$") + @final = (options.grep(/\A\$#{NAME_PATTERN}\z/o)[0] || "p->s_lvalue") end @vars = 0 - # create $1 == "$1", $2 == "$2", ... - s = (1..20).map {|n| "$#{n}"} - re = Array.new(s.size, "([^\0]+)") - /#{re.join("\0")}/ =~ s.join("\0") - # struct parser_params *p p = p = "p" - @code = "" + @code = +"" + code = code.gsub(%r[\G#{NOT_REF_PATTERN}\K(\$|\$:|@)#{TAG_PATTERN}?#{NAME_PATTERN}]o, '"\&"') @last_value = eval(code) + rescue SyntaxError + $stderr.puts "error on line #{@lineno}" if @lineno + raise end attr_reader :events @@ -62,11 +77,15 @@ class DSL vars = [] args.each do |arg| vars << v = new_var - @code << "#{ v }=#{ arg };" + if arg =~ /\A\$:#{NAME_PATTERN}\z/ + @code << "#{ v }=get_value(#{arg});" + else + @code << "#{ v }=#{ arg };" + end end v = new_var d = "dispatch#{ args.size }(#{ [event, *vars].join(",") })" - d = "#{ vars.last }==Qundef ? #{ vars.first } : #{ d }" if qundef_check + d = "#{ vars.last }==rb_ripper_none ? #{ vars.first } : #{ d }" if qundef_check @code << "#{ v }=#{ d };" v end @@ -85,4 +104,3 @@ class DSL name end end - diff --git a/ext/ripper/tools/generate.rb b/ext/ripper/tools/generate.rb index 883e6ef2df..92ced37f04 100644 --- a/ext/ripper/tools/generate.rb +++ b/ext/ripper/tools/generate.rb @@ -11,7 +11,7 @@ def main parser = @parser = OptionParser.new parser.banner = "Usage: #{File.basename($0)} --mode=MODE [--ids1src=PATH] [--ids2src=PATH] [--output=PATH]" - parser.on('--mode=MODE', 'check, eventids1, or eventids2table.') {|m| + parser.on('--mode=MODE', 'check, eventids1_h, eventids1, or eventids2table.') {|m| mode = m } parser.on('--ids1src=PATH', 'A source file of event-IDs 1 (parse.y).') {|path| @@ -45,6 +45,9 @@ def main abort "event crash: #{common.join(' ')}" end exit 0 + when 'eventids1_h' + usage 'no --ids1src' unless ids1src + result = generate_eventids1_h(read_ids1(ids1src)) when 'eventids1' usage 'no --ids1src' unless ids1src result = generate_eventids1(read_ids1(ids1src)) @@ -67,19 +70,35 @@ def usage(msg) exit false end -def generate_eventids1(ids) +def generate_eventids1_h(ids) buf = "".dup - buf << %Q[static struct {\n] + buf << %Q[#ifndef RIPPER_EVENTIDS1\n] + buf << %Q[#define RIPPER_EVENTIDS1\n] + buf << %Q[\n] + buf << %Q[void ripper_init_eventids1(void);\n] + buf << %Q[void ripper_init_eventids1_table(VALUE self);\n] + buf << %Q[\n] + buf << %Q[struct ripper_parser_ids {\n] ids.each do |id, arity| buf << %Q[ ID id_#{id};\n] end - buf << %Q[} ripper_parser_ids;\n] + buf << %Q[};\n] buf << %Q[\n] ids.each do |id, arity| buf << %Q[#define ripper_id_#{id} ripper_parser_ids.id_#{id}\n] end + buf << %Q[#endif /* RIPPER_EVENTIDS1 */\n] + buf << %Q[\n] +end + +def generate_eventids1(ids) + buf = "".dup + buf << %Q[#include "ruby/ruby.h"\n] + buf << %Q[#include "eventids1.h"\n] buf << %Q[\n] - buf << %Q[static void\n] + buf << %Q[struct ripper_parser_ids ripper_parser_ids;\n] + buf << %Q[\n] + buf << %Q[void\n] buf << %Q[ripper_init_eventids1(void)\n] buf << %Q[{\n] buf << %Q[#define set_id1(name) ripper_id_##name = rb_intern_const("on_"#name)\n] @@ -88,7 +107,9 @@ def generate_eventids1(ids) end buf << %Q[}\n] buf << %Q[\n] - buf << %Q[static void\n] + buf << %Q[#define intern_sym(name) ID2SYM(rb_intern_const(name))\n] + buf << %Q[\n] + buf << %Q[void\n] buf << %Q[ripper_init_eventids1_table(VALUE self)\n] buf << %Q[{\n] buf << %Q[ VALUE h = rb_hash_new();\n] @@ -102,7 +123,11 @@ end def generate_eventids2_table(ids) buf = "".dup - buf << %Q[static void\n] + buf << %Q[#include "ruby/ruby.h"\n] + buf << %Q[\n] + buf << %Q[#define intern_sym(name) ID2SYM(rb_intern_const(name))\n] + buf << %Q[\n] + buf << %Q[void\n] buf << %Q[ripper_init_eventids2_table(VALUE self)\n] buf << %Q[{\n] buf << %Q[ VALUE h = rb_hash_new();\n] @@ -111,6 +136,8 @@ def generate_eventids2_table(ids) buf << %Q[ rb_hash_aset(h, intern_sym("#{id}"), INT2FIX(1));\n] end buf << %Q[}\n] + buf << %Q[\n] + buf << %Q[#define RIPPER_EVENTIDS2_TABLE_SIZE #{ids.size}\n] buf end @@ -146,9 +173,7 @@ def read_ids1_with_locations(path) line.scan(/\bdispatch(\d)\((\w+)/) do |arity, event| (h[event] ||= []).push [f.lineno, arity.to_i] end - if line =~ %r</\*% *ripper(?:\[(.*?)\])?: *(.*?) *%\*/> - gen = DSL.new($2, ($1 || "").split(",")) - gen.generate + if gen = DSL.line?(line, f.lineno) gen.events.each do |event, arity| (h[event] ||= []).push [f.lineno, arity.to_i] end diff --git a/ext/ripper/tools/preproc.rb b/ext/ripper/tools/preproc.rb index cd85a5da61..a92be93d5b 100644 --- a/ext/ripper/tools/preproc.rb +++ b/ext/ripper/tools/preproc.rb @@ -5,11 +5,15 @@ require 'optparse' def main output = nil + template = nil parser = OptionParser.new - parser.banner = "Usage: #{File.basename($0)} [--output=PATH] <parse.y>" + parser.banner = "Usage: #{File.basename($0)} [--output=PATH] [--template=PATH] <parse.y>" parser.on('--output=PATH', 'An output file.') {|path| output = path } + parser.on('--template=PATH', 'An template file.') {|path| + template = path + } parser.on('--help', 'Prints this message and quit.') { puts parser.help exit true @@ -17,50 +21,56 @@ def main begin parser.parse! rescue OptionParser::ParseError => err - $stderr.puts err.message - $stderr.puts parser.help - exit false - end - unless ARGV.size == 1 - abort "wrong number of arguments (#{ARGV.size} for 1)" + warn err.message + abort parser.help end out = "".dup - File.open(ARGV[0]) {|f| - prelude f, out - grammar f, out - usercode f, out - } - if output - File.open(output, 'w') {|f| - f.write out + if ARGV[0] == "-" + unless ARGV.size == 2 + abort "wrong number of arguments (#{ARGV.size} for 2)" + end + process STDIN, out, ARGV[1], template + else + unless ARGV.size == 1 + abort "wrong number of arguments (#{ARGV.size} for 1)" + end + File.open(ARGV[0]) {|f| + process f, out, ARGV[0], template } + end + if output + File.write(output, out) else print out end end -def prelude(f, out) - @exprs = {} - lex_state_def = false +def process(f, out, path, template) + prelude f, out + grammar f, out + usercode f, out, path, template +end + +require_relative 'dsl' + +def generate_line(f, out) while line = f.gets - case line - when /\A%%/ + case + when gen = DSL.line?(line) + out << gen.generate << "\n" + when line.start_with?("%%") out << "%%\n" - return - when /\A%token/, /\A} <node>/ - out << line.sub(/<\w+>/, '<val>') - when /\A%type/ - out << line.sub(/<\w+>/, '<val>') - when /^enum lex_state_(?:bits|e) \{/ - lex_state_def = true - out << line - when /^\}/ - lex_state_def = false - out << line + break else - out << line + out << yield(line) end - if lex_state_def + end +end + +def prelude(f, out) + @exprs = {} + generate_line(f, out) do |line| + if (/^enum lex_state_(?:bits|e) \{/ =~ line)..(/^\}/ =~ line) case line when /^\s*(EXPR_\w+),\s+\/\*(.+)\*\// @exprs[$1.chomp("_bit")] = $2.strip @@ -70,38 +80,45 @@ def prelude(f, out) @exprs[name] = "equals to " + (val.start_with?("(") ? "<tt>#{val}</tt>" : "+#{val}+") end end + line end end -require_relative "dsl" - def grammar(f, out) - while line = f.gets + generate_line(f, out) do |line| case line - when %r</\*% *ripper(?:\[(.*?)\])?: *(.*?) *%\*/> - out << DSL.new($2, ($1 || "").split(",")).generate << "\n" when %r</\*%%%\*/> - out << "#if 0\n" + "#if 0\n" when %r</\*%> - out << "#endif\n" + "#endif\n" when %r<%\*/> - out << "\n" - when /\A%%/ - out << "%%\n" - return + "\n" else - out << line + line end end end -def usercode(f, out) +def usercode(f, out, path, template) require 'erb' + lineno = nil + src = nil compiler = ERB::Compiler.new('%-') compiler.put_cmd = compiler.insert_cmd = "out.<<" - lineno = f.lineno - src, = compiler.compile(f.read) - eval(src, binding, f.path, lineno) + + if template + File.open(template) do |f| + out.clear + lineno = f.lineno + src, = compiler.compile(f.read) + path = template + end + else + lineno = f.lineno + src, = compiler.compile(f.read) + end + + eval(src, binding, path, lineno) end main diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index 7406177de2..6ef040b692 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -1555,6 +1555,10 @@ bsock_recvmsg_internal(VALUE sock, ss = rb_recvmsg(fptr->fd, &mh, flags); + if (ss == 0 && !rsock_is_dgram(fptr)) { + return Qnil; + } + if (ss == -1) { int e; if (!nonblock && rb_io_maybe_wait_readable(errno, fptr->self, RUBY_IO_TIMEOUT_DEFAULT)) { diff --git a/ext/socket/depend b/ext/socket/depend index 28c5540cd6..750bb0734f 100644 --- a/ext/socket/depend +++ b/ext/socket/depend @@ -13,6 +13,7 @@ constdefs.c: constdefs.h ancdata.o: $(RUBY_EXTCONF_H) ancdata.o: $(arch_hdrdir)/ruby/config.h ancdata.o: $(hdrdir)/ruby/assert.h +ancdata.o: $(hdrdir)/ruby/atomic.h ancdata.o: $(hdrdir)/ruby/backward.h ancdata.o: $(hdrdir)/ruby/backward/2/assume.h ancdata.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -65,6 +66,7 @@ ancdata.o: $(hdrdir)/ruby/internal/attr/noexcept.h ancdata.o: $(hdrdir)/ruby/internal/attr/noinline.h ancdata.o: $(hdrdir)/ruby/internal/attr/nonnull.h ancdata.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ancdata.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ancdata.o: $(hdrdir)/ruby/internal/attr/pure.h ancdata.o: $(hdrdir)/ruby/internal/attr/restrict.h ancdata.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -133,7 +135,6 @@ ancdata.o: $(hdrdir)/ruby/internal/intern/enumerator.h ancdata.o: $(hdrdir)/ruby/internal/intern/error.h ancdata.o: $(hdrdir)/ruby/internal/intern/eval.h ancdata.o: $(hdrdir)/ruby/internal/intern/file.h -ancdata.o: $(hdrdir)/ruby/internal/intern/gc.h ancdata.o: $(hdrdir)/ruby/internal/intern/hash.h ancdata.o: $(hdrdir)/ruby/internal/intern/io.h ancdata.o: $(hdrdir)/ruby/internal/intern/load.h @@ -164,12 +165,12 @@ ancdata.o: $(hdrdir)/ruby/internal/memory.h ancdata.o: $(hdrdir)/ruby/internal/method.h ancdata.o: $(hdrdir)/ruby/internal/module.h ancdata.o: $(hdrdir)/ruby/internal/newobj.h -ancdata.o: $(hdrdir)/ruby/internal/rgengc.h ancdata.o: $(hdrdir)/ruby/internal/scan_args.h ancdata.o: $(hdrdir)/ruby/internal/special_consts.h ancdata.o: $(hdrdir)/ruby/internal/static_assert.h ancdata.o: $(hdrdir)/ruby/internal/stdalign.h ancdata.o: $(hdrdir)/ruby/internal/stdbool.h +ancdata.o: $(hdrdir)/ruby/internal/stdckdint.h ancdata.o: $(hdrdir)/ruby/internal/symbol.h ancdata.o: $(hdrdir)/ruby/internal/value.h ancdata.o: $(hdrdir)/ruby/internal/value_type.h @@ -184,27 +185,46 @@ ancdata.o: $(hdrdir)/ruby/ruby.h ancdata.o: $(hdrdir)/ruby/st.h ancdata.o: $(hdrdir)/ruby/subst.h ancdata.o: $(hdrdir)/ruby/thread.h +ancdata.o: $(hdrdir)/ruby/thread_native.h ancdata.o: $(hdrdir)/ruby/util.h +ancdata.o: $(hdrdir)/ruby/version.h +ancdata.o: $(top_srcdir)/ccan/check_type/check_type.h +ancdata.o: $(top_srcdir)/ccan/container_of/container_of.h +ancdata.o: $(top_srcdir)/ccan/list/list.h +ancdata.o: $(top_srcdir)/ccan/str/str.h ancdata.o: $(top_srcdir)/internal.h ancdata.o: $(top_srcdir)/internal/array.h +ancdata.o: $(top_srcdir)/internal/basic_operators.h ancdata.o: $(top_srcdir)/internal/compilers.h ancdata.o: $(top_srcdir)/internal/error.h ancdata.o: $(top_srcdir)/internal/gc.h +ancdata.o: $(top_srcdir)/internal/imemo.h ancdata.o: $(top_srcdir)/internal/io.h +ancdata.o: $(top_srcdir)/internal/sanitizers.h ancdata.o: $(top_srcdir)/internal/serial.h ancdata.o: $(top_srcdir)/internal/static_assert.h ancdata.o: $(top_srcdir)/internal/string.h ancdata.o: $(top_srcdir)/internal/thread.h ancdata.o: $(top_srcdir)/internal/vm.h ancdata.o: $(top_srcdir)/internal/warnings.h +ancdata.o: $(top_srcdir)/method.h +ancdata.o: $(top_srcdir)/node.h +ancdata.o: $(top_srcdir)/ruby_assert.h +ancdata.o: $(top_srcdir)/ruby_atomic.h +ancdata.o: $(top_srcdir)/rubyparser.h ancdata.o: $(top_srcdir)/shape.h +ancdata.o: $(top_srcdir)/thread_pthread.h +ancdata.o: $(top_srcdir)/vm_core.h +ancdata.o: $(top_srcdir)/vm_opts.h ancdata.o: ancdata.c ancdata.o: constdefs.h ancdata.o: rubysocket.h ancdata.o: sockport.h +ancdata.o: {$(VPATH)}id.h basicsocket.o: $(RUBY_EXTCONF_H) basicsocket.o: $(arch_hdrdir)/ruby/config.h basicsocket.o: $(hdrdir)/ruby/assert.h +basicsocket.o: $(hdrdir)/ruby/atomic.h basicsocket.o: $(hdrdir)/ruby/backward.h basicsocket.o: $(hdrdir)/ruby/backward/2/assume.h basicsocket.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -257,6 +277,7 @@ basicsocket.o: $(hdrdir)/ruby/internal/attr/noexcept.h basicsocket.o: $(hdrdir)/ruby/internal/attr/noinline.h basicsocket.o: $(hdrdir)/ruby/internal/attr/nonnull.h basicsocket.o: $(hdrdir)/ruby/internal/attr/noreturn.h +basicsocket.o: $(hdrdir)/ruby/internal/attr/packed_struct.h basicsocket.o: $(hdrdir)/ruby/internal/attr/pure.h basicsocket.o: $(hdrdir)/ruby/internal/attr/restrict.h basicsocket.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -325,7 +346,6 @@ basicsocket.o: $(hdrdir)/ruby/internal/intern/enumerator.h basicsocket.o: $(hdrdir)/ruby/internal/intern/error.h basicsocket.o: $(hdrdir)/ruby/internal/intern/eval.h basicsocket.o: $(hdrdir)/ruby/internal/intern/file.h -basicsocket.o: $(hdrdir)/ruby/internal/intern/gc.h basicsocket.o: $(hdrdir)/ruby/internal/intern/hash.h basicsocket.o: $(hdrdir)/ruby/internal/intern/io.h basicsocket.o: $(hdrdir)/ruby/internal/intern/load.h @@ -356,12 +376,12 @@ basicsocket.o: $(hdrdir)/ruby/internal/memory.h basicsocket.o: $(hdrdir)/ruby/internal/method.h basicsocket.o: $(hdrdir)/ruby/internal/module.h basicsocket.o: $(hdrdir)/ruby/internal/newobj.h -basicsocket.o: $(hdrdir)/ruby/internal/rgengc.h basicsocket.o: $(hdrdir)/ruby/internal/scan_args.h basicsocket.o: $(hdrdir)/ruby/internal/special_consts.h basicsocket.o: $(hdrdir)/ruby/internal/static_assert.h basicsocket.o: $(hdrdir)/ruby/internal/stdalign.h basicsocket.o: $(hdrdir)/ruby/internal/stdbool.h +basicsocket.o: $(hdrdir)/ruby/internal/stdckdint.h basicsocket.o: $(hdrdir)/ruby/internal/symbol.h basicsocket.o: $(hdrdir)/ruby/internal/value.h basicsocket.o: $(hdrdir)/ruby/internal/value_type.h @@ -376,27 +396,46 @@ basicsocket.o: $(hdrdir)/ruby/ruby.h basicsocket.o: $(hdrdir)/ruby/st.h basicsocket.o: $(hdrdir)/ruby/subst.h basicsocket.o: $(hdrdir)/ruby/thread.h +basicsocket.o: $(hdrdir)/ruby/thread_native.h basicsocket.o: $(hdrdir)/ruby/util.h +basicsocket.o: $(hdrdir)/ruby/version.h +basicsocket.o: $(top_srcdir)/ccan/check_type/check_type.h +basicsocket.o: $(top_srcdir)/ccan/container_of/container_of.h +basicsocket.o: $(top_srcdir)/ccan/list/list.h +basicsocket.o: $(top_srcdir)/ccan/str/str.h basicsocket.o: $(top_srcdir)/internal.h basicsocket.o: $(top_srcdir)/internal/array.h +basicsocket.o: $(top_srcdir)/internal/basic_operators.h basicsocket.o: $(top_srcdir)/internal/compilers.h basicsocket.o: $(top_srcdir)/internal/error.h basicsocket.o: $(top_srcdir)/internal/gc.h +basicsocket.o: $(top_srcdir)/internal/imemo.h basicsocket.o: $(top_srcdir)/internal/io.h +basicsocket.o: $(top_srcdir)/internal/sanitizers.h basicsocket.o: $(top_srcdir)/internal/serial.h basicsocket.o: $(top_srcdir)/internal/static_assert.h basicsocket.o: $(top_srcdir)/internal/string.h basicsocket.o: $(top_srcdir)/internal/thread.h basicsocket.o: $(top_srcdir)/internal/vm.h basicsocket.o: $(top_srcdir)/internal/warnings.h +basicsocket.o: $(top_srcdir)/method.h +basicsocket.o: $(top_srcdir)/node.h +basicsocket.o: $(top_srcdir)/ruby_assert.h +basicsocket.o: $(top_srcdir)/ruby_atomic.h +basicsocket.o: $(top_srcdir)/rubyparser.h basicsocket.o: $(top_srcdir)/shape.h +basicsocket.o: $(top_srcdir)/thread_pthread.h +basicsocket.o: $(top_srcdir)/vm_core.h +basicsocket.o: $(top_srcdir)/vm_opts.h basicsocket.o: basicsocket.c basicsocket.o: constdefs.h basicsocket.o: rubysocket.h basicsocket.o: sockport.h +basicsocket.o: {$(VPATH)}id.h constants.o: $(RUBY_EXTCONF_H) constants.o: $(arch_hdrdir)/ruby/config.h constants.o: $(hdrdir)/ruby/assert.h +constants.o: $(hdrdir)/ruby/atomic.h constants.o: $(hdrdir)/ruby/backward.h constants.o: $(hdrdir)/ruby/backward/2/assume.h constants.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -449,6 +488,7 @@ constants.o: $(hdrdir)/ruby/internal/attr/noexcept.h constants.o: $(hdrdir)/ruby/internal/attr/noinline.h constants.o: $(hdrdir)/ruby/internal/attr/nonnull.h constants.o: $(hdrdir)/ruby/internal/attr/noreturn.h +constants.o: $(hdrdir)/ruby/internal/attr/packed_struct.h constants.o: $(hdrdir)/ruby/internal/attr/pure.h constants.o: $(hdrdir)/ruby/internal/attr/restrict.h constants.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -517,7 +557,6 @@ constants.o: $(hdrdir)/ruby/internal/intern/enumerator.h constants.o: $(hdrdir)/ruby/internal/intern/error.h constants.o: $(hdrdir)/ruby/internal/intern/eval.h constants.o: $(hdrdir)/ruby/internal/intern/file.h -constants.o: $(hdrdir)/ruby/internal/intern/gc.h constants.o: $(hdrdir)/ruby/internal/intern/hash.h constants.o: $(hdrdir)/ruby/internal/intern/io.h constants.o: $(hdrdir)/ruby/internal/intern/load.h @@ -548,12 +587,12 @@ constants.o: $(hdrdir)/ruby/internal/memory.h constants.o: $(hdrdir)/ruby/internal/method.h constants.o: $(hdrdir)/ruby/internal/module.h constants.o: $(hdrdir)/ruby/internal/newobj.h -constants.o: $(hdrdir)/ruby/internal/rgengc.h constants.o: $(hdrdir)/ruby/internal/scan_args.h constants.o: $(hdrdir)/ruby/internal/special_consts.h constants.o: $(hdrdir)/ruby/internal/static_assert.h constants.o: $(hdrdir)/ruby/internal/stdalign.h constants.o: $(hdrdir)/ruby/internal/stdbool.h +constants.o: $(hdrdir)/ruby/internal/stdckdint.h constants.o: $(hdrdir)/ruby/internal/symbol.h constants.o: $(hdrdir)/ruby/internal/value.h constants.o: $(hdrdir)/ruby/internal/value_type.h @@ -568,28 +607,47 @@ constants.o: $(hdrdir)/ruby/ruby.h constants.o: $(hdrdir)/ruby/st.h constants.o: $(hdrdir)/ruby/subst.h constants.o: $(hdrdir)/ruby/thread.h +constants.o: $(hdrdir)/ruby/thread_native.h constants.o: $(hdrdir)/ruby/util.h +constants.o: $(hdrdir)/ruby/version.h +constants.o: $(top_srcdir)/ccan/check_type/check_type.h +constants.o: $(top_srcdir)/ccan/container_of/container_of.h +constants.o: $(top_srcdir)/ccan/list/list.h +constants.o: $(top_srcdir)/ccan/str/str.h constants.o: $(top_srcdir)/internal.h constants.o: $(top_srcdir)/internal/array.h +constants.o: $(top_srcdir)/internal/basic_operators.h constants.o: $(top_srcdir)/internal/compilers.h constants.o: $(top_srcdir)/internal/error.h constants.o: $(top_srcdir)/internal/gc.h +constants.o: $(top_srcdir)/internal/imemo.h constants.o: $(top_srcdir)/internal/io.h +constants.o: $(top_srcdir)/internal/sanitizers.h constants.o: $(top_srcdir)/internal/serial.h constants.o: $(top_srcdir)/internal/static_assert.h constants.o: $(top_srcdir)/internal/string.h constants.o: $(top_srcdir)/internal/thread.h constants.o: $(top_srcdir)/internal/vm.h constants.o: $(top_srcdir)/internal/warnings.h +constants.o: $(top_srcdir)/method.h +constants.o: $(top_srcdir)/node.h +constants.o: $(top_srcdir)/ruby_assert.h +constants.o: $(top_srcdir)/ruby_atomic.h +constants.o: $(top_srcdir)/rubyparser.h constants.o: $(top_srcdir)/shape.h +constants.o: $(top_srcdir)/thread_pthread.h +constants.o: $(top_srcdir)/vm_core.h +constants.o: $(top_srcdir)/vm_opts.h constants.o: constants.c constants.o: constdefs.c constants.o: constdefs.h constants.o: rubysocket.h constants.o: sockport.h +constants.o: {$(VPATH)}id.h ifaddr.o: $(RUBY_EXTCONF_H) ifaddr.o: $(arch_hdrdir)/ruby/config.h ifaddr.o: $(hdrdir)/ruby/assert.h +ifaddr.o: $(hdrdir)/ruby/atomic.h ifaddr.o: $(hdrdir)/ruby/backward.h ifaddr.o: $(hdrdir)/ruby/backward/2/assume.h ifaddr.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -642,6 +700,7 @@ ifaddr.o: $(hdrdir)/ruby/internal/attr/noexcept.h ifaddr.o: $(hdrdir)/ruby/internal/attr/noinline.h ifaddr.o: $(hdrdir)/ruby/internal/attr/nonnull.h ifaddr.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ifaddr.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ifaddr.o: $(hdrdir)/ruby/internal/attr/pure.h ifaddr.o: $(hdrdir)/ruby/internal/attr/restrict.h ifaddr.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -710,7 +769,6 @@ ifaddr.o: $(hdrdir)/ruby/internal/intern/enumerator.h ifaddr.o: $(hdrdir)/ruby/internal/intern/error.h ifaddr.o: $(hdrdir)/ruby/internal/intern/eval.h ifaddr.o: $(hdrdir)/ruby/internal/intern/file.h -ifaddr.o: $(hdrdir)/ruby/internal/intern/gc.h ifaddr.o: $(hdrdir)/ruby/internal/intern/hash.h ifaddr.o: $(hdrdir)/ruby/internal/intern/io.h ifaddr.o: $(hdrdir)/ruby/internal/intern/load.h @@ -741,12 +799,12 @@ ifaddr.o: $(hdrdir)/ruby/internal/memory.h ifaddr.o: $(hdrdir)/ruby/internal/method.h ifaddr.o: $(hdrdir)/ruby/internal/module.h ifaddr.o: $(hdrdir)/ruby/internal/newobj.h -ifaddr.o: $(hdrdir)/ruby/internal/rgengc.h ifaddr.o: $(hdrdir)/ruby/internal/scan_args.h ifaddr.o: $(hdrdir)/ruby/internal/special_consts.h ifaddr.o: $(hdrdir)/ruby/internal/static_assert.h ifaddr.o: $(hdrdir)/ruby/internal/stdalign.h ifaddr.o: $(hdrdir)/ruby/internal/stdbool.h +ifaddr.o: $(hdrdir)/ruby/internal/stdckdint.h ifaddr.o: $(hdrdir)/ruby/internal/symbol.h ifaddr.o: $(hdrdir)/ruby/internal/value.h ifaddr.o: $(hdrdir)/ruby/internal/value_type.h @@ -761,27 +819,46 @@ ifaddr.o: $(hdrdir)/ruby/ruby.h ifaddr.o: $(hdrdir)/ruby/st.h ifaddr.o: $(hdrdir)/ruby/subst.h ifaddr.o: $(hdrdir)/ruby/thread.h +ifaddr.o: $(hdrdir)/ruby/thread_native.h ifaddr.o: $(hdrdir)/ruby/util.h +ifaddr.o: $(hdrdir)/ruby/version.h +ifaddr.o: $(top_srcdir)/ccan/check_type/check_type.h +ifaddr.o: $(top_srcdir)/ccan/container_of/container_of.h +ifaddr.o: $(top_srcdir)/ccan/list/list.h +ifaddr.o: $(top_srcdir)/ccan/str/str.h ifaddr.o: $(top_srcdir)/internal.h ifaddr.o: $(top_srcdir)/internal/array.h +ifaddr.o: $(top_srcdir)/internal/basic_operators.h ifaddr.o: $(top_srcdir)/internal/compilers.h ifaddr.o: $(top_srcdir)/internal/error.h ifaddr.o: $(top_srcdir)/internal/gc.h +ifaddr.o: $(top_srcdir)/internal/imemo.h ifaddr.o: $(top_srcdir)/internal/io.h +ifaddr.o: $(top_srcdir)/internal/sanitizers.h ifaddr.o: $(top_srcdir)/internal/serial.h ifaddr.o: $(top_srcdir)/internal/static_assert.h ifaddr.o: $(top_srcdir)/internal/string.h ifaddr.o: $(top_srcdir)/internal/thread.h ifaddr.o: $(top_srcdir)/internal/vm.h ifaddr.o: $(top_srcdir)/internal/warnings.h +ifaddr.o: $(top_srcdir)/method.h +ifaddr.o: $(top_srcdir)/node.h +ifaddr.o: $(top_srcdir)/ruby_assert.h +ifaddr.o: $(top_srcdir)/ruby_atomic.h +ifaddr.o: $(top_srcdir)/rubyparser.h ifaddr.o: $(top_srcdir)/shape.h +ifaddr.o: $(top_srcdir)/thread_pthread.h +ifaddr.o: $(top_srcdir)/vm_core.h +ifaddr.o: $(top_srcdir)/vm_opts.h ifaddr.o: constdefs.h ifaddr.o: ifaddr.c ifaddr.o: rubysocket.h ifaddr.o: sockport.h +ifaddr.o: {$(VPATH)}id.h init.o: $(RUBY_EXTCONF_H) init.o: $(arch_hdrdir)/ruby/config.h init.o: $(hdrdir)/ruby/assert.h +init.o: $(hdrdir)/ruby/atomic.h init.o: $(hdrdir)/ruby/backward.h init.o: $(hdrdir)/ruby/backward/2/assume.h init.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -834,6 +911,7 @@ init.o: $(hdrdir)/ruby/internal/attr/noexcept.h init.o: $(hdrdir)/ruby/internal/attr/noinline.h init.o: $(hdrdir)/ruby/internal/attr/nonnull.h init.o: $(hdrdir)/ruby/internal/attr/noreturn.h +init.o: $(hdrdir)/ruby/internal/attr/packed_struct.h init.o: $(hdrdir)/ruby/internal/attr/pure.h init.o: $(hdrdir)/ruby/internal/attr/restrict.h init.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -902,7 +980,6 @@ init.o: $(hdrdir)/ruby/internal/intern/enumerator.h init.o: $(hdrdir)/ruby/internal/intern/error.h init.o: $(hdrdir)/ruby/internal/intern/eval.h init.o: $(hdrdir)/ruby/internal/intern/file.h -init.o: $(hdrdir)/ruby/internal/intern/gc.h init.o: $(hdrdir)/ruby/internal/intern/hash.h init.o: $(hdrdir)/ruby/internal/intern/io.h init.o: $(hdrdir)/ruby/internal/intern/load.h @@ -933,12 +1010,12 @@ init.o: $(hdrdir)/ruby/internal/memory.h init.o: $(hdrdir)/ruby/internal/method.h init.o: $(hdrdir)/ruby/internal/module.h init.o: $(hdrdir)/ruby/internal/newobj.h -init.o: $(hdrdir)/ruby/internal/rgengc.h init.o: $(hdrdir)/ruby/internal/scan_args.h init.o: $(hdrdir)/ruby/internal/special_consts.h init.o: $(hdrdir)/ruby/internal/static_assert.h init.o: $(hdrdir)/ruby/internal/stdalign.h init.o: $(hdrdir)/ruby/internal/stdbool.h +init.o: $(hdrdir)/ruby/internal/stdckdint.h init.o: $(hdrdir)/ruby/internal/symbol.h init.o: $(hdrdir)/ruby/internal/value.h init.o: $(hdrdir)/ruby/internal/value_type.h @@ -953,27 +1030,46 @@ init.o: $(hdrdir)/ruby/ruby.h init.o: $(hdrdir)/ruby/st.h init.o: $(hdrdir)/ruby/subst.h init.o: $(hdrdir)/ruby/thread.h +init.o: $(hdrdir)/ruby/thread_native.h init.o: $(hdrdir)/ruby/util.h +init.o: $(hdrdir)/ruby/version.h +init.o: $(top_srcdir)/ccan/check_type/check_type.h +init.o: $(top_srcdir)/ccan/container_of/container_of.h +init.o: $(top_srcdir)/ccan/list/list.h +init.o: $(top_srcdir)/ccan/str/str.h init.o: $(top_srcdir)/internal.h init.o: $(top_srcdir)/internal/array.h +init.o: $(top_srcdir)/internal/basic_operators.h init.o: $(top_srcdir)/internal/compilers.h init.o: $(top_srcdir)/internal/error.h init.o: $(top_srcdir)/internal/gc.h +init.o: $(top_srcdir)/internal/imemo.h init.o: $(top_srcdir)/internal/io.h +init.o: $(top_srcdir)/internal/sanitizers.h init.o: $(top_srcdir)/internal/serial.h init.o: $(top_srcdir)/internal/static_assert.h init.o: $(top_srcdir)/internal/string.h init.o: $(top_srcdir)/internal/thread.h init.o: $(top_srcdir)/internal/vm.h init.o: $(top_srcdir)/internal/warnings.h +init.o: $(top_srcdir)/method.h +init.o: $(top_srcdir)/node.h +init.o: $(top_srcdir)/ruby_assert.h +init.o: $(top_srcdir)/ruby_atomic.h +init.o: $(top_srcdir)/rubyparser.h init.o: $(top_srcdir)/shape.h +init.o: $(top_srcdir)/thread_pthread.h +init.o: $(top_srcdir)/vm_core.h +init.o: $(top_srcdir)/vm_opts.h init.o: constdefs.h init.o: init.c init.o: rubysocket.h init.o: sockport.h +init.o: {$(VPATH)}id.h ipsocket.o: $(RUBY_EXTCONF_H) ipsocket.o: $(arch_hdrdir)/ruby/config.h ipsocket.o: $(hdrdir)/ruby/assert.h +ipsocket.o: $(hdrdir)/ruby/atomic.h ipsocket.o: $(hdrdir)/ruby/backward.h ipsocket.o: $(hdrdir)/ruby/backward/2/assume.h ipsocket.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -1026,6 +1122,7 @@ ipsocket.o: $(hdrdir)/ruby/internal/attr/noexcept.h ipsocket.o: $(hdrdir)/ruby/internal/attr/noinline.h ipsocket.o: $(hdrdir)/ruby/internal/attr/nonnull.h ipsocket.o: $(hdrdir)/ruby/internal/attr/noreturn.h +ipsocket.o: $(hdrdir)/ruby/internal/attr/packed_struct.h ipsocket.o: $(hdrdir)/ruby/internal/attr/pure.h ipsocket.o: $(hdrdir)/ruby/internal/attr/restrict.h ipsocket.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1094,7 +1191,6 @@ ipsocket.o: $(hdrdir)/ruby/internal/intern/enumerator.h ipsocket.o: $(hdrdir)/ruby/internal/intern/error.h ipsocket.o: $(hdrdir)/ruby/internal/intern/eval.h ipsocket.o: $(hdrdir)/ruby/internal/intern/file.h -ipsocket.o: $(hdrdir)/ruby/internal/intern/gc.h ipsocket.o: $(hdrdir)/ruby/internal/intern/hash.h ipsocket.o: $(hdrdir)/ruby/internal/intern/io.h ipsocket.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1125,12 +1221,12 @@ ipsocket.o: $(hdrdir)/ruby/internal/memory.h ipsocket.o: $(hdrdir)/ruby/internal/method.h ipsocket.o: $(hdrdir)/ruby/internal/module.h ipsocket.o: $(hdrdir)/ruby/internal/newobj.h -ipsocket.o: $(hdrdir)/ruby/internal/rgengc.h ipsocket.o: $(hdrdir)/ruby/internal/scan_args.h ipsocket.o: $(hdrdir)/ruby/internal/special_consts.h ipsocket.o: $(hdrdir)/ruby/internal/static_assert.h ipsocket.o: $(hdrdir)/ruby/internal/stdalign.h ipsocket.o: $(hdrdir)/ruby/internal/stdbool.h +ipsocket.o: $(hdrdir)/ruby/internal/stdckdint.h ipsocket.o: $(hdrdir)/ruby/internal/symbol.h ipsocket.o: $(hdrdir)/ruby/internal/value.h ipsocket.o: $(hdrdir)/ruby/internal/value_type.h @@ -1145,27 +1241,46 @@ ipsocket.o: $(hdrdir)/ruby/ruby.h ipsocket.o: $(hdrdir)/ruby/st.h ipsocket.o: $(hdrdir)/ruby/subst.h ipsocket.o: $(hdrdir)/ruby/thread.h +ipsocket.o: $(hdrdir)/ruby/thread_native.h ipsocket.o: $(hdrdir)/ruby/util.h +ipsocket.o: $(hdrdir)/ruby/version.h +ipsocket.o: $(top_srcdir)/ccan/check_type/check_type.h +ipsocket.o: $(top_srcdir)/ccan/container_of/container_of.h +ipsocket.o: $(top_srcdir)/ccan/list/list.h +ipsocket.o: $(top_srcdir)/ccan/str/str.h ipsocket.o: $(top_srcdir)/internal.h ipsocket.o: $(top_srcdir)/internal/array.h +ipsocket.o: $(top_srcdir)/internal/basic_operators.h ipsocket.o: $(top_srcdir)/internal/compilers.h ipsocket.o: $(top_srcdir)/internal/error.h ipsocket.o: $(top_srcdir)/internal/gc.h +ipsocket.o: $(top_srcdir)/internal/imemo.h ipsocket.o: $(top_srcdir)/internal/io.h +ipsocket.o: $(top_srcdir)/internal/sanitizers.h ipsocket.o: $(top_srcdir)/internal/serial.h ipsocket.o: $(top_srcdir)/internal/static_assert.h ipsocket.o: $(top_srcdir)/internal/string.h ipsocket.o: $(top_srcdir)/internal/thread.h ipsocket.o: $(top_srcdir)/internal/vm.h ipsocket.o: $(top_srcdir)/internal/warnings.h +ipsocket.o: $(top_srcdir)/method.h +ipsocket.o: $(top_srcdir)/node.h +ipsocket.o: $(top_srcdir)/ruby_assert.h +ipsocket.o: $(top_srcdir)/ruby_atomic.h +ipsocket.o: $(top_srcdir)/rubyparser.h ipsocket.o: $(top_srcdir)/shape.h +ipsocket.o: $(top_srcdir)/thread_pthread.h +ipsocket.o: $(top_srcdir)/vm_core.h +ipsocket.o: $(top_srcdir)/vm_opts.h ipsocket.o: constdefs.h ipsocket.o: ipsocket.c ipsocket.o: rubysocket.h ipsocket.o: sockport.h +ipsocket.o: {$(VPATH)}id.h option.o: $(RUBY_EXTCONF_H) option.o: $(arch_hdrdir)/ruby/config.h option.o: $(hdrdir)/ruby/assert.h +option.o: $(hdrdir)/ruby/atomic.h option.o: $(hdrdir)/ruby/backward.h option.o: $(hdrdir)/ruby/backward/2/assume.h option.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -1218,6 +1333,7 @@ option.o: $(hdrdir)/ruby/internal/attr/noexcept.h option.o: $(hdrdir)/ruby/internal/attr/noinline.h option.o: $(hdrdir)/ruby/internal/attr/nonnull.h option.o: $(hdrdir)/ruby/internal/attr/noreturn.h +option.o: $(hdrdir)/ruby/internal/attr/packed_struct.h option.o: $(hdrdir)/ruby/internal/attr/pure.h option.o: $(hdrdir)/ruby/internal/attr/restrict.h option.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1286,7 +1402,6 @@ option.o: $(hdrdir)/ruby/internal/intern/enumerator.h option.o: $(hdrdir)/ruby/internal/intern/error.h option.o: $(hdrdir)/ruby/internal/intern/eval.h option.o: $(hdrdir)/ruby/internal/intern/file.h -option.o: $(hdrdir)/ruby/internal/intern/gc.h option.o: $(hdrdir)/ruby/internal/intern/hash.h option.o: $(hdrdir)/ruby/internal/intern/io.h option.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1317,12 +1432,12 @@ option.o: $(hdrdir)/ruby/internal/memory.h option.o: $(hdrdir)/ruby/internal/method.h option.o: $(hdrdir)/ruby/internal/module.h option.o: $(hdrdir)/ruby/internal/newobj.h -option.o: $(hdrdir)/ruby/internal/rgengc.h option.o: $(hdrdir)/ruby/internal/scan_args.h option.o: $(hdrdir)/ruby/internal/special_consts.h option.o: $(hdrdir)/ruby/internal/static_assert.h option.o: $(hdrdir)/ruby/internal/stdalign.h option.o: $(hdrdir)/ruby/internal/stdbool.h +option.o: $(hdrdir)/ruby/internal/stdckdint.h option.o: $(hdrdir)/ruby/internal/symbol.h option.o: $(hdrdir)/ruby/internal/value.h option.o: $(hdrdir)/ruby/internal/value_type.h @@ -1337,27 +1452,46 @@ option.o: $(hdrdir)/ruby/ruby.h option.o: $(hdrdir)/ruby/st.h option.o: $(hdrdir)/ruby/subst.h option.o: $(hdrdir)/ruby/thread.h +option.o: $(hdrdir)/ruby/thread_native.h option.o: $(hdrdir)/ruby/util.h +option.o: $(hdrdir)/ruby/version.h +option.o: $(top_srcdir)/ccan/check_type/check_type.h +option.o: $(top_srcdir)/ccan/container_of/container_of.h +option.o: $(top_srcdir)/ccan/list/list.h +option.o: $(top_srcdir)/ccan/str/str.h option.o: $(top_srcdir)/internal.h option.o: $(top_srcdir)/internal/array.h +option.o: $(top_srcdir)/internal/basic_operators.h option.o: $(top_srcdir)/internal/compilers.h option.o: $(top_srcdir)/internal/error.h option.o: $(top_srcdir)/internal/gc.h +option.o: $(top_srcdir)/internal/imemo.h option.o: $(top_srcdir)/internal/io.h +option.o: $(top_srcdir)/internal/sanitizers.h option.o: $(top_srcdir)/internal/serial.h option.o: $(top_srcdir)/internal/static_assert.h option.o: $(top_srcdir)/internal/string.h option.o: $(top_srcdir)/internal/thread.h option.o: $(top_srcdir)/internal/vm.h option.o: $(top_srcdir)/internal/warnings.h +option.o: $(top_srcdir)/method.h +option.o: $(top_srcdir)/node.h +option.o: $(top_srcdir)/ruby_assert.h +option.o: $(top_srcdir)/ruby_atomic.h +option.o: $(top_srcdir)/rubyparser.h option.o: $(top_srcdir)/shape.h +option.o: $(top_srcdir)/thread_pthread.h +option.o: $(top_srcdir)/vm_core.h +option.o: $(top_srcdir)/vm_opts.h option.o: constdefs.h option.o: option.c option.o: rubysocket.h option.o: sockport.h +option.o: {$(VPATH)}id.h raddrinfo.o: $(RUBY_EXTCONF_H) raddrinfo.o: $(arch_hdrdir)/ruby/config.h raddrinfo.o: $(hdrdir)/ruby/assert.h +raddrinfo.o: $(hdrdir)/ruby/atomic.h raddrinfo.o: $(hdrdir)/ruby/backward.h raddrinfo.o: $(hdrdir)/ruby/backward/2/assume.h raddrinfo.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -1410,6 +1544,7 @@ raddrinfo.o: $(hdrdir)/ruby/internal/attr/noexcept.h raddrinfo.o: $(hdrdir)/ruby/internal/attr/noinline.h raddrinfo.o: $(hdrdir)/ruby/internal/attr/nonnull.h raddrinfo.o: $(hdrdir)/ruby/internal/attr/noreturn.h +raddrinfo.o: $(hdrdir)/ruby/internal/attr/packed_struct.h raddrinfo.o: $(hdrdir)/ruby/internal/attr/pure.h raddrinfo.o: $(hdrdir)/ruby/internal/attr/restrict.h raddrinfo.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1478,7 +1613,6 @@ raddrinfo.o: $(hdrdir)/ruby/internal/intern/enumerator.h raddrinfo.o: $(hdrdir)/ruby/internal/intern/error.h raddrinfo.o: $(hdrdir)/ruby/internal/intern/eval.h raddrinfo.o: $(hdrdir)/ruby/internal/intern/file.h -raddrinfo.o: $(hdrdir)/ruby/internal/intern/gc.h raddrinfo.o: $(hdrdir)/ruby/internal/intern/hash.h raddrinfo.o: $(hdrdir)/ruby/internal/intern/io.h raddrinfo.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1509,12 +1643,12 @@ raddrinfo.o: $(hdrdir)/ruby/internal/memory.h raddrinfo.o: $(hdrdir)/ruby/internal/method.h raddrinfo.o: $(hdrdir)/ruby/internal/module.h raddrinfo.o: $(hdrdir)/ruby/internal/newobj.h -raddrinfo.o: $(hdrdir)/ruby/internal/rgengc.h raddrinfo.o: $(hdrdir)/ruby/internal/scan_args.h raddrinfo.o: $(hdrdir)/ruby/internal/special_consts.h raddrinfo.o: $(hdrdir)/ruby/internal/static_assert.h raddrinfo.o: $(hdrdir)/ruby/internal/stdalign.h raddrinfo.o: $(hdrdir)/ruby/internal/stdbool.h +raddrinfo.o: $(hdrdir)/ruby/internal/stdckdint.h raddrinfo.o: $(hdrdir)/ruby/internal/symbol.h raddrinfo.o: $(hdrdir)/ruby/internal/value.h raddrinfo.o: $(hdrdir)/ruby/internal/value_type.h @@ -1529,27 +1663,46 @@ raddrinfo.o: $(hdrdir)/ruby/ruby.h raddrinfo.o: $(hdrdir)/ruby/st.h raddrinfo.o: $(hdrdir)/ruby/subst.h raddrinfo.o: $(hdrdir)/ruby/thread.h +raddrinfo.o: $(hdrdir)/ruby/thread_native.h raddrinfo.o: $(hdrdir)/ruby/util.h +raddrinfo.o: $(hdrdir)/ruby/version.h +raddrinfo.o: $(top_srcdir)/ccan/check_type/check_type.h +raddrinfo.o: $(top_srcdir)/ccan/container_of/container_of.h +raddrinfo.o: $(top_srcdir)/ccan/list/list.h +raddrinfo.o: $(top_srcdir)/ccan/str/str.h raddrinfo.o: $(top_srcdir)/internal.h raddrinfo.o: $(top_srcdir)/internal/array.h +raddrinfo.o: $(top_srcdir)/internal/basic_operators.h raddrinfo.o: $(top_srcdir)/internal/compilers.h raddrinfo.o: $(top_srcdir)/internal/error.h raddrinfo.o: $(top_srcdir)/internal/gc.h +raddrinfo.o: $(top_srcdir)/internal/imemo.h raddrinfo.o: $(top_srcdir)/internal/io.h +raddrinfo.o: $(top_srcdir)/internal/sanitizers.h raddrinfo.o: $(top_srcdir)/internal/serial.h raddrinfo.o: $(top_srcdir)/internal/static_assert.h raddrinfo.o: $(top_srcdir)/internal/string.h raddrinfo.o: $(top_srcdir)/internal/thread.h raddrinfo.o: $(top_srcdir)/internal/vm.h raddrinfo.o: $(top_srcdir)/internal/warnings.h +raddrinfo.o: $(top_srcdir)/method.h +raddrinfo.o: $(top_srcdir)/node.h +raddrinfo.o: $(top_srcdir)/ruby_assert.h +raddrinfo.o: $(top_srcdir)/ruby_atomic.h +raddrinfo.o: $(top_srcdir)/rubyparser.h raddrinfo.o: $(top_srcdir)/shape.h +raddrinfo.o: $(top_srcdir)/thread_pthread.h +raddrinfo.o: $(top_srcdir)/vm_core.h +raddrinfo.o: $(top_srcdir)/vm_opts.h raddrinfo.o: constdefs.h raddrinfo.o: raddrinfo.c raddrinfo.o: rubysocket.h raddrinfo.o: sockport.h +raddrinfo.o: {$(VPATH)}id.h socket.o: $(RUBY_EXTCONF_H) socket.o: $(arch_hdrdir)/ruby/config.h socket.o: $(hdrdir)/ruby/assert.h +socket.o: $(hdrdir)/ruby/atomic.h socket.o: $(hdrdir)/ruby/backward.h socket.o: $(hdrdir)/ruby/backward/2/assume.h socket.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -1602,6 +1755,7 @@ socket.o: $(hdrdir)/ruby/internal/attr/noexcept.h socket.o: $(hdrdir)/ruby/internal/attr/noinline.h socket.o: $(hdrdir)/ruby/internal/attr/nonnull.h socket.o: $(hdrdir)/ruby/internal/attr/noreturn.h +socket.o: $(hdrdir)/ruby/internal/attr/packed_struct.h socket.o: $(hdrdir)/ruby/internal/attr/pure.h socket.o: $(hdrdir)/ruby/internal/attr/restrict.h socket.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1670,7 +1824,6 @@ socket.o: $(hdrdir)/ruby/internal/intern/enumerator.h socket.o: $(hdrdir)/ruby/internal/intern/error.h socket.o: $(hdrdir)/ruby/internal/intern/eval.h socket.o: $(hdrdir)/ruby/internal/intern/file.h -socket.o: $(hdrdir)/ruby/internal/intern/gc.h socket.o: $(hdrdir)/ruby/internal/intern/hash.h socket.o: $(hdrdir)/ruby/internal/intern/io.h socket.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1701,12 +1854,12 @@ socket.o: $(hdrdir)/ruby/internal/memory.h socket.o: $(hdrdir)/ruby/internal/method.h socket.o: $(hdrdir)/ruby/internal/module.h socket.o: $(hdrdir)/ruby/internal/newobj.h -socket.o: $(hdrdir)/ruby/internal/rgengc.h socket.o: $(hdrdir)/ruby/internal/scan_args.h socket.o: $(hdrdir)/ruby/internal/special_consts.h socket.o: $(hdrdir)/ruby/internal/static_assert.h socket.o: $(hdrdir)/ruby/internal/stdalign.h socket.o: $(hdrdir)/ruby/internal/stdbool.h +socket.o: $(hdrdir)/ruby/internal/stdckdint.h socket.o: $(hdrdir)/ruby/internal/symbol.h socket.o: $(hdrdir)/ruby/internal/value.h socket.o: $(hdrdir)/ruby/internal/value_type.h @@ -1721,27 +1874,46 @@ socket.o: $(hdrdir)/ruby/ruby.h socket.o: $(hdrdir)/ruby/st.h socket.o: $(hdrdir)/ruby/subst.h socket.o: $(hdrdir)/ruby/thread.h +socket.o: $(hdrdir)/ruby/thread_native.h socket.o: $(hdrdir)/ruby/util.h +socket.o: $(hdrdir)/ruby/version.h +socket.o: $(top_srcdir)/ccan/check_type/check_type.h +socket.o: $(top_srcdir)/ccan/container_of/container_of.h +socket.o: $(top_srcdir)/ccan/list/list.h +socket.o: $(top_srcdir)/ccan/str/str.h socket.o: $(top_srcdir)/internal.h socket.o: $(top_srcdir)/internal/array.h +socket.o: $(top_srcdir)/internal/basic_operators.h socket.o: $(top_srcdir)/internal/compilers.h socket.o: $(top_srcdir)/internal/error.h socket.o: $(top_srcdir)/internal/gc.h +socket.o: $(top_srcdir)/internal/imemo.h socket.o: $(top_srcdir)/internal/io.h +socket.o: $(top_srcdir)/internal/sanitizers.h socket.o: $(top_srcdir)/internal/serial.h socket.o: $(top_srcdir)/internal/static_assert.h socket.o: $(top_srcdir)/internal/string.h socket.o: $(top_srcdir)/internal/thread.h socket.o: $(top_srcdir)/internal/vm.h socket.o: $(top_srcdir)/internal/warnings.h +socket.o: $(top_srcdir)/method.h +socket.o: $(top_srcdir)/node.h +socket.o: $(top_srcdir)/ruby_assert.h +socket.o: $(top_srcdir)/ruby_atomic.h +socket.o: $(top_srcdir)/rubyparser.h socket.o: $(top_srcdir)/shape.h +socket.o: $(top_srcdir)/thread_pthread.h +socket.o: $(top_srcdir)/vm_core.h +socket.o: $(top_srcdir)/vm_opts.h socket.o: constdefs.h socket.o: rubysocket.h socket.o: socket.c socket.o: sockport.h +socket.o: {$(VPATH)}id.h sockssocket.o: $(RUBY_EXTCONF_H) sockssocket.o: $(arch_hdrdir)/ruby/config.h sockssocket.o: $(hdrdir)/ruby/assert.h +sockssocket.o: $(hdrdir)/ruby/atomic.h sockssocket.o: $(hdrdir)/ruby/backward.h sockssocket.o: $(hdrdir)/ruby/backward/2/assume.h sockssocket.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -1794,6 +1966,7 @@ sockssocket.o: $(hdrdir)/ruby/internal/attr/noexcept.h sockssocket.o: $(hdrdir)/ruby/internal/attr/noinline.h sockssocket.o: $(hdrdir)/ruby/internal/attr/nonnull.h sockssocket.o: $(hdrdir)/ruby/internal/attr/noreturn.h +sockssocket.o: $(hdrdir)/ruby/internal/attr/packed_struct.h sockssocket.o: $(hdrdir)/ruby/internal/attr/pure.h sockssocket.o: $(hdrdir)/ruby/internal/attr/restrict.h sockssocket.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -1862,7 +2035,6 @@ sockssocket.o: $(hdrdir)/ruby/internal/intern/enumerator.h sockssocket.o: $(hdrdir)/ruby/internal/intern/error.h sockssocket.o: $(hdrdir)/ruby/internal/intern/eval.h sockssocket.o: $(hdrdir)/ruby/internal/intern/file.h -sockssocket.o: $(hdrdir)/ruby/internal/intern/gc.h sockssocket.o: $(hdrdir)/ruby/internal/intern/hash.h sockssocket.o: $(hdrdir)/ruby/internal/intern/io.h sockssocket.o: $(hdrdir)/ruby/internal/intern/load.h @@ -1893,12 +2065,12 @@ sockssocket.o: $(hdrdir)/ruby/internal/memory.h sockssocket.o: $(hdrdir)/ruby/internal/method.h sockssocket.o: $(hdrdir)/ruby/internal/module.h sockssocket.o: $(hdrdir)/ruby/internal/newobj.h -sockssocket.o: $(hdrdir)/ruby/internal/rgengc.h sockssocket.o: $(hdrdir)/ruby/internal/scan_args.h sockssocket.o: $(hdrdir)/ruby/internal/special_consts.h sockssocket.o: $(hdrdir)/ruby/internal/static_assert.h sockssocket.o: $(hdrdir)/ruby/internal/stdalign.h sockssocket.o: $(hdrdir)/ruby/internal/stdbool.h +sockssocket.o: $(hdrdir)/ruby/internal/stdckdint.h sockssocket.o: $(hdrdir)/ruby/internal/symbol.h sockssocket.o: $(hdrdir)/ruby/internal/value.h sockssocket.o: $(hdrdir)/ruby/internal/value_type.h @@ -1913,27 +2085,46 @@ sockssocket.o: $(hdrdir)/ruby/ruby.h sockssocket.o: $(hdrdir)/ruby/st.h sockssocket.o: $(hdrdir)/ruby/subst.h sockssocket.o: $(hdrdir)/ruby/thread.h +sockssocket.o: $(hdrdir)/ruby/thread_native.h sockssocket.o: $(hdrdir)/ruby/util.h +sockssocket.o: $(hdrdir)/ruby/version.h +sockssocket.o: $(top_srcdir)/ccan/check_type/check_type.h +sockssocket.o: $(top_srcdir)/ccan/container_of/container_of.h +sockssocket.o: $(top_srcdir)/ccan/list/list.h +sockssocket.o: $(top_srcdir)/ccan/str/str.h sockssocket.o: $(top_srcdir)/internal.h sockssocket.o: $(top_srcdir)/internal/array.h +sockssocket.o: $(top_srcdir)/internal/basic_operators.h sockssocket.o: $(top_srcdir)/internal/compilers.h sockssocket.o: $(top_srcdir)/internal/error.h sockssocket.o: $(top_srcdir)/internal/gc.h +sockssocket.o: $(top_srcdir)/internal/imemo.h sockssocket.o: $(top_srcdir)/internal/io.h +sockssocket.o: $(top_srcdir)/internal/sanitizers.h sockssocket.o: $(top_srcdir)/internal/serial.h sockssocket.o: $(top_srcdir)/internal/static_assert.h sockssocket.o: $(top_srcdir)/internal/string.h sockssocket.o: $(top_srcdir)/internal/thread.h sockssocket.o: $(top_srcdir)/internal/vm.h sockssocket.o: $(top_srcdir)/internal/warnings.h +sockssocket.o: $(top_srcdir)/method.h +sockssocket.o: $(top_srcdir)/node.h +sockssocket.o: $(top_srcdir)/ruby_assert.h +sockssocket.o: $(top_srcdir)/ruby_atomic.h +sockssocket.o: $(top_srcdir)/rubyparser.h sockssocket.o: $(top_srcdir)/shape.h +sockssocket.o: $(top_srcdir)/thread_pthread.h +sockssocket.o: $(top_srcdir)/vm_core.h +sockssocket.o: $(top_srcdir)/vm_opts.h sockssocket.o: constdefs.h sockssocket.o: rubysocket.h sockssocket.o: sockport.h sockssocket.o: sockssocket.c +sockssocket.o: {$(VPATH)}id.h tcpserver.o: $(RUBY_EXTCONF_H) tcpserver.o: $(arch_hdrdir)/ruby/config.h tcpserver.o: $(hdrdir)/ruby/assert.h +tcpserver.o: $(hdrdir)/ruby/atomic.h tcpserver.o: $(hdrdir)/ruby/backward.h tcpserver.o: $(hdrdir)/ruby/backward/2/assume.h tcpserver.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -1986,6 +2177,7 @@ tcpserver.o: $(hdrdir)/ruby/internal/attr/noexcept.h tcpserver.o: $(hdrdir)/ruby/internal/attr/noinline.h tcpserver.o: $(hdrdir)/ruby/internal/attr/nonnull.h tcpserver.o: $(hdrdir)/ruby/internal/attr/noreturn.h +tcpserver.o: $(hdrdir)/ruby/internal/attr/packed_struct.h tcpserver.o: $(hdrdir)/ruby/internal/attr/pure.h tcpserver.o: $(hdrdir)/ruby/internal/attr/restrict.h tcpserver.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2054,7 +2246,6 @@ tcpserver.o: $(hdrdir)/ruby/internal/intern/enumerator.h tcpserver.o: $(hdrdir)/ruby/internal/intern/error.h tcpserver.o: $(hdrdir)/ruby/internal/intern/eval.h tcpserver.o: $(hdrdir)/ruby/internal/intern/file.h -tcpserver.o: $(hdrdir)/ruby/internal/intern/gc.h tcpserver.o: $(hdrdir)/ruby/internal/intern/hash.h tcpserver.o: $(hdrdir)/ruby/internal/intern/io.h tcpserver.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2085,12 +2276,12 @@ tcpserver.o: $(hdrdir)/ruby/internal/memory.h tcpserver.o: $(hdrdir)/ruby/internal/method.h tcpserver.o: $(hdrdir)/ruby/internal/module.h tcpserver.o: $(hdrdir)/ruby/internal/newobj.h -tcpserver.o: $(hdrdir)/ruby/internal/rgengc.h tcpserver.o: $(hdrdir)/ruby/internal/scan_args.h tcpserver.o: $(hdrdir)/ruby/internal/special_consts.h tcpserver.o: $(hdrdir)/ruby/internal/static_assert.h tcpserver.o: $(hdrdir)/ruby/internal/stdalign.h tcpserver.o: $(hdrdir)/ruby/internal/stdbool.h +tcpserver.o: $(hdrdir)/ruby/internal/stdckdint.h tcpserver.o: $(hdrdir)/ruby/internal/symbol.h tcpserver.o: $(hdrdir)/ruby/internal/value.h tcpserver.o: $(hdrdir)/ruby/internal/value_type.h @@ -2105,27 +2296,46 @@ tcpserver.o: $(hdrdir)/ruby/ruby.h tcpserver.o: $(hdrdir)/ruby/st.h tcpserver.o: $(hdrdir)/ruby/subst.h tcpserver.o: $(hdrdir)/ruby/thread.h +tcpserver.o: $(hdrdir)/ruby/thread_native.h tcpserver.o: $(hdrdir)/ruby/util.h +tcpserver.o: $(hdrdir)/ruby/version.h +tcpserver.o: $(top_srcdir)/ccan/check_type/check_type.h +tcpserver.o: $(top_srcdir)/ccan/container_of/container_of.h +tcpserver.o: $(top_srcdir)/ccan/list/list.h +tcpserver.o: $(top_srcdir)/ccan/str/str.h tcpserver.o: $(top_srcdir)/internal.h tcpserver.o: $(top_srcdir)/internal/array.h +tcpserver.o: $(top_srcdir)/internal/basic_operators.h tcpserver.o: $(top_srcdir)/internal/compilers.h tcpserver.o: $(top_srcdir)/internal/error.h tcpserver.o: $(top_srcdir)/internal/gc.h +tcpserver.o: $(top_srcdir)/internal/imemo.h tcpserver.o: $(top_srcdir)/internal/io.h +tcpserver.o: $(top_srcdir)/internal/sanitizers.h tcpserver.o: $(top_srcdir)/internal/serial.h tcpserver.o: $(top_srcdir)/internal/static_assert.h tcpserver.o: $(top_srcdir)/internal/string.h tcpserver.o: $(top_srcdir)/internal/thread.h tcpserver.o: $(top_srcdir)/internal/vm.h tcpserver.o: $(top_srcdir)/internal/warnings.h +tcpserver.o: $(top_srcdir)/method.h +tcpserver.o: $(top_srcdir)/node.h +tcpserver.o: $(top_srcdir)/ruby_assert.h +tcpserver.o: $(top_srcdir)/ruby_atomic.h +tcpserver.o: $(top_srcdir)/rubyparser.h tcpserver.o: $(top_srcdir)/shape.h +tcpserver.o: $(top_srcdir)/thread_pthread.h +tcpserver.o: $(top_srcdir)/vm_core.h +tcpserver.o: $(top_srcdir)/vm_opts.h tcpserver.o: constdefs.h tcpserver.o: rubysocket.h tcpserver.o: sockport.h tcpserver.o: tcpserver.c +tcpserver.o: {$(VPATH)}id.h tcpsocket.o: $(RUBY_EXTCONF_H) tcpsocket.o: $(arch_hdrdir)/ruby/config.h tcpsocket.o: $(hdrdir)/ruby/assert.h +tcpsocket.o: $(hdrdir)/ruby/atomic.h tcpsocket.o: $(hdrdir)/ruby/backward.h tcpsocket.o: $(hdrdir)/ruby/backward/2/assume.h tcpsocket.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -2178,6 +2388,7 @@ tcpsocket.o: $(hdrdir)/ruby/internal/attr/noexcept.h tcpsocket.o: $(hdrdir)/ruby/internal/attr/noinline.h tcpsocket.o: $(hdrdir)/ruby/internal/attr/nonnull.h tcpsocket.o: $(hdrdir)/ruby/internal/attr/noreturn.h +tcpsocket.o: $(hdrdir)/ruby/internal/attr/packed_struct.h tcpsocket.o: $(hdrdir)/ruby/internal/attr/pure.h tcpsocket.o: $(hdrdir)/ruby/internal/attr/restrict.h tcpsocket.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2246,7 +2457,6 @@ tcpsocket.o: $(hdrdir)/ruby/internal/intern/enumerator.h tcpsocket.o: $(hdrdir)/ruby/internal/intern/error.h tcpsocket.o: $(hdrdir)/ruby/internal/intern/eval.h tcpsocket.o: $(hdrdir)/ruby/internal/intern/file.h -tcpsocket.o: $(hdrdir)/ruby/internal/intern/gc.h tcpsocket.o: $(hdrdir)/ruby/internal/intern/hash.h tcpsocket.o: $(hdrdir)/ruby/internal/intern/io.h tcpsocket.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2277,12 +2487,12 @@ tcpsocket.o: $(hdrdir)/ruby/internal/memory.h tcpsocket.o: $(hdrdir)/ruby/internal/method.h tcpsocket.o: $(hdrdir)/ruby/internal/module.h tcpsocket.o: $(hdrdir)/ruby/internal/newobj.h -tcpsocket.o: $(hdrdir)/ruby/internal/rgengc.h tcpsocket.o: $(hdrdir)/ruby/internal/scan_args.h tcpsocket.o: $(hdrdir)/ruby/internal/special_consts.h tcpsocket.o: $(hdrdir)/ruby/internal/static_assert.h tcpsocket.o: $(hdrdir)/ruby/internal/stdalign.h tcpsocket.o: $(hdrdir)/ruby/internal/stdbool.h +tcpsocket.o: $(hdrdir)/ruby/internal/stdckdint.h tcpsocket.o: $(hdrdir)/ruby/internal/symbol.h tcpsocket.o: $(hdrdir)/ruby/internal/value.h tcpsocket.o: $(hdrdir)/ruby/internal/value_type.h @@ -2297,27 +2507,46 @@ tcpsocket.o: $(hdrdir)/ruby/ruby.h tcpsocket.o: $(hdrdir)/ruby/st.h tcpsocket.o: $(hdrdir)/ruby/subst.h tcpsocket.o: $(hdrdir)/ruby/thread.h +tcpsocket.o: $(hdrdir)/ruby/thread_native.h tcpsocket.o: $(hdrdir)/ruby/util.h +tcpsocket.o: $(hdrdir)/ruby/version.h +tcpsocket.o: $(top_srcdir)/ccan/check_type/check_type.h +tcpsocket.o: $(top_srcdir)/ccan/container_of/container_of.h +tcpsocket.o: $(top_srcdir)/ccan/list/list.h +tcpsocket.o: $(top_srcdir)/ccan/str/str.h tcpsocket.o: $(top_srcdir)/internal.h tcpsocket.o: $(top_srcdir)/internal/array.h +tcpsocket.o: $(top_srcdir)/internal/basic_operators.h tcpsocket.o: $(top_srcdir)/internal/compilers.h tcpsocket.o: $(top_srcdir)/internal/error.h tcpsocket.o: $(top_srcdir)/internal/gc.h +tcpsocket.o: $(top_srcdir)/internal/imemo.h tcpsocket.o: $(top_srcdir)/internal/io.h +tcpsocket.o: $(top_srcdir)/internal/sanitizers.h tcpsocket.o: $(top_srcdir)/internal/serial.h tcpsocket.o: $(top_srcdir)/internal/static_assert.h tcpsocket.o: $(top_srcdir)/internal/string.h tcpsocket.o: $(top_srcdir)/internal/thread.h tcpsocket.o: $(top_srcdir)/internal/vm.h tcpsocket.o: $(top_srcdir)/internal/warnings.h +tcpsocket.o: $(top_srcdir)/method.h +tcpsocket.o: $(top_srcdir)/node.h +tcpsocket.o: $(top_srcdir)/ruby_assert.h +tcpsocket.o: $(top_srcdir)/ruby_atomic.h +tcpsocket.o: $(top_srcdir)/rubyparser.h tcpsocket.o: $(top_srcdir)/shape.h +tcpsocket.o: $(top_srcdir)/thread_pthread.h +tcpsocket.o: $(top_srcdir)/vm_core.h +tcpsocket.o: $(top_srcdir)/vm_opts.h tcpsocket.o: constdefs.h tcpsocket.o: rubysocket.h tcpsocket.o: sockport.h tcpsocket.o: tcpsocket.c +tcpsocket.o: {$(VPATH)}id.h udpsocket.o: $(RUBY_EXTCONF_H) udpsocket.o: $(arch_hdrdir)/ruby/config.h udpsocket.o: $(hdrdir)/ruby/assert.h +udpsocket.o: $(hdrdir)/ruby/atomic.h udpsocket.o: $(hdrdir)/ruby/backward.h udpsocket.o: $(hdrdir)/ruby/backward/2/assume.h udpsocket.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -2370,6 +2599,7 @@ udpsocket.o: $(hdrdir)/ruby/internal/attr/noexcept.h udpsocket.o: $(hdrdir)/ruby/internal/attr/noinline.h udpsocket.o: $(hdrdir)/ruby/internal/attr/nonnull.h udpsocket.o: $(hdrdir)/ruby/internal/attr/noreturn.h +udpsocket.o: $(hdrdir)/ruby/internal/attr/packed_struct.h udpsocket.o: $(hdrdir)/ruby/internal/attr/pure.h udpsocket.o: $(hdrdir)/ruby/internal/attr/restrict.h udpsocket.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2438,7 +2668,6 @@ udpsocket.o: $(hdrdir)/ruby/internal/intern/enumerator.h udpsocket.o: $(hdrdir)/ruby/internal/intern/error.h udpsocket.o: $(hdrdir)/ruby/internal/intern/eval.h udpsocket.o: $(hdrdir)/ruby/internal/intern/file.h -udpsocket.o: $(hdrdir)/ruby/internal/intern/gc.h udpsocket.o: $(hdrdir)/ruby/internal/intern/hash.h udpsocket.o: $(hdrdir)/ruby/internal/intern/io.h udpsocket.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2469,12 +2698,12 @@ udpsocket.o: $(hdrdir)/ruby/internal/memory.h udpsocket.o: $(hdrdir)/ruby/internal/method.h udpsocket.o: $(hdrdir)/ruby/internal/module.h udpsocket.o: $(hdrdir)/ruby/internal/newobj.h -udpsocket.o: $(hdrdir)/ruby/internal/rgengc.h udpsocket.o: $(hdrdir)/ruby/internal/scan_args.h udpsocket.o: $(hdrdir)/ruby/internal/special_consts.h udpsocket.o: $(hdrdir)/ruby/internal/static_assert.h udpsocket.o: $(hdrdir)/ruby/internal/stdalign.h udpsocket.o: $(hdrdir)/ruby/internal/stdbool.h +udpsocket.o: $(hdrdir)/ruby/internal/stdckdint.h udpsocket.o: $(hdrdir)/ruby/internal/symbol.h udpsocket.o: $(hdrdir)/ruby/internal/value.h udpsocket.o: $(hdrdir)/ruby/internal/value_type.h @@ -2489,27 +2718,46 @@ udpsocket.o: $(hdrdir)/ruby/ruby.h udpsocket.o: $(hdrdir)/ruby/st.h udpsocket.o: $(hdrdir)/ruby/subst.h udpsocket.o: $(hdrdir)/ruby/thread.h +udpsocket.o: $(hdrdir)/ruby/thread_native.h udpsocket.o: $(hdrdir)/ruby/util.h +udpsocket.o: $(hdrdir)/ruby/version.h +udpsocket.o: $(top_srcdir)/ccan/check_type/check_type.h +udpsocket.o: $(top_srcdir)/ccan/container_of/container_of.h +udpsocket.o: $(top_srcdir)/ccan/list/list.h +udpsocket.o: $(top_srcdir)/ccan/str/str.h udpsocket.o: $(top_srcdir)/internal.h udpsocket.o: $(top_srcdir)/internal/array.h +udpsocket.o: $(top_srcdir)/internal/basic_operators.h udpsocket.o: $(top_srcdir)/internal/compilers.h udpsocket.o: $(top_srcdir)/internal/error.h udpsocket.o: $(top_srcdir)/internal/gc.h +udpsocket.o: $(top_srcdir)/internal/imemo.h udpsocket.o: $(top_srcdir)/internal/io.h +udpsocket.o: $(top_srcdir)/internal/sanitizers.h udpsocket.o: $(top_srcdir)/internal/serial.h udpsocket.o: $(top_srcdir)/internal/static_assert.h udpsocket.o: $(top_srcdir)/internal/string.h udpsocket.o: $(top_srcdir)/internal/thread.h udpsocket.o: $(top_srcdir)/internal/vm.h udpsocket.o: $(top_srcdir)/internal/warnings.h +udpsocket.o: $(top_srcdir)/method.h +udpsocket.o: $(top_srcdir)/node.h +udpsocket.o: $(top_srcdir)/ruby_assert.h +udpsocket.o: $(top_srcdir)/ruby_atomic.h +udpsocket.o: $(top_srcdir)/rubyparser.h udpsocket.o: $(top_srcdir)/shape.h +udpsocket.o: $(top_srcdir)/thread_pthread.h +udpsocket.o: $(top_srcdir)/vm_core.h +udpsocket.o: $(top_srcdir)/vm_opts.h udpsocket.o: constdefs.h udpsocket.o: rubysocket.h udpsocket.o: sockport.h udpsocket.o: udpsocket.c +udpsocket.o: {$(VPATH)}id.h unixserver.o: $(RUBY_EXTCONF_H) unixserver.o: $(arch_hdrdir)/ruby/config.h unixserver.o: $(hdrdir)/ruby/assert.h +unixserver.o: $(hdrdir)/ruby/atomic.h unixserver.o: $(hdrdir)/ruby/backward.h unixserver.o: $(hdrdir)/ruby/backward/2/assume.h unixserver.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -2562,6 +2810,7 @@ unixserver.o: $(hdrdir)/ruby/internal/attr/noexcept.h unixserver.o: $(hdrdir)/ruby/internal/attr/noinline.h unixserver.o: $(hdrdir)/ruby/internal/attr/nonnull.h unixserver.o: $(hdrdir)/ruby/internal/attr/noreturn.h +unixserver.o: $(hdrdir)/ruby/internal/attr/packed_struct.h unixserver.o: $(hdrdir)/ruby/internal/attr/pure.h unixserver.o: $(hdrdir)/ruby/internal/attr/restrict.h unixserver.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2630,7 +2879,6 @@ unixserver.o: $(hdrdir)/ruby/internal/intern/enumerator.h unixserver.o: $(hdrdir)/ruby/internal/intern/error.h unixserver.o: $(hdrdir)/ruby/internal/intern/eval.h unixserver.o: $(hdrdir)/ruby/internal/intern/file.h -unixserver.o: $(hdrdir)/ruby/internal/intern/gc.h unixserver.o: $(hdrdir)/ruby/internal/intern/hash.h unixserver.o: $(hdrdir)/ruby/internal/intern/io.h unixserver.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2661,12 +2909,12 @@ unixserver.o: $(hdrdir)/ruby/internal/memory.h unixserver.o: $(hdrdir)/ruby/internal/method.h unixserver.o: $(hdrdir)/ruby/internal/module.h unixserver.o: $(hdrdir)/ruby/internal/newobj.h -unixserver.o: $(hdrdir)/ruby/internal/rgengc.h unixserver.o: $(hdrdir)/ruby/internal/scan_args.h unixserver.o: $(hdrdir)/ruby/internal/special_consts.h unixserver.o: $(hdrdir)/ruby/internal/static_assert.h unixserver.o: $(hdrdir)/ruby/internal/stdalign.h unixserver.o: $(hdrdir)/ruby/internal/stdbool.h +unixserver.o: $(hdrdir)/ruby/internal/stdckdint.h unixserver.o: $(hdrdir)/ruby/internal/symbol.h unixserver.o: $(hdrdir)/ruby/internal/value.h unixserver.o: $(hdrdir)/ruby/internal/value_type.h @@ -2681,27 +2929,46 @@ unixserver.o: $(hdrdir)/ruby/ruby.h unixserver.o: $(hdrdir)/ruby/st.h unixserver.o: $(hdrdir)/ruby/subst.h unixserver.o: $(hdrdir)/ruby/thread.h +unixserver.o: $(hdrdir)/ruby/thread_native.h unixserver.o: $(hdrdir)/ruby/util.h +unixserver.o: $(hdrdir)/ruby/version.h +unixserver.o: $(top_srcdir)/ccan/check_type/check_type.h +unixserver.o: $(top_srcdir)/ccan/container_of/container_of.h +unixserver.o: $(top_srcdir)/ccan/list/list.h +unixserver.o: $(top_srcdir)/ccan/str/str.h unixserver.o: $(top_srcdir)/internal.h unixserver.o: $(top_srcdir)/internal/array.h +unixserver.o: $(top_srcdir)/internal/basic_operators.h unixserver.o: $(top_srcdir)/internal/compilers.h unixserver.o: $(top_srcdir)/internal/error.h unixserver.o: $(top_srcdir)/internal/gc.h +unixserver.o: $(top_srcdir)/internal/imemo.h unixserver.o: $(top_srcdir)/internal/io.h +unixserver.o: $(top_srcdir)/internal/sanitizers.h unixserver.o: $(top_srcdir)/internal/serial.h unixserver.o: $(top_srcdir)/internal/static_assert.h unixserver.o: $(top_srcdir)/internal/string.h unixserver.o: $(top_srcdir)/internal/thread.h unixserver.o: $(top_srcdir)/internal/vm.h unixserver.o: $(top_srcdir)/internal/warnings.h +unixserver.o: $(top_srcdir)/method.h +unixserver.o: $(top_srcdir)/node.h +unixserver.o: $(top_srcdir)/ruby_assert.h +unixserver.o: $(top_srcdir)/ruby_atomic.h +unixserver.o: $(top_srcdir)/rubyparser.h unixserver.o: $(top_srcdir)/shape.h +unixserver.o: $(top_srcdir)/thread_pthread.h +unixserver.o: $(top_srcdir)/vm_core.h +unixserver.o: $(top_srcdir)/vm_opts.h unixserver.o: constdefs.h unixserver.o: rubysocket.h unixserver.o: sockport.h unixserver.o: unixserver.c +unixserver.o: {$(VPATH)}id.h unixsocket.o: $(RUBY_EXTCONF_H) unixsocket.o: $(arch_hdrdir)/ruby/config.h unixsocket.o: $(hdrdir)/ruby/assert.h +unixsocket.o: $(hdrdir)/ruby/atomic.h unixsocket.o: $(hdrdir)/ruby/backward.h unixsocket.o: $(hdrdir)/ruby/backward/2/assume.h unixsocket.o: $(hdrdir)/ruby/backward/2/attributes.h @@ -2754,6 +3021,7 @@ unixsocket.o: $(hdrdir)/ruby/internal/attr/noexcept.h unixsocket.o: $(hdrdir)/ruby/internal/attr/noinline.h unixsocket.o: $(hdrdir)/ruby/internal/attr/nonnull.h unixsocket.o: $(hdrdir)/ruby/internal/attr/noreturn.h +unixsocket.o: $(hdrdir)/ruby/internal/attr/packed_struct.h unixsocket.o: $(hdrdir)/ruby/internal/attr/pure.h unixsocket.o: $(hdrdir)/ruby/internal/attr/restrict.h unixsocket.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -2822,7 +3090,6 @@ unixsocket.o: $(hdrdir)/ruby/internal/intern/enumerator.h unixsocket.o: $(hdrdir)/ruby/internal/intern/error.h unixsocket.o: $(hdrdir)/ruby/internal/intern/eval.h unixsocket.o: $(hdrdir)/ruby/internal/intern/file.h -unixsocket.o: $(hdrdir)/ruby/internal/intern/gc.h unixsocket.o: $(hdrdir)/ruby/internal/intern/hash.h unixsocket.o: $(hdrdir)/ruby/internal/intern/io.h unixsocket.o: $(hdrdir)/ruby/internal/intern/load.h @@ -2853,12 +3120,12 @@ unixsocket.o: $(hdrdir)/ruby/internal/memory.h unixsocket.o: $(hdrdir)/ruby/internal/method.h unixsocket.o: $(hdrdir)/ruby/internal/module.h unixsocket.o: $(hdrdir)/ruby/internal/newobj.h -unixsocket.o: $(hdrdir)/ruby/internal/rgengc.h unixsocket.o: $(hdrdir)/ruby/internal/scan_args.h unixsocket.o: $(hdrdir)/ruby/internal/special_consts.h unixsocket.o: $(hdrdir)/ruby/internal/static_assert.h unixsocket.o: $(hdrdir)/ruby/internal/stdalign.h unixsocket.o: $(hdrdir)/ruby/internal/stdbool.h +unixsocket.o: $(hdrdir)/ruby/internal/stdckdint.h unixsocket.o: $(hdrdir)/ruby/internal/symbol.h unixsocket.o: $(hdrdir)/ruby/internal/value.h unixsocket.o: $(hdrdir)/ruby/internal/value_type.h @@ -2873,22 +3140,40 @@ unixsocket.o: $(hdrdir)/ruby/ruby.h unixsocket.o: $(hdrdir)/ruby/st.h unixsocket.o: $(hdrdir)/ruby/subst.h unixsocket.o: $(hdrdir)/ruby/thread.h +unixsocket.o: $(hdrdir)/ruby/thread_native.h unixsocket.o: $(hdrdir)/ruby/util.h +unixsocket.o: $(hdrdir)/ruby/version.h +unixsocket.o: $(top_srcdir)/ccan/check_type/check_type.h +unixsocket.o: $(top_srcdir)/ccan/container_of/container_of.h +unixsocket.o: $(top_srcdir)/ccan/list/list.h +unixsocket.o: $(top_srcdir)/ccan/str/str.h unixsocket.o: $(top_srcdir)/internal.h unixsocket.o: $(top_srcdir)/internal/array.h +unixsocket.o: $(top_srcdir)/internal/basic_operators.h unixsocket.o: $(top_srcdir)/internal/compilers.h unixsocket.o: $(top_srcdir)/internal/error.h unixsocket.o: $(top_srcdir)/internal/gc.h +unixsocket.o: $(top_srcdir)/internal/imemo.h unixsocket.o: $(top_srcdir)/internal/io.h +unixsocket.o: $(top_srcdir)/internal/sanitizers.h unixsocket.o: $(top_srcdir)/internal/serial.h unixsocket.o: $(top_srcdir)/internal/static_assert.h unixsocket.o: $(top_srcdir)/internal/string.h unixsocket.o: $(top_srcdir)/internal/thread.h unixsocket.o: $(top_srcdir)/internal/vm.h unixsocket.o: $(top_srcdir)/internal/warnings.h +unixsocket.o: $(top_srcdir)/method.h +unixsocket.o: $(top_srcdir)/node.h +unixsocket.o: $(top_srcdir)/ruby_assert.h +unixsocket.o: $(top_srcdir)/ruby_atomic.h +unixsocket.o: $(top_srcdir)/rubyparser.h unixsocket.o: $(top_srcdir)/shape.h +unixsocket.o: $(top_srcdir)/thread_pthread.h +unixsocket.o: $(top_srcdir)/vm_core.h +unixsocket.o: $(top_srcdir)/vm_opts.h unixsocket.o: constdefs.h unixsocket.o: rubysocket.h unixsocket.o: sockport.h unixsocket.o: unixsocket.c +unixsocket.o: {$(VPATH)}id.h # AUTOGENERATED DEPENDENCIES END diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 37ff216560..d44ce31b0a 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -327,6 +327,8 @@ end net/if_dl.h arpa/nameser.h resolv.h + pthread.h + sched.h ].each {|h| if have_header(h, headers) headers << h @@ -347,10 +349,22 @@ have_type("struct sockaddr_storage", headers) have_type("struct addrinfo", headers) -if have_type("socklen_t", headers) - if try_static_assert("sizeof(socklen_t) >= sizeof(long)", headers) - $defs << "-DRSTRING_SOCKLEN=(socklen_t)RSTRING_LEN" +def check_socklen(headers) + def (fmt = "none").%(x) + x || self end + s = checking_for("RSTRING_SOCKLEN", fmt) do + if try_static_assert("sizeof(socklen_t) >= sizeof(long)", headers) + "RSTRING_LEN" + else + "RSTRING_LENINT" + end + end + $defs << "-DRSTRING_SOCKLEN=(socklen_t)"+s +end + +if have_type("socklen_t", headers) + check_socklen(headers) end have_type("struct in_pktinfo", headers) {|src| @@ -687,5 +701,10 @@ SRC "not needed" end end + + have_func("pthread_create") + have_func("pthread_detach") + + $VPATH << '$(topdir)' << '$(top_srcdir)' create_makefile("socket") end diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index 95a2feb3be..bf0d90129f 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -219,8 +219,7 @@ freeaddrinfo(struct addrinfo *ai) do { next = ai->ai_next; - if (ai->ai_canonname) - free(ai->ai_canonname); + free(ai->ai_canonname); /* no need to free(ai->ai_addr) */ free(ai); } while ((ai = next) != NULL); diff --git a/ext/socket/init.c b/ext/socket/init.c index 557d4374a5..0e312b540e 100644 --- a/ext/socket/init.c +++ b/ext/socket/init.c @@ -27,6 +27,7 @@ VALUE rb_cSocket; VALUE rb_cAddrinfo; VALUE rb_eSocket; +VALUE rb_eResolution; #ifdef SOCKS VALUE rb_cSOCKSSocket; @@ -34,9 +35,10 @@ VALUE rb_cSOCKSSocket; int rsock_do_not_reverse_lookup = 1; static VALUE sym_wait_readable; +static ID id_error_code; void -rsock_raise_socket_error(const char *reason, int error) +rsock_raise_resolution_error(const char *reason, int error) { #ifdef EAI_SYSTEM int e; @@ -48,10 +50,14 @@ rsock_raise_socket_error(const char *reason, int error) VALUE msg = rb_sprintf("%s: ", reason); if (!enc) enc = rb_default_internal_encoding(); rb_str_concat(msg, rb_w32_conv_from_wchar(gai_strerrorW(error), enc)); - rb_exc_raise(rb_exc_new_str(rb_eSocket, msg)); #else - rb_raise(rb_eSocket, "%s: %s", reason, gai_strerror(error)); + VALUE msg = rb_sprintf("%s: %s", reason, gai_strerror(error)); #endif + + StringValue(msg); + VALUE self = rb_class_new_instance(1, &msg, rb_eResolution); + rb_ivar_set(self, id_error_code, INT2NUM(error)); + rb_exc_raise(self); } #if defined __APPLE__ @@ -116,6 +122,7 @@ recvfrom_blocking(void *data) ssize_t ret; ret = recvfrom(arg->fd, RSTRING_PTR(arg->str), arg->length, arg->flags, &arg->buf.addr, &arg->alen); + if (ret != -1 && len0 < arg->alen) arg->alen = len0; @@ -147,6 +154,18 @@ recvfrom_locktmp(VALUE v) return rb_thread_io_blocking_region(recvfrom_blocking, arg, arg->fd); } +int +rsock_is_dgram(rb_io_t *fptr) +{ + int socktype; + socklen_t optlen = (socklen_t)sizeof(socktype); + int ret = getsockopt(fptr->fd, SOL_SOCKET, SO_TYPE, (void*)&socktype, &optlen); + if (ret == -1) { + rb_sys_fail("getsockopt(SO_TYPE)"); + } + return socktype == SOCK_DGRAM; +} + VALUE rsock_s_recvfrom(VALUE socket, int argc, VALUE *argv, enum sock_recv_type from) { @@ -185,8 +204,12 @@ rsock_s_recvfrom(VALUE socket, int argc, VALUE *argv, enum sock_recv_type from) rb_io_wait(fptr->self, RB_INT2NUM(RUBY_IO_READABLE), Qnil); #endif - slen = (long)rb_str_locktmp_ensure(str, recvfrom_locktmp, (VALUE)&arg); + rb_str_locktmp(str); + slen = (long)rb_ensure(recvfrom_locktmp, (VALUE)&arg, rb_str_unlocktmp, str); + if (slen == 0 && !rsock_is_dgram(fptr)) { + return Qnil; + } if (slen >= 0) break; if (!rb_io_maybe_wait_readable(errno, socket, RUBY_IO_TIMEOUT_DEFAULT)) @@ -259,6 +282,10 @@ rsock_s_recvfrom_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str, if (slen != -1 && len0 < alen) alen = len0; + if (slen == 0 && !rsock_is_dgram(fptr)) { + return Qnil; + } + if (slen < 0) { int e = errno; switch (e) { @@ -392,7 +419,7 @@ rsock_write_nonblock(VALUE sock, VALUE str, VALUE ex) if (e == EWOULDBLOCK || e == EAGAIN) { if (ex == Qfalse) return sym_wait_writable; rb_readwrite_syserr_fail(RB_IO_WAIT_WRITABLE, e, - "write would block"); + "write would block"); } rb_syserr_fail_path(e, fptr->pathv); } @@ -433,9 +460,9 @@ rsock_socket(int domain, int type, int proto) fd = rsock_socket0(domain, type, proto); if (fd < 0) { - if (rb_gc_for_fd(errno)) { - fd = rsock_socket0(domain, type, proto); - } + if (rb_gc_for_fd(errno)) { + fd = rsock_socket0(domain, type, proto); + } } if (0 <= fd) rb_update_max_fd(fd); @@ -492,10 +519,10 @@ wait_connectable(int fd, struct timeval *timeout) switch (sockerr) { case 0: - /* - * be defensive in case some platforms set SO_ERROR on the original, - * interrupted connect() - */ + /* + * be defensive in case some platforms set SO_ERROR on the original, + * interrupted connect() + */ /* when the connection timed out, no errno is set and revents is 0. */ if (timeout && revents == 0) { @@ -681,9 +708,9 @@ rsock_s_accept(VALUE klass, VALUE io, struct sockaddr *sockaddr, socklen_t *len) RB_IO_POINTER(io, fptr); struct accept_arg accept_arg = { - .fd = fptr->fd, - .sockaddr = sockaddr, - .len = len + .fd = fptr->fd, + .sockaddr = sockaddr, + .len = len }; int retry = 0, peer; @@ -730,10 +757,10 @@ rsock_getfamily(rb_io_t *fptr) if (cached) { switch (cached) { #ifdef AF_UNIX - case FMODE_UNIX: return AF_UNIX; + case FMODE_UNIX: return AF_UNIX; #endif - case FMODE_INET: return AF_INET; - case FMODE_INET6: return AF_INET6; + case FMODE_INET: return AF_INET; + case FMODE_INET6: return AF_INET6; } } @@ -752,6 +779,18 @@ rsock_getfamily(rb_io_t *fptr) return ss.addr.sa_family; } +/* + * call-seq: + * error_code -> integer + * + * Returns the raw error code occurred at name resolution. + */ +static VALUE +sock_resolv_error_code(VALUE self) +{ + return rb_attr_get(self, id_error_code); +} + void rsock_init_socket_init(void) { @@ -759,6 +798,11 @@ rsock_init_socket_init(void) * SocketError is the error class for socket. */ rb_eSocket = rb_define_class("SocketError", rb_eStandardError); + /* + * ResolutionError is the error class for socket name resolution. + */ + rb_eResolution = rb_define_class_under(rb_cSocket, "ResolutionError", rb_eSocket); + rb_define_method(rb_eResolution, "error_code", sock_resolv_error_code, 0); rsock_init_ipsocket(); rsock_init_tcpsocket(); rsock_init_tcpserver(); @@ -772,6 +816,8 @@ rsock_init_socket_init(void) rsock_init_sockifaddr(); rsock_init_socket_constants(); + id_error_code = rb_intern_const("error_code"); + #undef rb_intern sym_wait_readable = ID2SYM(rb_intern("wait_readable")); diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb index 6196638bd2..e953077fe6 100644 --- a/ext/socket/lib/socket.rb +++ b/ext/socket/lib/socket.rb @@ -1,7 +1,11 @@ # frozen_string_literal: true require 'socket.so' -require 'io/wait' + +unless IO.method_defined?(:wait_writable, false) + # It's only required on older Rubies < v3.2: + require 'io/wait' +end class Addrinfo # creates an Addrinfo object from the arguments. @@ -329,9 +333,10 @@ class BasicSocket < IO # _flags_ is zero or more of the +MSG_+ options. # The result, _mesg_, is the data received. # - # When recvfrom(2) returns 0, Socket#recv_nonblock returns - # an empty string as data. - # The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc. + # When recvfrom(2) returns 0, Socket#recv_nonblock returns nil. + # In most cases it means the connection was closed, but for UDP connections + # it may mean an empty packet was received, as the underlying API makes + # it impossible to distinguish these two cases. # # === Parameters # * +maxlen+ - the number of bytes to receive from the socket @@ -476,9 +481,10 @@ class Socket < BasicSocket # The second element, _sender_addrinfo_, contains protocol-specific address # information of the sender. # - # When recvfrom(2) returns 0, Socket#recvfrom_nonblock returns - # an empty string as data. - # The meaning depends on the socket: EOF on TCP, empty packet on UDP, etc. + # When recvfrom(2) returns 0, Socket#recv_nonblock returns nil. + # In most cases it means the connection was closed, but for UDP connections + # it may mean an empty packet was received, as the underlying API makes + # it impossible to distinguish these two cases. # # === Parameters # * +maxlen+ - the maximum number of bytes to receive from the socket @@ -593,6 +599,30 @@ class Socket < BasicSocket __accept_nonblock(exception) end + RESOLUTION_DELAY = 0.05 + private_constant :RESOLUTION_DELAY + + CONNECTION_ATTEMPT_DELAY = 0.25 + private_constant :CONNECTION_ATTEMPT_DELAY + + ADDRESS_FAMILIES = { + ipv6: Socket::AF_INET6, + ipv4: Socket::AF_INET + }.freeze + private_constant :ADDRESS_FAMILIES + + HOSTNAME_RESOLUTION_QUEUE_UPDATED = 0 + private_constant :HOSTNAME_RESOLUTION_QUEUE_UPDATED + + IPV6_ADRESS_FORMAT = /(?i)(?:(?:[0-9A-F]{1,4}:){7}(?:[0-9A-F]{1,4}|:)|(?:[0-9A-F]{1,4}:){6}(?:[0-9A-F]{1,4}::[0-9A-F]{1,4}|:(?:[0-9A-F]{1,4}:){1,5}[0-9A-F]{1,4}|:)|(?:[0-9A-F]{1,4}:){5}(?::[0-9A-F]{1,4}::[0-9A-F]{1,4}|:(?:[0-9A-F]{1,4}:){1,4}[0-9A-F]{1,4}|:)|(?:[0-9A-F]{1,4}:){4}(?::[0-9A-F]{1,4}::[0-9A-F]{1,4}|:(?:[0-9A-F]{1,4}:){1,3}[0-9A-F]{1,4}|:)|(?:[0-9A-F]{1,4}:){3}(?::[0-9A-F]{1,4}::[0-9A-F]{1,4}|:(?:[0-9A-F]{1,4}:){1,2}[0-9A-F]{1,4}|:)|(?:[0-9A-F]{1,4}:){2}(?::[0-9A-F]{1,4}::[0-9A-F]{1,4}|:(?:[0-9A-F]{1,4}:)[0-9A-F]{1,4}|:)|(?:[0-9A-F]{1,4}:){1}(?::[0-9A-F]{1,4}::[0-9A-F]{1,4}|::(?:[0-9A-F]{1,4}:){1,5}[0-9A-F]{1,4}|:)|::(?:[0-9A-F]{1,4}::[0-9A-F]{1,4}|:(?:[0-9A-F]{1,4}:){1,6}[0-9A-F]{1,4}|:))(?:%.+)?/ + private_constant :IPV6_ADRESS_FORMAT + + @tcp_fast_fallback = true + + class << self + attr_accessor :tcp_fast_fallback + 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]) @@ -618,8 +648,491 @@ class Socket < BasicSocket # sock.close_write # puts sock.read # } - # - def self.tcp(host, port, local_host = nil, local_port = nil, connect_timeout: nil, resolv_timeout: nil) # :yield: socket + def self.tcp(host, port, local_host = nil, local_port = nil, connect_timeout: nil, resolv_timeout: nil, fast_fallback: tcp_fast_fallback, &block) # :yield: socket + unless fast_fallback + return tcp_without_fast_fallback(host, port, local_host, local_port, connect_timeout:, resolv_timeout:, &block) + end + + # Happy Eyeballs' states + # - :start + # - :v6c + # - :v4w + # - :v4c + # - :v46c + # - :v46w + # - :success + # - :failure + # - :timeout + + specified_family_name = nil + hostname_resolution_threads = [] + hostname_resolution_queue = nil + hostname_resolution_waiting = nil + hostname_resolution_expires_at = nil + selectable_addrinfos = SelectableAddrinfos.new + connecting_sockets = ConnectingSockets.new + local_addrinfos = [] + connection_attempt_delay_expires_at = nil + connection_attempt_started_at = nil + state = :start + connected_socket = nil + last_error = nil + is_windows_environment ||= (RUBY_PLATFORM =~ /mswin|mingw|cygwin/) + + ret = loop do + case state + when :start + specified_family_name, next_state = host && specified_family_name_and_next_state(host) + + if local_host && local_port + specified_family_name, next_state = specified_family_name_and_next_state(local_host) unless specified_family_name + local_addrinfos = Addrinfo.getaddrinfo(local_host, local_port, ADDRESS_FAMILIES[specified_family_name], :STREAM, timeout: resolv_timeout) + end + + if specified_family_name + addrinfos = Addrinfo.getaddrinfo(host, port, ADDRESS_FAMILIES[specified_family_name], :STREAM, timeout: resolv_timeout) + selectable_addrinfos.add(specified_family_name, addrinfos) + hostname_resolution_queue = NoHostnameResolutionQueue.new + state = next_state + next + end + + resolving_family_names = ADDRESS_FAMILIES.keys + hostname_resolution_queue = HostnameResolutionQueue.new(resolving_family_names.size) + hostname_resolution_waiting = hostname_resolution_queue.waiting_pipe + hostname_resolution_started_at = current_clocktime if resolv_timeout + hostname_resolution_args = [host, port, hostname_resolution_queue] + + hostname_resolution_threads.concat( + resolving_family_names.map { |family| + thread_args = [family, *hostname_resolution_args] + thread = Thread.new(*thread_args) { |*thread_args| hostname_resolution(*thread_args) } + Thread.pass + thread + } + ) + + hostname_resolution_retry_count = resolving_family_names.size - 1 + hostname_resolution_expires_at = hostname_resolution_started_at + resolv_timeout if resolv_timeout + + while hostname_resolution_retry_count >= 0 + remaining = resolv_timeout ? second_to_timeout(hostname_resolution_started_at + resolv_timeout) : nil + hostname_resolved, _, = IO.select(hostname_resolution_waiting, nil, nil, remaining) + + unless hostname_resolved + state = :timeout + break + end + + family_name, res = hostname_resolution_queue.get + + if res.is_a? Exception + unless (Socket.const_defined?(:EAI_ADDRFAMILY)) && + (res.is_a?(Socket::ResolutionError)) && + (res.error_code == Socket::EAI_ADDRFAMILY) + last_error = res + end + + if hostname_resolution_retry_count.zero? + state = :failure + break + end + hostname_resolution_retry_count -= 1 + else + state = case family_name + when :ipv6 then :v6c + when :ipv4 then hostname_resolution_queue.closed? ? :v4c : :v4w + end + selectable_addrinfos.add(family_name, res) + last_error = nil + break + end + end + + next + when :v4w + ipv6_resolved, _, = IO.select(hostname_resolution_waiting, nil, nil, RESOLUTION_DELAY) + + if ipv6_resolved + family_name, res = hostname_resolution_queue.get + selectable_addrinfos.add(family_name, res) unless res.is_a? Exception + state = :v46c + else + state = :v4c + end + + next + when :v4c, :v6c, :v46c + connection_attempt_started_at = current_clocktime unless connection_attempt_started_at + addrinfo = selectable_addrinfos.get + + if local_addrinfos.any? + local_addrinfo = local_addrinfos.find { |lai| lai.afamily == addrinfo.afamily } + + if local_addrinfo.nil? + if selectable_addrinfos.empty? && connecting_sockets.empty? && hostname_resolution_queue.closed? + last_error = SocketError.new 'no appropriate local address' + state = :failure + elsif selectable_addrinfos.any? + # Try other Addrinfo in next loop + else + if resolv_timeout && hostname_resolution_queue.opened? && + (current_clocktime >= hostname_resolution_expires_at) + state = :timeout + else + # Wait for connection to be established or hostname resolution in next loop + connection_attempt_delay_expires_at = nil + state = :v46w + end + end + next + end + end + + connection_attempt_delay_expires_at = current_clocktime + CONNECTION_ATTEMPT_DELAY + + begin + result = if specified_family_name && selectable_addrinfos.empty? && + connecting_sockets.empty? && hostname_resolution_queue.closed? + local_addrinfo ? + addrinfo.connect_from(local_addrinfo, timeout: connect_timeout) : + addrinfo.connect(timeout: connect_timeout) + else + socket = Socket.new(addrinfo.pfamily, addrinfo.socktype, addrinfo.protocol) + socket.bind(local_addrinfo) if local_addrinfo + socket.connect_nonblock(addrinfo, exception: false) + end + + case result + when 0 + connected_socket = socket + state = :success + when Socket + connected_socket = result + state = :success + when :wait_writable + connecting_sockets.add(socket, addrinfo) + state = :v46w + end + rescue SystemCallError => e + last_error = e + socket.close if socket && !socket.closed? + + if selectable_addrinfos.empty? && connecting_sockets.empty? && hostname_resolution_queue.closed? + state = :failure + elsif selectable_addrinfos.any? + # Try other Addrinfo in next loop + else + if resolv_timeout && hostname_resolution_queue.opened? && + (current_clocktime >= hostname_resolution_expires_at) + state = :timeout + else + # Wait for connection to be established or hostname resolution in next loop + connection_attempt_delay_expires_at = nil + state = :v46w + end + end + end + + next + when :v46w + if connect_timeout && second_to_timeout(connection_attempt_started_at + connect_timeout).zero? + state = :timeout + next + end + + remaining = second_to_timeout(connection_attempt_delay_expires_at) + hostname_resolution_waiting = hostname_resolution_waiting && hostname_resolution_queue.closed? ? nil : hostname_resolution_waiting + hostname_resolved, connectable_sockets, = IO.select(hostname_resolution_waiting, connecting_sockets.all, nil, remaining) + + if connectable_sockets&.any? + while (connectable_socket = connectable_sockets.pop) + is_connected = + if is_windows_environment + sockopt = connectable_socket.getsockopt(Socket::SOL_SOCKET, Socket::SO_CONNECT_TIME) + sockopt.unpack('i').first >= 0 + else + sockopt = connectable_socket.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR) + sockopt.int.zero? + end + + if is_connected + connected_socket = connectable_socket + connecting_sockets.delete connectable_socket + connectable_sockets.each do |other_connectable_socket| + other_connectable_socket.close unless other_connectable_socket.closed? + end + state = :success + break + else + failed_ai = connecting_sockets.delete connectable_socket + inspected_ip_address = failed_ai.ipv6? ? "[#{failed_ai.ip_address}]" : failed_ai.ip_address + last_error = SystemCallError.new("connect(2) for #{inspected_ip_address}:#{failed_ai.ip_port}", sockopt.int) + connectable_socket.close unless connectable_socket.closed? + + next if connectable_sockets.any? + + if selectable_addrinfos.empty? && connecting_sockets.empty? && hostname_resolution_queue.closed? + state = :failure + elsif selectable_addrinfos.any? + # Wait for connection attempt delay timeout in next loop + else + if resolv_timeout && hostname_resolution_queue.opened? && + (current_clocktime >= hostname_resolution_expires_at) + state = :timeout + else + # Wait for connection to be established or hostname resolution in next loop + connection_attempt_delay_expires_at = nil + end + end + end + end + elsif hostname_resolved&.any? + family_name, res = hostname_resolution_queue.get + selectable_addrinfos.add(family_name, res) unless res.is_a? Exception + else + if selectable_addrinfos.empty? && connecting_sockets.empty? && hostname_resolution_queue.closed? + state = :failure + elsif selectable_addrinfos.any? + # Try other Addrinfo in next loop + state = :v46c + else + if resolv_timeout && hostname_resolution_queue.opened? && + (current_clocktime >= hostname_resolution_expires_at) + state = :timeout + else + # Wait for connection to be established or hostname resolution in next loop + connection_attempt_delay_expires_at = nil + end + end + end + + next + when :success + break connected_socket + when :failure + raise last_error + when :timeout + raise Errno::ETIMEDOUT, 'user specified timeout' + end + end + + if block_given? + begin + yield ret + ensure + ret.close + end + else + ret + end + ensure + if fast_fallback + hostname_resolution_threads.each do |thread| + thread&.exit + end + + hostname_resolution_queue&.close_all + + connecting_sockets.each do |connecting_socket| + connecting_socket.close unless connecting_socket.closed? + end + end + end + + def self.specified_family_name_and_next_state(hostname) + if hostname.match?(IPV6_ADRESS_FORMAT) then [:ipv6, :v6c] + elsif hostname.match?(/^([0-9]{1,3}\.){3}[0-9]{1,3}$/) then [:ipv4, :v4c] + end + end + private_class_method :specified_family_name_and_next_state + + def self.hostname_resolution(family, host, port, hostname_resolution_queue) + begin + resolved_addrinfos = Addrinfo.getaddrinfo(host, port, ADDRESS_FAMILIES[family], :STREAM) + hostname_resolution_queue.add_resolved(family, resolved_addrinfos) + rescue => e + hostname_resolution_queue.add_error(family, e) + end + end + private_class_method :hostname_resolution + + def self.second_to_timeout(ends_at) + return 0 unless ends_at + + remaining = (ends_at - current_clocktime) + remaining.negative? ? 0 : remaining + end + private_class_method :second_to_timeout + + def self.current_clocktime + Process.clock_gettime(Process::CLOCK_MONOTONIC) + end + private_class_method :current_clocktime + + class SelectableAddrinfos + PRIORITY_ON_V6 = [:ipv6, :ipv4] + PRIORITY_ON_V4 = [:ipv4, :ipv6] + + def initialize + @addrinfo_dict = {} + @last_family = nil + end + + def add(family_name, addrinfos) + @addrinfo_dict[family_name] = addrinfos + end + + def get + return nil if empty? + + if @addrinfo_dict.size == 1 + @addrinfo_dict.each { |_, addrinfos| return addrinfos.shift } + end + + precedences = case @last_family + when :ipv4, nil then PRIORITY_ON_V6 + when :ipv6 then PRIORITY_ON_V4 + end + + precedences.each do |family_name| + addrinfo = @addrinfo_dict[family_name]&.shift + next unless addrinfo + + @last_family = family_name + return addrinfo + end + end + + def empty? + @addrinfo_dict.all? { |_, addrinfos| addrinfos.empty? } + end + + def any? + !empty? + end + end + private_constant :SelectableAddrinfos + + class NoHostnameResolutionQueue + def waiting_pipe + nil + end + + def add_resolved(_, _) + raise StandardError, "This #{self.class} cannot respond to:" + end + + def add_error(_, _) + raise StandardError, "This #{self.class} cannot respond to:" + end + + def get + nil + end + + def opened? + false + end + + def closed? + true + end + + def close_all + # Do nothing + end + end + private_constant :NoHostnameResolutionQueue + + class HostnameResolutionQueue + def initialize(size) + @size = size + @taken_count = 0 + @rpipe, @wpipe = IO.pipe + @queue = Queue.new + @mutex = Mutex.new + end + + def waiting_pipe + [@rpipe] + end + + def add_resolved(family, resolved_addrinfos) + @mutex.synchronize do + @queue.push [family, resolved_addrinfos] + @wpipe.putc HOSTNAME_RESOLUTION_QUEUE_UPDATED + end + end + + def add_error(family, error) + @mutex.synchronize do + @queue.push [family, error] + @wpipe.putc HOSTNAME_RESOLUTION_QUEUE_UPDATED + end + end + + def get + return nil if @queue.empty? + + res = nil + + @mutex.synchronize do + @rpipe.getbyte + res = @queue.pop + end + + @taken_count += 1 + close_all if @taken_count == @size + res + end + + def closed? + @rpipe.closed? + end + + def opened? + !closed? + end + + def close_all + @queue.close unless @queue.closed? + @rpipe.close unless @rpipe.closed? + @wpipe.close unless @wpipe.closed? + end + end + private_constant :HostnameResolutionQueue + + class ConnectingSockets + def initialize + @socket_dict = {} + end + + def all + @socket_dict.keys + end + + def add(socket, addrinfo) + @socket_dict[socket] = addrinfo + end + + def delete(socket) + @socket_dict.delete socket + end + + def empty? + @socket_dict.empty? + end + + def each + @socket_dict.keys.each do |socket| + yield socket + end + end + end + private_constant :ConnectingSockets + + def self.tcp_without_fast_fallback(host, port, local_host, local_port, connect_timeout:, resolv_timeout:, &block) last_error = nil ret = nil @@ -663,6 +1176,7 @@ class Socket < BasicSocket ret end end + private_class_method :tcp_without_fast_fallback # :stopdoc: def self.ip_sockets_port0(ai_list, reuseaddr) @@ -1225,9 +1739,10 @@ class UDPSocket < IPSocket # The first element of the results, _mesg_, is the data received. # The second element, _sender_inet_addr_, is an array to represent the sender address. # - # When recvfrom(2) returns 0, - # Socket#recvfrom_nonblock returns an empty string as data. - # It means an empty packet. + # When recvfrom(2) returns 0, Socket#recv_nonblock returns nil. + # In most cases it means the connection was closed, but it may also mean + # an empty packet was received, as the underlying API makes + # it impossible to distinguish these two cases. # # === Parameters # * +maxlen+ - the number of bytes to receive from the socket diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb index 5e6c0668f6..4271e40cd8 100644 --- a/ext/socket/mkconstants.rb +++ b/ext/socket/mkconstants.rb @@ -51,7 +51,10 @@ DATA.each_line {|s| next end h[name] = default_value - COMMENTS[name] = comment + if comment + # Stop unintentional references + COMMENTS[name] = comment.gsub(/\b(Data|Kernel|Process|Set|Socket|Time)\b/, '\\\\\\&') + end } DEFS = h.to_a @@ -73,15 +76,11 @@ def each_name(pat) } end -erb_new = lambda do |src, safe, trim| - if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+ - ERB.new(src, trim_mode: trim) - else - ERB.new(src, safe, trim) - end +erb_new = lambda do |src, trim| + ERB.new(src, trim_mode: trim) end -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_decls") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_const_decls") % each_const {|guard, name, default_value| #if !defined(<%=name%>) # if defined(HAVE_CONST_<%=name.upcase%>) @@ -95,7 +94,7 @@ erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_decls") % } EOS -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_defs_in_guard(name, default_value)") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_const_defs_in_guard(name, default_value)") #if defined(<%=name%>) /* <%= COMMENTS[name] %> */ rb_define_const(rb_cSocket, <%=c_str name%>, INTEGER2NUM(<%=name%>)); @@ -104,7 +103,7 @@ erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_defs_in_guard(name #endif EOS -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_const_defs") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_const_defs") % each_const {|guard, name, default_value| % if guard #if <%=guard%> @@ -154,7 +153,7 @@ def each_names_with_len(pat, prefix_optional=nil) } end -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_name_to_int_decl(funcname, pat, prefix_optional, guard=nil)") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_name_to_int_decl(funcname, pat, prefix_optional, guard=nil)") %if guard #ifdef <%=guard%> int <%=funcname%>(const char *str, long len, int *valp); @@ -164,7 +163,7 @@ int <%=funcname%>(const char *str, long len, int *valp); %end EOS -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_name_to_int_func_in_guard(funcname, pat, prefix_optional, guard=nil)") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_name_to_int_func_in_guard(funcname, pat, prefix_optional, guard=nil)") int <%=funcname%>(const char *str, long len, int *valp) { @@ -186,7 +185,7 @@ int } EOS -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_name_to_int_func(funcname, pat, prefix_optional, guard=nil)") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_name_to_int_func(funcname, pat, prefix_optional, guard=nil)") %if guard #ifdef <%=guard%> <%=gen_name_to_int_func_in_guard(funcname, pat, prefix_optional, guard)%> @@ -215,7 +214,7 @@ def reverse_each_name_with_prefix_optional(pat, prefix_pat) end end -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_int_to_name_hash(hash_var, pat, prefix_pat)") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_int_to_name_hash(hash_var, pat, prefix_pat)") <%=hash_var%> = st_init_numtable(); % reverse_each_name_with_prefix_optional(pat, prefix_pat) {|n,s| #ifdef <%=n%> @@ -224,7 +223,7 @@ erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_int_to_name_hash(hash_va % } EOS -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_int_to_name_func(func_name, hash_var)") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_int_to_name_func(func_name, hash_var)") ID <%=func_name%>(int val) { @@ -235,7 +234,7 @@ ID } EOS -erb_new.call(<<'EOS', nil, '%').def_method(Object, "gen_int_to_name_decl(func_name, hash_var)") +erb_new.call(<<'EOS', '%').def_method(Object, "gen_int_to_name_decl(func_name, hash_var)") ID <%=func_name%>(int val); EOS @@ -284,7 +283,7 @@ def_intern('rsock_intern_udp_optname', /\AUDP_/, "UDP_") def_intern('rsock_intern_scm_optname', /\ASCM_/, "SCM_") def_intern('rsock_intern_local_optname', /\ALOCAL_/, "LOCAL_") -result = erb_new.call(<<'EOS', nil, '%').result(binding) +result = erb_new.call(<<'EOS', '%').result(binding) /* autogenerated file */ <%= INTERN_DEFS.map {|vardef, gen_hash, decl, func| vardef }.join("\n") %> @@ -327,7 +326,7 @@ init_constants(void) EOS -header_result = erb_new.call(<<'EOS', nil, '%').result(binding) +header_result = erb_new.call(<<'EOS', '%').result(binding) /* autogenerated file */ <%= gen_const_decls %> <%= NAME_TO_INT_DEFS.map {|decl, func| decl }.join("\n") %> @@ -423,8 +422,8 @@ AF_ISDN nil Integrated Services Digital Network PF_ISDN nil Integrated Services Digital Network AF_NATM nil Native ATM access PF_NATM nil Native ATM access -AF_SYSTEM -PF_SYSTEM +AF_SYSTEM nil Kernel event messages +PF_SYSTEM nil Kernel event messages AF_NETBIOS nil NetBIOS PF_NETBIOS nil NetBIOS AF_PPP nil Point-to-Point Protocol @@ -440,8 +439,8 @@ PF_PACKET nil Direct link-layer access AF_E164 nil CCITT (ITU-T) E.164 recommendation PF_XTP nil eXpress Transfer Protocol -PF_RTIP -PF_PIP +PF_RTIP nil Help Identify RTIP packets +PF_PIP nil Help Identify PIP packets AF_KEY nil Key management protocol, originally developed for usage with IPsec PF_KEY nil Key management protocol, originally developed for usage with IPsec AF_NETLINK nil Kernel user interface device @@ -666,6 +665,7 @@ SO_SETFIB nil Set the associated routing table for the socket (FreeBSD SO_RTABLE nil Set the routing table for this socket (OpenBSD) SO_INCOMING_CPU nil Receive the cpu attached to the socket (Linux 3.19) SO_INCOMING_NAPI_ID nil Receive the napi ID attached to a RX queue (Linux 4.12) +SO_CONNECT_TIME nil Returns the number of seconds a socket has been connected. This option is only valid for connection-oriented protocols (Windows) SOPRI_INTERACTIVE nil Interactive socket priority SOPRI_NORMAL nil Normal socket priority @@ -745,6 +745,7 @@ SHUT_RDWR 2 Shut down the both sides of the socket IPV6_JOIN_GROUP nil Join a group membership IPV6_LEAVE_GROUP nil Leave a group membership +IPV6_MTU_DISCOVER nil Path MTU discovery IPV6_MULTICAST_HOPS nil IP6 multicast hops IPV6_MULTICAST_IF nil IP6 multicast interface IPV6_MULTICAST_LOOP nil IP6 multicast loopback @@ -759,6 +760,7 @@ IPV6_NEXTHOP nil Next hop address IPV6_PATHMTU nil Retrieve current path MTU IPV6_PKTINFO nil Receive packet information with datagram IPV6_RECVDSTOPTS nil Receive all IP6 options for response +IPV6_RECVERR nil Enable extended reliable error message passing IPV6_RECVHOPLIMIT nil Receive hop limit with datagram IPV6_RECVHOPOPTS nil Receive hop-by-hop options IPV6_RECVPKTINFO nil Receive destination IP address and incoming interface diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c index 269edc4dad..e79bcfa332 100644 --- a/ext/socket/raddrinfo.c +++ b/ext/socket/raddrinfo.c @@ -10,6 +10,22 @@ #include "rubysocket.h" +// GETADDRINFO_IMPL == 0 : call getaddrinfo/getnameinfo directly +// GETADDRINFO_IMPL == 1 : call getaddrinfo/getnameinfo without gvl (but uncancellable) +// GETADDRINFO_IMPL == 2 : call getaddrinfo/getnameinfo in a dedicated pthread +// (and if the call is interrupted, the pthread is detached) + +#ifndef GETADDRINFO_IMPL +# ifdef GETADDRINFO_EMU +# define GETADDRINFO_IMPL 0 +# elif !defined(HAVE_PTHREAD_CREATE) || !defined(HAVE_PTHREAD_DETACH) || defined(__MINGW32__) || defined(__MINGW64__) +# define GETADDRINFO_IMPL 1 +# else +# define GETADDRINFO_IMPL 2 +# include "ruby/thread_native.h" +# endif +#endif + #if defined(INET6) && (defined(LOOKUP_ORDER_HACK_INET) || defined(LOOKUP_ORDER_HACK_INET6)) #define LOOKUP_ORDERS (sizeof(lookup_order_table) / sizeof(lookup_order_table[0])) static const int lookup_order_table[] = { @@ -173,32 +189,6 @@ parse_numeric_port(const char *service, int *portp) } #endif -#ifndef GETADDRINFO_EMU -struct getaddrinfo_arg -{ - const char *node; - const char *service; - const struct addrinfo *hints; - struct addrinfo **res; -}; - -static void * -nogvl_getaddrinfo(void *arg) -{ - int ret; - struct getaddrinfo_arg *ptr = arg; - ret = getaddrinfo(ptr->node, ptr->service, ptr->hints, ptr->res); -#ifdef __linux__ - /* On Linux (mainly Ubuntu 13.04) /etc/nsswitch.conf has mdns4 and - * it cause getaddrinfo to return EAI_SYSTEM/ENOENT. [ruby-list:49420] - */ - if (ret == EAI_SYSTEM && errno == ENOENT) - ret = EAI_NONAME; -#endif - return (void *)(VALUE)ret; -} -#endif - static int numeric_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, @@ -302,7 +292,263 @@ rb_freeaddrinfo(struct rb_addrinfo *ai) xfree(ai); } -#ifndef GETADDRINFO_EMU +#if GETADDRINFO_IMPL == 0 + +static int +rb_getaddrinfo(const char *hostp, const char *portp, const struct addrinfo *hints, struct addrinfo **ai) +{ + return getaddrinfo(hostp, portp, hints, ai); +} + +#elif GETADDRINFO_IMPL == 1 + +struct getaddrinfo_arg +{ + const char *node; + const char *service; + const struct addrinfo *hints; + struct addrinfo **res; +}; + +static void * +nogvl_getaddrinfo(void *arg) +{ + int ret; + struct getaddrinfo_arg *ptr = arg; + 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; +} + +static int +rb_getaddrinfo(const char *hostp, const char *portp, const struct addrinfo *hints, struct addrinfo **ai) +{ + struct getaddrinfo_arg arg; + MEMZERO(&arg, struct getaddrinfo_arg, 1); + arg.node = hostp; + arg.service = portp; + arg.hints = hints; + arg.res = ai; + return (int)(VALUE)rb_thread_call_without_gvl(nogvl_getaddrinfo, &arg, RUBY_UBF_IO, 0); +} + +#elif GETADDRINFO_IMPL == 2 + +struct getaddrinfo_arg +{ + char *node, *service; + struct addrinfo hints; + struct addrinfo *ai; + int err, gai_errno, refcount, done, cancelled; + rb_nativethread_lock_t lock; + rb_nativethread_cond_t cond; +}; + +static struct getaddrinfo_arg * +allocate_getaddrinfo_arg(const char *hostp, const char *portp, const struct addrinfo *hints) +{ + size_t hostp_offset = sizeof(struct getaddrinfo_arg); + size_t portp_offset = hostp_offset + (hostp ? strlen(hostp) + 1 : 0); + size_t bufsize = portp_offset + (portp ? strlen(portp) + 1 : 0); + + char *buf = malloc(bufsize); + if (!buf) { + rb_gc(); + buf = malloc(bufsize); + if (!buf) return NULL; + } + struct getaddrinfo_arg *arg = (struct getaddrinfo_arg *)buf; + + if (hostp) { + arg->node = buf + hostp_offset; + strcpy(arg->node, hostp); + } + else { + arg->node = NULL; + } + + if (portp) { + arg->service = buf + portp_offset; + strcpy(arg->service, portp); + } + else { + arg->service = NULL; + } + + arg->hints = *hints; + arg->ai = NULL; + + arg->refcount = 2; + arg->done = arg->cancelled = 0; + + rb_nativethread_lock_initialize(&arg->lock); + rb_native_cond_initialize(&arg->cond); + + return arg; +} + +static void +free_getaddrinfo_arg(struct getaddrinfo_arg *arg) +{ + rb_native_cond_destroy(&arg->cond); + rb_nativethread_lock_destroy(&arg->lock); + free(arg); +} + +static void * +do_getaddrinfo(void *ptr) +{ + struct getaddrinfo_arg *arg = (struct getaddrinfo_arg *)ptr; + + int err, gai_errno; + err = getaddrinfo(arg->node, arg->service, &arg->hints, &arg->ai); + gai_errno = errno; +#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 (err == EAI_SYSTEM && errno == ENOENT) + err = EAI_NONAME; +#endif + + int need_free = 0; + rb_nativethread_lock_lock(&arg->lock); + { + arg->err = err; + arg->gai_errno = gai_errno; + if (arg->cancelled) { + freeaddrinfo(arg->ai); + } + else { + arg->done = 1; + rb_native_cond_signal(&arg->cond); + } + if (--arg->refcount == 0) need_free = 1; + } + rb_nativethread_lock_unlock(&arg->lock); + + if (need_free) free_getaddrinfo_arg(arg); + + return 0; +} + +static void * +wait_getaddrinfo(void *ptr) +{ + struct getaddrinfo_arg *arg = (struct getaddrinfo_arg *)ptr; + rb_nativethread_lock_lock(&arg->lock); + while (!arg->done && !arg->cancelled) { + rb_native_cond_wait(&arg->cond, &arg->lock); + } + rb_nativethread_lock_unlock(&arg->lock); + return 0; +} + +static void +cancel_getaddrinfo(void *ptr) +{ + struct getaddrinfo_arg *arg = (struct getaddrinfo_arg *)ptr; + rb_nativethread_lock_lock(&arg->lock); + { + arg->cancelled = 1; + rb_native_cond_signal(&arg->cond); + } + rb_nativethread_lock_unlock(&arg->lock); +} + +static int +do_pthread_create(pthread_t *th, void *(*start_routine) (void *), void *arg) +{ + int limit = 3, ret; + do { + // It is said that pthread_create may fail spuriously, so we follow the JDK and retry several times. + // + // https://bugs.openjdk.org/browse/JDK-8268605 + // https://github.com/openjdk/jdk/commit/e35005d5ce383ddd108096a3079b17cb0bcf76f1 + ret = pthread_create(th, 0, start_routine, arg); + } while (ret == EAGAIN && limit-- > 0); + return ret; +} + +static int +rb_getaddrinfo(const char *hostp, const char *portp, const struct addrinfo *hints, struct addrinfo **ai) +{ + int retry; + struct getaddrinfo_arg *arg; + int err, gai_errno = 0; + +start: + retry = 0; + + arg = allocate_getaddrinfo_arg(hostp, portp, hints); + if (!arg) { + return EAI_MEMORY; + } + + pthread_t th; + if (do_pthread_create(&th, do_getaddrinfo, arg) != 0) { + free_getaddrinfo_arg(arg); + return EAI_AGAIN; + } + pthread_detach(th); + + rb_thread_call_without_gvl2(wait_getaddrinfo, arg, cancel_getaddrinfo, arg); + + int need_free = 0; + rb_nativethread_lock_lock(&arg->lock); + { + if (arg->done) { + err = arg->err; + gai_errno = arg->gai_errno; + if (err == 0) *ai = arg->ai; + } + else if (arg->cancelled) { + err = EAI_AGAIN; + } + else { + // If already interrupted, rb_thread_call_without_gvl2 may return without calling wait_getaddrinfo. + // In this case, it could be !arg->done && !arg->cancelled. + arg->cancelled = 1; // to make do_getaddrinfo call freeaddrinfo + retry = 1; + } + if (--arg->refcount == 0) need_free = 1; + } + rb_nativethread_lock_unlock(&arg->lock); + + if (need_free) free_getaddrinfo_arg(arg); + + // If the current thread is interrupted by asynchronous exception, the following raises the exception. + // But if the current thread is interrupted by timer thread, the following returns; we need to manually retry. + rb_thread_check_ints(); + if (retry) goto start; + + /* Because errno is threadlocal, the errno value we got from the call to getaddrinfo() in the thread + * (in case of EAI_SYSTEM return value) is not propagated to the caller of _this_ function. Set errno + * explicitly, as round-tripped through struct getaddrinfo_arg, to deal with that */ + if (gai_errno) errno = gai_errno; + return err; +} + +#endif + +#if GETADDRINFO_IMPL == 0 + +int +rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, + char *host, size_t hostlen, + char *serv, size_t servlen, int flags) +{ + return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags); +} + +#elif GETADDRINFO_IMPL == 1 + struct getnameinfo_arg { const struct sockaddr *sa; @@ -323,16 +569,11 @@ nogvl_getnameinfo(void *arg) ptr->serv, (socklen_t)ptr->servlen, ptr->flags); } -#endif - int rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, - char *host, size_t hostlen, - char *serv, size_t servlen, int flags) + char *host, size_t hostlen, + char *serv, size_t servlen, int flags) { -#ifdef GETADDRINFO_EMU - return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags); -#else struct getnameinfo_arg arg; int ret; arg.sa = sa; @@ -344,17 +585,185 @@ rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, arg.flags = flags; ret = (int)(VALUE)rb_thread_call_without_gvl(nogvl_getnameinfo, &arg, RUBY_UBF_IO, 0); return ret; -#endif +} + +#elif GETADDRINFO_IMPL == 2 + +struct getnameinfo_arg +{ + struct sockaddr *sa; + socklen_t salen; + int flags; + char *host; + size_t hostlen; + char *serv; + size_t servlen; + int err, gni_errno, refcount, done, cancelled; + rb_nativethread_lock_t lock; + rb_nativethread_cond_t cond; +}; + +static struct getnameinfo_arg * +allocate_getnameinfo_arg(const struct sockaddr *sa, socklen_t salen, size_t hostlen, size_t servlen, int flags) +{ + size_t sa_offset = sizeof(struct getnameinfo_arg); + size_t host_offset = sa_offset + salen; + size_t serv_offset = host_offset + hostlen; + size_t bufsize = serv_offset + servlen; + + char *buf = malloc(bufsize); + if (!buf) { + rb_gc(); + buf = malloc(bufsize); + if (!buf) return NULL; + } + struct getnameinfo_arg *arg = (struct getnameinfo_arg *)buf; + + arg->sa = (struct sockaddr *)(buf + sa_offset); + memcpy(arg->sa, sa, salen); + arg->salen = salen; + arg->host = buf + host_offset; + arg->hostlen = hostlen; + arg->serv = buf + serv_offset; + arg->servlen = servlen; + arg->flags = flags; + + arg->refcount = 2; + arg->done = arg->cancelled = 0; + + rb_nativethread_lock_initialize(&arg->lock); + rb_native_cond_initialize(&arg->cond); + + return arg; +} + +static void +free_getnameinfo_arg(struct getnameinfo_arg *arg) +{ + rb_native_cond_destroy(&arg->cond); + rb_nativethread_lock_destroy(&arg->lock); + + free(arg); +} + +static void * +do_getnameinfo(void *ptr) +{ + struct getnameinfo_arg *arg = (struct getnameinfo_arg *)ptr; + + int err, gni_errno; + err = getnameinfo(arg->sa, arg->salen, arg->host, (socklen_t)arg->hostlen, arg->serv, (socklen_t)arg->servlen, arg->flags); + gni_errno = errno; + + int need_free = 0; + rb_nativethread_lock_lock(&arg->lock); + arg->err = err; + arg->gni_errno = gni_errno; + if (!arg->cancelled) { + arg->done = 1; + rb_native_cond_signal(&arg->cond); + } + if (--arg->refcount == 0) need_free = 1; + rb_nativethread_lock_unlock(&arg->lock); + + if (need_free) free_getnameinfo_arg(arg); + + return 0; +} + +static void * +wait_getnameinfo(void *ptr) +{ + struct getnameinfo_arg *arg = (struct getnameinfo_arg *)ptr; + rb_nativethread_lock_lock(&arg->lock); + while (!arg->done && !arg->cancelled) { + rb_native_cond_wait(&arg->cond, &arg->lock); + } + rb_nativethread_lock_unlock(&arg->lock); + return 0; } static void +cancel_getnameinfo(void *ptr) +{ + struct getnameinfo_arg *arg = (struct getnameinfo_arg *)ptr; + rb_nativethread_lock_lock(&arg->lock); + arg->cancelled = 1; + rb_native_cond_signal(&arg->cond); + rb_nativethread_lock_unlock(&arg->lock); +} + +int +rb_getnameinfo(const struct sockaddr *sa, socklen_t salen, + char *host, size_t hostlen, + char *serv, size_t servlen, int flags) +{ + int retry; + struct getnameinfo_arg *arg; + int err, gni_errno = 0; + +start: + retry = 0; + + arg = allocate_getnameinfo_arg(sa, salen, hostlen, servlen, flags); + if (!arg) { + return EAI_MEMORY; + } + + pthread_t th; + if (do_pthread_create(&th, do_getnameinfo, arg) != 0) { + free_getnameinfo_arg(arg); + return EAI_AGAIN; + } + pthread_detach(th); + + rb_thread_call_without_gvl2(wait_getnameinfo, arg, cancel_getnameinfo, arg); + + int need_free = 0; + rb_nativethread_lock_lock(&arg->lock); + if (arg->done) { + err = arg->err; + gni_errno = arg->gni_errno; + if (err == 0) { + if (host) memcpy(host, arg->host, hostlen); + if (serv) memcpy(serv, arg->serv, servlen); + } + } + else if (arg->cancelled) { + err = EAI_AGAIN; + } + else { + // If already interrupted, rb_thread_call_without_gvl2 may return without calling wait_getnameinfo. + // In this case, it could be !arg->done && !arg->cancelled. + arg->cancelled = 1; + retry = 1; + } + if (--arg->refcount == 0) need_free = 1; + rb_nativethread_lock_unlock(&arg->lock); + + if (need_free) free_getnameinfo_arg(arg); + + // If the current thread is interrupted by asynchronous exception, the following raises the exception. + // But if the current thread is interrupted by timer thread, the following returns; we need to manually retry. + rb_thread_check_ints(); + if (retry) goto start; + + /* Make sure we copy the thread-local errno value from the getnameinfo thread back to this thread, so + * calling code sees the correct errno */ + if (gni_errno) errno = gni_errno; + return err; +} + +#endif + +static void make_ipaddr0(struct sockaddr *addr, socklen_t addrlen, char *buf, size_t buflen) { int error; error = rb_getnameinfo(addr, addrlen, buf, buflen, NULL, 0, NI_NUMERICHOST); if (error) { - rsock_raise_socket_error("getnameinfo", error); + rsock_raise_resolution_error("getnameinfo", error); } } @@ -550,17 +959,7 @@ rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_h } if (!resolved) { -#ifdef GETADDRINFO_EMU - error = getaddrinfo(hostp, portp, hints, &ai); -#else - struct getaddrinfo_arg arg; - MEMZERO(&arg, struct getaddrinfo_arg, 1); - arg.node = hostp; - arg.service = portp; - arg.hints = hints; - arg.res = &ai; - error = (int)(VALUE)rb_thread_call_without_gvl(nogvl_getaddrinfo, &arg, RUBY_UBF_IO, 0); -#endif + error = rb_getaddrinfo(hostp, portp, hints, &ai); if (error == 0) { res = (struct rb_addrinfo *)xmalloc(sizeof(struct rb_addrinfo)); res->allocated_by_malloc = 0; @@ -573,7 +972,7 @@ rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_h if (hostp && hostp[strlen(hostp)-1] == '\n') { rb_raise(rb_eSocket, "newline at the end of hostname"); } - rsock_raise_socket_error("getaddrinfo", error); + rsock_raise_resolution_error("getaddrinfo", error); } return res; @@ -632,7 +1031,7 @@ rsock_ipaddr(struct sockaddr *sockaddr, socklen_t sockaddrlen, int norevlookup) error = rb_getnameinfo(sockaddr, sockaddrlen, hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV); if (error) { - rsock_raise_socket_error("getnameinfo", error); + rsock_raise_resolution_error("getnameinfo", error); } addr2 = rb_str_new2(hbuf); if (addr1 == Qnil) { @@ -1266,11 +1665,11 @@ rsock_inspect_sockaddr(struct sockaddr *sockaddr_arg, socklen_t socklen, VALUE r * RFC 4007: IPv6 Scoped Address Architecture * draft-ietf-ipv6-scope-api-00.txt: Scoped Address Extensions to the IPv6 Basic Socket API */ - error = getnameinfo(&sockaddr->addr, socklen, - hbuf, (socklen_t)sizeof(hbuf), NULL, 0, - NI_NUMERICHOST|NI_NUMERICSERV); + error = rb_getnameinfo(&sockaddr->addr, socklen, + hbuf, (socklen_t)sizeof(hbuf), NULL, 0, + NI_NUMERICHOST|NI_NUMERICSERV); if (error) { - rsock_raise_socket_error("getnameinfo", error); + rsock_raise_resolution_error("getnameinfo", error); } if (addr->sin6_port == 0) { rb_str_cat2(ret, hbuf); @@ -1634,11 +2033,11 @@ addrinfo_mdump(VALUE self) { char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; int error; - error = getnameinfo(&rai->addr.addr, rai->sockaddr_len, - hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf), - NI_NUMERICHOST|NI_NUMERICSERV); + error = rb_getnameinfo(&rai->addr.addr, rai->sockaddr_len, + hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf), + NI_NUMERICHOST|NI_NUMERICSERV); if (error) { - rsock_raise_socket_error("getnameinfo", error); + rsock_raise_resolution_error("getnameinfo", error); } sockaddr = rb_assoc_new(rb_str_new_cstr(hbuf), rb_str_new_cstr(pbuf)); break; @@ -1980,11 +2379,11 @@ addrinfo_getnameinfo(int argc, VALUE *argv, VALUE self) if (rai->socktype == SOCK_DGRAM) flags |= NI_DGRAM; - error = getnameinfo(&rai->addr.addr, rai->sockaddr_len, - hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf), - flags); + error = rb_getnameinfo(&rai->addr.addr, rai->sockaddr_len, + hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf), + flags); if (error) { - rsock_raise_socket_error("getnameinfo", error); + rsock_raise_resolution_error("getnameinfo", error); } return rb_assoc_new(rb_str_new2(hbuf), rb_str_new2(pbuf)); @@ -2614,12 +3013,12 @@ rsock_io_socket_addrinfo(VALUE io, struct sockaddr *addr, socklen_t len) void rsock_init_addrinfo(void) { + id_timeout = rb_intern("timeout"); + /* * The Addrinfo class maps <tt>struct addrinfo</tt> to ruby. This * structure identifies an Internet host and a service. */ - id_timeout = rb_intern("timeout"); - rb_cAddrinfo = rb_define_class("Addrinfo", rb_cObject); rb_define_alloc_func(rb_cAddrinfo, addrinfo_s_allocate); rb_define_method(rb_cAddrinfo, "initialize", addrinfo_initialize, -1); diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h index 5f803ba0da..f486db4262 100644 --- a/ext/socket/rubysocket.h +++ b/ext/socket/rubysocket.h @@ -35,6 +35,7 @@ #ifdef _WIN32 # include <winsock2.h> # include <ws2tcpip.h> +# include <mswsock.h> # include <iphlpapi.h> # if defined(_MSC_VER) # undef HAVE_TYPE_STRUCT_SOCKADDR_DL @@ -285,6 +286,7 @@ extern VALUE rb_cAddrinfo; extern VALUE rb_cSockOpt; extern VALUE rb_eSocket; +extern VALUE rb_eResolution; #ifdef SOCKS extern VALUE rb_cSOCKSSocket; @@ -307,7 +309,7 @@ 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)); +NORETURN(void rsock_raise_resolution_error(const char *, int)); int rsock_family_arg(VALUE domain); int rsock_socktype_arg(VALUE type); @@ -459,6 +461,8 @@ VALUE rsock_write_nonblock(VALUE sock, VALUE buf, VALUE ex); void rsock_make_fd_nonblock(int fd); +int rsock_is_dgram(rb_io_t *fptr); + #if !defined HAVE_INET_NTOP && ! defined _WIN32 const char *inet_ntop(int, const void *, char *, size_t); #elif defined __MINGW32__ diff --git a/ext/socket/socket.c b/ext/socket/socket.c index eb74f7a936..c780d77cf6 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -1313,7 +1313,7 @@ sock_s_getnameinfo(int argc, VALUE *argv, VALUE _) saved_errno = errno; if (res) rb_freeaddrinfo(res); errno = saved_errno; - rsock_raise_socket_error("getnameinfo", error); + rsock_raise_resolution_error("getnameinfo", error); UNREACHABLE_RETURN(Qnil); } @@ -1654,8 +1654,7 @@ socket_s_ip_address_list(VALUE self) finish: save_errno = errno; - if (lc.lifc_buf != NULL) - xfree(lc.lifc_req); + xfree(lc.lifc_req); if (fd != -1) close(fd); errno = save_errno; diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c index 26ab76fc9f..a8475e3e60 100644 --- a/ext/socket/unixsocket.c +++ b/ext/socket/unixsocket.c @@ -540,7 +540,7 @@ unix_peeraddr(VALUE sock) * * Creates a pair of sockets connected to each other. * - * _socktype_ should be a socket type such as: :STREAM, :DGRAM, :RAW, etc. + * _type_ 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. diff --git a/ext/stringio/.document b/ext/stringio/.document new file mode 100644 index 0000000000..decba0135a --- /dev/null +++ b/ext/stringio/.document @@ -0,0 +1 @@ +*.[ch] diff --git a/ext/stringio/depend b/ext/stringio/depend index 828fc6e842..b9fba7e9fa 100644 --- a/ext/stringio/depend +++ b/ext/stringio/depend @@ -53,6 +53,7 @@ stringio.o: $(hdrdir)/ruby/internal/attr/noexcept.h stringio.o: $(hdrdir)/ruby/internal/attr/noinline.h stringio.o: $(hdrdir)/ruby/internal/attr/nonnull.h stringio.o: $(hdrdir)/ruby/internal/attr/noreturn.h +stringio.o: $(hdrdir)/ruby/internal/attr/packed_struct.h stringio.o: $(hdrdir)/ruby/internal/attr/pure.h stringio.o: $(hdrdir)/ruby/internal/attr/restrict.h stringio.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ stringio.o: $(hdrdir)/ruby/internal/intern/enumerator.h stringio.o: $(hdrdir)/ruby/internal/intern/error.h stringio.o: $(hdrdir)/ruby/internal/intern/eval.h stringio.o: $(hdrdir)/ruby/internal/intern/file.h -stringio.o: $(hdrdir)/ruby/internal/intern/gc.h stringio.o: $(hdrdir)/ruby/internal/intern/hash.h stringio.o: $(hdrdir)/ruby/internal/intern/io.h stringio.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ stringio.o: $(hdrdir)/ruby/internal/memory.h stringio.o: $(hdrdir)/ruby/internal/method.h stringio.o: $(hdrdir)/ruby/internal/module.h stringio.o: $(hdrdir)/ruby/internal/newobj.h -stringio.o: $(hdrdir)/ruby/internal/rgengc.h stringio.o: $(hdrdir)/ruby/internal/scan_args.h stringio.o: $(hdrdir)/ruby/internal/special_consts.h stringio.o: $(hdrdir)/ruby/internal/static_assert.h stringio.o: $(hdrdir)/ruby/internal/stdalign.h stringio.o: $(hdrdir)/ruby/internal/stdbool.h +stringio.o: $(hdrdir)/ruby/internal/stdckdint.h stringio.o: $(hdrdir)/ruby/internal/symbol.h stringio.o: $(hdrdir)/ruby/internal/value.h stringio.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/stringio/extconf.rb b/ext/stringio/extconf.rb index a933159766..553732f79c 100644 --- a/ext/stringio/extconf.rb +++ b/ext/stringio/extconf.rb @@ -1,4 +1,7 @@ # frozen_string_literal: false require 'mkmf' -have_func("rb_io_extract_modeenc", "ruby/io.h") -create_makefile('stringio') +if RUBY_ENGINE == 'ruby' + create_makefile('stringio') +else + File.write('Makefile', dummy_makefile("").join) +end diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index ed2b0a3fe8..820b8228a3 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -12,7 +12,10 @@ **********************************************************************/ -#define STRINGIO_VERSION "3.0.3" +static const char *const +STRINGIO_VERSION = "3.1.1"; + +#include <stdbool.h> #include "ruby.h" #include "ruby/io.h" @@ -32,86 +35,6 @@ # define rb_class_new_instance_kw(argc, argv, klass, kw_splat) rb_class_new_instance(argc, argv, klass) #endif -#ifndef HAVE_RB_IO_EXTRACT_MODEENC -#define rb_io_extract_modeenc strio_extract_modeenc -static void -strio_extract_modeenc(VALUE *vmode_p, VALUE *vperm_p, VALUE opthash, - int *oflags_p, int *fmode_p, struct rb_io_enc_t *convconfig_p) -{ - VALUE mode = *vmode_p; - VALUE intmode; - int fmode; - int has_enc = 0, has_vmode = 0; - - convconfig_p->enc = convconfig_p->enc2 = 0; - - vmode_handle: - if (NIL_P(mode)) { - fmode = FMODE_READABLE; - } - else if (!NIL_P(intmode = rb_check_to_integer(mode, "to_int"))) { - int flags = NUM2INT(intmode); - fmode = rb_io_oflags_fmode(flags); - } - else { - const char *m = StringValueCStr(mode), *n, *e; - fmode = rb_io_modestr_fmode(m); - n = strchr(m, ':'); - if (n) { - long len; - char encname[ENCODING_MAXNAMELEN+1]; - has_enc = 1; - if (fmode & FMODE_SETENC_BY_BOM) { - n = strchr(n, '|'); - } - e = strchr(++n, ':'); - len = e ? e - n : (long)strlen(n); - if (len > 0 && len <= ENCODING_MAXNAMELEN) { - rb_encoding *enc; - if (e) { - memcpy(encname, n, len); - encname[len] = '\0'; - n = encname; - } - enc = rb_enc_find(n); - if (e) - convconfig_p->enc2 = enc; - else - convconfig_p->enc = enc; - } - if (e && (len = strlen(++e)) > 0 && len <= ENCODING_MAXNAMELEN) { - convconfig_p->enc = rb_enc_find(e); - } - } - } - - if (!NIL_P(opthash)) { - rb_encoding *extenc = 0, *intenc = 0; - VALUE v; - if (!has_vmode) { - ID id_mode; - CONST_ID(id_mode, "mode"); - v = rb_hash_aref(opthash, ID2SYM(id_mode)); - if (!NIL_P(v)) { - if (!NIL_P(mode)) { - rb_raise(rb_eArgError, "mode specified twice"); - } - has_vmode = 1; - mode = v; - goto vmode_handle; - } - } - - if (rb_io_extract_encoding_option(opthash, &extenc, &intenc, &fmode)) { - if (has_enc) { - rb_raise(rb_eArgError, "encoding specified twice"); - } - } - } - *fmode_p = fmode; -} -#endif - struct StringIO { VALUE string; rb_encoding *enc; @@ -127,7 +50,20 @@ static long strio_write(VALUE self, VALUE str); #define IS_STRIO(obj) (rb_typeddata_is_kind_of((obj), &strio_data_type)) #define error_inval(msg) (rb_syserr_fail(EINVAL, msg)) -#define get_enc(ptr) ((ptr)->enc ? (ptr)->enc : rb_enc_get((ptr)->string)) +#define get_enc(ptr) ((ptr)->enc ? (ptr)->enc : !NIL_P((ptr)->string) ? rb_enc_get((ptr)->string) : NULL) +#ifndef HAVE_RB_STR_CHILLED_P +static bool +rb_str_chilled_p(VALUE str) +{ + return false; +} +#endif + +static bool +readonly_string_p(VALUE string) +{ + return OBJ_FROZEN_RAW(string) && !rb_str_chilled_p(string); +} static struct StringIO * strio_alloc(void) @@ -171,7 +107,7 @@ static const rb_data_type_t strio_data_type = { strio_free, strio_memsize, }, - 0, 0, RUBY_TYPED_FREE_IMMEDIATELY + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED }; #define check_strio(self) ((struct StringIO*)rb_check_typeddata((self), &strio_data_type)) @@ -245,7 +181,13 @@ writable(VALUE strio) static void check_modifiable(struct StringIO *ptr) { - if (OBJ_FROZEN(ptr->string)) { + if (NIL_P(ptr->string)) { + /* Null device StringIO */ + } + else if (rb_str_chilled_p(ptr->string)) { + rb_str_modify(ptr->string); + } + else if (OBJ_FROZEN_RAW(ptr->string)) { rb_raise(rb_eIOError, "not modifiable string"); } } @@ -356,17 +298,18 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self) { VALUE string, vmode, opt; int oflags; - struct rb_io_enc_t convconfig; + rb_io_enc_t convconfig; argc = rb_scan_args(argc, argv, "02:", &string, &vmode, &opt); rb_io_extract_modeenc(&vmode, 0, opt, &oflags, &ptr->flags, &convconfig); - if (argc) { + if (!NIL_P(string)) { StringValue(string); } - else { + else if (!argc) { string = rb_enc_str_new("", 0, rb_default_external_encoding()); } - if (OBJ_FROZEN_RAW(string)) { + + if (!NIL_P(string) && readonly_string_p(string)) { if (ptr->flags & FMODE_WRITABLE) { rb_syserr_fail(EACCES, 0); } @@ -376,11 +319,11 @@ strio_init(int argc, VALUE *argv, struct StringIO *ptr, VALUE self) ptr->flags |= FMODE_WRITABLE; } } - if (ptr->flags & FMODE_TRUNC) { + if (!NIL_P(string) && (ptr->flags & FMODE_TRUNC)) { rb_str_resize(string, 0); } - ptr->string = string; - if (argc == 1) { + RB_OBJ_WRITE(self, &ptr->string, string); + if (argc == 1 && !NIL_P(string)) { ptr->enc = rb_enc_get(string); } else { @@ -397,7 +340,7 @@ static VALUE strio_finalize(VALUE self) { struct StringIO *ptr = StringIO(self); - ptr->string = Qnil; + RB_OBJ_WRITE(self, &ptr->string, Qnil); ptr->flags &= ~FMODE_READWRITE; return self; } @@ -560,10 +503,11 @@ strio_set_string(VALUE self, VALUE string) rb_io_taint_check(self); ptr->flags &= ~FMODE_READWRITE; StringValue(string); - ptr->flags = OBJ_FROZEN(string) ? FMODE_READABLE : FMODE_READWRITE; + ptr->flags = readonly_string_p(string) ? FMODE_READABLE : FMODE_READWRITE; ptr->pos = 0; ptr->lineno = 0; - return ptr->string = string; + RB_OBJ_WRITE(self, &ptr->string, string); + return string; } /* @@ -673,6 +617,7 @@ static struct StringIO * strio_to_read(VALUE self) { struct StringIO *ptr = readable(self); + if (NIL_P(ptr->string)) return NULL; if (ptr->pos < RSTRING_LEN(ptr->string)) return ptr; return NULL; } @@ -682,11 +627,9 @@ strio_to_read(VALUE self) * eof? -> true or false * * Returns +true+ if positioned at end-of-stream, +false+ otherwise; - * see {Position}[rdoc-ref:File@Position]. + * see {Position}[rdoc-ref:IO@Position]. * * Raises IOError if the stream is not opened for reading. - * - * StreamIO#eof is an alias for StreamIO#eof?. */ static VALUE strio_eof(VALUE self) @@ -699,15 +642,19 @@ strio_eof(VALUE self) static VALUE strio_copy(VALUE copy, VALUE orig) { - struct StringIO *ptr; + struct StringIO *ptr, *old_ptr; + VALUE old_string = Qundef; orig = rb_convert_type(orig, T_DATA, "StringIO", "to_strio"); if (copy == orig) return copy; ptr = StringIO(orig); - if (check_strio(copy)) { - strio_free(DATA_PTR(copy)); + old_ptr = check_strio(copy); + if (old_ptr) { + old_string = old_ptr->string; + strio_free(old_ptr); } DATA_PTR(copy) = ptr; + RB_OBJ_WRITTEN(copy, old_string, ptr->string); RBASIC(copy)->flags &= ~STRIO_READWRITE; RBASIC(copy)->flags |= RBASIC(orig)->flags & STRIO_READWRITE; ++ptr->count; @@ -719,7 +666,7 @@ strio_copy(VALUE copy, VALUE orig) * lineno -> current_line_number * * Returns the current line number in +self+; - * see {Line Number}[rdoc-ref:io_streams.rdoc@Line+Number]. + * see {Line Number}[rdoc-ref:IO@Line+Number]. */ static VALUE strio_get_lineno(VALUE self) @@ -732,7 +679,7 @@ strio_get_lineno(VALUE self) * lineno = new_line_number -> new_line_number * * Sets the current line number in +self+ to the given +new_line_number+; - * see {Line Number}[rdoc-ref:io_streams.rdoc@Line+Number]. + * see {Line Number}[rdoc-ref:IO@Line+Number]. */ static VALUE strio_set_lineno(VALUE self, VALUE lineno) @@ -807,9 +754,7 @@ strio_reopen(int argc, VALUE *argv, VALUE self) * pos -> stream_position * * Returns the current position (in bytes); - * see {Position}[rdoc-ref:io_streams.rdoc@Position]. - * - * StringIO#tell is an alias for StringIO#pos. + * see {Position}[rdoc-ref:IO@Position]. */ static VALUE strio_get_pos(VALUE self) @@ -822,7 +767,7 @@ strio_get_pos(VALUE self) * pos = new_position -> new_position * * Sets the current position (in bytes); - * see {Position}[rdoc-ref:io_streams.rdoc@Position]. + * see {Position}[rdoc-ref:IO@Position]. */ static VALUE strio_set_pos(VALUE self, VALUE pos) @@ -841,8 +786,8 @@ strio_set_pos(VALUE self, VALUE pos) * rewind -> 0 * * Sets the current position and line number to zero; - * see {Position}[rdoc-ref:io_streams.rdoc@Position] - * and {Line Number}[rdoc-ref:io_streams.rdoc@Line+Number]. + * see {Position}[rdoc-ref:IO@Position] + * and {Line Number}[rdoc-ref:IO@Line+Number]. */ static VALUE strio_rewind(VALUE self) @@ -859,7 +804,7 @@ strio_rewind(VALUE self) * * Sets the current position to the given integer +offset+ (in bytes), * with respect to a given constant +whence+; - * see {Position}[rdoc-ref:io_streams.rdoc@Position]. + * see {Position}[rdoc-ref:IO@Position]. */ static VALUE strio_seek(int argc, VALUE *argv, VALUE self) @@ -915,7 +860,7 @@ strio_get_sync(VALUE self) * each_byte {|byte| ... } -> self * * With a block given, calls the block with each remaining byte in the stream; - * see {Byte IO}[rdoc-ref:io_streams.rdoc@Byte+IO]. + * see {Byte IO}[rdoc-ref:IO@Byte+IO]. * * With no block given, returns an enumerator. */ @@ -938,7 +883,7 @@ strio_each_byte(VALUE self) * getc -> character or nil * * Reads and returns the next character from the stream; - * see {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO]. + * see {Character IO}[rdoc-ref:IO@Character+IO]. */ static VALUE strio_getc(VALUE self) @@ -950,7 +895,7 @@ strio_getc(VALUE self) int len; char *p; - if (pos >= RSTRING_LEN(str)) { + if (NIL_P(str) || pos >= RSTRING_LEN(str)) { return Qnil; } p = RSTRING_PTR(str)+pos; @@ -964,14 +909,14 @@ strio_getc(VALUE self) * getbyte -> byte or nil * * Reads and returns the next 8-bit byte from the stream; - * see {Byte IO}[rdoc-ref:io_streams.rdoc@Byte+IO]. + * see {Byte IO}[rdoc-ref:IO@Byte+IO]. */ static VALUE strio_getbyte(VALUE self) { struct StringIO *ptr = readable(self); int c; - if (ptr->pos >= RSTRING_LEN(ptr->string)) { + if (NIL_P(ptr->string) || ptr->pos >= RSTRING_LEN(ptr->string)) { return Qnil; } c = RSTRING_PTR(ptr->string)[ptr->pos++]; @@ -993,9 +938,6 @@ strio_extend(struct StringIO *ptr, long pos, long len) if (pos > olen) MEMZERO(RSTRING_PTR(ptr->string) + olen, char, pos - olen); } - else { - rb_str_modify(ptr->string); - } } /* @@ -1003,7 +945,7 @@ strio_extend(struct StringIO *ptr, long pos, long len) * ungetc(character) -> nil * * Pushes back ("unshifts") a character or integer onto the stream; - * see {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO]. + * see {Character IO}[rdoc-ref:IO@Character+IO]. */ static VALUE strio_ungetc(VALUE self, VALUE c) @@ -1012,6 +954,7 @@ strio_ungetc(VALUE self, VALUE c) rb_encoding *enc, *enc2; check_modifiable(ptr); + if (NIL_P(ptr->string)) return Qnil; if (NIL_P(c)) return Qnil; if (RB_INTEGER_TYPE_P(c)) { int len, cc = NUM2INT(c); @@ -1041,7 +984,7 @@ strio_ungetc(VALUE self, VALUE c) * ungetbyte(byte) -> nil * * Pushes back ("unshifts") an 8-bit byte onto the stream; - * see {Byte IO}[rdoc-ref:io_streams.rdoc@Byte+IO]. + * see {Byte IO}[rdoc-ref:IO@Byte+IO]. */ static VALUE strio_ungetbyte(VALUE self, VALUE c) @@ -1049,12 +992,13 @@ strio_ungetbyte(VALUE self, VALUE c) struct StringIO *ptr = readable(self); check_modifiable(ptr); + if (NIL_P(ptr->string)) return Qnil; if (NIL_P(c)) return Qnil; if (RB_INTEGER_TYPE_P(c)) { - /* rb_int_and() not visible from exts */ - VALUE v = rb_funcall(c, '&', 1, INT2FIX(0xff)); - const char cc = NUM2INT(v) & 0xFF; - strio_unget_bytes(ptr, &cc, 1); + /* rb_int_and() not visible from exts */ + VALUE v = rb_funcall(c, '&', 1, INT2FIX(0xff)); + const char cc = NUM2INT(v) & 0xFF; + strio_unget_bytes(ptr, &cc, 1); } else { long cl; @@ -1104,7 +1048,7 @@ strio_unget_bytes(struct StringIO *ptr, const char *cp, long cl) * readchar -> string * * Like +getc+, but raises an exception if already at end-of-stream; - * see {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO]. + * see {Character IO}[rdoc-ref:IO@Character+IO]. */ static VALUE strio_readchar(VALUE self) @@ -1119,7 +1063,7 @@ strio_readchar(VALUE self) * readbyte -> byte * * Like +getbyte+, but raises an exception if already at end-of-stream; - * see {Byte IO}[rdoc-ref:io_streams.rdoc@Byte+IO]. + * see {Byte IO}[rdoc-ref:IO@Byte+IO]. */ static VALUE strio_readbyte(VALUE self) @@ -1134,7 +1078,7 @@ strio_readbyte(VALUE self) * each_char {|c| ... } -> self * * With a block given, calls the block with each remaining character in the stream; - * see {Character IO}[rdoc-ref:io_streams.rdoc@Character+IO]. + * see {Character IO}[rdoc-ref:IO@Character+IO]. * * With no block given, returns an enumerator. */ @@ -1156,7 +1100,7 @@ strio_each_char(VALUE self) * each_codepoint {|codepoint| ... } -> self * * With a block given, calls the block with each remaining codepoint in the stream; - * see {Codepoint IO}[rdoc-ref:io_streams.rdoc@Codepoint+IO]. + * see {Codepoint IO}[rdoc-ref:IO@Codepoint+IO]. * * With no block given, returns an enumerator. */ @@ -1221,38 +1165,57 @@ struct getline_arg { }; static struct getline_arg * -prepare_getline_args(struct getline_arg *arg, int argc, VALUE *argv) +prepare_getline_args(struct StringIO *ptr, struct getline_arg *arg, int argc, VALUE *argv) { - VALUE str, lim, opts; + VALUE rs, lim, opts; long limit = -1; int respect_chomp; - argc = rb_scan_args(argc, argv, "02:", &str, &lim, &opts); - respect_chomp = argc == 0 || !NIL_P(str); + argc = rb_scan_args(argc, argv, "02:", &rs, &lim, &opts); + respect_chomp = argc == 0 || !NIL_P(rs); switch (argc) { case 0: - str = rb_rs; + rs = rb_rs; break; case 1: - if (!NIL_P(str) && !RB_TYPE_P(str, T_STRING)) { - VALUE tmp = rb_check_string_type(str); + if (!NIL_P(rs) && !RB_TYPE_P(rs, T_STRING)) { + VALUE tmp = rb_check_string_type(rs); if (NIL_P(tmp)) { - limit = NUM2LONG(str); - str = rb_rs; + limit = NUM2LONG(rs); + rs = rb_rs; } else { - str = tmp; + rs = tmp; } } break; case 2: - if (!NIL_P(str)) StringValue(str); + if (!NIL_P(rs)) StringValue(rs); if (!NIL_P(lim)) limit = NUM2LONG(lim); break; } - arg->rs = str; + if (!NIL_P(ptr->string) && !NIL_P(rs)) { + rb_encoding *enc_rs, *enc_io; + enc_rs = rb_enc_get(rs); + enc_io = get_enc(ptr); + if (enc_rs != enc_io && + (rb_enc_str_coderange(rs) != ENC_CODERANGE_7BIT || + (RSTRING_LEN(rs) > 0 && !rb_enc_asciicompat(enc_io)))) { + if (rs == rb_rs) { + rs = rb_enc_str_new(0, 0, enc_io); + rb_str_buf_cat_ascii(rs, "\n"); + rs = rs; + } + else { + rb_raise(rb_eArgError, "encoding mismatch: %s IO with %s RS", + rb_enc_name(enc_io), + rb_enc_name(enc_rs)); + } + } + } + arg->rs = rs; arg->limit = limit; arg->chomp = 0; if (!NIL_P(opts)) { @@ -1262,9 +1225,9 @@ prepare_getline_args(struct getline_arg *arg, int argc, VALUE *argv) keywords[0] = rb_intern_const("chomp"); } rb_get_kwargs(opts, keywords, 0, 1, &vchomp); - if (respect_chomp) { + if (respect_chomp) { arg->chomp = (vchomp != Qundef) && RTEST(vchomp); - } + } } return arg; } @@ -1288,7 +1251,7 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr) long w = 0; rb_encoding *enc = get_enc(ptr); - if (ptr->pos >= (n = RSTRING_LEN(ptr->string))) { + if (NIL_P(ptr->string) || ptr->pos >= (n = RSTRING_LEN(ptr->string))) { return Qnil; } s = RSTRING_PTR(ptr->string); @@ -1304,7 +1267,7 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr) str = strio_substr(ptr, ptr->pos, e - s - w, enc); } else if ((n = RSTRING_LEN(str)) == 0) { - const char *paragraph_end = NULL; + const char *paragraph_end = NULL; p = s; while (p[(p + 1 < e) && (*p == '\r') && 0] == '\n') { p += *p == '\r'; @@ -1314,18 +1277,18 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr) } s = p; while ((p = memchr(p, '\n', e - p)) && (p != e)) { - p++; - if (!((p < e && *p == '\n') || - (p + 1 < e && *p == '\r' && *(p+1) == '\n'))) { - continue; - } - paragraph_end = p - ((*(p-2) == '\r') ? 2 : 1); - while ((p < e && *p == '\n') || - (p + 1 < e && *p == '\r' && *(p+1) == '\n')) { - p += (*p == '\r') ? 2 : 1; - } - e = p; - break; + p++; + if (!((p < e && *p == '\n') || + (p + 1 < e && *p == '\r' && *(p+1) == '\n'))) { + continue; + } + paragraph_end = p - ((*(p-2) == '\r') ? 2 : 1); + while ((p < e && *p == '\n') || + (p + 1 < e && *p == '\r' && *(p+1) == '\n')) { + p += (*p == '\r') ? 2 : 1; + } + e = p; + break; } if (arg->chomp && paragraph_end) { w = e - paragraph_end; @@ -1340,8 +1303,9 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr) str = strio_substr(ptr, ptr->pos, e - s - w, enc); } else { - if (n < e - s) { - if (e - s < 1024) { + if (n < e - s + arg->chomp) { + /* unless chomping, RS at the end does not matter */ + if (e - s < 1024 || n == e - s) { for (p = s; p + n <= e; ++p) { if (MEMCMP(p, RSTRING_PTR(str), char, n) == 0) { e = p + n; @@ -1374,20 +1338,21 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr) * * Reads and returns a line from the stream; * assigns the return value to <tt>$_</tt>; - * see {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO]. + * see {Line IO}[rdoc-ref:IO@Line+IO]. */ static VALUE strio_gets(int argc, VALUE *argv, VALUE self) { + struct StringIO *ptr = readable(self); struct getline_arg arg; VALUE str; - if (prepare_getline_args(&arg, argc, argv)->limit == 0) { - struct StringIO *ptr = readable(self); + if (prepare_getline_args(ptr, &arg, argc, argv)->limit == 0) { + if (NIL_P(ptr->string)) return Qnil; return rb_enc_str_new(0, 0, get_enc(ptr)); } - str = strio_getline(&arg, readable(self)); + str = strio_getline(&arg, ptr); rb_lastline_set(str); return str; } @@ -1399,7 +1364,7 @@ strio_gets(int argc, VALUE *argv, VALUE self) * readline(sep, limit, chomp: false) -> string * * Reads a line as with IO#gets, but raises EOFError if already at end-of-file; - * see {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO]. + * see {Line IO}[rdoc-ref:IO@Line+IO]. */ static VALUE strio_readline(int argc, VALUE *argv, VALUE self) @@ -1418,24 +1383,22 @@ strio_readline(int argc, VALUE *argv, VALUE self) * Calls the block with each remaining line read from the stream; * does nothing if already at end-of-file; * returns +self+. - * See {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO]. - * - * StringIO#each is an alias for StringIO#each_line. + * See {Line IO}[rdoc-ref:IO@Line+IO]. */ static VALUE strio_each(int argc, VALUE *argv, VALUE self) { VALUE line; + struct StringIO *ptr = readable(self); struct getline_arg arg; - StringIO(self); RETURN_ENUMERATOR(self, argc, argv); - if (prepare_getline_args(&arg, argc, argv)->limit == 0) { + if (prepare_getline_args(ptr, &arg, argc, argv)->limit == 0) { rb_raise(rb_eArgError, "invalid limit: 0 for each_line"); } - while (!NIL_P(line = strio_getline(&arg, readable(self)))) { + while (!NIL_P(line = strio_getline(&arg, ptr))) { rb_yield(line); } return self; @@ -1453,15 +1416,15 @@ static VALUE strio_readlines(int argc, VALUE *argv, VALUE self) { VALUE ary, line; + struct StringIO *ptr = readable(self); struct getline_arg arg; - StringIO(self); - ary = rb_ary_new(); - if (prepare_getline_args(&arg, argc, argv)->limit == 0) { + if (prepare_getline_args(ptr, &arg, argc, argv)->limit == 0) { rb_raise(rb_eArgError, "invalid limit: 0 for readlines"); } - while (!NIL_P(line = strio_getline(&arg, readable(self)))) { + ary = rb_ary_new(); + while (!NIL_P(line = strio_getline(&arg, ptr))) { rb_ary_push(ary, line); } return ary; @@ -1500,6 +1463,7 @@ strio_write(VALUE self, VALUE str) if (!RB_TYPE_P(str, T_STRING)) str = rb_obj_as_string(str); enc = get_enc(ptr); + if (!enc) return 0; enc2 = rb_enc_get(str); if (enc != enc2 && enc != ascii8bit && enc != (usascii = rb_usascii_encoding())) { VALUE converted = rb_str_conv_enc(str, enc2, enc); @@ -1525,6 +1489,7 @@ strio_write(VALUE self, VALUE str) } else { strio_extend(ptr, ptr->pos, len); + rb_str_modify(ptr->string); memmove(RSTRING_PTR(ptr->string)+ptr->pos, RSTRING_PTR(str), len); } RB_GC_GUARD(str); @@ -1571,10 +1536,12 @@ strio_putc(VALUE self, VALUE ch) check_modifiable(ptr); if (RB_TYPE_P(ch, T_STRING)) { + if (NIL_P(ptr->string)) return ch; str = rb_str_substr(ch, 0, 1); } else { char c = NUM2CHR(ch); + if (NIL_P(ptr->string)) return ch; str = rb_str_new(&c, 1); } strio_write(self, str); @@ -1617,7 +1584,8 @@ strio_read(int argc, VALUE *argv, VALUE self) if (len < 0) { rb_raise(rb_eArgError, "negative length %ld given", len); } - if (len > 0 && ptr->pos >= RSTRING_LEN(ptr->string)) { + if (len > 0 && + (NIL_P(ptr->string) || ptr->pos >= RSTRING_LEN(ptr->string))) { if (!NIL_P(str)) rb_str_resize(str, 0); return Qnil; } @@ -1626,6 +1594,7 @@ strio_read(int argc, VALUE *argv, VALUE self) } /* fall through */ case 0: + if (NIL_P(ptr->string)) return Qnil; len = RSTRING_LEN(ptr->string); if (len <= ptr->pos) { rb_encoding *enc = get_enc(ptr); @@ -1643,7 +1612,7 @@ strio_read(int argc, VALUE *argv, VALUE self) } break; default: - rb_error_arity(argc, 0, 2); + rb_error_arity(argc, 0, 2); } if (NIL_P(str)) { rb_encoding *enc = binary ? rb_ascii8bit_encoding() : get_enc(ptr); @@ -1654,16 +1623,64 @@ strio_read(int argc, VALUE *argv, VALUE self) if (len > rest) len = rest; rb_str_resize(str, len); MEMCPY(RSTRING_PTR(str), RSTRING_PTR(ptr->string) + ptr->pos, char, len); - if (binary) - rb_enc_associate(str, rb_ascii8bit_encoding()); - else + if (!binary) { rb_enc_copy(str, ptr->string); + } } ptr->pos += RSTRING_LEN(str); return str; } /* + * call-seq: + * pread(maxlen, offset) -> string + * pread(maxlen, offset, out_string) -> string + * + * See IO#pread. + */ +static VALUE +strio_pread(int argc, VALUE *argv, VALUE self) +{ + VALUE rb_len, rb_offset, rb_buf; + rb_scan_args(argc, argv, "21", &rb_len, &rb_offset, &rb_buf); + long len = NUM2LONG(rb_len); + long offset = NUM2LONG(rb_offset); + + if (len < 0) { + rb_raise(rb_eArgError, "negative string size (or size too big): %" PRIsVALUE, rb_len); + } + + if (len == 0) { + if (NIL_P(rb_buf)) { + return rb_str_new("", 0); + } + return rb_buf; + } + + if (offset < 0) { + rb_syserr_fail_str(EINVAL, rb_sprintf("pread: Invalid offset argument: %" PRIsVALUE, rb_offset)); + } + + struct StringIO *ptr = readable(self); + + if (offset >= RSTRING_LEN(ptr->string)) { + rb_eof_error(); + } + + if (NIL_P(rb_buf)) { + return strio_substr(ptr, offset, len, rb_ascii8bit_encoding()); + } + + long rest = RSTRING_LEN(ptr->string) - offset; + if (len > rest) len = rest; + rb_str_resize(rb_buf, len); + rb_enc_associate(rb_buf, rb_ascii8bit_encoding()); + MEMCPY(RSTRING_PTR(rb_buf), RSTRING_PTR(ptr->string) + offset, char, len); + return rb_buf; +} + + +/* * call-seq: * strio.sysread(integer[, outbuf]) -> string * strio.readpartial(integer[, outbuf]) -> string @@ -1711,8 +1728,14 @@ strio_read_nonblock(int argc, VALUE *argv, VALUE self) return val; } +/* + * See IO#write + */ #define strio_syswrite rb_io_write +/* + * See IO#write_nonblock + */ static VALUE strio_syswrite_nonblock(int argc, VALUE *argv, VALUE self) { @@ -1740,7 +1763,7 @@ strio_size(VALUE self) { VALUE string = StringIO(self)->string; if (NIL_P(string)) { - rb_raise(rb_eIOError, "not opened"); + return INT2FIX(0); } return ULONG2NUM(RSTRING_LEN(string)); } @@ -1757,10 +1780,12 @@ strio_truncate(VALUE self, VALUE len) { VALUE string = writable(self)->string; long l = NUM2LONG(len); - long plen = RSTRING_LEN(string); + long plen; if (l < 0) { error_inval("negative length"); } + if (NIL_P(string)) return 0; + plen = RSTRING_LEN(string); rb_str_resize(string, l); if (plen < l) { MEMZERO(RSTRING_PTR(string) + plen, char, l - plen); @@ -1823,7 +1848,7 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self) else { enc = rb_find_encoding(ext_enc); if (!enc) { - struct rb_io_enc_t convconfig; + rb_io_enc_t convconfig; int oflags, fmode; VALUE vmode = rb_str_append(rb_str_new_cstr("r:"), ext_enc); rb_io_extract_modeenc(&vmode, 0, Qnil, &oflags, &fmode, &convconfig); @@ -1831,13 +1856,22 @@ strio_set_encoding(int argc, VALUE *argv, VALUE self) } } ptr->enc = enc; - if (WRITABLE(self)) { + if (!NIL_P(ptr->string) && WRITABLE(self)) { rb_enc_associate(ptr->string, enc); } return self; } +/* + * call-seq: + * strio.set_encoding_by_bom => strio or nil + * + * Sets the encoding according to the BOM (Byte Order Mark) in the + * string. + * + * Returns +self+ if the BOM is found, otherwise +nil. + */ static VALUE strio_set_encoding_by_bom(VALUE self) { @@ -1850,7 +1884,7 @@ strio_set_encoding_by_bom(VALUE self) /* * \IO streams for strings, with access similar to * {IO}[rdoc-ref:IO]; - * see {IO Streams}[rdoc-ref:io_streams.rdoc]. + * see {IO}[rdoc-ref:IO]. * * === About the Examples * @@ -1870,10 +1904,15 @@ Init_stringio(void) VALUE StringIO = rb_define_class("StringIO", rb_cObject); + /* The version string */ rb_define_const(StringIO, "VERSION", rb_str_new_cstr(STRINGIO_VERSION)); rb_include_module(StringIO, rb_mEnumerable); rb_define_alloc_func(StringIO, strio_s_allocate); + + /* Maximum length that a StringIO instance can hold */ + rb_define_const(StringIO, "MAX_LENGTH", LONG2NUM(LONG_MAX)); + rb_define_singleton_method(StringIO, "new", strio_s_new, -1); rb_define_singleton_method(StringIO, "open", strio_s_open, -1); rb_define_method(StringIO, "initialize", strio_initialize, -1); @@ -1923,6 +1962,7 @@ Init_stringio(void) rb_define_method(StringIO, "gets", strio_gets, -1); rb_define_method(StringIO, "readlines", strio_readlines, -1); rb_define_method(StringIO, "read", strio_read, -1); + rb_define_method(StringIO, "pread", strio_pread, -1); rb_define_method(StringIO, "write", strio_write_m, -1); rb_define_method(StringIO, "putc", strio_putc, 1); diff --git a/ext/stringio/stringio.gemspec b/ext/stringio/stringio.gemspec index 1015d261f5..b40b7fc824 100644 --- a/ext/stringio/stringio.gemspec +++ b/ext/stringio/stringio.gemspec @@ -4,7 +4,7 @@ source_version = ["", "ext/stringio/"].find do |dir| begin break File.open(File.join(__dir__, "#{dir}stringio.c")) {|f| - f.gets("\n#define STRINGIO_VERSION ") + f.gets("\nSTRINGIO_VERSION ") f.gets[/\s*"(.+)"/, 1] } rescue Errno::ENOENT @@ -14,7 +14,6 @@ Gem::Specification.new do |s| s.name = "stringio" s.version = source_version - s.required_rubygems_version = Gem::Requirement.new(">= 2.6") s.require_paths = ["lib"] s.authors = ["Nobu Nakada", "Charles Oliver Nutter"] s.description = "Pseudo `IO` class from/to `String`." @@ -22,15 +21,22 @@ Gem::Specification.new do |s| s.files = ["README.md"] jruby = true if Gem::Platform.new('java') =~ s.platform or RUBY_ENGINE == 'jruby' if jruby - s.files += ["lib/stringio.rb", "lib/stringio.jar"] + s.require_paths = "lib/java" + s.files += ["lib/java/stringio.rb", "lib/java/stringio.jar"] s.platform = "java" else s.extensions = ["ext/stringio/extconf.rb"] s.files += ["ext/stringio/extconf.rb", "ext/stringio/stringio.c"] end + + s.extra_rdoc_files = [ + ".document", ".rdoc_options", "COPYING", "LICENSE.txt", + "NEWS.md", "README.md", "docs/io.rb", "ext/stringio/.document", + ] + s.homepage = "https://github.com/ruby/stringio" s.licenses = ["Ruby", "BSD-2-Clause"] - s.required_ruby_version = ">= 2.5" + s.required_ruby_version = ">= 2.7" s.summary = "Pseudo IO on String" # s.cert_chain = %w[certs/nobu.pem] diff --git a/ext/strscan/depend b/ext/strscan/depend index 8fe3cb23d9..8dbae206d4 100644 --- a/ext/strscan/depend +++ b/ext/strscan/depend @@ -52,6 +52,7 @@ strscan.o: $(hdrdir)/ruby/internal/attr/noexcept.h strscan.o: $(hdrdir)/ruby/internal/attr/noinline.h strscan.o: $(hdrdir)/ruby/internal/attr/nonnull.h strscan.o: $(hdrdir)/ruby/internal/attr/noreturn.h +strscan.o: $(hdrdir)/ruby/internal/attr/packed_struct.h strscan.o: $(hdrdir)/ruby/internal/attr/pure.h strscan.o: $(hdrdir)/ruby/internal/attr/restrict.h strscan.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ strscan.o: $(hdrdir)/ruby/internal/intern/enumerator.h strscan.o: $(hdrdir)/ruby/internal/intern/error.h strscan.o: $(hdrdir)/ruby/internal/intern/eval.h strscan.o: $(hdrdir)/ruby/internal/intern/file.h -strscan.o: $(hdrdir)/ruby/internal/intern/gc.h strscan.o: $(hdrdir)/ruby/internal/intern/hash.h strscan.o: $(hdrdir)/ruby/internal/intern/io.h strscan.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ strscan.o: $(hdrdir)/ruby/internal/memory.h strscan.o: $(hdrdir)/ruby/internal/method.h strscan.o: $(hdrdir)/ruby/internal/module.h strscan.o: $(hdrdir)/ruby/internal/newobj.h -strscan.o: $(hdrdir)/ruby/internal/rgengc.h strscan.o: $(hdrdir)/ruby/internal/scan_args.h strscan.o: $(hdrdir)/ruby/internal/special_consts.h strscan.o: $(hdrdir)/ruby/internal/static_assert.h strscan.o: $(hdrdir)/ruby/internal/stdalign.h strscan.o: $(hdrdir)/ruby/internal/stdbool.h +strscan.o: $(hdrdir)/ruby/internal/stdckdint.h strscan.o: $(hdrdir)/ruby/internal/symbol.h strscan.o: $(hdrdir)/ruby/internal/value.h strscan.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/strscan/extconf.rb b/ext/strscan/extconf.rb index f0ecbf85d8..bd65606a4e 100644 --- a/ext/strscan/extconf.rb +++ b/ext/strscan/extconf.rb @@ -1,5 +1,10 @@ # frozen_string_literal: true require 'mkmf' -$INCFLAGS << " -I$(top_srcdir)" if $extmk -have_func("onig_region_memsize", "ruby.h") -create_makefile 'strscan' +if RUBY_ENGINE == 'ruby' + $INCFLAGS << " -I$(top_srcdir)" if $extmk + have_func("onig_region_memsize", "ruby.h") + have_func("rb_reg_onig_match", "ruby.h") + create_makefile 'strscan' +else + File.write('Makefile', dummy_makefile("").join) +end diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index e1426380b4..70a3ce5260 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -22,7 +22,7 @@ extern size_t onig_region_memsize(const struct re_registers *regs); #include <stdbool.h> -#define STRSCAN_VERSION "3.0.1" +#define STRSCAN_VERSION "3.1.1" /* ======================================================================= Data Type Definitions @@ -435,11 +435,11 @@ strscan_get_pos(VALUE self) * * 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 + * s = StringScanner.new("abc\u00e4def\u00f6ghi") + * s.charpos # -> 0 + * s.scan_until(/\u00e4/) # -> "abc\u00E4" + * s.pos # -> 5 + * s.charpos # -> 4 */ static VALUE strscan_get_charpos(VALUE self) @@ -539,6 +539,68 @@ adjust_register_position(struct strscanner *p, long position) } } +/* rb_reg_onig_match is available in Ruby 3.3 and later. */ +#ifndef HAVE_RB_REG_ONIG_MATCH +static OnigPosition +rb_reg_onig_match(VALUE re, VALUE str, + OnigPosition (*match)(regex_t *reg, VALUE str, struct re_registers *regs, void *args), + void *args, struct re_registers *regs) +{ + regex_t *reg = rb_reg_prepare_re(re, str); + + bool tmpreg = reg != RREGEXP_PTR(re); + if (!tmpreg) RREGEXP(re)->usecnt++; + + OnigPosition result = match(reg, str, regs, args); + + if (!tmpreg) RREGEXP(re)->usecnt--; + if (tmpreg) { + if (RREGEXP(re)->usecnt) { + onig_free(reg); + } + else { + onig_free(RREGEXP_PTR(re)); + RREGEXP_PTR(re) = reg; + } + } + + if (result < 0) { + if (result != ONIG_MISMATCH) { + rb_raise(ScanError, "regexp buffer overflow"); + } + } + + return result; +} +#endif + +static OnigPosition +strscan_match(regex_t *reg, VALUE str, struct re_registers *regs, void *args_ptr) +{ + struct strscanner *p = (struct strscanner *)args_ptr; + + return onig_match(reg, + match_target(p), + (UChar* )(CURPTR(p) + S_RESTLEN(p)), + (UChar* )CURPTR(p), + regs, + ONIG_OPTION_NONE); +} + +static OnigPosition +strscan_search(regex_t *reg, VALUE str, struct re_registers *regs, void *args_ptr) +{ + struct strscanner *p = (struct strscanner *)args_ptr; + + return onig_search(reg, + match_target(p), + (UChar *)(CURPTR(p) + S_RESTLEN(p)), + (UChar *)CURPTR(p), + (UChar *)(CURPTR(p) + S_RESTLEN(p)), + regs, + ONIG_OPTION_NONE); +} + static VALUE strscan_do_scan(VALUE self, VALUE pattern, int succptr, int getstr, int headonly) { @@ -560,47 +622,14 @@ strscan_do_scan(VALUE self, VALUE pattern, int succptr, int getstr, int headonly } if (RB_TYPE_P(pattern, T_REGEXP)) { - regex_t *rb_reg_prepare_re(VALUE re, VALUE str); - regex_t *re; - long ret; - int tmpreg; - p->regex = pattern; - re = rb_reg_prepare_re(pattern, p->str); - tmpreg = re != RREGEXP_PTR(pattern); - if (!tmpreg) RREGEXP(pattern)->usecnt++; - - if (headonly) { - ret = onig_match(re, - match_target(p), - (UChar* )(CURPTR(p) + S_RESTLEN(p)), - (UChar* )CURPTR(p), - &(p->regs), - ONIG_OPTION_NONE); - } - else { - ret = onig_search(re, - match_target(p), - (UChar* )(CURPTR(p) + S_RESTLEN(p)), - (UChar* )CURPTR(p), - (UChar* )(CURPTR(p) + S_RESTLEN(p)), - &(p->regs), - ONIG_OPTION_NONE); - } - if (!tmpreg) RREGEXP(pattern)->usecnt--; - if (tmpreg) { - if (RREGEXP(pattern)->usecnt) { - onig_free(re); - } - else { - onig_free(RREGEXP_PTR(pattern)); - RREGEXP_PTR(pattern) = re; - } - } + OnigPosition ret = rb_reg_onig_match(pattern, + p->str, + headonly ? strscan_match : strscan_search, + (void *)p, + &(p->regs)); - if (ret == -2) rb_raise(ScanError, "regexp buffer overflow"); - if (ret < 0) { - /* not matched */ + if (ret == ONIG_MISMATCH) { return Qnil; } } @@ -874,6 +903,57 @@ strscan_getch(VALUE self) } /* + * Scans one byte and returns it as an integer. + * This method is not multibyte character sensitive. + * See also: #getch. + * + * s = StringScanner.new('ab') + * s.scan_byte # => 97 + * s.scan_byte # => 98 + * s.scan_byte # => nil + * + * s = StringScanner.new("\244\242".force_encoding("euc-jp")) + * s.scan_byte # => 0xA4 + * s.scan_byte # => 0xA2 + * s.scan_byte # => nil + */ +static VALUE +strscan_scan_byte(VALUE self) +{ + struct strscanner *p; + + GET_SCANNER(self, p); + CLEAR_MATCH_STATUS(p); + if (EOS_P(p)) + return Qnil; + + VALUE byte = INT2FIX((unsigned char)*CURPTR(p)); + p->prev = p->curr; + p->curr++; + MATCHED(p); + adjust_registers_to_matched(p); + return byte; +} + +/* + * Peeks at the current byte and returns it as an integer. + * + * s = StringScanner.new('ab') + * s.peek_byte # => 97 + */ +static VALUE +strscan_peek_byte(VALUE self) +{ + struct strscanner *p; + + GET_SCANNER(self, p); + if (EOS_P(p)) + return Qnil; + + return INT2FIX((unsigned char)*CURPTR(p)); +} + +/* * Scans one byte and returns it. * This method is not multibyte character sensitive. * See also: #getch. @@ -1038,8 +1118,9 @@ strscan_empty_p(VALUE self) * This method is obsolete; use #eos? instead. * * s = StringScanner.new('test string') - * s.eos? # These two - * s.rest? # are opposites. + * # These two are opposites + * s.eos? # => false + * s.rest? # => true */ static VALUE strscan_rest_p(VALUE self) @@ -1213,10 +1294,10 @@ strscan_size(VALUE self) * If nothing was priorly matched, it returns nil. * * s = StringScanner.new("Fri Dec 12 1975 14:39") - * s.scan(/(\w+) (\w+) (\d+) /) # -> "Fri Dec 12 " - * s.captures # -> ["Fri", "Dec", "12"] - * s.scan(/(\w+) (\w+) (\d+) /) # -> nil - * s.captures # -> nil + * s.scan(/(\w+) (\w+) (\d+) (1980)?/) # -> "Fri Dec 12 " + * s.captures # -> ["Fri", "Dec", "12", nil] + * s.scan(/(\w+) (\w+) (\d+) (1980)?/) # -> nil + * s.captures # -> nil */ static VALUE strscan_captures(VALUE self) @@ -1232,9 +1313,13 @@ strscan_captures(VALUE self) new_ary = rb_ary_new2(num_regs); for (i = 1; i < num_regs; i++) { - VALUE str = extract_range(p, - adjust_register_position(p, p->regs.beg[i]), - adjust_register_position(p, p->regs.end[i])); + VALUE str; + if (p->regs.beg[i] == -1) + str = Qnil; + else + str = extract_range(p, + adjust_register_position(p, p->regs.beg[i]), + adjust_register_position(p, p->regs.end[i])); rb_ary_push(new_ary, str); } @@ -1458,6 +1543,56 @@ strscan_fixed_anchor_p(VALUE self) return p->fixed_anchor_p ? Qtrue : Qfalse; } +typedef struct { + VALUE self; + VALUE captures; +} named_captures_data; + +static int +named_captures_iter(const OnigUChar *name, + const OnigUChar *name_end, + int back_num, + int *back_refs, + OnigRegex regex, + void *arg) +{ + named_captures_data *data = arg; + + VALUE key = rb_str_new((const char *)name, name_end - name); + VALUE value = RUBY_Qnil; + int i; + for (i = 0; i < back_num; i++) { + value = strscan_aref(data->self, INT2NUM(back_refs[i])); + } + rb_hash_aset(data->captures, key, value); + return 0; +} + +/* + * call-seq: + * scanner.named_captures -> hash + * + * Returns a hash of string variables matching the regular expression. + * + * scan = StringScanner.new('foobarbaz') + * scan.match?(/(?<f>foo)(?<r>bar)(?<z>baz)/) + * scan.named_captures # -> {"f"=>"foo", "r"=>"bar", "z"=>"baz"} + */ +static VALUE +strscan_named_captures(VALUE self) +{ + struct strscanner *p; + GET_SCANNER(self, p); + named_captures_data data; + data.self = self; + data.captures = rb_hash_new(); + if (!RB_NIL_P(p->regex)) { + onig_foreach_name(RREGEXP_PTR(p->regex), named_captures_iter, &data); + } + + return data.captures; +} + /* ======================================================================= Ruby Interface ======================================================================= */ @@ -1468,6 +1603,8 @@ strscan_fixed_anchor_p(VALUE self) * StringScanner provides for lexical scanning operations on a String. Here is * an example of its usage: * + * require 'strscan' + * * s = StringScanner.new('This is an example string') * s.eos? # -> false * @@ -1519,6 +1656,7 @@ strscan_fixed_anchor_p(VALUE self) * * - #getch * - #get_byte + * - #scan_byte * - #scan * - #scan_until * - #skip @@ -1531,6 +1669,7 @@ strscan_fixed_anchor_p(VALUE self) * - #exist? * - #match? * - #peek + * - #peek_byte * * === Finding Where we Are * @@ -1622,7 +1761,9 @@ Init_strscan(void) rb_define_method(StringScanner, "getch", strscan_getch, 0); rb_define_method(StringScanner, "get_byte", strscan_get_byte, 0); rb_define_method(StringScanner, "getbyte", strscan_getbyte, 0); + rb_define_method(StringScanner, "scan_byte", strscan_scan_byte, 0); rb_define_method(StringScanner, "peek", strscan_peek, 1); + rb_define_method(StringScanner, "peek_byte", strscan_peek_byte, 0); rb_define_method(StringScanner, "peep", strscan_peep, 1); rb_define_method(StringScanner, "unscan", strscan_unscan, 0); @@ -1650,4 +1791,6 @@ Init_strscan(void) rb_define_method(StringScanner, "inspect", strscan_inspect, 0); rb_define_method(StringScanner, "fixed_anchor?", strscan_fixed_anchor_p, 0); + + rb_define_method(StringScanner, "named_captures", strscan_named_captures, 0); } diff --git a/ext/strscan/strscan.gemspec b/ext/strscan/strscan.gemspec index 5d8119ea4c..8a61c7abe6 100644 --- a/ext/strscan/strscan.gemspec +++ b/ext/strscan/strscan.gemspec @@ -16,13 +16,26 @@ Gem::Specification.new do |s| s.summary = "Provides lexical scanning operations on a String." s.description = "Provides lexical scanning operations on a String." - s.require_path = %w{lib} - s.files = %w{ext/strscan/extconf.rb ext/strscan/strscan.c} - s.extensions = %w{ext/strscan/extconf.rb} + files = [ + "COPYING", + "LICENSE.txt", + ] + if RUBY_ENGINE == "jruby" + s.require_paths = %w{ext/jruby/lib lib} + files << "ext/jruby/lib/strscan.rb" + files << "lib/strscan.jar" + s.platform = "java" + else + s.require_paths = %w{lib} + files << "ext/strscan/extconf.rb" + files << "ext/strscan/strscan.c" + s.extensions = %w{ext/strscan/extconf.rb} + end + s.files = files s.required_ruby_version = ">= 2.4.0" - s.authors = ["Minero Aoki", "Sutou Kouhei"] - s.email = [nil, "kou@cozmixng.org"] + s.authors = ["Minero Aoki", "Sutou Kouhei", "Charles Oliver Nutter"] + s.email = [nil, "kou@cozmixng.org", "headius@headius.com"] s.homepage = "https://github.com/ruby/strscan" s.licenses = ["Ruby", "BSD-2-Clause"] end diff --git a/ext/syslog/depend b/ext/syslog/depend deleted file mode 100644 index 4eea8c3bf9..0000000000 --- a/ext/syslog/depend +++ /dev/null @@ -1,162 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -syslog.o: $(RUBY_EXTCONF_H) -syslog.o: $(arch_hdrdir)/ruby/config.h -syslog.o: $(hdrdir)/ruby/assert.h -syslog.o: $(hdrdir)/ruby/backward.h -syslog.o: $(hdrdir)/ruby/backward/2/assume.h -syslog.o: $(hdrdir)/ruby/backward/2/attributes.h -syslog.o: $(hdrdir)/ruby/backward/2/bool.h -syslog.o: $(hdrdir)/ruby/backward/2/inttypes.h -syslog.o: $(hdrdir)/ruby/backward/2/limits.h -syslog.o: $(hdrdir)/ruby/backward/2/long_long.h -syslog.o: $(hdrdir)/ruby/backward/2/stdalign.h -syslog.o: $(hdrdir)/ruby/backward/2/stdarg.h -syslog.o: $(hdrdir)/ruby/defines.h -syslog.o: $(hdrdir)/ruby/intern.h -syslog.o: $(hdrdir)/ruby/internal/abi.h -syslog.o: $(hdrdir)/ruby/internal/anyargs.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/char.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/double.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/fixnum.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/gid_t.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/int.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/intptr_t.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/long.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/long_long.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/mode_t.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/off_t.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/pid_t.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/short.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/size_t.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/st_data_t.h -syslog.o: $(hdrdir)/ruby/internal/arithmetic/uid_t.h -syslog.o: $(hdrdir)/ruby/internal/assume.h -syslog.o: $(hdrdir)/ruby/internal/attr/alloc_size.h -syslog.o: $(hdrdir)/ruby/internal/attr/artificial.h -syslog.o: $(hdrdir)/ruby/internal/attr/cold.h -syslog.o: $(hdrdir)/ruby/internal/attr/const.h -syslog.o: $(hdrdir)/ruby/internal/attr/constexpr.h -syslog.o: $(hdrdir)/ruby/internal/attr/deprecated.h -syslog.o: $(hdrdir)/ruby/internal/attr/diagnose_if.h -syslog.o: $(hdrdir)/ruby/internal/attr/enum_extensibility.h -syslog.o: $(hdrdir)/ruby/internal/attr/error.h -syslog.o: $(hdrdir)/ruby/internal/attr/flag_enum.h -syslog.o: $(hdrdir)/ruby/internal/attr/forceinline.h -syslog.o: $(hdrdir)/ruby/internal/attr/format.h -syslog.o: $(hdrdir)/ruby/internal/attr/maybe_unused.h -syslog.o: $(hdrdir)/ruby/internal/attr/noalias.h -syslog.o: $(hdrdir)/ruby/internal/attr/nodiscard.h -syslog.o: $(hdrdir)/ruby/internal/attr/noexcept.h -syslog.o: $(hdrdir)/ruby/internal/attr/noinline.h -syslog.o: $(hdrdir)/ruby/internal/attr/nonnull.h -syslog.o: $(hdrdir)/ruby/internal/attr/noreturn.h -syslog.o: $(hdrdir)/ruby/internal/attr/pure.h -syslog.o: $(hdrdir)/ruby/internal/attr/restrict.h -syslog.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h -syslog.o: $(hdrdir)/ruby/internal/attr/warning.h -syslog.o: $(hdrdir)/ruby/internal/attr/weakref.h -syslog.o: $(hdrdir)/ruby/internal/cast.h -syslog.o: $(hdrdir)/ruby/internal/compiler_is.h -syslog.o: $(hdrdir)/ruby/internal/compiler_is/apple.h -syslog.o: $(hdrdir)/ruby/internal/compiler_is/clang.h -syslog.o: $(hdrdir)/ruby/internal/compiler_is/gcc.h -syslog.o: $(hdrdir)/ruby/internal/compiler_is/intel.h -syslog.o: $(hdrdir)/ruby/internal/compiler_is/msvc.h -syslog.o: $(hdrdir)/ruby/internal/compiler_is/sunpro.h -syslog.o: $(hdrdir)/ruby/internal/compiler_since.h -syslog.o: $(hdrdir)/ruby/internal/config.h -syslog.o: $(hdrdir)/ruby/internal/constant_p.h -syslog.o: $(hdrdir)/ruby/internal/core.h -syslog.o: $(hdrdir)/ruby/internal/core/rarray.h -syslog.o: $(hdrdir)/ruby/internal/core/rbasic.h -syslog.o: $(hdrdir)/ruby/internal/core/rbignum.h -syslog.o: $(hdrdir)/ruby/internal/core/rclass.h -syslog.o: $(hdrdir)/ruby/internal/core/rdata.h -syslog.o: $(hdrdir)/ruby/internal/core/rfile.h -syslog.o: $(hdrdir)/ruby/internal/core/rhash.h -syslog.o: $(hdrdir)/ruby/internal/core/robject.h -syslog.o: $(hdrdir)/ruby/internal/core/rregexp.h -syslog.o: $(hdrdir)/ruby/internal/core/rstring.h -syslog.o: $(hdrdir)/ruby/internal/core/rstruct.h -syslog.o: $(hdrdir)/ruby/internal/core/rtypeddata.h -syslog.o: $(hdrdir)/ruby/internal/ctype.h -syslog.o: $(hdrdir)/ruby/internal/dllexport.h -syslog.o: $(hdrdir)/ruby/internal/dosish.h -syslog.o: $(hdrdir)/ruby/internal/error.h -syslog.o: $(hdrdir)/ruby/internal/eval.h -syslog.o: $(hdrdir)/ruby/internal/event.h -syslog.o: $(hdrdir)/ruby/internal/fl_type.h -syslog.o: $(hdrdir)/ruby/internal/gc.h -syslog.o: $(hdrdir)/ruby/internal/glob.h -syslog.o: $(hdrdir)/ruby/internal/globals.h -syslog.o: $(hdrdir)/ruby/internal/has/attribute.h -syslog.o: $(hdrdir)/ruby/internal/has/builtin.h -syslog.o: $(hdrdir)/ruby/internal/has/c_attribute.h -syslog.o: $(hdrdir)/ruby/internal/has/cpp_attribute.h -syslog.o: $(hdrdir)/ruby/internal/has/declspec_attribute.h -syslog.o: $(hdrdir)/ruby/internal/has/extension.h -syslog.o: $(hdrdir)/ruby/internal/has/feature.h -syslog.o: $(hdrdir)/ruby/internal/has/warning.h -syslog.o: $(hdrdir)/ruby/internal/intern/array.h -syslog.o: $(hdrdir)/ruby/internal/intern/bignum.h -syslog.o: $(hdrdir)/ruby/internal/intern/class.h -syslog.o: $(hdrdir)/ruby/internal/intern/compar.h -syslog.o: $(hdrdir)/ruby/internal/intern/complex.h -syslog.o: $(hdrdir)/ruby/internal/intern/cont.h -syslog.o: $(hdrdir)/ruby/internal/intern/dir.h -syslog.o: $(hdrdir)/ruby/internal/intern/enum.h -syslog.o: $(hdrdir)/ruby/internal/intern/enumerator.h -syslog.o: $(hdrdir)/ruby/internal/intern/error.h -syslog.o: $(hdrdir)/ruby/internal/intern/eval.h -syslog.o: $(hdrdir)/ruby/internal/intern/file.h -syslog.o: $(hdrdir)/ruby/internal/intern/gc.h -syslog.o: $(hdrdir)/ruby/internal/intern/hash.h -syslog.o: $(hdrdir)/ruby/internal/intern/io.h -syslog.o: $(hdrdir)/ruby/internal/intern/load.h -syslog.o: $(hdrdir)/ruby/internal/intern/marshal.h -syslog.o: $(hdrdir)/ruby/internal/intern/numeric.h -syslog.o: $(hdrdir)/ruby/internal/intern/object.h -syslog.o: $(hdrdir)/ruby/internal/intern/parse.h -syslog.o: $(hdrdir)/ruby/internal/intern/proc.h -syslog.o: $(hdrdir)/ruby/internal/intern/process.h -syslog.o: $(hdrdir)/ruby/internal/intern/random.h -syslog.o: $(hdrdir)/ruby/internal/intern/range.h -syslog.o: $(hdrdir)/ruby/internal/intern/rational.h -syslog.o: $(hdrdir)/ruby/internal/intern/re.h -syslog.o: $(hdrdir)/ruby/internal/intern/ruby.h -syslog.o: $(hdrdir)/ruby/internal/intern/select.h -syslog.o: $(hdrdir)/ruby/internal/intern/select/largesize.h -syslog.o: $(hdrdir)/ruby/internal/intern/signal.h -syslog.o: $(hdrdir)/ruby/internal/intern/sprintf.h -syslog.o: $(hdrdir)/ruby/internal/intern/string.h -syslog.o: $(hdrdir)/ruby/internal/intern/struct.h -syslog.o: $(hdrdir)/ruby/internal/intern/thread.h -syslog.o: $(hdrdir)/ruby/internal/intern/time.h -syslog.o: $(hdrdir)/ruby/internal/intern/variable.h -syslog.o: $(hdrdir)/ruby/internal/intern/vm.h -syslog.o: $(hdrdir)/ruby/internal/interpreter.h -syslog.o: $(hdrdir)/ruby/internal/iterator.h -syslog.o: $(hdrdir)/ruby/internal/memory.h -syslog.o: $(hdrdir)/ruby/internal/method.h -syslog.o: $(hdrdir)/ruby/internal/module.h -syslog.o: $(hdrdir)/ruby/internal/newobj.h -syslog.o: $(hdrdir)/ruby/internal/rgengc.h -syslog.o: $(hdrdir)/ruby/internal/scan_args.h -syslog.o: $(hdrdir)/ruby/internal/special_consts.h -syslog.o: $(hdrdir)/ruby/internal/static_assert.h -syslog.o: $(hdrdir)/ruby/internal/stdalign.h -syslog.o: $(hdrdir)/ruby/internal/stdbool.h -syslog.o: $(hdrdir)/ruby/internal/symbol.h -syslog.o: $(hdrdir)/ruby/internal/value.h -syslog.o: $(hdrdir)/ruby/internal/value_type.h -syslog.o: $(hdrdir)/ruby/internal/variable.h -syslog.o: $(hdrdir)/ruby/internal/warning_push.h -syslog.o: $(hdrdir)/ruby/internal/xmalloc.h -syslog.o: $(hdrdir)/ruby/missing.h -syslog.o: $(hdrdir)/ruby/ruby.h -syslog.o: $(hdrdir)/ruby/st.h -syslog.o: $(hdrdir)/ruby/subst.h -syslog.o: $(hdrdir)/ruby/util.h -syslog.o: syslog.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ext/syslog/extconf.rb b/ext/syslog/extconf.rb deleted file mode 100644 index 1230a4d52e..0000000000 --- a/ext/syslog/extconf.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: false -# $RoughId: extconf.rb,v 1.3 2001/11/24 17:49:26 knu Exp $ -# $Id$ - -require 'mkmf' - -have_library("log") # for Android - -have_header("syslog.h") && - have_func("openlog") && - have_func("setlogmask") && - create_makefile("syslog") - diff --git a/ext/syslog/lib/syslog/logger.rb b/ext/syslog/lib/syslog/logger.rb deleted file mode 100644 index 453ca2785c..0000000000 --- a/ext/syslog/lib/syslog/logger.rb +++ /dev/null @@ -1,209 +0,0 @@ -# frozen_string_literal: false -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.1.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 deleted file mode 100644 index 8f3674aa8d..0000000000 --- a/ext/syslog/syslog.c +++ /dev/null @@ -1,588 +0,0 @@ -/* - * UNIX Syslog extension for Ruby - * Amos Gouaux, University of Texas at Dallas - * <amos+ruby@utdallas.edu> - * Documented by mathew <meta@pobox.com> - * - * $RoughId: syslog.c,v 1.21 2002/02/25 12:21:17 knu Exp $ - * $Id$ - */ - -#include "ruby/ruby.h" -#include "ruby/util.h" -#include <syslog.h> - -/* Syslog class */ -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; - -/* Package helper routines */ -static void syslog_write(int pri, int argc, VALUE *argv) -{ - VALUE str; - - if (argc < 1) { - rb_raise(rb_eArgError, "no log message supplied"); - } - - if (!syslog_opened) { - rb_raise(rb_eRuntimeError, "must open syslog before write"); - } - - str = rb_f_sprintf(argc, argv); - - syslog(pri, "%s", RSTRING_PTR(str)); -} - -/* Closes the syslog facility. - * Raises a runtime exception if it is not open. - */ -static VALUE mSyslog_close(VALUE self) -{ - if (!syslog_opened) { - rb_raise(rb_eRuntimeError, "syslog not opened"); - } - - closelog(); - - xfree((void *)syslog_ident); - syslog_ident = NULL; - syslog_options = syslog_facility = syslog_mask = -1; - syslog_opened = 0; - - return Qnil; -} - -/* call-seq: - * open(ident, options, facility) => syslog - * - * :yields: syslog - * - * Open the syslog facility. - * Raises a runtime exception if it is already open. - * - * Can be called with or without a code block. If called with a block, the - * Syslog object created is passed to the block. - * - * If the syslog is already open, raises a RuntimeError. - * - * +ident+ is a String which identifies the calling program. - * - * +options+ is the logical OR of any of the following: - * - * LOG_CONS:: If there is an error while sending to the system logger, - * write directly to the console instead. - * - * LOG_NDELAY:: Open the connection now, rather than waiting for the first - * message to be written. - * - * LOG_NOWAIT:: Don't wait for any child processes created while logging - * messages. (Has no effect on Linux.) - * - * LOG_ODELAY:: Opposite of LOG_NDELAY; wait until a message is sent before - * opening the connection. (This is the default.) - * - * LOG_PERROR:: Print the message to stderr as well as sending it to syslog. - * (Not in POSIX.1-2001.) - * - * LOG_PID:: Include the current process ID with each message. - * - * +facility+ describes the type of program opening the syslog, and is - * the logical OR of any of the following which are defined for the host OS: - * - * LOG_AUTH:: Security or authorization. Deprecated, use LOG_AUTHPRIV - * instead. - * - * LOG_AUTHPRIV:: Security or authorization messages which should be kept - * private. - * - * LOG_CONSOLE:: System console message. - * - * LOG_CRON:: System task scheduler (cron or at). - * - * LOG_DAEMON:: A system daemon which has no facility value of its own. - * - * LOG_FTP:: An FTP server. - * - * LOG_KERN:: A kernel message (not sendable by user processes, so not of - * much use to Ruby, but listed here for completeness). - * - * LOG_LPR:: Line printer subsystem. - * - * LOG_MAIL:: Mail delivery or transport subsystem. - * - * LOG_NEWS:: Usenet news system. - * - * LOG_NTP:: Network Time Protocol server. - * - * LOG_SECURITY:: General security message. - * - * LOG_SYSLOG:: Messages generated internally by syslog. - * - * LOG_USER:: Generic user-level message. - * - * LOG_UUCP:: UUCP subsystem. - * - * LOG_LOCAL0 to LOG_LOCAL7:: Locally-defined facilities. - * - * Example: - * - * Syslog.open("webrick", Syslog::LOG_PID, - * Syslog::LOG_DAEMON | Syslog::LOG_LOCAL3) - * - */ -static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self) -{ - VALUE ident, opt, fac; - const char *ident_ptr; - - if (syslog_opened) { - rb_raise(rb_eRuntimeError, "syslog already open"); - } - - rb_scan_args(argc, argv, "03", &ident, &opt, &fac); - - if (NIL_P(ident)) { - ident = rb_gv_get("$0"); - } - ident_ptr = StringValueCStr(ident); - syslog_ident = strdup(ident_ptr); - - if (NIL_P(opt)) { - syslog_options = LOG_PID | LOG_CONS; - } else { - syslog_options = NUM2INT(opt); - } - - if (NIL_P(fac)) { - syslog_facility = LOG_USER; - } else { - syslog_facility = NUM2INT(fac); - } - - openlog(syslog_ident, syslog_options, syslog_facility); - - syslog_opened = 1; - - setlogmask(syslog_mask = setlogmask(0)); - - /* be like File.new.open {...} */ - if (rb_block_given_p()) { - rb_ensure(rb_yield, self, mSyslog_close, self); - } - - return self; -} - -/* call-seq: - * reopen(ident, options, facility) => syslog - * - * :yields: syslog - * - * Closes and then reopens the syslog. - * - * Arguments are the same as for open(). - */ -static VALUE mSyslog_reopen(int argc, VALUE *argv, VALUE self) -{ - mSyslog_close(self); - - return mSyslog_open(argc, argv, self); -} - -/* call-seq: - * opened? - * - * Returns true if the syslog is open. - */ -static VALUE mSyslog_isopen(VALUE self) -{ - return syslog_opened ? Qtrue : Qfalse; -} - -/* Returns the identity string used in the last call to open() - */ -static VALUE mSyslog_ident(VALUE self) -{ - return syslog_opened ? rb_str_new2(syslog_ident) : Qnil; -} - -/* Returns the options bitmask used in the last call to open() - */ -static VALUE mSyslog_options(VALUE self) -{ - return syslog_opened ? INT2NUM(syslog_options) : Qnil; -} - -/* Returns the facility number used in the last call to open() - */ -static VALUE mSyslog_facility(VALUE self) -{ - return syslog_opened ? INT2NUM(syslog_facility) : Qnil; -} - -/* Returns the log priority mask in effect. The mask is not reset by opening - * or closing syslog. - */ -static VALUE mSyslog_get_mask(VALUE self) -{ - return syslog_opened ? INT2NUM(syslog_mask) : Qnil; -} - -/* call-seq: - * mask=(priority_mask) - * - * Sets the log priority mask. A method LOG_UPTO is defined to make it easier - * to set mask values. Example: - * - * Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR) - * - * Alternatively, specific priorities can be selected and added together using - * binary OR. Example: - * - * Syslog.mask = Syslog::LOG_MASK(Syslog::LOG_ERR) | Syslog::LOG_MASK(Syslog::LOG_CRIT) - * - * The priority mask persists through calls to open() and close(). - */ -static VALUE mSyslog_set_mask(VALUE self, VALUE mask) -{ - if (!syslog_opened) { - rb_raise(rb_eRuntimeError, "must open syslog before setting log mask"); - } - - setlogmask(syslog_mask = NUM2INT(mask)); - - return mask; -} - -/* call-seq: - * log(priority, format_string, *format_args) - * - * Log a message with the specified priority. Example: - * - * Syslog.log(Syslog::LOG_CRIT, "Out of disk space") - * Syslog.log(Syslog::LOG_CRIT, "User %s logged in", ENV['USER']) - * - * The priority levels, in descending order, are: - * - * LOG_EMERG:: System is unusable - * LOG_ALERT:: Action needs to be taken immediately - * LOG_CRIT:: A critical condition has occurred - * LOG_ERR:: An error occurred - * LOG_WARNING:: Warning of a possible problem - * LOG_NOTICE:: A normal but significant condition occurred - * LOG_INFO:: Informational message - * LOG_DEBUG:: Debugging information - * - * Each priority level also has a shortcut method that logs with it's named priority. - * As an example, the two following statements would produce the same result: - * - * Syslog.log(Syslog::LOG_ALERT, "Out of memory") - * Syslog.alert("Out of memory") - * - */ -static VALUE mSyslog_log(int argc, VALUE *argv, VALUE self) -{ - VALUE pri; - - rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS); - - argc--; - pri = *argv++; - - if (!FIXNUM_P(pri)) { - rb_raise(rb_eTypeError, "type mismatch: %"PRIsVALUE" given", rb_obj_class(pri)); - } - - syslog_write(FIX2INT(pri), argc, argv); - - return self; -} - -/* Returns an inspect() string summarizing the object state. - */ -static VALUE mSyslog_inspect(VALUE self) -{ - Check_Type(self, T_MODULE); - - if (!syslog_opened) - return rb_sprintf("<#%"PRIsVALUE": opened=false>", self); - - return rb_sprintf("<#%"PRIsVALUE": opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>", - self, - syslog_ident, - syslog_options, - syslog_facility, - syslog_mask); -} - -/* Returns self, for backward compatibility. - */ -static VALUE mSyslog_instance(VALUE self) -{ - return self; -} - -#define define_syslog_shortcut_method(pri, name) \ -static VALUE mSyslog_##name(int argc, VALUE *argv, VALUE self) \ -{ \ - syslog_write((pri), argc, argv); \ -\ - return self; \ -} - -#ifdef LOG_EMERG -define_syslog_shortcut_method(LOG_EMERG, emerg) -#endif -#ifdef LOG_ALERT -define_syslog_shortcut_method(LOG_ALERT, alert) -#endif -#ifdef LOG_CRIT -define_syslog_shortcut_method(LOG_CRIT, crit) -#endif -#ifdef LOG_ERR -define_syslog_shortcut_method(LOG_ERR, err) -#endif -#ifdef LOG_WARNING -define_syslog_shortcut_method(LOG_WARNING, warning) -#endif -#ifdef LOG_NOTICE -define_syslog_shortcut_method(LOG_NOTICE, notice) -#endif -#ifdef LOG_INFO -define_syslog_shortcut_method(LOG_INFO, info) -#endif -#ifdef LOG_DEBUG -define_syslog_shortcut_method(LOG_DEBUG, debug) -#endif - -/* call-seq: - * LOG_MASK(priority_level) => priority_mask - * - * Generates a mask bit for a priority level. See #mask= - */ -static VALUE mSyslogMacros_LOG_MASK(VALUE mod, VALUE pri) -{ - return INT2FIX(LOG_MASK(NUM2INT(pri))); -} - -/* call-seq: - * LOG_UPTO(priority_level) => priority_mask - * - * Generates a mask value for priority levels at or below the level specified. - * See #mask= - */ -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. - * - * Syslog messages are typically passed to a central logging daemon. - * The daemon may filter them; route them into different files (usually - * found under /var/log); place them in SQL databases; forward - * them to centralized logging servers via TCP or UDP; or even alert the - * system administrator via email, pager or text message. - * - * Unlike application-level logging via Logger or Log4r, syslog is designed - * to allow secure tamper-proof logging. - * - * The syslog protocol is standardized in RFC 5424. - */ -void Init_syslog(void) -{ -#undef rb_intern - mSyslog = rb_define_module("Syslog"); - - mSyslogConstants = rb_define_module_under(mSyslog, "Constants"); - - 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); - rb_define_module_function(mSyslog, "open!", mSyslog_reopen, -1); - rb_define_module_function(mSyslog, "opened?", mSyslog_isopen, 0); - - rb_define_module_function(mSyslog, "ident", mSyslog_ident, 0); - rb_define_module_function(mSyslog, "options", mSyslog_options, 0); - rb_define_module_function(mSyslog, "facility", mSyslog_facility, 0); - - rb_define_module_function(mSyslog, "log", mSyslog_log, -1); - rb_define_module_function(mSyslog, "close", mSyslog_close, 0); - rb_define_module_function(mSyslog, "mask", mSyslog_get_mask, 0); - rb_define_module_function(mSyslog, "mask=", mSyslog_set_mask, 1); - - rb_define_singleton_method(mSyslog, "inspect", mSyslog_inspect, 0); - rb_define_module_function(mSyslog, "instance", mSyslog_instance, 0); - - /* Syslog options */ - -#define rb_define_syslog_option(c) \ - rb_define_const(mSyslogOption, #c, INT2NUM(c)) - -#ifdef LOG_PID - rb_define_syslog_option(LOG_PID); -#endif -#ifdef LOG_CONS - rb_define_syslog_option(LOG_CONS); -#endif -#ifdef LOG_ODELAY - rb_define_syslog_option(LOG_ODELAY); /* deprecated */ -#endif -#ifdef LOG_NDELAY - rb_define_syslog_option(LOG_NDELAY); -#endif -#ifdef LOG_NOWAIT - rb_define_syslog_option(LOG_NOWAIT); /* deprecated */ -#endif -#ifdef LOG_PERROR - rb_define_syslog_option(LOG_PERROR); -#endif - - /* Syslog facilities */ - -#define rb_define_syslog_facility(c) \ - rb_define_const(mSyslogFacility, #c, INT2NUM(c)) - -#ifdef LOG_AUTH - rb_define_syslog_facility(LOG_AUTH); -#endif -#ifdef LOG_AUTHPRIV - rb_define_syslog_facility(LOG_AUTHPRIV); -#endif -#ifdef LOG_CONSOLE - rb_define_syslog_facility(LOG_CONSOLE); -#endif -#ifdef LOG_CRON - rb_define_syslog_facility(LOG_CRON); -#endif -#ifdef LOG_DAEMON - rb_define_syslog_facility(LOG_DAEMON); -#endif -#ifdef LOG_FTP - rb_define_syslog_facility(LOG_FTP); -#endif -#ifdef LOG_KERN - rb_define_syslog_facility(LOG_KERN); -#endif -#ifdef LOG_LPR - rb_define_syslog_facility(LOG_LPR); -#endif -#ifdef LOG_MAIL - rb_define_syslog_facility(LOG_MAIL); -#endif -#ifdef LOG_NEWS - rb_define_syslog_facility(LOG_NEWS); -#endif -#ifdef LOG_NTP - rb_define_syslog_facility(LOG_NTP); -#endif -#ifdef LOG_SECURITY - rb_define_syslog_facility(LOG_SECURITY); -#endif -#ifdef LOG_SYSLOG - rb_define_syslog_facility(LOG_SYSLOG); -#endif -#ifdef LOG_USER - rb_define_syslog_facility(LOG_USER); -#endif -#ifdef LOG_UUCP - rb_define_syslog_facility(LOG_UUCP); -#endif -#ifdef LOG_LOCAL0 - rb_define_syslog_facility(LOG_LOCAL0); -#endif -#ifdef LOG_LOCAL1 - rb_define_syslog_facility(LOG_LOCAL1); -#endif -#ifdef LOG_LOCAL2 - rb_define_syslog_facility(LOG_LOCAL2); -#endif -#ifdef LOG_LOCAL3 - rb_define_syslog_facility(LOG_LOCAL3); -#endif -#ifdef LOG_LOCAL4 - rb_define_syslog_facility(LOG_LOCAL4); -#endif -#ifdef LOG_LOCAL5 - rb_define_syslog_facility(LOG_LOCAL5); -#endif -#ifdef LOG_LOCAL6 - rb_define_syslog_facility(LOG_LOCAL6); -#endif -#ifdef LOG_LOCAL7 - rb_define_syslog_facility(LOG_LOCAL7); -#endif - - /* 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) - -#ifdef LOG_EMERG - rb_define_syslog_level(LOG_EMERG, emerg); -#endif -#ifdef LOG_ALERT - rb_define_syslog_level(LOG_ALERT, alert); -#endif -#ifdef LOG_CRIT - rb_define_syslog_level(LOG_CRIT, crit); -#endif -#ifdef LOG_ERR - rb_define_syslog_level(LOG_ERR, err); -#endif -#ifdef LOG_WARNING - rb_define_syslog_level(LOG_WARNING, warning); -#endif -#ifdef LOG_NOTICE - rb_define_syslog_level(LOG_NOTICE, notice); -#endif -#ifdef LOG_INFO - rb_define_syslog_level(LOG_INFO, info); -#endif -#ifdef LOG_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/syslog/syslog.gemspec b/ext/syslog/syslog.gemspec deleted file mode 100644 index 8f73f5ad0d..0000000000 --- a/ext/syslog/syslog.gemspec +++ /dev/null @@ -1,23 +0,0 @@ -Gem::Specification.new do |spec| - spec.name = "syslog" - spec.version = "0.1.0" - spec.authors = ["Akinori MUSHA"] - spec.email = ["knu@idaemons.org"] - - spec.summary = %q{Ruby interface for the POSIX system logging facility.} - spec.description = %q{Ruby interface for the POSIX system logging facility.} - spec.homepage = "https://github.com/ruby/syslog" - spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0") - spec.licenses = ["Ruby", "BSD-2-Clause"] - - spec.metadata["homepage_uri"] = spec.homepage - spec.metadata["source_code_uri"] = spec.homepage - - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - end - spec.extensions = ["ext/syslog/extconf.rb"] - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } - spec.require_paths = ["lib"] -end diff --git a/ext/syslog/syslog.txt b/ext/syslog/syslog.txt deleted file mode 100644 index 1507a87924..0000000000 --- a/ext/syslog/syslog.txt +++ /dev/null @@ -1,124 +0,0 @@ -.\" syslog.txt - -*- Indented-Text -*- -$RoughId: syslog.txt,v 1.18 2002/02/25 08:20:14 knu Exp $ -$Id$ - -UNIX Syslog extension for Ruby -Amos Gouaux, University of Texas at Dallas -<amos+ruby@utdallas.edu> -& -Akinori MUSHA -<knu@iDaemons.org> - -Contact: - - Akinori MUSHA <knu@iDaemons.org> (current maintainer) - -** Syslog(Module) - -Included Modules: Syslog::Constants - -require 'syslog' - -A Simple wrapper for the UNIX syslog system calls that might be handy -if you're writing a server in Ruby. For the details of the syslog(8) -architecture and constants, see the syslog(3) manual page of your -platform. - -Module Methods: - - open(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS, - facility = Syslog::LOG_USER) [{ |syslog| ... }] - - Opens syslog with the given options and returns the module - itself. If a block is given, calls it with an argument of - itself. If syslog is already opened, raises RuntimeError. - - Example: - Syslog.open('ftpd', Syslog::LOG_PID | Syslog::LOG_NDELAY, - Syslog::LOG_FTP) - - open!(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS, - facility = Syslog::LOG_USER) - reopen(ident = $0, logopt = Syslog::LOG_PID | Syslog::LOG_CONS, - facility = Syslog::LOG_USER) - - Same as open, but does a close first. - - opened? - - Returns true if syslog opened, otherwise false. - - ident - options - facility - - Returns the parameters given in the last open, respectively. - Every call of Syslog::open resets these values. - - log(pri, message, ...) - - Writes message to syslog. - - Example: - Syslog.log(Syslog::LOG_CRIT, "the sky is falling in %d seconds!", 10) - - crit(message, ...) - emerg(message, ...) - alert(message, ...) - err(message, ...) - warning(message, ...) - notice(message, ...) - info(message, ...) - debug(message, ...) - - These are shortcut methods of Syslog::log(). The lineup may - vary depending on what priorities are defined on your system. - - Example: - Syslog.crit("the sky is falling in %d seconds!", 5) - - mask - mask=(mask) - - Returns or sets the log priority mask. The value of the mask - is persistent and will not be reset by Syslog::open or - Syslog::close. - - Example: - Syslog.mask = Syslog::LOG_UPTO(Syslog::LOG_ERR) - - close - - Closes syslog. - - inspect - - Returns the "inspect" string of the Syslog module. - - instance - - Returns the module itself. (Just for backward compatibility) - - LOG_MASK(pri) - - Creates a mask for one priority. - - LOG_UPTO(pri) - - Creates a mask for all priorities up to pri. - -** Syslog::Constants(Module) - -require 'syslog' -include Syslog::Constants - -This module includes the LOG_* constants available on the system. - -Module Methods: - - LOG_MASK(pri) - - Creates a mask for one priority. - - LOG_UPTO(pri) - - Creates a mask for all priorities up to pri. diff --git a/ext/win32/lib/win32/registry.rb b/ext/win32/lib/win32/registry.rb index b5b99ff684..92b95d1bf7 100644 --- a/ext/win32/lib/win32/registry.rb +++ b/ext/win32/lib/win32/registry.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'fiddle/import' module Win32 @@ -254,30 +254,34 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr /^(?:x64|x86_64)/ =~ RUBY_PLATFORM end + TEMPLATE_HANDLE = 'J<' + def packhandle(h) - win64? ? packqw(h) : packdw(h) + [h].pack(TEMPLATE_HANDLE) end def unpackhandle(h) - win64? ? unpackqw(h) : unpackdw(h) + (h + [0].pack(TEMPLATE_HANDLE)).unpack1(TEMPLATE_HANDLE) end + TEMPLATE_DWORD = 'V' + def packdw(dw) - [dw].pack('V') + [dw].pack(TEMPLATE_DWORD) end def unpackdw(dw) - dw += [0].pack('V') - dw.unpack('V')[0] + (dw + [0].pack(TEMPLATE_DWORD)).unpack1(TEMPLATE_DWORD) end + TEMPLATE_QWORD = 'Q<' + def packqw(qw) - [ qw & 0xFFFFFFFF, qw >> 32 ].pack('VV') + [qw].pack(TEMPLATE_QWORD) end def unpackqw(qw) - qw = qw.unpack('VV') - (qw[1] << 32) | qw[0] + (qw + [0].pack(TEMPLATE_QWORD)).unpack1(TEMPLATE_QWORD) end def make_wstr(str) @@ -318,7 +322,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr size = packdw(0) name = make_wstr(name) check RegQueryValueExW.call(hkey, name, 0, type, 0, size) - data = "\0".force_encoding('ASCII-8BIT') * unpackdw(size) + data = "\0".b * unpackdw(size) check RegQueryValueExW.call(hkey, name, 0, type, data, size) [ unpackdw(type), data[0, unpackdw(size)] ] end @@ -373,8 +377,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr def self.expand_environ(str) str.gsub(Regexp.compile("%([^%]+)%".encode(str.encoding))) { v = $1.encode(LOCALE) - (e = ENV[v] || ENV[v.upcase]; e.encode(str.encoding) if e) || - $& + (ENV[v] || ENV[v.upcase])&.encode(str.encoding) || $& } end @@ -384,7 +387,6 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr REG_RESOURCE_LIST REG_FULL_RESOURCE_DESCRIPTOR REG_RESOURCE_REQUIREMENTS_LIST REG_QWORD ].inject([]) do |ary, type| - type.freeze ary[Constants.const_get(type)] = type ary end.freeze @@ -657,7 +659,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr when REG_DWORD [ type, API.unpackdw(data) ] when REG_DWORD_BIG_ENDIAN - [ type, data.unpack('N')[0] ] + [ type, data.unpack1('N') ] when REG_QWORD [ type, API.unpackqw(data) ] else @@ -740,14 +742,11 @@ 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.encode(WCHAR) - termsize = WCHAR_SIZE + data = data.encode(WCHAR) << WCHAR_NUL when REG_MULTI_SZ data = data.to_a.map {|s| s.encode(WCHAR)}.join(WCHAR_NUL) << WCHAR_NUL - termsize = WCHAR_SIZE when REG_BINARY, REG_NONE data = data.to_s when REG_DWORD @@ -759,7 +758,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr else raise TypeError, "Unsupported type #{Registry.type2name(type)}" end - API.SetValue(@hkey, name, type, data, data.bytesize + termsize) + API.SetValue(@hkey, name, type, data, data.bytesize) end # diff --git a/ext/win32ole/.document b/ext/win32ole/.document new file mode 100644 index 0000000000..decba0135a --- /dev/null +++ b/ext/win32ole/.document @@ -0,0 +1 @@ +*.[ch] diff --git a/ext/win32ole/lib/win32ole.rb b/ext/win32ole/lib/win32ole.rb index d7034f7845..f5c8a52c4a 100644 --- a/ext/win32ole/lib/win32ole.rb +++ b/ext/win32ole/lib/win32ole.rb @@ -5,7 +5,6 @@ rescue LoadError end if defined?(WIN32OLE) - # WIN32OLE class WIN32OLE # @@ -26,7 +25,7 @@ if defined?(WIN32OLE) def ole_methods_safely ole_methods - rescue WIN32OLEQueryInterfaceError + rescue WIN32OLE::QueryInterfaceError [] end end diff --git a/ext/win32ole/lib/win32ole/property.rb b/ext/win32ole/lib/win32ole/property.rb index fea047cd19..558056b32b 100644 --- a/ext/win32ole/lib/win32ole/property.rb +++ b/ext/win32ole/lib/win32ole/property.rb @@ -1,7 +1,12 @@ # frozen_string_literal: false -# OLEProperty -# helper class of Property with arguments. -class OLEProperty + +class WIN32OLE +end + +# OLEProperty is a helper class of Property with arguments, used by +# `olegen.rb`-generated files. +class WIN32OLE::Property + # :stopdoc: def initialize(obj, dispid, gettypes, settypes) @obj = obj @dispid = dispid @@ -14,4 +19,11 @@ class OLEProperty def []=(*args) @obj._setproperty(@dispid, args, @settypes) end + # :stopdoc: +end + +module WIN32OLE::VariantType + # Alias for `olegen.rb`-generated files, that should include + # WIN32OLE::VARIANT. + OLEProperty = WIN32OLE::Property end diff --git a/ext/win32ole/sample/excel1.rb b/ext/win32ole/sample/excel1.rb deleted file mode 100644 index 4fe1d0c2a9..0000000000 --- a/ext/win32ole/sample/excel1.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -application = WIN32OLE.new('Excel.Application') - -application.visible = true -workbook = application.Workbooks.Add(); -worksheet = workbook.Worksheets(1); - -=begin -worksheet.Range("A1:D1").value = ["North","South","East","West"]; -worksheet.Range("A2:B2").value = [5.2, 10]; - -worksheet.Range("C2").value = 8; -worksheet.Range("D2").value = 20; -=end - -worksheet.Range("A1:B2").value = [["North","South"], - [5.2, 10]]; - -vals = WIN32OLE_VARIANT.new([["East","West"], - [8, 20]], - WIN32OLE::VARIANT::VT_ARRAY) -worksheet.Range("C1:D2").value = vals - -range = worksheet.Range("A1:D2"); -range.Select -chart = workbook.Charts.Add; - -workbook.saved = true; - -print "Now quit Excel... Please enter." -gets - -application.ActiveWorkbook.Close(0); -application.Quit(); - diff --git a/ext/win32ole/sample/excel2.rb b/ext/win32ole/sample/excel2.rb deleted file mode 100644 index 47a5715f84..0000000000 --- a/ext/win32ole/sample/excel2.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -# -4100 is the value for the Excel constant xl3DColumn. -ChartTypeVal = -4100; - -# Creates OLE object to Excel -excel = WIN32OLE.new("excel.application") - -# Create and rotate the chart -excel.visible = true; -excel.Workbooks.Add(); -excel.Range("a1").value = 3; -excel.Range("a2").value = 2; -excel.Range("a3").value = 1; -excel.Range("a1:a3").Select(); -excelchart = excel.Charts.Add(); -excelchart.type = ChartTypeVal; - -i = 0 -i.step(180, 10) do |rot| - excelchart.rotation=rot; - sleep 0.1 -end -# Done, bye - -print "Now quit Excel... Please enter." -gets - -excel.ActiveWorkbook.Close(0); -excel.Quit(); diff --git a/ext/win32ole/sample/excel3.rb b/ext/win32ole/sample/excel3.rb deleted file mode 100644 index 72aee2a929..0000000000 --- a/ext/win32ole/sample/excel3.rb +++ /dev/null @@ -1,21 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -#application = WIN32OLE.new('Excel.Application.5') -application = WIN32OLE.new('Excel.Application') - -application.visible = true -workbook = application.Workbooks.Add(); -sheet = workbook.Worksheets(1); -sheetS = workbook.Worksheets -puts "The number of sheets is #{sheetS.count}" -puts "Now add 2 sheets after of `#{sheet.name}`" -sheetS.add({'count'=>2, 'after'=>sheet}) -puts "The number of sheets is #{sheetS.count}" - -print "Now quit Excel... Please enter." -gets - -application.ActiveWorkbook.Close(0); -application.Quit(); - diff --git a/ext/win32ole/sample/ie.rb b/ext/win32ole/sample/ie.rb deleted file mode 100644 index 4db64eed30..0000000000 --- a/ext/win32ole/sample/ie.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' -url = 'http://www.ruby-lang.org/' -ie = WIN32OLE.new('InternetExplorer.Application') -ie.visible = true -ie.gohome -print "Now navigate Ruby home page... Please enter." -gets -ie.navigate(url) -print "Now quit Internet Explorer... Please enter." -gets -ie.Quit() diff --git a/ext/win32ole/sample/ieconst.rb b/ext/win32ole/sample/ieconst.rb deleted file mode 100644 index 363a4f8153..0000000000 --- a/ext/win32ole/sample/ieconst.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -ie = WIN32OLE.new('InternetExplorer.Application') -=begin -WIN32OLE.const_load(ie) -WIN32OLE.constants.sort.each do |c| - puts "#{c} = #{WIN32OLE.const_get(c)}" -end -=end - -module IE_CONST -end - -WIN32OLE.const_load(ie, IE_CONST) -IE_CONST.constants.sort.each do |c| - puts "#{c} = #{IE_CONST.const_get(c)}" -end - -#------------------------------------------------------------ -# Remark!!! CONSTANTS has not tested enoughly!!! -# CONSTANTS is alpha release. -# If there are constants which first letter is not [a-zA-Z], -# like a '_Foo', then maybe you can access the value by -# using CONSTANTS['_Foo'] -#------------------------------------------------------------ -IE_CONST::CONSTANTS.each do |k, v| - puts "#{k} = #{v}" -end - -puts WIN32OLE::VERSION -ie.quit - diff --git a/ext/win32ole/sample/ienavi.rb b/ext/win32ole/sample/ienavi.rb deleted file mode 100644 index 5d0536028b..0000000000 --- a/ext/win32ole/sample/ienavi.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -$urls = [] - -def navigate(url) - $urls << url -end - -def stop_msg_loop - puts "Now Stop IE..." - $LOOP = false; -end - -def default_handler(event, *args) - case event - when "BeforeNavigate" - puts "Now Navigate #{args[0]}..." - end -end - -ie = WIN32OLE.new('InternetExplorer.Application') -ie.visible = true -ie.gohome - -ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents') - -ev.on_event {|*args| default_handler(*args)} -ev.on_event("NavigateComplete") {|url| navigate(url)} -ev.on_event("Quit") {|*args| stop_msg_loop} - -$LOOP = true -while ($LOOP) - WIN32OLE_EVENT.message_loop -end - -puts "You Navigated the URLs ..." -$urls.each_with_index do |url, i| - puts "(#{i+1}) #{url}" -end - diff --git a/ext/win32ole/sample/ienavi2.rb b/ext/win32ole/sample/ienavi2.rb deleted file mode 100644 index 3248393077..0000000000 --- a/ext/win32ole/sample/ienavi2.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: false -require 'win32ole' - -class IEHandler - attr_reader :loop - def initialize - @urls = [] - @loop = true - end - def method_missing(event, *args) - case event - when "BeforeNavigate2" - puts "Now Navigate #{args[1]}..." - end - end - def onNavigateComplete2(pdisp, url) - @urls << url - end - def onOnQuit - puts "Now Stop IE..." - @loop = false - end - def put_urls - puts "You Navigated the URLs ..." - @urls.each_with_index do |url, i| - puts "(#{i+1}) #{url}" - end - end -end - -ie = WIN32OLE.new('InternetExplorer.Application') -ie.visible = true -ie.gohome - -ev = WIN32OLE_EVENT.new(ie) -ev.handler = IEHandler.new - -while (ev.handler.loop) - WIN32OLE_EVENT.message_loop -end -ev.handler.put_urls diff --git a/ext/win32ole/sample/oledirs.rb b/ext/win32ole/sample/oledirs.rb deleted file mode 100644 index e52a0fd7ac..0000000000 --- a/ext/win32ole/sample/oledirs.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: false -# -# You need WSH(Windows Scripting Host) to run this script. -# - -require "win32ole" - -def listup(items) -# items.each do |i| - for i in items - puts i.name - end -end - -fs = WIN32OLE.new("Scripting.FileSystemObject") - -folder = fs.GetFolder(".") - -puts "--- folder of #{folder.path} ---" -listup(folder.SubFolders) - -puts "--- files of #{folder.path} ---" -listup(folder.Files) - diff --git a/ext/win32ole/sample/olegen.rb b/ext/win32ole/sample/olegen.rb deleted file mode 100644 index 4b088a774f..0000000000 --- a/ext/win32ole/sample/olegen.rb +++ /dev/null @@ -1,348 +0,0 @@ -# frozen_string_literal: false -#----------------------------- -# olegen.rb -# $Revision$ -#----------------------------- - -require 'win32ole' - -class WIN32COMGen - def initialize(typelib) - @typelib = typelib - @receiver = "" - end - attr_reader :typelib - - def ole_classes(typelib) - begin - @ole = WIN32OLE.new(typelib) - [@ole.ole_obj_help] - rescue - WIN32OLE_TYPE.ole_classes(typelib) - end - end - - def generate_args(method) - args = [] - if method.size_opt_params >= 0 - size_required_params = method.size_params - method.size_opt_params - else - size_required_params = method.size_params - 1 - end - size_required_params.times do |i| - if method.params[i] && method.params[i].optional? - args.push "arg#{i}=nil" - else - args.push "arg#{i}" - end - end - if method.size_opt_params >= 0 - method.size_opt_params.times do |i| - args.push "arg#{i + size_required_params}=nil" - end - else - args.push "*arg" - end - args.join(", ") - end - - def generate_argtype(typedetails) - ts = '' - typedetails.each do |t| - case t - when 'CARRAY', 'VOID', 'UINT', 'RESULT', 'DECIMAL', 'I8', 'UI8' -# raise "Sorry type\"" + t + "\" not supported" - ts << "\"??? NOT SUPPORTED TYPE:`#{t}'\"" - when 'USERDEFINED', 'Unknown Type 9' - ts << 'VT_DISPATCH' - break; - when 'SAFEARRAY' - ts << 'VT_ARRAY|' - when 'PTR' - ts << 'VT_BYREF|' - when 'INT' - ts << 'VT_I4' - else - if String === t - ts << 'VT_' + t - end - end - end - if ts.empty? - ts = 'VT_VARIANT' - elsif ts[-1] == ?| - ts += 'VT_VARIANT' - end - ts - end - - def generate_argtypes(method, proptypes) - types = method.params.collect{|param| - generate_argtype(param.ole_type_detail) - }.join(", ") - if proptypes - types += ", " if types.size > 0 - types += generate_argtype(proptypes) - end - types - end - - def generate_method_body(method, disptype, types=nil) - " ret = #{@receiver}#{disptype}(#{method.dispid}, [" + - generate_args(method).gsub("=nil", "") + - "], [" + - generate_argtypes(method, types) + - "])\n" + - " @lastargs = WIN32OLE::ARGV\n" + - " ret" - end - - def generate_method_help(method, type = nil) - str = " # " - if type - str += type - else - str += method.return_type - end - str += " #{method.name}" - if method.event? - str += " EVENT" - str += " in #{method.event_interface}" - end - if method.helpstring && method.helpstring != "" - str += "\n # " - str += method.helpstring - end - args_help = generate_method_args_help(method) - if args_help - str += "\n" - str += args_help - end - str - end - - def generate_method_args_help(method) - args = [] - method.params.each_with_index {|param, i| - h = " # #{param.ole_type} arg#{i} --- #{param.name}" - inout = [] - inout.push "IN" if param.input? - inout.push "OUT" if param.output? - h += " [#{inout.join('/')}]" - h += " ( = #{param.default})" if param.default - args.push h - } - if args.size > 0 - args.join("\n") - else - nil - end - end - - def generate_method(method, disptype, io = STDOUT, types = nil) - io.puts "\n" - io.puts generate_method_help(method) - if method.invoke_kind == 'PROPERTYPUT' - io.print " def #{method.name}=(" - else - io.print " def #{method.name}(" - end - io.print generate_args(method) - io.puts ")" - io.puts generate_method_body(method, disptype, types) - io.puts " end" - end - - def generate_propputref_methods(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == 'PROPERTYPUTREF' && method.visible? - }.each do |method| - generate_method(method, io) - end - end - - def generate_properties_with_args(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == 'PROPERTYGET' && - method.visible? && - method.size_params > 0 - }.each do |method| - types = method.return_type_detail - io.puts "\n" - io.puts generate_method_help(method, types[0]) - io.puts " def #{method.name}" - if klass.ole_type == "Class" - io.print " OLEProperty.new(@dispatch, #{method.dispid}, [" - else - io.print " OLEProperty.new(self, #{method.dispid}, [" - end - io.print generate_argtypes(method, nil) - io.print "], [" - io.print generate_argtypes(method, types) - io.puts "])" - io.puts " end" - end - end - - def generate_propput_methods(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == 'PROPERTYPUT' && method.visible? && - method.size_params == 1 - }.each do |method| - ms = klass.ole_methods.select {|m| - m.invoke_kind == 'PROPERTYGET' && - m.dispid == method.dispid - } - types = [] - if ms.size == 1 - types = ms[0].return_type_detail - end - generate_method(method, '_setproperty', io, types) - end - end - - def generate_propget_methods(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == 'PROPERTYGET' && method.visible? && - method.size_params == 0 - }.each do |method| - generate_method(method, '_getproperty', io) - end - end - - def generate_func_methods(klass, io = STDOUT) - klass.ole_methods.select {|method| - method.invoke_kind == "FUNC" && method.visible? - }.each do |method| - generate_method(method, '_invoke', io) - end - end - - def generate_methods(klass, io = STDOUT) - generate_propget_methods(klass, io) - generate_propput_methods(klass, io) - generate_properties_with_args(klass, io) - generate_func_methods(klass, io) -# generate_propputref_methods(klass, io) - end - - def generate_constants(klass, io = STDOUT) - klass.variables.select {|v| - v.visible? && v.variable_kind == 'CONSTANT' - }.each do |v| - io.print " " - io.print v.name.sub(/^./){$&.upcase} - io.print " = " - io.puts v.value - end - end - - def class_name(klass) - klass_name = klass.name - if klass.ole_type == "Class" && - klass.guid && - klass.progid - klass_name = klass.progid.gsub(/\./, '_') - end - if /^[A-Z]/ !~ klass_name || Module.constants.include?(klass_name) - klass_name = 'OLE' + klass_name - end - klass_name - end - - def define_initialize(klass) - <<STR - - def initialize(obj = nil) - @clsid = "#{klass.guid}" - @progid = "#{klass.progid}" - if obj.nil? - @dispatch = WIN32OLE.new @progid - else - @dispatch = obj - end - end -STR - end - - def define_include - " include WIN32OLE::VARIANT" - end - - def define_instance_variables - " attr_reader :lastargs" - end - - def define_method_missing - <<STR - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end -STR - end - - def define_class(klass, io = STDOUT) - io.puts "class #{class_name(klass)} # #{klass.name}" - io.puts define_include - io.puts define_instance_variables - io.puts " attr_reader :dispatch" - io.puts " attr_reader :clsid" - io.puts " attr_reader :progid" - io.puts define_initialize(klass) - io.puts define_method_missing - end - - def define_module(klass, io = STDOUT) - io.puts "module #{class_name(klass)}" - io.puts define_include - io.puts define_instance_variables - end - - def generate_class(klass, io = STDOUT) - io.puts "\n# #{klass.helpstring}" - if klass.ole_type == "Class" && - klass.guid && - klass.progid - @receiver = "@dispatch." - define_class(klass, io) - else - @receiver = "" - define_module(klass, io) - end - generate_constants(klass, io) - generate_methods(klass, io) - io.puts "end" - end - - def generate(io = STDOUT) - io.puts "require 'win32ole'" - io.puts "require 'win32ole/property'" - - ole_classes(typelib).select{|klass| - klass.visible? && - (klass.ole_type == "Class" || - klass.ole_type == "Interface" || - klass.ole_type == "Dispatch" || - klass.ole_type == "Enum") - }.each do |klass| - generate_class(klass, io) - end - begin - @ole.quit if @ole - rescue - end - end -end - -require 'win32ole' -if __FILE__ == $0 - if ARGV.size == 0 - $stderr.puts "usage: #{$0} Type Library [...]" - exit 1 - end - ARGV.each do |typelib| - comgen = WIN32COMGen.new(typelib) - comgen.generate - end -end diff --git a/ext/win32ole/sample/xml.rb b/ext/win32ole/sample/xml.rb deleted file mode 100644 index 5a239c9336..0000000000 --- a/ext/win32ole/sample/xml.rb +++ /dev/null @@ -1,7307 +0,0 @@ -# frozen_string_literal: false -# -# This file created by olegen.rb as following. -# ruby olegen.rb 'Microsoft XML, version 2.0' > xml.rb -# -require 'win32ole' -require 'win32ole/property' - -# -module IXMLDOMImplementation - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BOOL hasFeature - # BSTR arg0 --- feature [IN] - # BSTR arg1 --- version [IN] - def hasFeature(arg0, arg1) - ret = _invoke(145, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# Core DOM node interface -module IXMLDOMNode - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# Constants that define a node's type -module OLEtagDOMNodeType - include WIN32OLE::VARIANT - attr_reader :lastargs - NODE_INVALID = 0 - NODE_ELEMENT = 1 - NODE_ATTRIBUTE = 2 - NODE_TEXT = 3 - NODE_CDATA_SECTION = 4 - NODE_ENTITY_REFERENCE = 5 - NODE_ENTITY = 6 - NODE_PROCESSING_INSTRUCTION = 7 - NODE_COMMENT = 8 - NODE_DOCUMENT = 9 - NODE_DOCUMENT_TYPE = 10 - NODE_DOCUMENT_FRAGMENT = 11 - NODE_NOTATION = 12 -end - -# -module IXMLDOMNodeList - include WIN32OLE::VARIANT - attr_reader :lastargs - - # I4 length - # number of nodes in the collection - def length() - ret = _getproperty(74, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # PTR item - # collection of nodes - # I4 arg0 --- index [IN] - def item - OLEProperty.new(self, 0, [VT_I4], [VT_I4, VT_BYREF|VT_DISPATCH]) - end - - # IXMLDOMNode nextNode - # get next node from iterator - def nextNode() - ret = _invoke(76, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID reset - # reset the position of iterator - def reset() - ret = _invoke(77, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMNamedNodeMap - include WIN32OLE::VARIANT - attr_reader :lastargs - - # I4 length - # number of nodes in the collection - def length() - ret = _getproperty(74, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # PTR item - # collection of nodes - # I4 arg0 --- index [IN] - def item - OLEProperty.new(self, 0, [VT_I4], [VT_I4, VT_BYREF|VT_DISPATCH]) - end - - # IXMLDOMNode getNamedItem - # lookup item by name - # BSTR arg0 --- name [IN] - def getNamedItem(arg0) - ret = _invoke(83, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode setNamedItem - # set item by name - # IXMLDOMNode arg0 --- newItem [IN] - def setNamedItem(arg0) - ret = _invoke(84, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeNamedItem - # remove item by name - # BSTR arg0 --- name [IN] - def removeNamedItem(arg0) - ret = _invoke(85, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode getQualifiedItem - # lookup the item by name and namespace - # BSTR arg0 --- baseName [IN] - # BSTR arg1 --- namespaceURI [IN] - def getQualifiedItem(arg0, arg1) - ret = _invoke(87, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeQualifiedItem - # remove the item by name and namespace - # BSTR arg0 --- baseName [IN] - # BSTR arg1 --- namespaceURI [IN] - def removeQualifiedItem(arg0, arg1) - ret = _invoke(88, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextNode - # get next node from iterator - def nextNode() - ret = _invoke(89, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID reset - # reset the position of iterator - def reset() - ret = _invoke(90, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMDocument - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentType doctype - # node corresponding to the DOCTYPE - def doctype() - ret = _getproperty(38, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMImplementation implementation - # info on this DOM implementation - def implementation() - ret = _getproperty(39, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement documentElement - # the root of the tree - def documentElement() - ret = _getproperty(40, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # get the state of the XML document - def readyState() - ret = _getproperty(-525, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMParseError parseError - # get the last parser error - def parseError() - ret = _getproperty(59, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR url - # get the URL for the loaded XML document - def url() - ret = _getproperty(60, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL async - # flag for asynchronous download - def async() - ret = _getproperty(61, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL validateOnParse - # indicates whether the parser performs validation - def validateOnParse() - ret = _getproperty(65, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals() - ret = _getproperty(66, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace() - ret = _getproperty(67, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID async - # flag for asynchronous download - def async=(arg0) - ret = _setproperty(61, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID validateOnParse - # indicates whether the parser performs validation - def validateOnParse=(arg0) - ret = _setproperty(65, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals=(arg0) - ret = _setproperty(66, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace=(arg0) - ret = _setproperty(67, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # register a readystatechange event handler - def onreadystatechange=(arg0) - ret = _setproperty(68, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ondataavailable - # register an ondataavailable event handler - def ondataavailable=(arg0) - ret = _setproperty(69, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ontransformnode - # register an ontransformnode event handler - def ontransformnode=(arg0) - ret = _setproperty(70, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement createElement - # create an Element node - # BSTR arg0 --- tagName [IN] - def createElement(arg0) - ret = _invoke(41, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentFragment createDocumentFragment - # create a DocumentFragment node - def createDocumentFragment() - ret = _invoke(42, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText createTextNode - # create a text node - # BSTR arg0 --- data [IN] - def createTextNode(arg0) - ret = _invoke(43, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMComment createComment - # create a comment node - # BSTR arg0 --- data [IN] - def createComment(arg0) - ret = _invoke(44, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMCDATASection createCDATASection - # create a CDATA section node - # BSTR arg0 --- data [IN] - def createCDATASection(arg0) - ret = _invoke(45, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMProcessingInstruction createProcessingInstruction - # create a processing instruction node - # BSTR arg0 --- target [IN] - # BSTR arg1 --- data [IN] - def createProcessingInstruction(arg0, arg1) - ret = _invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute createAttribute - # create an attribute node - # BSTR arg0 --- name [IN] - def createAttribute(arg0) - ret = _invoke(47, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMEntityReference createEntityReference - # create an entity reference node - # BSTR arg0 --- name [IN] - def createEntityReference(arg0) - ret = _invoke(49, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList getElementsByTagName - # build a list of elements by name - # BSTR arg0 --- tagName [IN] - def getElementsByTagName(arg0) - ret = _invoke(50, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode createNode - # create a node of the specified node type and name - # VARIANT arg0 --- type [IN] - # BSTR arg1 --- name [IN] - # BSTR arg2 --- namespaceURI [IN] - def createNode(arg0, arg1, arg2) - ret = _invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nodeFromID - # retrieve node from it's ID - # BSTR arg0 --- idString [IN] - def nodeFromID(arg0) - ret = _invoke(56, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL load - # load document from the specified XML source - # VARIANT arg0 --- xmlSource [IN] - def load(arg0) - ret = _invoke(58, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # abort an asynchronous download - def abort() - ret = _invoke(62, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL loadXML - # load the document from a string - # BSTR arg0 --- bstrXML [IN] - def loadXML(arg0) - ret = _invoke(63, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID save - # save the document to a specified destination - # VARIANT arg0 --- destination [IN] - def save(arg0) - ret = _invoke(64, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMDocumentType - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR name - # name of the document type (root of the tree) - def name() - ret = _getproperty(131, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap entities - # a list of entities in the document - def entities() - ret = _getproperty(132, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap notations - # a list of notations in the document - def notations() - ret = _getproperty(133, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMElement - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR tagName - # get the tagName of the element - def tagName() - ret = _getproperty(97, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT getAttribute - # look up the string value of an attribute by name - # BSTR arg0 --- name [IN] - def getAttribute(arg0) - ret = _invoke(99, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID setAttribute - # set the string value of an attribute by name - # BSTR arg0 --- name [IN] - # VARIANT arg1 --- value [IN] - def setAttribute(arg0, arg1) - ret = _invoke(100, [arg0, arg1], [VT_BSTR, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID removeAttribute - # remove an attribute by name - # BSTR arg0 --- name [IN] - def removeAttribute(arg0) - ret = _invoke(101, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute getAttributeNode - # look up the attribute node by name - # BSTR arg0 --- name [IN] - def getAttributeNode(arg0) - ret = _invoke(102, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute setAttributeNode - # set the specified attribute on the element - # IXMLDOMAttribute arg0 --- DOMAttribute [IN] - def setAttributeNode(arg0) - ret = _invoke(103, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute removeAttributeNode - # remove the specified attribute - # IXMLDOMAttribute arg0 --- DOMAttribute [IN] - def removeAttributeNode(arg0) - ret = _invoke(104, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList getElementsByTagName - # build a list of elements by name - # BSTR arg0 --- tagName [IN] - def getElementsByTagName(arg0) - ret = _invoke(105, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID normalize - # collapse all adjacent text nodes in sub-tree - def normalize() - ret = _invoke(106, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMAttribute - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR name - # get name of the attribute - def name() - ret = _getproperty(118, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT value - # string value of the attribute - def value() - ret = _getproperty(120, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID value - # string value of the attribute - def value=(arg0) - ret = _setproperty(120, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMDocumentFragment - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMText - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # value of the node - def data() - ret = _getproperty(109, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 length - # number of characters in value - def length() - ret = _getproperty(110, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # value of the node - def data=(arg0) - ret = _setproperty(109, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR substringData - # retrieve substring of value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def substringData(arg0, arg1) - ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID appendData - # append string to value - # BSTR arg0 --- data [IN] - def appendData(arg0) - ret = _invoke(112, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID insertData - # insert string into value - # I4 arg0 --- offset [IN] - # BSTR arg1 --- data [IN] - def insertData(arg0, arg1) - ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID deleteData - # delete string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def deleteData(arg0, arg1) - ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID replaceData - # replace string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - # BSTR arg2 --- data [IN] - def replaceData(arg0, arg1, arg2) - ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText splitText - # split the text node into two text nodes at the position specified - # I4 arg0 --- offset [IN] - def splitText(arg0) - ret = _invoke(123, [arg0], [VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMCharacterData - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # value of the node - def data() - ret = _getproperty(109, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 length - # number of characters in value - def length() - ret = _getproperty(110, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # value of the node - def data=(arg0) - ret = _setproperty(109, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR substringData - # retrieve substring of value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def substringData(arg0, arg1) - ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID appendData - # append string to value - # BSTR arg0 --- data [IN] - def appendData(arg0) - ret = _invoke(112, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID insertData - # insert string into value - # I4 arg0 --- offset [IN] - # BSTR arg1 --- data [IN] - def insertData(arg0, arg1) - ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID deleteData - # delete string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def deleteData(arg0, arg1) - ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID replaceData - # replace string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - # BSTR arg2 --- data [IN] - def replaceData(arg0, arg1, arg2) - ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMComment - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # value of the node - def data() - ret = _getproperty(109, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 length - # number of characters in value - def length() - ret = _getproperty(110, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # value of the node - def data=(arg0) - ret = _setproperty(109, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR substringData - # retrieve substring of value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def substringData(arg0, arg1) - ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID appendData - # append string to value - # BSTR arg0 --- data [IN] - def appendData(arg0) - ret = _invoke(112, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID insertData - # insert string into value - # I4 arg0 --- offset [IN] - # BSTR arg1 --- data [IN] - def insertData(arg0, arg1) - ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID deleteData - # delete string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def deleteData(arg0, arg1) - ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID replaceData - # replace string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - # BSTR arg2 --- data [IN] - def replaceData(arg0, arg1, arg2) - ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMCDATASection - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # value of the node - def data() - ret = _getproperty(109, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 length - # number of characters in value - def length() - ret = _getproperty(110, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # value of the node - def data=(arg0) - ret = _setproperty(109, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR substringData - # retrieve substring of value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def substringData(arg0, arg1) - ret = _invoke(111, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID appendData - # append string to value - # BSTR arg0 --- data [IN] - def appendData(arg0) - ret = _invoke(112, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID insertData - # insert string into value - # I4 arg0 --- offset [IN] - # BSTR arg1 --- data [IN] - def insertData(arg0, arg1) - ret = _invoke(113, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID deleteData - # delete string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - def deleteData(arg0, arg1) - ret = _invoke(114, [arg0, arg1], [VT_I4, VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID replaceData - # replace string within the value - # I4 arg0 --- offset [IN] - # I4 arg1 --- count [IN] - # BSTR arg2 --- data [IN] - def replaceData(arg0, arg1, arg2) - ret = _invoke(115, [arg0, arg1, arg2], [VT_I4, VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText splitText - # split the text node into two text nodes at the position specified - # I4 arg0 --- offset [IN] - def splitText(arg0) - ret = _invoke(123, [arg0], [VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMProcessingInstruction - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR target - # the target - def target() - ret = _getproperty(127, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR data - # the data - def data() - ret = _getproperty(128, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID data - # the data - def data=(arg0) - ret = _setproperty(128, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMEntityReference - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# structure for reporting parser errors -module IXMLDOMParseError - include WIN32OLE::VARIANT - attr_reader :lastargs - - # I4 errorCode - # the error code - def errorCode() - ret = _getproperty(0, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR url - # the URL of the XML document containing the error - def url() - ret = _getproperty(179, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR reason - # the cause of the error - def reason() - ret = _getproperty(180, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR srcText - # the data where the error occurred - def srcText() - ret = _getproperty(181, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 line - # the line number in the XML document where the error occurred - def line() - ret = _getproperty(182, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 linepos - # the character position in the line containing the error - def linepos() - ret = _getproperty(183, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 filepos - # the absolute file position in the XML document containing the error - def filepos() - ret = _getproperty(184, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMNotation - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT publicId - # the public ID - def publicId() - ret = _getproperty(136, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT systemId - # the system ID - def systemId() - ret = _getproperty(137, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# -module IXMLDOMEntity - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT publicId - # the public ID - def publicId() - ret = _getproperty(140, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT systemId - # the system ID - def systemId() - ret = _getproperty(141, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR notationName - # the name of the notation - def notationName() - ret = _getproperty(142, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# XTL runtime object -module IXTLRuntime - include WIN32OLE::VARIANT - attr_reader :lastargs - - # BSTR nodeName - # name of the node - def nodeName() - ret = _getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = _getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = _getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = _getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = _getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = _getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = _getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = _getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = _getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = _getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = _getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = _getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = _getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = _getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = _getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = _getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = _setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = _setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = _setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = _setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = _invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = _invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = _invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = _invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = _invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = _invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = _invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = _invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = _invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = _invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 uniqueID - # IXMLDOMNode arg0 --- pNode [IN] - def uniqueID(arg0) - ret = _invoke(187, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 depth - # IXMLDOMNode arg0 --- pNode [IN] - def depth(arg0) - ret = _invoke(188, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 childNumber - # IXMLDOMNode arg0 --- pNode [IN] - def childNumber(arg0) - ret = _invoke(189, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 ancestorChildNumber - # BSTR arg0 --- bstrNodeName [IN] - # IXMLDOMNode arg1 --- pNode [IN] - def ancestorChildNumber(arg0, arg1) - ret = _invoke(190, [arg0, arg1], [VT_BSTR, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 absoluteChildNumber - # IXMLDOMNode arg0 --- pNode [IN] - def absoluteChildNumber(arg0) - ret = _invoke(191, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR formatIndex - # I4 arg0 --- lIndex [IN] - # BSTR arg1 --- bstrFormat [IN] - def formatIndex(arg0, arg1) - ret = _invoke(192, [arg0, arg1], [VT_I4, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR formatNumber - # R8 arg0 --- dblNumber [IN] - # BSTR arg1 --- bstrFormat [IN] - def formatNumber(arg0, arg1) - ret = _invoke(193, [arg0, arg1], [VT_R8, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR formatDate - # VARIANT arg0 --- varDate [IN] - # BSTR arg1 --- bstrFormat [IN] - # VARIANT arg2 --- varDestLocale [IN] - def formatDate(arg0, arg1, arg2=nil) - ret = _invoke(194, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR formatTime - # VARIANT arg0 --- varTime [IN] - # BSTR arg1 --- bstrFormat [IN] - # VARIANT arg2 --- varDestLocale [IN] - def formatTime(arg0, arg1, arg2=nil) - ret = _invoke(195, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# W3C-DOM XML Document -class Microsoft_XMLDOM_1_0 # DOMDocument - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{2933BF90-7B36-11D2-B20E-00C04F983E60}" - @progid = "Microsoft.XMLDOM.1.0" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # BSTR nodeName - # name of the node - def nodeName() - ret = @dispatch._getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = @dispatch._getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = @dispatch._getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = @dispatch._getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = @dispatch._getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = @dispatch._getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = @dispatch._getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = @dispatch._getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = @dispatch._getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = @dispatch._getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = @dispatch._getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = @dispatch._getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = @dispatch._getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = @dispatch._getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = @dispatch._getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = @dispatch._getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = @dispatch._getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = @dispatch._getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = @dispatch._getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = @dispatch._getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = @dispatch._getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = @dispatch._getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentType doctype - # node corresponding to the DOCTYPE - def doctype() - ret = @dispatch._getproperty(38, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMImplementation implementation - # info on this DOM implementation - def implementation() - ret = @dispatch._getproperty(39, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement documentElement - # the root of the tree - def documentElement() - ret = @dispatch._getproperty(40, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # get the state of the XML document - def readyState() - ret = @dispatch._getproperty(-525, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMParseError parseError - # get the last parser error - def parseError() - ret = @dispatch._getproperty(59, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR url - # get the URL for the loaded XML document - def url() - ret = @dispatch._getproperty(60, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL async - # flag for asynchronous download - def async() - ret = @dispatch._getproperty(61, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL validateOnParse - # indicates whether the parser performs validation - def validateOnParse() - ret = @dispatch._getproperty(65, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals() - ret = @dispatch._getproperty(66, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace() - ret = @dispatch._getproperty(67, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = @dispatch._setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = @dispatch._setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = @dispatch._setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = @dispatch._setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID async - # flag for asynchronous download - def async=(arg0) - ret = @dispatch._setproperty(61, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID validateOnParse - # indicates whether the parser performs validation - def validateOnParse=(arg0) - ret = @dispatch._setproperty(65, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals=(arg0) - ret = @dispatch._setproperty(66, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace=(arg0) - ret = @dispatch._setproperty(67, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # register a readystatechange event handler - def onreadystatechange=(arg0) - ret = @dispatch._setproperty(68, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ondataavailable - # register an ondataavailable event handler - def ondataavailable=(arg0) - ret = @dispatch._setproperty(69, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ontransformnode - # register an ontransformnode event handler - def ontransformnode=(arg0) - ret = @dispatch._setproperty(70, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = @dispatch._invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = @dispatch._invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = @dispatch._invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = @dispatch._invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = @dispatch._invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = @dispatch._invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = @dispatch._invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = @dispatch._invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = @dispatch._invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = @dispatch._invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement createElement - # create an Element node - # BSTR arg0 --- tagName [IN] - def createElement(arg0) - ret = @dispatch._invoke(41, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentFragment createDocumentFragment - # create a DocumentFragment node - def createDocumentFragment() - ret = @dispatch._invoke(42, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText createTextNode - # create a text node - # BSTR arg0 --- data [IN] - def createTextNode(arg0) - ret = @dispatch._invoke(43, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMComment createComment - # create a comment node - # BSTR arg0 --- data [IN] - def createComment(arg0) - ret = @dispatch._invoke(44, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMCDATASection createCDATASection - # create a CDATA section node - # BSTR arg0 --- data [IN] - def createCDATASection(arg0) - ret = @dispatch._invoke(45, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMProcessingInstruction createProcessingInstruction - # create a processing instruction node - # BSTR arg0 --- target [IN] - # BSTR arg1 --- data [IN] - def createProcessingInstruction(arg0, arg1) - ret = @dispatch._invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute createAttribute - # create an attribute node - # BSTR arg0 --- name [IN] - def createAttribute(arg0) - ret = @dispatch._invoke(47, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMEntityReference createEntityReference - # create an entity reference node - # BSTR arg0 --- name [IN] - def createEntityReference(arg0) - ret = @dispatch._invoke(49, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList getElementsByTagName - # build a list of elements by name - # BSTR arg0 --- tagName [IN] - def getElementsByTagName(arg0) - ret = @dispatch._invoke(50, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode createNode - # create a node of the specified node type and name - # VARIANT arg0 --- type [IN] - # BSTR arg1 --- name [IN] - # BSTR arg2 --- namespaceURI [IN] - def createNode(arg0, arg1, arg2) - ret = @dispatch._invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nodeFromID - # retrieve node from it's ID - # BSTR arg0 --- idString [IN] - def nodeFromID(arg0) - ret = @dispatch._invoke(56, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL load - # load document from the specified XML source - # VARIANT arg0 --- xmlSource [IN] - def load(arg0) - ret = @dispatch._invoke(58, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # abort an asynchronous download - def abort() - ret = @dispatch._invoke(62, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL loadXML - # load the document from a string - # BSTR arg0 --- bstrXML [IN] - def loadXML(arg0) - ret = @dispatch._invoke(63, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID save - # save the document to a specified destination - # VARIANT arg0 --- destination [IN] - def save(arg0) - ret = @dispatch._invoke(64, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT ondataavailable EVENT in XMLDOMDocumentEvents - def ondataavailable() - ret = @dispatch._invoke(198, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT onreadystatechange EVENT in XMLDOMDocumentEvents - def onreadystatechange() - ret = @dispatch._invoke(-609, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# W3C-DOM XML Document (Apartment) -class Microsoft_FreeThreadedXMLDOM_1_0 # DOMFreeThreadedDocument - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{2933BF91-7B36-11D2-B20E-00C04F983E60}" - @progid = "Microsoft.FreeThreadedXMLDOM.1.0" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # BSTR nodeName - # name of the node - def nodeName() - ret = @dispatch._getproperty(2, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeValue - # value stored in the node - def nodeValue() - ret = @dispatch._getproperty(3, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DOMNodeType nodeType - # the node's type - def nodeType() - ret = @dispatch._getproperty(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode parentNode - # parent of the node - def parentNode() - ret = @dispatch._getproperty(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList childNodes - # the collection of the node's children - def childNodes() - ret = @dispatch._getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode firstChild - # first child of the node - def firstChild() - ret = @dispatch._getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode lastChild - # first child of the node - def lastChild() - ret = @dispatch._getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode previousSibling - # left sibling of the node - def previousSibling() - ret = @dispatch._getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nextSibling - # right sibling of the node - def nextSibling() - ret = @dispatch._getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNamedNodeMap attributes - # the collection of the node's attributes - def attributes() - ret = @dispatch._getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocument ownerDocument - # document that contains the node - def ownerDocument() - ret = @dispatch._getproperty(18, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR nodeTypeString - # the type of node in string form - def nodeTypeString() - ret = @dispatch._getproperty(21, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR text - # text content of the node and subtree - def text() - ret = @dispatch._getproperty(24, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL specified - # indicates whether node is a default value - def specified() - ret = @dispatch._getproperty(22, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode definition - # pointer to the definition of the node in the DTD or schema - def definition() - ret = @dispatch._getproperty(23, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue() - ret = @dispatch._getproperty(25, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT dataType - # the data type of the node - def dataType() - ret = @dispatch._getproperty(26, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR xml - # return the XML source for the node and each of its descendants - def xml() - ret = @dispatch._getproperty(27, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL parsed - # has sub-tree been completely parsed - def parsed() - ret = @dispatch._getproperty(31, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR namespaceURI - # the URI for the namespace applying to the node - def namespaceURI() - ret = @dispatch._getproperty(32, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR prefix - # the prefix for the namespace applying to the node - def prefix() - ret = @dispatch._getproperty(33, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR baseName - # the base name of the node (nodename with the prefix stripped off) - def baseName() - ret = @dispatch._getproperty(34, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentType doctype - # node corresponding to the DOCTYPE - def doctype() - ret = @dispatch._getproperty(38, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMImplementation implementation - # info on this DOM implementation - def implementation() - ret = @dispatch._getproperty(39, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement documentElement - # the root of the tree - def documentElement() - ret = @dispatch._getproperty(40, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # get the state of the XML document - def readyState() - ret = @dispatch._getproperty(-525, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMParseError parseError - # get the last parser error - def parseError() - ret = @dispatch._getproperty(59, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR url - # get the URL for the loaded XML document - def url() - ret = @dispatch._getproperty(60, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL async - # flag for asynchronous download - def async() - ret = @dispatch._getproperty(61, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL validateOnParse - # indicates whether the parser performs validation - def validateOnParse() - ret = @dispatch._getproperty(65, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals() - ret = @dispatch._getproperty(66, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace() - ret = @dispatch._getproperty(67, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeValue - # value stored in the node - def nodeValue=(arg0) - ret = @dispatch._setproperty(3, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID text - # text content of the node and subtree - def text=(arg0) - ret = @dispatch._setproperty(24, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID nodeTypedValue - # get the strongly typed value of the node - def nodeTypedValue=(arg0) - ret = @dispatch._setproperty(25, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID dataType - # the data type of the node - def dataType=(arg0) - ret = @dispatch._setproperty(26, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID async - # flag for asynchronous download - def async=(arg0) - ret = @dispatch._setproperty(61, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID validateOnParse - # indicates whether the parser performs validation - def validateOnParse=(arg0) - ret = @dispatch._setproperty(65, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID resolveExternals - # indicates whether the parser resolves references to external DTD/Entities/Schema - def resolveExternals=(arg0) - ret = @dispatch._setproperty(66, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID preserveWhiteSpace - # indicates whether the parser preserves whitespace - def preserveWhiteSpace=(arg0) - ret = @dispatch._setproperty(67, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # register a readystatechange event handler - def onreadystatechange=(arg0) - ret = @dispatch._setproperty(68, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ondataavailable - # register an ondataavailable event handler - def ondataavailable=(arg0) - ret = @dispatch._setproperty(69, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID ontransformnode - # register an ontransformnode event handler - def ontransformnode=(arg0) - ret = @dispatch._setproperty(70, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode insertBefore - # insert a child node - # IXMLDOMNode arg0 --- newChild [IN] - # VARIANT arg1 --- refChild [IN] - def insertBefore(arg0, arg1) - ret = @dispatch._invoke(13, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode replaceChild - # replace a child node - # IXMLDOMNode arg0 --- newChild [IN] - # IXMLDOMNode arg1 --- oldChild [IN] - def replaceChild(arg0, arg1) - ret = @dispatch._invoke(14, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode removeChild - # remove a child node - # IXMLDOMNode arg0 --- childNode [IN] - def removeChild(arg0) - ret = @dispatch._invoke(15, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode appendChild - # append a child node - # IXMLDOMNode arg0 --- newChild [IN] - def appendChild(arg0) - ret = @dispatch._invoke(16, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL hasChildNodes - def hasChildNodes() - ret = @dispatch._invoke(17, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode cloneNode - # BOOL arg0 --- deep [IN] - def cloneNode(arg0) - ret = @dispatch._invoke(19, [arg0], [VT_BOOL]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR transformNode - # apply the stylesheet to the subtree - # IXMLDOMNode arg0 --- stylesheet [IN] - def transformNode(arg0) - ret = @dispatch._invoke(28, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList selectNodes - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectNodes(arg0) - ret = @dispatch._invoke(29, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode selectSingleNode - # execute query on the subtree - # BSTR arg0 --- queryString [IN] - def selectSingleNode(arg0) - ret = @dispatch._invoke(30, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID transformNodeToObject - # apply the stylesheet to the subtree, returning the result through a document or a stream - # IXMLDOMNode arg0 --- stylesheet [IN] - # VARIANT arg1 --- outputObject [IN] - def transformNodeToObject(arg0, arg1) - ret = @dispatch._invoke(35, [arg0, arg1], [VT_BYREF|VT_DISPATCH, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMElement createElement - # create an Element node - # BSTR arg0 --- tagName [IN] - def createElement(arg0) - ret = @dispatch._invoke(41, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMDocumentFragment createDocumentFragment - # create a DocumentFragment node - def createDocumentFragment() - ret = @dispatch._invoke(42, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMText createTextNode - # create a text node - # BSTR arg0 --- data [IN] - def createTextNode(arg0) - ret = @dispatch._invoke(43, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMComment createComment - # create a comment node - # BSTR arg0 --- data [IN] - def createComment(arg0) - ret = @dispatch._invoke(44, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMCDATASection createCDATASection - # create a CDATA section node - # BSTR arg0 --- data [IN] - def createCDATASection(arg0) - ret = @dispatch._invoke(45, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMProcessingInstruction createProcessingInstruction - # create a processing instruction node - # BSTR arg0 --- target [IN] - # BSTR arg1 --- data [IN] - def createProcessingInstruction(arg0, arg1) - ret = @dispatch._invoke(46, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMAttribute createAttribute - # create an attribute node - # BSTR arg0 --- name [IN] - def createAttribute(arg0) - ret = @dispatch._invoke(47, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMEntityReference createEntityReference - # create an entity reference node - # BSTR arg0 --- name [IN] - def createEntityReference(arg0) - ret = @dispatch._invoke(49, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNodeList getElementsByTagName - # build a list of elements by name - # BSTR arg0 --- tagName [IN] - def getElementsByTagName(arg0) - ret = @dispatch._invoke(50, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode createNode - # create a node of the specified node type and name - # VARIANT arg0 --- type [IN] - # BSTR arg1 --- name [IN] - # BSTR arg2 --- namespaceURI [IN] - def createNode(arg0, arg1, arg2) - ret = @dispatch._invoke(54, [arg0, arg1, arg2], [VT_VARIANT, VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # IXMLDOMNode nodeFromID - # retrieve node from it's ID - # BSTR arg0 --- idString [IN] - def nodeFromID(arg0) - ret = @dispatch._invoke(56, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL load - # load document from the specified XML source - # VARIANT arg0 --- xmlSource [IN] - def load(arg0) - ret = @dispatch._invoke(58, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # abort an asynchronous download - def abort() - ret = @dispatch._invoke(62, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BOOL loadXML - # load the document from a string - # BSTR arg0 --- bstrXML [IN] - def loadXML(arg0) - ret = @dispatch._invoke(63, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID save - # save the document to a specified destination - # VARIANT arg0 --- destination [IN] - def save(arg0) - ret = @dispatch._invoke(64, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT ondataavailable EVENT in XMLDOMDocumentEvents - def ondataavailable() - ret = @dispatch._invoke(198, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT onreadystatechange EVENT in XMLDOMDocumentEvents - def onreadystatechange() - ret = @dispatch._invoke(-609, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# IXMLHttpRequest Interface -module IXMLHttpRequest - include WIN32OLE::VARIANT - attr_reader :lastargs - - # I4 status - # Get HTTP status code - def status() - ret = _getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR statusText - # Get HTTP status text - def statusText() - ret = _getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DISPATCH responseXML - # Get response body - def responseXML() - ret = _getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR responseText - # Get response body - def responseText() - ret = _getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT responseBody - # Get response body - def responseBody() - ret = _getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT responseStream - # Get response body - def responseStream() - ret = _getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # Get ready state - def readyState() - ret = _getproperty(13, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # Register a complete event handler - def onreadystatechange=(arg0) - ret = _setproperty(14, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID open - # Open HTTP connection - # BSTR arg0 --- bstrMethod [IN] - # BSTR arg1 --- bstrUrl [IN] - # VARIANT arg2 --- varAsync [IN] - # VARIANT arg3 --- bstrUser [IN] - # VARIANT arg4 --- bstrPassword [IN] - def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil) - ret = _invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID setRequestHeader - # Add HTTP request header - # BSTR arg0 --- bstrHeader [IN] - # BSTR arg1 --- bstrValue [IN] - def setRequestHeader(arg0, arg1) - ret = _invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR getResponseHeader - # Get HTTP response header - # BSTR arg0 --- bstrHeader [IN] - def getResponseHeader(arg0) - ret = _invoke(3, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR getAllResponseHeaders - # Get all HTTP response headers - def getAllResponseHeaders() - ret = _invoke(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID send - # Send HTTP request - # VARIANT arg0 --- varBody [IN] - def send(arg0=nil) - ret = _invoke(5, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # Abort HTTP request - def abort() - ret = _invoke(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# XML HTTP Request class. -class Microsoft_XMLHTTP_1 # XMLHTTPRequest - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{ED8C108E-4349-11D2-91A4-00C04F7969E8}" - @progid = "Microsoft.XMLHTTP.1" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # I4 status - # Get HTTP status code - def status() - ret = @dispatch._getproperty(7, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR statusText - # Get HTTP status text - def statusText() - ret = @dispatch._getproperty(8, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # DISPATCH responseXML - # Get response body - def responseXML() - ret = @dispatch._getproperty(9, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR responseText - # Get response body - def responseText() - ret = @dispatch._getproperty(10, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT responseBody - # Get response body - def responseBody() - ret = @dispatch._getproperty(11, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VARIANT responseStream - # Get response body - def responseStream() - ret = @dispatch._getproperty(12, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - # Get ready state - def readyState() - ret = @dispatch._getproperty(13, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID onreadystatechange - # Register a complete event handler - def onreadystatechange=(arg0) - ret = @dispatch._setproperty(14, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID open - # Open HTTP connection - # BSTR arg0 --- bstrMethod [IN] - # BSTR arg1 --- bstrUrl [IN] - # VARIANT arg2 --- varAsync [IN] - # VARIANT arg3 --- bstrUser [IN] - # VARIANT arg4 --- bstrPassword [IN] - def open(arg0, arg1, arg2=nil, arg3=nil, arg4=nil) - ret = @dispatch._invoke(1, [arg0, arg1, arg2, arg3, arg4], [VT_BSTR, VT_BSTR, VT_VARIANT, VT_VARIANT, VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID setRequestHeader - # Add HTTP request header - # BSTR arg0 --- bstrHeader [IN] - # BSTR arg1 --- bstrValue [IN] - def setRequestHeader(arg0, arg1) - ret = @dispatch._invoke(2, [arg0, arg1], [VT_BSTR, VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR getResponseHeader - # Get HTTP response header - # BSTR arg0 --- bstrHeader [IN] - def getResponseHeader(arg0) - ret = @dispatch._invoke(3, [arg0], [VT_BSTR]) - @lastargs = WIN32OLE::ARGV - ret - end - - # BSTR getAllResponseHeaders - # Get all HTTP response headers - def getAllResponseHeaders() - ret = @dispatch._invoke(4, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID send - # Send HTTP request - # VARIANT arg0 --- varBody [IN] - def send(arg0=nil) - ret = @dispatch._invoke(5, [arg0], [VT_VARIANT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID abort - # Abort HTTP request - def abort() - ret = @dispatch._invoke(6, [], []) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# XML Data Source Object -class Microsoft_XMLDSO_1_0 # XMLDSOControl - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{550DDA30-0541-11D2-9CA9-0060B0EC3D39}" - @progid = "Microsoft.XMLDSO.1.0" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # IXMLDOMDocument XMLDocument - def XMLDocument() - ret = @dispatch._getproperty(65537, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 JavaDSOCompatible - def JavaDSOCompatible() - ret = @dispatch._getproperty(65538, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # I4 readyState - def readyState() - ret = @dispatch._getproperty(-525, [], []) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID XMLDocument - def XMLDocument=(arg0) - ret = @dispatch._setproperty(65537, [arg0], [VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end - - # VOID JavaDSOCompatible - def JavaDSOCompatible=(arg0) - ret = @dispatch._setproperty(65538, [arg0], [VT_I4]) - @lastargs = WIN32OLE::ARGV - ret - end -end - -# Constants that define types for IXMLElement. -module OLEtagXMLEMEM_TYPE - include WIN32OLE::VARIANT - attr_reader :lastargs - XMLELEMTYPE_ELEMENT = 0 - XMLELEMTYPE_TEXT = 1 - XMLELEMTYPE_COMMENT = 2 - XMLELEMTYPE_DOCUMENT = 3 - XMLELEMTYPE_DTD = 4 - XMLELEMTYPE_PI = 5 - XMLELEMTYPE_OTHER = 6 -end - -# XMLDocument extends IXML Document. It is obsolete. You should use DOMDocument. This object should not be confused with the XMLDocument property on the XML data island. -class Msxml # XMLDocument - include WIN32OLE::VARIANT - attr_reader :lastargs - attr_reader :dispatch - attr_reader :clsid - attr_reader :progid - - def initialize(obj = nil) - @clsid = "{CFC399AF-D876-11D0-9C10-00C04FC99C8E}" - @progid = "Msxml" - if obj.nil? - @dispatch = WIN32OLE.new(@progid) - else - @dispatch = obj - end - end - - def method_missing(cmd, *arg) - @dispatch.method_missing(cmd, *arg) - end - - # HRESULT url - # set URL to load an XML document from the URL. - # BSTR arg0 --- p [IN] - def url=(arg0) - ret = @dispatch._setproperty(65641, [arg0], [VT_BSTR, VT_HRESULT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT charset - # get encoding. - # BSTR arg0 --- p [IN] - def charset=(arg0) - ret = @dispatch._setproperty(65645, [arg0], [VT_BSTR, VT_HRESULT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT async - # get asynchronous loading flag. - # BOOL arg0 --- pf [IN] - def async=(arg0) - ret = @dispatch._setproperty(65649, [arg0], [VT_BOOL, VT_HRESULT]) - @lastargs = WIN32OLE::ARGV - ret - end - - # HRESULT root - # get root IXMLElement of the XML document. - # IXMLElement2,IXMLElement2 arg0 --- p [OUT] - def root - OLEProperty.new(@dispatch, 65637, [VT_BYREF|VT_BYREF|VT_DISPATCH], [VT_BYREF|VT_BYREF|VT_DISPATCH, VT_HRESULT]) - end - - # HRESULT url - # set URL to load an XML document from the URL. - # BSTR arg0 --- p [OUT] - def url - OLEProperty.new(@dispatch, 65641, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT]) - end - - # HRESULT readyState - # get ready state. - # I4 arg0 --- pl [OUT] - def readyState - OLEProperty.new(@dispatch, 65643, [VT_BYREF|VT_I4], [VT_BYREF|VT_I4, VT_HRESULT]) - end - - # HRESULT charset - # get encoding. - # BSTR arg0 --- p [OUT] - def charset - OLEProperty.new(@dispatch, 65645, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT]) - end - - # HRESULT version - # get XML version number. - # BSTR arg0 --- p [OUT] - def version - OLEProperty.new(@dispatch, 65646, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT]) - end - - # HRESULT doctype - # get document type. - # BSTR arg0 --- p [OUT] - def doctype - OLEProperty.new(@dispatch, 65647, [VT_BYREF|VT_BSTR], [VT_BYREF|VT_BSTR, VT_HRESULT]) - end - - # HRESULT async - # get asynchronous loading flag. - # BOOL arg0 --- pf [OUT] - def async - OLEProperty.new(@dispatch, 65649, [VT_BYREF|VT_BOOL], [VT_BYREF|VT_BOOL, VT_HRESULT]) - end - - # HRESULT createElement - # create different types of IXMLElements. - # VARIANT arg0 --- vType [IN] - # VARIANT arg1 --- var1 [IN] - # IXMLElement2,IXMLElement2 arg2 --- ppElem [OUT] - def createElement(arg0, arg1=nil, arg2=nil) - ret = @dispatch._invoke(65644, [arg0, arg1, arg2], [VT_VARIANT, VT_VARIANT, VT_BYREF|VT_BYREF|VT_DISPATCH]) - @lastargs = WIN32OLE::ARGV - ret - end -end diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c index 3f083bb12d..e0342d1e9d 100644 --- a/ext/win32ole/win32ole.c +++ b/ext/win32ole/win32ole.c @@ -27,7 +27,7 @@ const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}}; #endif -#define WIN32OLE_VERSION "1.8.8" +#define WIN32OLE_VERSION "1.8.10" typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX) (REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*); @@ -1962,7 +1962,7 @@ ole_bind_obj(VALUE moniker, int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE.connect( ole ) --> aWIN32OLE + * connect(ole) --> aWIN32OLE * * Returns running OLE Automation object or WIN32OLE object from moniker. * 1st argument should be OLE program id or class id or moniker. @@ -2019,7 +2019,7 @@ fole_s_connect(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE.const_load( ole, mod = WIN32OLE) + * const_load(ole, mod = WIN32OLE) * * Defines the constants of OLE Automation server as mod's constants. * The first argument is WIN32OLE object or type library name. @@ -2124,7 +2124,7 @@ reference_count(struct oledata * pole) /* * call-seq: - * WIN32OLE.ole_reference_count(aWIN32OLE) --> number + * ole_reference_count(aWIN32OLE) --> number * * Returns reference counter of Dispatch interface of WIN32OLE object. * You should not use this method because this method @@ -2140,7 +2140,7 @@ fole_s_reference_count(VALUE self, VALUE obj) /* * call-seq: - * WIN32OLE.ole_free(aWIN32OLE) --> number + * ole_free(aWIN32OLE) --> number * * Invokes Release method of Dispatch interface of WIN32OLE object. * You should not use this method because this method @@ -2184,10 +2184,10 @@ ole_show_help(VALUE helpfile, VALUE helpcontext) /* * call-seq: - * WIN32OLE.ole_show_help(obj [,helpcontext]) + * ole_show_help(obj [,helpcontext]) * - * Displays helpfile. The 1st argument specifies WIN32OLE_TYPE - * object or WIN32OLE_METHOD object or helpfile. + * Displays helpfile. The 1st argument specifies WIN32OLE::Type + * object or WIN32OLE::Method object or helpfile. * * excel = WIN32OLE.new('Excel.Application') * typeobj = excel.ole_type @@ -2215,7 +2215,7 @@ fole_s_show_help(int argc, VALUE *argv, VALUE self) helpfile = target; } if (!RB_TYPE_P(helpfile, T_STRING)) { - rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD)"); + rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE::Type|WIN32OLE::Method)"); } hwnd = ole_show_help(helpfile, helpcontext); if(hwnd == 0) { @@ -2227,7 +2227,7 @@ fole_s_show_help(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE.codepage + * codepage * * Returns current codepage. * WIN32OLE.codepage # => WIN32OLE::CP_ACP @@ -2258,7 +2258,7 @@ code_page_installed(UINT cp) /* * call-seq: - * WIN32OLE.codepage = CP + * codepage = CP * * Sets current codepage. * The WIN32OLE.codepage is initialized according to @@ -2282,7 +2282,7 @@ fole_s_set_code_page(VALUE self, VALUE vcp) /* * call-seq: - * WIN32OLE.locale -> locale id. + * locale -> locale id. * * Returns current locale id (lcid). The default locale is * WIN32OLE::LOCALE_SYSTEM_DEFAULT. @@ -2316,12 +2316,12 @@ lcid_installed(LCID lcid) /* * call-seq: - * WIN32OLE.locale = lcid + * locale = lcid * * Sets current locale id (lcid). * * WIN32OLE.locale = 1033 # set locale English(U.S) - * obj = WIN32OLE_VARIANT.new("$100,000", WIN32OLE::VARIANT::VT_CY) + * obj = WIN32OLE::Variant.new("$100,000", WIN32OLE::VARIANT::VT_CY) * */ static VALUE @@ -2345,7 +2345,7 @@ fole_s_set_locale(VALUE self, VALUE vlcid) /* * call-seq: - * WIN32OLE.create_guid + * create_guid * * Creates GUID. * WIN32OLE.create_guid # => {1CB530F1-F6B1-404D-BCE6-1959BF91F4A8} @@ -2393,9 +2393,9 @@ fole_s_ole_uninitialize(VALUE self) /* * Document-class: WIN32OLE * - * <code>WIN32OLE</code> objects represent OLE Automation object in Ruby. + * +WIN32OLE+ objects represent OLE Automation object in Ruby. * - * By using WIN32OLE, you can access OLE server like VBScript. + * By using +WIN32OLE+, you can access OLE server like VBScript. * * Here is sample script. * @@ -2419,18 +2419,18 @@ fole_s_ole_uninitialize(VALUE self) * excel.ActiveWorkbook.Close(0); * excel.Quit(); * - * Unfortunately, Win32OLE doesn't support the argument passed by + * Unfortunately, +WIN32OLE+ doesn't support the argument passed by * reference directly. - * Instead, Win32OLE provides WIN32OLE::ARGV or WIN32OLE_VARIANT object. + * Instead, +WIN32OLE+ provides WIN32OLE::ARGV or WIN32OLE::Variant object. * If you want to get the result value of argument passed by reference, - * you can use WIN32OLE::ARGV or WIN32OLE_VARIANT. + * you can use WIN32OLE::ARGV or WIN32OLE::Variant. * * oleobj.method(arg1, arg2, refargv3) * puts WIN32OLE::ARGV[2] # the value of refargv3 after called oleobj.method * * or * - * refargv3 = WIN32OLE_VARIANT.new(XXX, + * refargv3 = WIN32OLE::Variant.new(XXX, * WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_XXX) * oleobj.method(arg1, arg2, refargv3) * p refargv3.value # the value of refargv3 after called oleobj.method. @@ -2439,7 +2439,7 @@ fole_s_ole_uninitialize(VALUE self) /* * call-seq: - * WIN32OLE.new(server, [host]) -> WIN32OLE object + * new(server, [host]) -> WIN32OLE object * WIN32OLE.new(server, license: 'key') -> WIN32OLE object * * Returns a new WIN32OLE object(OLE Automation object). @@ -2826,7 +2826,7 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket) /* * call-seq: - * WIN32OLE#invoke(method, [arg1,...]) => return value of method. + * invoke(method, [arg1,...]) => return value of method. * * Runs OLE method. * The first argument specifies the method name of OLE Automation object. @@ -3038,7 +3038,7 @@ ole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types, USHORT dispkind) /* * call-seq: - * WIN32OLE#_invoke(dispid, args, types) + * _invoke(dispid, args, types) * * Runs the early binding method. * The 1st argument specifies dispatch ID, @@ -3056,7 +3056,7 @@ fole_invoke2(VALUE self, VALUE dispid, VALUE args, VALUE types) /* * call-seq: - * WIN32OLE#_getproperty(dispid, args, types) + * _getproperty(dispid, args, types) * * Runs the early binding method to get property. * The 1st argument specifies dispatch ID, @@ -3074,7 +3074,7 @@ fole_getproperty2(VALUE self, VALUE dispid, VALUE args, VALUE types) /* * call-seq: - * WIN32OLE#_setproperty(dispid, args, types) + * _setproperty(dispid, args, types) * * Runs the early binding method to set property. * The 1st argument specifies dispatch ID, @@ -3120,7 +3120,7 @@ fole_setproperty_with_bracket(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE.setproperty('property', [arg1, arg2,...] val) + * setproperty('property', [arg1, arg2,...] val) * * Sets property of OLE object. * When you want to set property with argument, you can use this method. @@ -3226,7 +3226,7 @@ ole_propertyput(VALUE self, VALUE property, VALUE value) /* * call-seq: - * WIN32OLE#ole_free + * ole_free * * invokes Release method of Dispatch interface of WIN32OLE object. * Usually, you do not need to call this method because Release method @@ -3269,7 +3269,7 @@ ole_ienum_free(VALUE pEnumV) /* * call-seq: - * WIN32OLE#each {|i|...} + * each {|i|...} * * Iterates over each item of OLE collection which has IEnumVARIANT interface. * @@ -3340,7 +3340,7 @@ fole_each(VALUE self) /* * call-seq: - * WIN32OLE#method_missing(id [,arg1, arg2, ...]) + * method_missing(id [,arg1, arg2, ...]) * * Calls WIN32OLE#invoke method. */ @@ -3438,9 +3438,9 @@ ole_methods(VALUE self, int mask) /* * call-seq: - * WIN32OLE#ole_methods + * ole_methods * - * Returns the array of WIN32OLE_METHOD object. + * Returns the array of WIN32OLE::Method object. * The element is OLE method of WIN32OLE object. * * excel = WIN32OLE.new('Excel.Application') @@ -3455,9 +3455,9 @@ fole_methods(VALUE self) /* * call-seq: - * WIN32OLE#ole_get_methods + * ole_get_methods * - * Returns the array of WIN32OLE_METHOD object . + * Returns the array of WIN32OLE::Method object . * The element of the array is property (gettable) of WIN32OLE object. * * excel = WIN32OLE.new('Excel.Application') @@ -3471,9 +3471,9 @@ fole_get_methods(VALUE self) /* * call-seq: - * WIN32OLE#ole_put_methods + * ole_put_methods * - * Returns the array of WIN32OLE_METHOD object . + * Returns the array of WIN32OLE::Method object . * The element of the array is property (settable) of WIN32OLE object. * * excel = WIN32OLE.new('Excel.Application') @@ -3487,9 +3487,9 @@ fole_put_methods(VALUE self) /* * call-seq: - * WIN32OLE#ole_func_methods + * ole_func_methods * - * Returns the array of WIN32OLE_METHOD object . + * Returns the array of WIN32OLE::Method object . * The element of the array is property (settable) of WIN32OLE object. * * excel = WIN32OLE.new('Excel.Application') @@ -3504,9 +3504,9 @@ fole_func_methods(VALUE self) /* * call-seq: - * WIN32OLE#ole_type + * ole_type * - * Returns WIN32OLE_TYPE object. + * Returns WIN32OLE::Type object. * * excel = WIN32OLE.new('Excel.Application') * tobj = excel.ole_type @@ -3529,16 +3529,16 @@ fole_type(VALUE self) type = ole_type_from_itypeinfo(pTypeInfo); OLE_RELEASE(pTypeInfo); if (type == Qnil) { - rb_raise(rb_eRuntimeError, "failed to create WIN32OLE_TYPE obj from ITypeInfo"); + rb_raise(rb_eRuntimeError, "failed to create WIN32OLE::Type obj from ITypeInfo"); } return type; } /* * call-seq: - * WIN32OLE#ole_typelib -> The WIN32OLE_TYPELIB object + * ole_typelib -> The WIN32OLE_TYPELIB object * - * Returns the WIN32OLE_TYPELIB object. The object represents the + * Returns the WIN32OLE::TypeLib object. The object represents the * type library which contains the WIN32OLE object. * * excel = WIN32OLE.new('Excel.Application') @@ -3570,7 +3570,7 @@ fole_typelib(VALUE self) /* * call-seq: - * WIN32OLE#ole_query_interface(iid) -> WIN32OLE object + * ole_query_interface(iid) -> WIN32OLE object * * Returns WIN32OLE object for a specific dispatch or dual * interface specified by iid. @@ -3616,7 +3616,7 @@ fole_query_interface(VALUE self, VALUE str_iid) /* * call-seq: - * WIN32OLE#ole_respond_to?(method) -> true or false + * ole_respond_to?(method) -> true or false * * Returns true when OLE object has OLE method, otherwise returns false. * @@ -3825,9 +3825,9 @@ ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails) /* * call-seq: - * WIN32OLE#ole_method_help(method) + * ole_method_help(method) * - * Returns WIN32OLE_METHOD object corresponding with method + * Returns WIN32OLE::Method object corresponding with method * specified by 1st argument. * * excel = WIN32OLE.new('Excel.Application') @@ -3859,7 +3859,7 @@ fole_method_help(VALUE self, VALUE cmdname) /* * call-seq: - * WIN32OLE#ole_activex_initialize() -> Qnil + * ole_activex_initialize() -> Qnil * * Initialize WIN32OLE object(ActiveX Control) by calling * IPersistMemory::InitNew. @@ -4073,7 +4073,7 @@ Init_win32ole(void) * p c # => 0 * p WIN32OLE::ARGV # => [10, 20, 30] * - * You can use WIN32OLE_VARIANT object to retrieve the value of reference + * You can use WIN32OLE::Variant object to retrieve the value of reference * arguments instead of referring WIN32OLE::ARGV. * */ diff --git a/ext/win32ole/win32ole.gemspec b/ext/win32ole/win32ole.gemspec index 977555c98d..625916ae17 100644 --- a/ext/win32ole/win32ole.gemspec +++ b/ext/win32ole/win32ole.gemspec @@ -1,6 +1,16 @@ +source_version = ["", "ext/win32ole/"].find do |dir| + begin + break File.open(File.join(__dir__, "#{dir}win32ole.c")) {|f| + f.gets("\n#define WIN32OLE_VERSION ") + f.gets[/\s*"(.+)"/, 1] + } + rescue Errno::ENOENT + end +end + Gem::Specification.new do |spec| spec.name = "win32ole" - spec.version = "1.8.8" + spec.version = source_version spec.authors = ["Masaki Suketa"] spec.email = ["suke@ruby-lang.org"] @@ -13,9 +23,11 @@ Gem::Specification.new do |spec| spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = spec.homepage - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } - end + pathspecs = %W[ + :(exclude,literal)#{File.basename(__FILE__)} + :^/bin/ :^/test/ :^/rakelib/ :^/.git* :^/Gemfile* :^/Rakefile* + ] + spec.files = IO.popen(%w[git ls-files -z --] + pathspecs, chdir: __dir__, err: IO::NULL, exception: false, &:read).split("\x0") spec.bindir = "exe" spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] diff --git a/ext/win32ole/win32ole_error.c b/ext/win32ole/win32ole_error.c index 2bb5156263..66b5136dee 100644 --- a/ext/win32ole/win32ole_error.c +++ b/ext/win32ole/win32ole_error.c @@ -67,7 +67,7 @@ void Init_win32ole_error(void) { /* - * Document-class: WIN32OLERuntimeError + * Document-class: WIN32OLE::RuntimeError * * Raised when OLE processing failed. * @@ -77,11 +77,20 @@ Init_win32ole_error(void) * * raises the exception: * - * WIN32OLERuntimeError: unknown OLE server: `NonExistProgID' + * WIN32OLE::RuntimeError: unknown OLE server: `NonExistProgID' * HRESULT error code:0x800401f3 * Invalid class string * */ - eWIN32OLERuntimeError = rb_define_class("WIN32OLERuntimeError", rb_eRuntimeError); - eWIN32OLEQueryInterfaceError = rb_define_class("WIN32OLEQueryInterfaceError", eWIN32OLERuntimeError); + eWIN32OLERuntimeError = rb_define_class_under(cWIN32OLE, "RuntimeError", rb_eRuntimeError); + /* Alias of WIN32OLE::RuntimeError, for the backward compatibility */ + rb_define_const(rb_cObject, "WIN32OLERuntimeError", eWIN32OLERuntimeError); + /* + * Document-class: WIN32OLE::QueryInterfaceError + * + * Raised when OLE query failed. + */ + eWIN32OLEQueryInterfaceError = rb_define_class_under(cWIN32OLE, "QueryInterfaceError", eWIN32OLERuntimeError); + /* Alias of WIN32OLE::QueryInterfaceError, for the backward compatibility */ + rb_define_const(rb_cObject, "WIN32OLEQueryInterfaceError", eWIN32OLEQueryInterfaceError); } diff --git a/ext/win32ole/win32ole_event.c b/ext/win32ole/win32ole_event.c index 45ebf13433..ff6835e3e4 100644 --- a/ext/win32ole/win32ole_event.c +++ b/ext/win32ole/win32ole_event.c @@ -1,9 +1,9 @@ #include "win32ole.h" /* - * Document-class: WIN32OLE_EVENT + * Document-class: WIN32OLE::Event * - * <code>WIN32OLE_EVENT</code> objects controls OLE event. + * +WIN32OLE::Event+ objects controls OLE event. */ RUBY_EXTERN void rb_write_error_str(VALUE mesg); @@ -974,13 +974,13 @@ ev_advise(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE_EVENT.new(ole, event) #=> WIN32OLE_EVENT object. + * new(ole, event) #=> WIN32OLE::Event object. * * Returns OLE event object. * The first argument specifies WIN32OLE object. * The second argument specifies OLE event name. * ie = WIN32OLE.new('InternetExplorer.Application') - * ev = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents') + * ev = WIN32OLE::Event.new(ie, 'DWebBrowserEvents') */ static VALUE fev_initialize(int argc, VALUE *argv, VALUE self) @@ -1004,7 +1004,7 @@ ole_msg_loop(void) /* * call-seq: - * WIN32OLE_EVENT.message_loop + * message_loop * * Translates and dispatches Windows message. */ @@ -1052,7 +1052,7 @@ ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg) /* * call-seq: - * WIN32OLE_EVENT#on_event([event]){...} + * on_event([event]){...} * * Defines the callback event. * If argument is omitted, this method defines the callback of all events. @@ -1061,12 +1061,12 @@ ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg) * use `return' or :return. * * ie = WIN32OLE.new('InternetExplorer.Application') - * ev = WIN32OLE_EVENT.new(ie) + * ev = WIN32OLE::Event.new(ie) * ev.on_event("NavigateComplete") {|url| puts url} * ev.on_event() {|ev, *args| puts "#{ev} fired"} * * ev.on_event("BeforeNavigate2") {|*args| - * ... + * # ... * # set true to BeforeNavigate reference argument `Cancel'. * # Cancel is 7-th argument of BeforeNavigate, * # so you can use 6 as key of hash instead of 'Cancel'. @@ -1075,7 +1075,7 @@ ev_on_event(int argc, VALUE *argv, VALUE self, VALUE is_ary_arg) * {:Cancel => true} # or {'Cancel' => true} or {6 => true} * } * - * ev.on_event(...) {|*args| + * ev.on_event(event_name) {|*args| * {:return => 1, :xxx => yyy} * } */ @@ -1087,14 +1087,14 @@ fev_on_event(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE_EVENT#on_event_with_outargs([event]){...} + * on_event_with_outargs([event]){...} * * Defines the callback of event. * If you want modify argument in callback, - * you could use this method instead of WIN32OLE_EVENT#on_event. + * you could use this method instead of WIN32OLE::Event#on_event. * * ie = WIN32OLE.new('InternetExplorer.Application') - * ev = WIN32OLE_EVENT.new(ie) + * ev = WIN32OLE::Event.new(ie) * ev.on_event_with_outargs('BeforeNavigate2') {|*args| * args.last[6] = true * } @@ -1107,18 +1107,18 @@ fev_on_event_with_outargs(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE_EVENT#off_event([event]) + * off_event([event]) * * removes the callback of event. * * ie = WIN32OLE.new('InternetExplorer.Application') - * ev = WIN32OLE_EVENT.new(ie) + * ev = WIN32OLE::Event.new(ie) * ev.on_event('BeforeNavigate2') {|*args| * args.last[6] = true * } - * ... + * # ... * ev.off_event('BeforeNavigate2') - * ... + * # ... */ static VALUE fev_off_event(int argc, VALUE *argv, VALUE self) @@ -1145,16 +1145,16 @@ fev_off_event(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE_EVENT#unadvise -> nil + * unadvise -> nil * - * disconnects OLE server. If this method called, then the WIN32OLE_EVENT object + * disconnects OLE server. If this method called, then the WIN32OLE::Event object * does not receive the OLE server event any more. * This method is trial implementation. * * ie = WIN32OLE.new('InternetExplorer.Application') - * ev = WIN32OLE_EVENT.new(ie) - * ev.on_event() {...} - * ... + * ev = WIN32OLE::Event.new(ie) + * ev.on_event() { something } + * # ... * ev.unadvise * */ @@ -1201,7 +1201,7 @@ evs_length(void) /* * call-seq: - * WIN32OLE_EVENT#handler= + * handler= * * sets event handler object. If handler object has onXXX * method according to XXX event, then onXXX method is called @@ -1212,7 +1212,7 @@ evs_length(void) * called and 1-st argument is event name. * * If handler object has onXXX method and there is block - * defined by WIN32OLE_EVENT#on_event('XXX'){}, + * defined by <code>on_event('XXX'){}</code>, * then block is executed but handler object method is not called * when XXX event occurs. * @@ -1230,7 +1230,7 @@ evs_length(void) * * handler = Handler.new * ie = WIN32OLE.new('InternetExplorer.Application') - * ev = WIN32OLE_EVENT.new(ie) + * ev = WIN32OLE::Event.new(ie) * ev.on_event("StatusTextChange") {|*args| * puts "this block executed." * puts "handler.onStatusTextChange method is not called." @@ -1246,7 +1246,7 @@ fev_set_handler(VALUE self, VALUE val) /* * call-seq: - * WIN32OLE_EVENT#handler + * handler * * returns handler object. * @@ -1265,6 +1265,7 @@ Init_win32ole_event(void) rb_gc_register_mark_object(ary_ole_event); id_events = rb_intern("events"); cWIN32OLE_EVENT = rb_define_class_under(cWIN32OLE, "Event", rb_cObject); + /* Alias of WIN32OLE::Event, for the backward compatibility */ rb_define_const(rb_cObject, "WIN32OLE_EVENT", cWIN32OLE_EVENT); rb_define_singleton_method(cWIN32OLE_EVENT, "message_loop", fev_s_msg_loop, 0); rb_define_alloc_func(cWIN32OLE_EVENT, fev_s_allocate); diff --git a/ext/win32ole/win32ole_method.c b/ext/win32ole/win32ole_method.c index 646fdaf60c..a0278729f0 100644 --- a/ext/win32ole/win32ole_method.c +++ b/ext/win32ole/win32ole_method.c @@ -216,9 +216,9 @@ create_win32ole_method(ITypeInfo *pTypeInfo, VALUE name) } /* - * Document-class: WIN32OLE_METHOD + * Document-class: WIN32OLE::Method * - * <code>WIN32OLE_METHOD</code> objects represent OLE method information. + * +WIN32OLE::Method+ objects represent OLE method information. */ static VALUE @@ -251,16 +251,16 @@ folemethod_s_allocate(VALUE klass) /* * call-seq: - * WIN32OLE_METHOD.new(ole_type, method) -> WIN32OLE_METHOD object + * WIN32OLE::Method.new(ole_type, method) -> WIN32OLE::Method object * - * Returns a new WIN32OLE_METHOD object which represents the information + * Returns a new WIN32OLE::Method object which represents the information * about OLE method. - * The first argument <i>ole_type</i> specifies WIN32OLE_TYPE object. + * The first argument <i>ole_type</i> specifies WIN32OLE::Type object. * The second argument <i>method</i> specifies OLE method name defined OLE class - * which represents WIN32OLE_TYPE object. + * which represents WIN32OLE::Type object. * - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') */ static VALUE folemethod_initialize(VALUE self, VALUE oletype, VALUE method) @@ -277,19 +277,19 @@ folemethod_initialize(VALUE self, VALUE oletype, VALUE method) } } else { - rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object"); + rb_raise(rb_eTypeError, "1st argument should be WIN32OLE::Type object"); } return obj; } /* * call-seq: - * WIN32OLE_METHOD#name + * name * * Returns the name of the method. * - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * puts method.name # => SaveAs * */ @@ -317,11 +317,11 @@ ole_method_return_type(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#return_type + * return_type * * Returns string of return value type of method. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.return_type # => Workbook * */ @@ -351,11 +351,11 @@ ole_method_return_vtype(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#return_vtype + * return_vtype * * Returns number of return value type of method. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.return_vtype # => 26 * */ @@ -385,12 +385,12 @@ ole_method_return_type_detail(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#return_type_detail + * return_type_detail * * Returns detail information of return value type of method. * The information is array. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * p method.return_type_detail # => ["PTR", "USERDEFINED", "Workbook"] */ static VALUE @@ -437,11 +437,11 @@ ole_method_invoke_kind(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#invkind + * invkind * * Returns the method invoke kind. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.invkind # => 1 * */ @@ -455,13 +455,13 @@ folemethod_invkind(VALUE self) /* * call-seq: - * WIN32OLE_METHOD#invoke_kind + * invoke_kind * * Returns the method kind string. The string is "UNKNOWN" or "PROPERTY" * or "PROPERTY" or "PROPERTYGET" or "PROPERTYPUT" or "PROPERTYPPUTREF" * or "FUNC". - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.invoke_kind # => "FUNC" */ static VALUE @@ -494,11 +494,11 @@ ole_method_visible(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#visible? + * visible? * * Returns true if the method is public. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.visible? # => true */ static VALUE @@ -575,11 +575,11 @@ ole_method_event(ITypeInfo *pTypeInfo, UINT method_index, VALUE method_name) /* * call-seq: - * WIN32OLE_METHOD#event? + * event? * * Returns true if the method is event. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SheetActivate') * puts method.event? # => true * */ @@ -597,11 +597,11 @@ folemethod_event(VALUE self) /* * call-seq: - * WIN32OLE_METHOD#event_interface + * event_interface * * Returns event interface name if the method is event. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SheetActivate') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SheetActivate') * puts method.event_interface # => WorkbookEvents */ static VALUE @@ -655,12 +655,12 @@ ole_method_helpstring(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#helpstring + * helpstring * * Returns help string of OLE method. If the help string is not found, * then the method returns nil. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser') - * method = WIN32OLE_METHOD.new(tobj, 'Navigate') + * tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'IWebBrowser') + * method = WIN32OLE::Method.new(tobj, 'Navigate') * puts method.helpstring # => Navigates to a URL or file. * */ @@ -686,12 +686,12 @@ ole_method_helpfile(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#helpfile + * helpfile * * Returns help file. If help file is not found, then * the method returns nil. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.helpfile # => C:\...\VBAXL9.CHM */ static VALUE @@ -717,11 +717,11 @@ ole_method_helpcontext(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#helpcontext + * helpcontext * * Returns help context. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.helpcontext # => 65717 */ static VALUE @@ -748,11 +748,11 @@ ole_method_dispid(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#dispid + * dispid * * Returns dispatch ID. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.dispid # => 181 */ static VALUE @@ -779,11 +779,11 @@ ole_method_offset_vtbl(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#offset_vtbl + * offset_vtbl * * Returns the offset ov VTBL. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbooks') - * method = WIN32OLE_METHOD.new(tobj, 'Add') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks') + * method = WIN32OLE::Method.new(tobj, 'Add') * puts method.offset_vtbl # => 40 */ static VALUE @@ -810,11 +810,11 @@ ole_method_size_params(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#size_params + * size_params * * Returns the size of arguments of the method. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * puts method.size_params # => 11 * */ @@ -842,11 +842,11 @@ ole_method_size_opt_params(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#size_opt_params + * size_opt_params * * Returns the size of optional parameters. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * puts method.size_opt_params # => 4 */ static VALUE @@ -892,11 +892,11 @@ ole_method_params(ITypeInfo *pTypeInfo, UINT method_index) /* * call-seq: - * WIN32OLE_METHOD#params + * params * - * returns array of WIN32OLE_PARAM object corresponding with method parameters. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * returns array of WIN32OLE::Param object corresponding with method parameters. + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * p method.params # => [Filename, FileFormat, Password, WriteResPassword, * ReadOnlyRecommended, CreateBackup, AccessMode, * ConflictResolution, AddToMru, TextCodepage, @@ -912,7 +912,7 @@ folemethod_params(VALUE self) /* * call-seq: - * WIN32OLE_METHOD#inspect -> String + * inspect -> String * * Returns the method name with class name. * @@ -920,7 +920,7 @@ folemethod_params(VALUE self) static VALUE folemethod_inspect(VALUE self) { - return default_inspect(self, "WIN32OLE_METHOD"); + return default_inspect(self, "WIN32OLE::Method"); } VALUE cWIN32OLE_METHOD; @@ -928,6 +928,7 @@ VALUE cWIN32OLE_METHOD; void Init_win32ole_method(void) { cWIN32OLE_METHOD = rb_define_class_under(cWIN32OLE, "Method", rb_cObject); + /* Alias of WIN32OLE::Method, for the backward compatibility */ rb_define_const(rb_cObject, "WIN32OLE_METHOD", cWIN32OLE_METHOD); rb_define_alloc_func(cWIN32OLE_METHOD, folemethod_s_allocate); rb_define_method(cWIN32OLE_METHOD, "initialize", folemethod_initialize, 2); diff --git a/ext/win32ole/win32ole_param.c b/ext/win32ole/win32ole_param.c index b654aaa845..0c4b185921 100644 --- a/ext/win32ole/win32ole_param.c +++ b/ext/win32ole/win32ole_param.c @@ -64,9 +64,9 @@ create_win32ole_param(ITypeInfo *pTypeInfo, UINT method_index, UINT index, VALUE } /* - * Document-class: WIN32OLE_PARAM + * Document-class: WIN32OLE::Param * - * <code>WIN32OLE_PARAM</code> objects represent param information of + * +WIN32OLE::Param+ objects represent param information of * the OLE method. */ static VALUE @@ -131,15 +131,15 @@ oleparam_ole_param(VALUE self, VALUE olemethod, int n) /* * call-seq: - * WIN32OLE_PARAM.new(method, n) -> WIN32OLE_PARAM object + * new(method, n) -> WIN32OLE::Param object * - * Returns WIN32OLE_PARAM object which represents OLE parameter information. - * 1st argument should be WIN32OLE_METHOD object. + * Returns WIN32OLE::Param object which represents OLE parameter information. + * 1st argument should be WIN32OLE::Method object. * 2nd argument `n' is n-th parameter of the method specified by 1st argument. * - * tobj = WIN32OLE_TYPE.new('Microsoft Scripting Runtime', 'IFileSystem') - * method = WIN32OLE_METHOD.new(tobj, 'CreateTextFile') - * param = WIN32OLE_PARAM.new(method, 2) # => #<WIN32OLE_PARAM:Overwrite=true> + * tobj = WIN32OLE::Type.new('Microsoft Scripting Runtime', 'IFileSystem') + * method = WIN32OLE::Method.new(tobj, 'CreateTextFile') + * param = WIN32OLE::Param.new(method, 2) # => #<WIN32OLE::Param:Overwrite=true> * */ static VALUE @@ -147,7 +147,7 @@ foleparam_initialize(VALUE self, VALUE olemethod, VALUE n) { int idx; if (!rb_obj_is_kind_of(olemethod, cWIN32OLE_METHOD)) { - rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE_METHOD object"); + rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE::Method object"); } idx = RB_FIX2INT(n); return oleparam_ole_param(self, olemethod, idx); @@ -155,11 +155,11 @@ foleparam_initialize(VALUE self, VALUE olemethod, VALUE n) /* * call-seq: - * WIN32OLE_PARAM#name + * name * * Returns name. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * param1 = method.params[0] * puts param1.name # => Filename */ @@ -186,11 +186,11 @@ ole_param_ole_type(ITypeInfo *pTypeInfo, UINT method_index, UINT index) /* * call-seq: - * WIN32OLE_PARAM#ole_type + * ole_type * - * Returns OLE type of WIN32OLE_PARAM object(parameter of OLE method). - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * Returns OLE type of WIN32OLE::Param object(parameter of OLE method). + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * param1 = method.params[0] * puts param1.ole_type # => VARIANT */ @@ -220,11 +220,11 @@ ole_param_ole_type_detail(ITypeInfo *pTypeInfo, UINT method_index, UINT index) /* * call-seq: - * WIN32OLE_PARAM#ole_type_detail + * ole_type_detail * * Returns detail information of type of argument. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction') - * method = WIN32OLE_METHOD.new(tobj, 'SumIf') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction') + * method = WIN32OLE::Method.new(tobj, 'SumIf') * param1 = method.params[0] * p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"] */ @@ -254,11 +254,11 @@ ole_param_flag_mask(ITypeInfo *pTypeInfo, UINT method_index, UINT index, USHORT /* * call-seq: - * WIN32OLE_PARAM#input? + * input? * * Returns true if the parameter is input. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * param1 = method.params[0] * puts param1.input? # => true */ @@ -273,22 +273,22 @@ foleparam_input(VALUE self) /* * call-seq: - * WIN32OLE#output? + * output? * * Returns true if argument is output. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents') - * method = WIN32OLE_METHOD.new(tobj, 'NewWindow') + * tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'DWebBrowserEvents') + * method = WIN32OLE::Method.new(tobj, 'NewWindow') * method.params.each do |param| * puts "#{param.name} #{param.output?}" * end * - * The result of above script is following: - * URL false - * Flags false - * TargetFrameName false - * PostData false - * Headers false - * Processed true + * The result of above script is following: + * URL false + * Flags false + * TargetFrameName false + * PostData false + * Headers false + * Processed true */ static VALUE foleparam_output(VALUE self) @@ -301,11 +301,11 @@ foleparam_output(VALUE self) /* * call-seq: - * WIN32OLE_PARAM#optional? + * optional? * * Returns true if argument is optional. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * param1 = method.params[0] * puts "#{param1.name} #{param1.optional?}" # => Filename true */ @@ -320,12 +320,12 @@ foleparam_optional(VALUE self) /* * call-seq: - * WIN32OLE_PARAM#retval? + * retval? * * Returns true if argument is return value. - * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', - * 'DirectPlayLobbyConnection') - * method = WIN32OLE_METHOD.new(tobj, 'GetPlayerShortName') + * tobj = WIN32OLE::Type.new('DirectX 7 for Visual Basic Type Library', + * 'DirectPlayLobbyConnection') + * method = WIN32OLE::Method.new(tobj, 'GetPlayerShortName') * param = method.params[0] * puts "#{param.name} #{param.retval?}" # => name true */ @@ -363,12 +363,12 @@ ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index) /* * call-seq: - * WIN32OLE_PARAM#default + * default * * Returns default value. If the default value does not exist, * this method returns nil. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook') - * method = WIN32OLE_METHOD.new(tobj, 'SaveAs') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook') + * method = WIN32OLE::Method.new(tobj, 'SaveAs') * method.params.each do |param| * if param.default * puts "#{param.name} (= #{param.default})" @@ -377,18 +377,18 @@ ole_param_default(ITypeInfo *pTypeInfo, UINT method_index, UINT index) * end * end * - * The above script result is following: - * Filename - * FileFormat - * Password - * WriteResPassword - * ReadOnlyRecommended - * CreateBackup - * AccessMode (= 1) - * ConflictResolution - * AddToMru - * TextCodepage - * TextVisualLayout + * The above script result is following: + * Filename + * FileFormat + * Password + * WriteResPassword + * ReadOnlyRecommended + * CreateBackup + * AccessMode (= 1) + * ConflictResolution + * AddToMru + * TextCodepage + * TextVisualLayout */ static VALUE foleparam_default(VALUE self) @@ -401,7 +401,7 @@ foleparam_default(VALUE self) /* * call-seq: - * WIN32OLE_PARAM#inspect -> String + * inspect -> String * * Returns the parameter name with class name. If the parameter has default value, * then returns name=value string with class name. @@ -416,13 +416,14 @@ foleparam_inspect(VALUE self) rb_str_cat2(detail, "="); rb_str_concat(detail, rb_inspect(defval)); } - return make_inspect("WIN32OLE_PARAM", detail); + return make_inspect("WIN32OLE::Param", detail); } void Init_win32ole_param(void) { cWIN32OLE_PARAM = rb_define_class_under(cWIN32OLE, "Param", rb_cObject); + /* Alias of WIN32OLE::Param, for the backward compatibility */ rb_define_const(rb_cObject, "WIN32OLE_PARAM", cWIN32OLE_PARAM); rb_define_alloc_func(cWIN32OLE_PARAM, foleparam_s_allocate); rb_define_method(cWIN32OLE_PARAM, "initialize", foleparam_initialize, 2); diff --git a/ext/win32ole/win32ole_record.c b/ext/win32ole/win32ole_record.c index 9e18653db9..02f05a3fa7 100644 --- a/ext/win32ole/win32ole_record.c +++ b/ext/win32ole/win32ole_record.c @@ -177,10 +177,10 @@ create_win32ole_record(IRecordInfo *pri, void *prec) } /* - * Document-class: WIN32OLE_RECORD + * Document-class: WIN32OLE::Record * - * <code>WIN32OLE_RECORD</code> objects represents VT_RECORD OLE variant. - * Win32OLE returns WIN32OLE_RECORD object if the result value of invoking + * +WIN32OLE::Record+ objects represents VT_RECORD OLE variant. + * Win32OLE returns WIN32OLE::Record object if the result value of invoking * OLE methods. * * If COM server in VB.NET ComServer project is the following: @@ -206,7 +206,7 @@ create_win32ole_record(IRecordInfo *pri, void *prec) * require 'win32ole' * obj = WIN32OLE.new('ComServer.ComClass') * book = obj.getBook - * book.class # => WIN32OLE_RECORD + * book.class # => WIN32OLE::Record * book.title # => "The Ruby Book" * book.cost # => 20 * @@ -253,11 +253,11 @@ folerecord_s_allocate(VALUE klass) { /* * call-seq: - * WIN32OLE_RECORD.new(typename, obj) -> WIN32OLE_RECORD object + * new(typename, obj) -> WIN32OLE::Record object * - * Returns WIN32OLE_RECORD object. The first argument is struct name (String + * Returns WIN32OLE::Record object. The first argument is struct name (String * or Symbol). - * The second parameter obj should be WIN32OLE object or WIN32OLE_TYPELIB object. + * The second parameter obj should be WIN32OLE object or WIN32OLE::TypeLib object. * If COM server in VB.NET ComServer project is the following: * * Imports System.Runtime.InteropServices @@ -269,13 +269,13 @@ folerecord_s_allocate(VALUE klass) { * End Structure * End Class * - * then, you can create WIN32OLE_RECORD object is as following: + * then, you can create WIN32OLE::Record object is as following: * * require 'win32ole' * obj = WIN32OLE.new('ComServer.ComClass') - * book1 = WIN32OLE_RECORD.new('Book', obj) # => WIN32OLE_RECORD object + * book1 = WIN32OLE::Record.new('Book', obj) # => WIN32OLE::Record object * tlib = obj.ole_typelib - * book2 = WIN32OLE_RECORD.new('Book', tlib) # => WIN32OLE_RECORD object + * book2 = WIN32OLE::Record.new('Book', tlib) # => WIN32OLE::Record object * */ static VALUE @@ -303,7 +303,7 @@ folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) { hr = E_FAIL; } } else { - rb_raise(rb_eArgError, "2nd argument should be WIN32OLE object or WIN32OLE_TYPELIB object"); + rb_raise(rb_eArgError, "2nd argument should be WIN32OLE object or WIN32OLE::TypeLib object"); } if (FAILED(hr)) { @@ -323,7 +323,7 @@ folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) { /* * call-seq: - * WIN32OLE_RECORD#to_h #=> Ruby Hash object. + * WIN32OLE::Record#to_h #=> Ruby Hash object. * * Returns Ruby Hash object which represents VT_RECORD variable. * The keys of Hash object are member names of VT_RECORD OLE variable and @@ -346,7 +346,7 @@ folerecord_initialize(VALUE self, VALUE typename, VALUE oleobj) { * End Function * End Class * - * then, the result of WIN32OLE_RECORD#to_h is the following: + * then, the result of WIN32OLE::Record#to_h is the following: * * require 'win32ole' * obj = WIN32OLE.new('ComServer.ComClass') @@ -362,7 +362,7 @@ folerecord_to_h(VALUE self) /* * call-seq: - * WIN32OLE_RECORD#typename #=> String object + * typename #=> String object * * Returns the type name of VT_RECORD OLE variable. * @@ -383,7 +383,7 @@ folerecord_to_h(VALUE self) * End Function * End Class * - * then, the result of WIN32OLE_RECORD#typename is the following: + * then, the result of WIN32OLE::Record#typename is the following: * * require 'win32ole' * obj = WIN32OLE.new('ComServer.ComClass') @@ -423,7 +423,7 @@ olerecord_ivar_set(VALUE self, VALUE name, VALUE val) /* * call-seq: - * WIN32OLE_RECORD#method_missing(name) + * method_missing(name) * * Returns value specified by the member name of VT_RECORD OLE variable. * Or sets value specified by the member name of VT_RECORD OLE variable. @@ -443,7 +443,7 @@ olerecord_ivar_set(VALUE self, VALUE name, VALUE val) * Then getting/setting value from Ruby is as the following: * * obj = WIN32OLE.new('ComServer.ComClass') - * book = WIN32OLE_RECORD.new('Book', obj) + * book = WIN32OLE::Record.new('Book', obj) * book.title # => nil ( book.method_missing(:title) is invoked. ) * book.title = "Ruby" # ( book.method_missing(:title=, "Ruby") is invoked. ) */ @@ -473,7 +473,7 @@ folerecord_method_missing(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE_RECORD#ole_instance_variable_get(name) + * ole_instance_variable_get(name) * * Returns value specified by the member name of VT_RECORD OLE object. * If the member name is not correct, KeyError exception is raised. @@ -494,7 +494,7 @@ folerecord_method_missing(int argc, VALUE *argv, VALUE self) * then accessing object_id of ComObject from Ruby is as the following: * * srver = WIN32OLE.new('ComServer.ComClass') - * obj = WIN32OLE_RECORD.new('ComObject', server) + * obj = WIN32OLE::Record.new('ComObject', server) * # obj.object_id returns Ruby Object#object_id * obj.ole_instance_variable_get(:object_id) # => nil * @@ -515,7 +515,7 @@ folerecord_ole_instance_variable_get(VALUE self, VALUE name) /* * call-seq: - * WIN32OLE_RECORD#ole_instance_variable_set(name, val) + * ole_instance_variable_set(name, val) * * Sets value specified by the member name of VT_RECORD OLE object. * If the member name is not correct, KeyError exception is raised. @@ -534,7 +534,7 @@ folerecord_ole_instance_variable_get(VALUE self, VALUE name) * then setting value of the `title' member is as following: * * srver = WIN32OLE.new('ComServer.ComClass') - * obj = WIN32OLE_RECORD.new('Book', server) + * obj = WIN32OLE::Record.new('Book', server) * obj.ole_instance_variable_set(:title, "The Ruby Book") * */ @@ -554,7 +554,7 @@ folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val) /* * call-seq: - * WIN32OLE_RECORD#inspect -> String + * inspect -> String * * Returns the OLE struct name and member name and the value of member * @@ -570,8 +570,8 @@ folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val) * then * * srver = WIN32OLE.new('ComServer.ComClass') - * obj = WIN32OLE_RECORD.new('Book', server) - * obj.inspect # => <WIN32OLE_RECORD(ComClass) {"title" => nil, "cost" => nil}> + * obj = WIN32OLE::Record.new('Book', server) + * obj.inspect # => <WIN32OLE::Record(ComClass) {"title" => nil, "cost" => nil}> * */ static VALUE @@ -584,7 +584,7 @@ folerecord_inspect(VALUE self) tname = rb_inspect(tname); } field = rb_inspect(folerecord_to_h(self)); - return rb_sprintf("#<WIN32OLE_RECORD(%"PRIsVALUE") %"PRIsVALUE">", + return rb_sprintf("#<WIN32OLE::Record(%"PRIsVALUE") %"PRIsVALUE">", tname, field); } @@ -595,6 +595,7 @@ void Init_win32ole_record(void) { cWIN32OLE_RECORD = rb_define_class_under(cWIN32OLE, "Record", rb_cObject); + /* Alias of WIN32OLE::Record, for the backward compatibility */ rb_define_const(rb_cObject, "WIN32OLE_RECORD", cWIN32OLE_RECORD); rb_define_alloc_func(cWIN32OLE_RECORD, folerecord_s_allocate); rb_define_method(cWIN32OLE_RECORD, "initialize", folerecord_initialize, 2); diff --git a/ext/win32ole/win32ole_type.c b/ext/win32ole/win32ole_type.c index 1b96aea858..45b16d6722 100644 --- a/ext/win32ole/win32ole_type.c +++ b/ext/win32ole/win32ole_type.c @@ -54,9 +54,9 @@ static const rb_data_type_t oletype_datatype = { }; /* - * Document-class: WIN32OLE_TYPE + * Document-class: WIN32OLE::Type * - * <code>WIN32OLE_TYPE</code> objects represent OLE type library information. + * +WIN32OLE::Type+ objects represent OLE type library information. */ static void @@ -106,10 +106,12 @@ ole_type_from_itypeinfo(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE.ole_classes(typelib) + * ole_classes(typelib) * - * Returns array of WIN32OLE_TYPE objects defined by the <i>typelib</i> type library. - * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.new(typelib).ole_classes instead. + * Returns array of WIN32OLE::Type objects defined by the <i>typelib</i> type library. + * + * This method will be OBSOLETE. + * Use <code>WIN32OLE::TypeLib.new(typelib).ole_classes</code> instead. */ static VALUE foletype_s_ole_classes(VALUE self, VALUE typelib) @@ -118,8 +120,8 @@ foletype_s_ole_classes(VALUE self, VALUE typelib) /* rb_warn("%s is obsolete; use %s instead.", - "WIN32OLE_TYPE.ole_classes", - "WIN32OLE_TYPELIB.new(typelib).ole_types"); + "WIN32OLE::Type.ole_classes", + "WIN32OLE::TypeLib.new(typelib).ole_types"); */ obj = rb_funcall(cWIN32OLE_TYPELIB, rb_intern("new"), 1, typelib); return rb_funcall(obj, rb_intern("ole_types"), 0); @@ -127,10 +129,12 @@ foletype_s_ole_classes(VALUE self, VALUE typelib) /* * call-seq: - * WIN32OLE_TYPE.typelibs + * typelibs * * Returns array of type libraries. - * This method will be OBSOLETE. Use WIN32OLE_TYPELIB.typelibs.collect{|t| t.name} instead. + * + * This method will be OBSOLETE. + * Use <code>WIN32OLE::TypeLib.typelibs.collect{|t| t.name}</code> instead. * */ static VALUE @@ -138,15 +142,15 @@ foletype_s_typelibs(VALUE self) { /* rb_warn("%s is obsolete. use %s instead.", - "WIN32OLE_TYPE.typelibs", - "WIN32OLE_TYPELIB.typelibs.collect{t|t.name}"); + "WIN32OLE::Type.typelibs", + "WIN32OLE::TypeLib.typelibs.collect{t|t.name}"); */ - return rb_eval_string("WIN32OLE_TYPELIB.typelibs.collect{|t|t.name}"); + return rb_eval_string("WIN32OLE::TypeLib.typelibs.collect{|t|t.name}"); } /* * call-seq: - * WIN32OLE_TYPE.progids + * progids * * Returns array of ProgID. */ @@ -214,7 +218,6 @@ create_win32ole_type(ITypeInfo *pTypeInfo, VALUE name) static VALUE oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass) { - long count; int i; HRESULT hr; @@ -245,14 +248,14 @@ oleclass_from_typelib(VALUE self, ITypeLib *pTypeLib, VALUE oleclass) /* * call-seq: - * WIN32OLE_TYPE.new(typelib, ole_class) -> WIN32OLE_TYPE object + * new(typelib, ole_class) -> WIN32OLE::Type object * - * Returns a new WIN32OLE_TYPE object. + * Returns a new WIN32OLE::Type object. * The first argument <i>typelib</i> specifies OLE type library name. * The second argument specifies OLE class name. * - * WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') - * # => WIN32OLE_TYPE object of Application class of Excel. + * WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Application') + * # => WIN32OLE::Type object of Application class of Excel. */ static VALUE foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass) @@ -284,10 +287,10 @@ foletype_initialize(VALUE self, VALUE typelib, VALUE oleclass) /* * call-seq: - * WIN32OLE_TYPE#name #=> OLE type name + * name #=> OLE type name * * Returns OLE type name. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.name # => Application */ static VALUE @@ -344,10 +347,10 @@ ole_ole_type(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#ole_type #=> OLE type string. + * ole_type #=> OLE type string. * * returns type of OLE class. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.ole_type # => Class */ static VALUE @@ -378,10 +381,10 @@ ole_type_guid(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#guid #=> GUID + * guid #=> GUID * * Returns GUID. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.guid # => {00024500-0000-0000-C000-000000000046} */ static VALUE @@ -412,10 +415,10 @@ ole_type_progid(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#progid #=> ProgID + * progid #=> ProgID * * Returns ProgID if it exists. If not found, then returns nil. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.progid # => Excel.Application.9 */ static VALUE @@ -446,10 +449,10 @@ ole_type_visible(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#visible? #=> true or false + * visible? #=> true or false * * Returns true if the OLE class is public. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Application') * puts tobj.visible # => true */ static VALUE @@ -475,10 +478,10 @@ ole_type_major_version(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#major_version + * major_version * * Returns major version. - * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') + * tobj = WIN32OLE::Type.new('Microsoft Word 10.0 Object Library', 'Documents') * puts tobj.major_version # => 8 */ static VALUE @@ -504,10 +507,10 @@ ole_type_minor_version(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#minor_version #=> OLE minor version + * minor_version #=> OLE minor version * * Returns minor version. - * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') + * tobj = WIN32OLE::Type.new('Microsoft Word 10.0 Object Library', 'Documents') * puts tobj.minor_version # => 2 */ static VALUE @@ -533,10 +536,10 @@ ole_type_typekind(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#typekind #=> number of type. + * typekind #=> number of type. * * Returns number which represents type. - * tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents') + * tobj = WIN32OLE::Type.new('Microsoft Word 10.0 Object Library', 'Documents') * puts tobj.typekind # => 4 * */ @@ -561,10 +564,10 @@ ole_type_helpstring(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#helpstring #=> help string. + * helpstring #=> help string. * * Returns help string. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser') + * tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'IWebBrowser') * puts tobj.helpstring # => Web Browser interface */ static VALUE @@ -594,10 +597,10 @@ ole_type_src_type(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#src_type #=> OLE source class + * src_type #=> OLE source class * * Returns source class when the OLE class is 'Alias'. - * tobj = WIN32OLE_TYPE.new('Microsoft Office 9.0 Object Library', 'MsoRGBType') + * tobj = WIN32OLE::Type.new('Microsoft Office 9.0 Object Library', 'MsoRGBType') * puts tobj.src_type # => I4 * */ @@ -622,10 +625,10 @@ ole_type_helpfile(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#helpfile + * helpfile * * Returns helpfile path. If helpfile is not found, then returns nil. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * puts tobj.helpfile # => C:\...\VBAXL9.CHM * */ @@ -650,10 +653,10 @@ ole_type_helpcontext(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#helpcontext + * helpcontext * * Returns helpcontext. If helpcontext is not found, then returns nil. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * puts tobj.helpfile # => 131185 */ static VALUE @@ -701,11 +704,11 @@ ole_variables(ITypeInfo *pTypeInfo) /* * call-seq: - * WIN32OLE_TYPE#variables + * variables * - * Returns array of WIN32OLE_VARIABLE objects which represent variables + * Returns array of WIN32OLE::Variable objects which represent variables * defined in OLE class. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * vars = tobj.variables * vars.each do |v| * puts "#{v.name} = #{v.value}" @@ -728,11 +731,11 @@ foletype_variables(VALUE self) /* * call-seq: - * WIN32OLE_TYPE#ole_methods # the array of WIN32OLE_METHOD objects. + * ole_methods # the array of WIN32OLE::Method objects. * - * Returns array of WIN32OLE_METHOD objects which represent OLE method defined in + * Returns array of WIN32OLE::Method objects which represent OLE method defined in * OLE type library. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * methods = tobj.ole_methods.collect{|m| * m.name * } @@ -747,11 +750,11 @@ foletype_methods(VALUE self) /* * call-seq: - * WIN32OLE_TYPE#ole_typelib + * ole_typelib * - * Returns the WIN32OLE_TYPELIB object which is including the WIN32OLE_TYPE + * Returns the WIN32OLE::TypeLib object which is including the WIN32OLE::Type * object. If it is not found, then returns nil. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * puts tobj.ole_typelib # => 'Microsoft Excel 9.0 Object Library' */ static VALUE @@ -804,11 +807,11 @@ ole_type_impl_ole_types(ITypeInfo *pTypeInfo, int implflags) /* * call-seq: - * WIN32OLE_TYPE#implemented_ole_types + * implemented_ole_types * - * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE + * Returns the array of WIN32OLE::Type object which is implemented by the WIN32OLE::Type * object. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Worksheet') * p tobj.implemented_ole_types # => [_Worksheet, DocEvents] */ static VALUE @@ -820,13 +823,13 @@ foletype_impl_ole_types(VALUE self) /* * call-seq: - * WIN32OLE_TYPE#source_ole_types + * source_ole_types * - * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE + * Returns the array of WIN32OLE::Type object which is implemented by the WIN32OLE::Type * object and having IMPLTYPEFLAG_FSOURCE. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") + * tobj = WIN32OLE::Type.new('Microsoft Internet Controls', "InternetExplorer") * p tobj.source_ole_types - * # => [#<WIN32OLE_TYPE:DWebBrowserEvents2>, #<WIN32OLE_TYPE:DWebBrowserEvents>] + * # => [#<WIN32OLE::Type:DWebBrowserEvents2>, #<WIN32OLE::Type:DWebBrowserEvents>] */ static VALUE foletype_source_ole_types(VALUE self) @@ -837,12 +840,12 @@ foletype_source_ole_types(VALUE self) /* * call-seq: - * WIN32OLE_TYPE#default_event_sources + * default_event_sources * - * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE + * Returns the array of WIN32OLE::Type object which is implemented by the WIN32OLE::Type * object and having IMPLTYPEFLAG_FSOURCE and IMPLTYPEFLAG_FDEFAULT. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") - * p tobj.default_event_sources # => [#<WIN32OLE_TYPE:DWebBrowserEvents2>] + * tobj = WIN32OLE::Type.new('Microsoft Internet Controls', "InternetExplorer") + * p tobj.default_event_sources # => [#<WIN32OLE::Type:DWebBrowserEvents2>] */ static VALUE foletype_default_event_sources(VALUE self) @@ -853,13 +856,13 @@ foletype_default_event_sources(VALUE self) /* * call-seq: - * WIN32OLE_TYPE#default_ole_types + * default_ole_types * - * Returns the array of WIN32OLE_TYPE object which is implemented by the WIN32OLE_TYPE + * Returns the array of WIN32OLE::Type object which is implemented by the WIN32OLE::Type * object and having IMPLTYPEFLAG_FDEFAULT. - * tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', "InternetExplorer") + * tobj = WIN32OLE::Type.new('Microsoft Internet Controls', "InternetExplorer") * p tobj.default_ole_types - * # => [#<WIN32OLE_TYPE:IWebBrowser2>, #<WIN32OLE_TYPE:DWebBrowserEvents2>] + * # => [#<WIN32OLE::Type:IWebBrowser2>, #<WIN32OLE::Type:DWebBrowserEvents2>] */ static VALUE foletype_default_ole_types(VALUE self) @@ -870,17 +873,17 @@ foletype_default_ole_types(VALUE self) /* * call-seq: - * WIN32OLE_TYPE#inspect -> String + * inspect -> String * * Returns the type name with class name. * * ie = WIN32OLE.new('InternetExplorer.Application') - * ie.ole_type.inspect => #<WIN32OLE_TYPE:IWebBrowser2> + * ie.ole_type.inspect => #<WIN32OLE::Type:IWebBrowser2> */ static VALUE foletype_inspect(VALUE self) { - return default_inspect(self, "WIN32OLE_TYPE"); + return default_inspect(self, "WIN32OLE::Type"); } VALUE cWIN32OLE_TYPE; @@ -888,6 +891,7 @@ VALUE cWIN32OLE_TYPE; void Init_win32ole_type(void) { cWIN32OLE_TYPE = rb_define_class_under(cWIN32OLE, "Type", rb_cObject); + /* Alias of WIN32OLE::Type, for the backward compatibility */ rb_define_const(rb_cObject, "WIN32OLE_TYPE", cWIN32OLE_TYPE); rb_define_singleton_method(cWIN32OLE_TYPE, "ole_classes", foletype_s_ole_classes, 1); rb_define_singleton_method(cWIN32OLE_TYPE, "typelibs", foletype_s_typelibs, 0); diff --git a/ext/win32ole/win32ole_typelib.c b/ext/win32ole/win32ole_typelib.c index fb68bebda8..e5eda07e76 100644 --- a/ext/win32ole/win32ole_typelib.c +++ b/ext/win32ole/win32ole_typelib.c @@ -127,19 +127,19 @@ ole_typelib_from_itypeinfo(ITypeInfo *pTypeInfo) } /* - * Document-class: WIN32OLE_TYPELIB + * Document-class: WIN32OLE::TypeLib * - * <code>WIN32OLE_TYPELIB</code> objects represent OLE tyblib information. + * +WIN32OLE::TypeLib+ objects represent OLE tyblib information. */ /* * call-seq: * - * WIN32OLE_TYPELIB.typelibs + * typelibs * - * Returns the array of WIN32OLE_TYPELIB object. + * Returns the array of WIN32OLE::TypeLib object. * - * tlibs = WIN32OLE_TYPELIB.typelibs + * tlibs = WIN32OLE::TypeLib.typelibs * */ static VALUE @@ -364,9 +364,9 @@ oletypelib_search_registry2(VALUE self, VALUE args) /* * call-seq: - * WIN32OLE_TYPELIB.new(typelib [, version1, version2]) -> WIN32OLE_TYPELIB object + * new(typelib [, version1, version2]) -> WIN32OLE::TypeLib object * - * Returns a new WIN32OLE_TYPELIB object. + * Returns a new WIN32OLE::TypeLib object. * * The first argument <i>typelib</i> specifies OLE type library name or GUID or * OLE library file. @@ -376,11 +376,11 @@ oletypelib_search_registry2(VALUE self, VALUE args) * If the first argument is type library name, then the second and third argument * are ignored. * - * tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') - * tlib2 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}') - * tlib3 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1.3) - * tlib4 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1, 3) - * tlib5 = WIN32OLE_TYPELIB.new("C:\\WINNT\\SYSTEM32\\SHELL32.DLL") + * tlib1 = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') + * tlib2 = WIN32OLE::TypeLib.new('{00020813-0000-0000-C000-000000000046}') + * tlib3 = WIN32OLE::TypeLib.new('{00020813-0000-0000-C000-000000000046}', 1.3) + * tlib4 = WIN32OLE::TypeLib.new('{00020813-0000-0000-C000-000000000046}', 1, 3) + * tlib5 = WIN32OLE::TypeLib.new("C:\\WINNT\\SYSTEM32\\SHELL32.DLL") * puts tlib1.name # -> 'Microsoft Excel 9.0 Object Library' * puts tlib2.name # -> 'Microsoft Excel 9.0 Object Library' * puts tlib3.name # -> 'Microsoft Excel 9.0 Object Library' @@ -428,11 +428,11 @@ foletypelib_initialize(VALUE self, VALUE args) /* * call-seq: - * WIN32OLE_TYPELIB#guid -> The guid string. + * guid -> The guid string. * * Returns guid string which specifies type library. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * guid = tlib.guid # -> '{00020813-0000-0000-C000-000000000046}' */ static VALUE @@ -456,11 +456,11 @@ foletypelib_guid(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#name -> The type library name + * name -> The type library name * * Returns the type library name. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * name = tlib.name # -> 'Microsoft Excel 9.0 Object Library' */ static VALUE @@ -500,11 +500,11 @@ make_version_str(VALUE major, VALUE minor) /* * call-seq: - * WIN32OLE_TYPELIB#version -> The type library version String object. + * version -> The type library version String object. * * Returns the type library version. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * puts tlib.version #-> "1.3" */ static VALUE @@ -523,11 +523,11 @@ foletypelib_version(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#major_version -> The type library major version. + * major_version -> The type library major version. * * Returns the type library major version. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * puts tlib.major_version # -> 1 */ static VALUE @@ -546,11 +546,11 @@ foletypelib_major_version(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#minor_version -> The type library minor version. + * minor_version -> The type library minor version. * * Returns the type library minor version. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * puts tlib.minor_version # -> 3 */ static VALUE @@ -568,11 +568,11 @@ foletypelib_minor_version(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#path -> The type library file path. + * path -> The type library file path. * * Returns the type library file path. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * puts tlib.path #-> 'C:\...\EXCEL9.OLB' */ static VALUE @@ -604,15 +604,15 @@ foletypelib_path(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#visible? + * visible? * * Returns true if the type library information is not hidden. * If wLibFlags of TLIBATTR is 0 or LIBFLAG_FRESTRICTED or LIBFLAG_FHIDDEN, * the method returns false, otherwise, returns true. * If the method fails to access the TLIBATTR information, then - * WIN32OLERuntimeError is raised. + * WIN32OLE::RuntimeError is raised. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * tlib.visible? # => true */ static VALUE @@ -636,12 +636,12 @@ foletypelib_visible(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#library_name + * library_name * * Returns library name. - * If the method fails to access library name, WIN32OLERuntimeError is raised. + * If the method fails to access library name, WIN32OLE::RuntimeError is raised. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * tlib.library_name # => Excel */ static VALUE @@ -790,11 +790,11 @@ typelib_file(VALUE ole) /* * call-seq: - * WIN32OLE_TYPELIB#ole_types -> The array of WIN32OLE_TYPE object included the type library. + * ole_types -> The array of WIN32OLE::Type object included the type library. * * Returns the type library file path. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') * classes = tlib.ole_types.collect{|k| k.name} # -> ['AddIn', 'AddIns' ...] */ static VALUE @@ -809,17 +809,17 @@ foletypelib_ole_types(VALUE self) /* * call-seq: - * WIN32OLE_TYPELIB#inspect -> String + * inspect -> String * * Returns the type library name with class name. * - * tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 9.0 Object Library') - * tlib.inspect # => "<#WIN32OLE_TYPELIB:Microsoft Excel 9.0 Object Library>" + * tlib = WIN32OLE::TypeLib.new('Microsoft Excel 9.0 Object Library') + * tlib.inspect # => "<#WIN32OLE::TypeLib:Microsoft Excel 9.0 Object Library>" */ static VALUE foletypelib_inspect(VALUE self) { - return default_inspect(self, "WIN32OLE_TYPELIB"); + return default_inspect(self, "WIN32OLE::TypeLib"); } VALUE cWIN32OLE_TYPELIB; @@ -827,7 +827,8 @@ VALUE cWIN32OLE_TYPELIB; void Init_win32ole_typelib(void) { - cWIN32OLE_TYPELIB = rb_define_class_under(cWIN32OLE, "Typelib", rb_cObject); + cWIN32OLE_TYPELIB = rb_define_class_under(cWIN32OLE, "TypeLib", rb_cObject); + /* Alias of WIN32OLE::TypeLib, for the backward compatibility */ rb_define_const(rb_cObject, "WIN32OLE_TYPELIB", cWIN32OLE_TYPELIB); rb_define_singleton_method(cWIN32OLE_TYPELIB, "typelibs", foletypelib_s_typelibs, 0); rb_define_alloc_func(cWIN32OLE_TYPELIB, foletypelib_s_allocate); diff --git a/ext/win32ole/win32ole_variable.c b/ext/win32ole/win32ole_variable.c index e7f58c891e..34435301d4 100644 --- a/ext/win32ole/win32ole_variable.c +++ b/ext/win32ole/win32ole_variable.c @@ -43,9 +43,9 @@ olevariable_size(const void *ptr) } /* - * Document-class: WIN32OLE_VARIABLE + * Document-class: WIN32OLE::Variable * - * <code>WIN32OLE_VARIABLE</code> objects represent OLE variable information. + * +WIN32OLE::Variable+ objects represent OLE variable information. */ VALUE @@ -63,11 +63,11 @@ create_win32ole_variable(ITypeInfo *pTypeInfo, UINT index, VALUE name) /* * call-seq: - * WIN32OLE_VARIABLE#name + * name * * Returns the name of variable. * - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * variables = tobj.variables * variables.each do |variable| * puts "#{variable.name}" @@ -103,11 +103,11 @@ ole_variable_ole_type(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: - * WIN32OLE_VARIABLE#ole_type + * ole_type * * Returns OLE type string. * - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * variables = tobj.variables * variables.each do |variable| * puts "#{variable.ole_type} #{variable.name}" @@ -145,11 +145,11 @@ ole_variable_ole_type_detail(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: - * WIN32OLE_VARIABLE#ole_type_detail + * ole_type_detail * * Returns detail information of type. The information is array of type. * - * tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS') + * tobj = WIN32OLE::Type.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS') * variable = tobj.variables.find {|variable| variable.name == 'lFlags'} * tdetail = variable.ole_type_detail * p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"] @@ -180,12 +180,12 @@ ole_variable_value(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: - * WIN32OLE_VARIABLE#value + * value * * Returns value if value is exists. If the value does not exist, * this method returns nil. * - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * variables = tobj.variables * variables.each do |variable| * puts "#{variable.name} #{variable.value}" @@ -227,11 +227,11 @@ ole_variable_visible(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: - * WIN32OLE_VARIABLE#visible? + * visible? * * Returns true if the variable is public. * - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * variables = tobj.variables * variables.each do |variable| * puts "#{variable.name} #{variable.visible?}" @@ -284,11 +284,11 @@ ole_variable_kind(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: - * WIN32OLE_VARIABLE#variable_kind + * variable_kind * * Returns variable kind string. * - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * variables = tobj.variables * variables.each do |variable| * puts "#{variable.name} #{variable.variable_kind}" @@ -325,10 +325,10 @@ ole_variable_varkind(ITypeInfo *pTypeInfo, UINT var_index) /* * call-seq: - * WIN32OLE_VARIABLE#varkind + * varkind * * Returns the number which represents variable kind. - * tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') + * tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') * variables = tobj.variables * variables.each do |variable| * puts "#{variable.name} #{variable.varkind}" @@ -351,7 +351,7 @@ folevariable_varkind(VALUE self) /* * call-seq: - * WIN32OLE_VARIABLE#inspect -> String + * inspect -> String * * Returns the OLE variable name and the value with class name. * @@ -362,7 +362,7 @@ folevariable_inspect(VALUE self) VALUE v = rb_inspect(folevariable_value(self)); VALUE n = folevariable_name(self); VALUE detail = rb_sprintf("%"PRIsVALUE"=%"PRIsVALUE, n, v); - return make_inspect("WIN32OLE_VARIABLE", detail); + return make_inspect("WIN32OLE::Variable", detail); } VALUE cWIN32OLE_VARIABLE; @@ -370,6 +370,7 @@ VALUE cWIN32OLE_VARIABLE; void Init_win32ole_variable(void) { cWIN32OLE_VARIABLE = rb_define_class_under(cWIN32OLE, "Variable", rb_cObject); + /* Alias of WIN32OLE::Variable, for the backward compatibility */ rb_define_const(rb_cObject, "WIN32OLE_VARIABLE", cWIN32OLE_VARIABLE); rb_undef_alloc_func(cWIN32OLE_VARIABLE); rb_define_method(cWIN32OLE_VARIABLE, "name", folevariable_name, 0); diff --git a/ext/win32ole/win32ole_variant.c b/ext/win32ole/win32ole_variant.c index f1d83ed2e1..45c70b1dc3 100644 --- a/ext/win32ole/win32ole_variant.c +++ b/ext/win32ole/win32ole_variant.c @@ -267,7 +267,7 @@ folevariant_s_allocate(VALUE klass) /* * call-seq: - * WIN32OLE_VARIANT.array(ary, vt) + * array(ary, vt) * * Returns Ruby object wrapping OLE variant whose variant type is VT_ARRAY. * The first argument should be Array object which specifies dimensions @@ -277,7 +277,7 @@ folevariant_s_allocate(VALUE klass) * The following create 2 dimensions OLE array. The first dimensions size * is 3, and the second is 4. * - * ole_ary = WIN32OLE_VARIANT.array([3,4], VT_I4) + * ole_ary = WIN32OLE::Variant.array([3,4], VT_I4) * ruby_ary = ole_ary.value # => [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] * */ @@ -357,44 +357,44 @@ check_type_val2variant(VALUE val) case T_NIL: break; default: - rb_raise(rb_eTypeError, "can not convert WIN32OLE_VARIANT from type %s", + rb_raise(rb_eTypeError, "can not convert WIN32OLE::Variant from type %s", rb_obj_classname(val)); } } } /* - * Document-class: WIN32OLE_VARIANT + * Document-class: WIN32OLE::Variant * - * <code>WIN32OLE_VARIANT</code> objects represents OLE variant. + * +WIN32OLE::Variant+ objects represents OLE variant. * * Win32OLE converts Ruby object into OLE variant automatically when * invoking OLE methods. If OLE method requires the argument which is * different from the variant by automatic conversion of Win32OLE, you - * can convert the specified variant type by using WIN32OLE_VARIANT class. + * can convert the specified variant type by using WIN32OLE::Variant class. * - * param = WIN32OLE_VARIANT.new(10, WIN32OLE::VARIANT::VT_R4) + * param = WIN32OLE::Variant.new(10, WIN32OLE::VARIANT::VT_R4) * oleobj.method(param) * - * WIN32OLE_VARIANT does not support VT_RECORD variant. Use WIN32OLE_RECORD - * class instead of WIN32OLE_VARIANT if the VT_RECORD variant is needed. + * WIN32OLE::Variant does not support VT_RECORD variant. Use WIN32OLE::Record + * class instead of WIN32OLE::Variant if the VT_RECORD variant is needed. */ /* * call-seq: - * WIN32OLE_VARIANT.new(val, vartype) #=> WIN32OLE_VARIANT object. + * new(val, vartype) #=> WIN32OLE::Variant object. * * Returns Ruby object wrapping OLE variant. * The first argument specifies Ruby object to convert OLE variant variable. * The second argument specifies VARIANT type. - * In some situation, you need the WIN32OLE_VARIANT object to pass OLE method + * In some situation, you need the WIN32OLE::Variant object to pass OLE method * * shell = WIN32OLE.new("Shell.Application") * folder = shell.NameSpace("C:\\Windows") * item = folder.ParseName("tmp.txt") * # You can't use Ruby String object to call FolderItem.InvokeVerb. - * # Instead, you have to use WIN32OLE_VARIANT object to call the method. - * shortcut = WIN32OLE_VARIANT.new("Create Shortcut(\&S)") + * # Instead, you have to use WIN32OLE::Variant object to call the method. + * shortcut = WIN32OLE::Variant.new("Create Shortcut(\&S)") * item.invokeVerb(shortcut) * */ @@ -422,7 +422,7 @@ folevariant_initialize(VALUE self, VALUE args) vvt = rb_ary_entry(args, 1); vt = RB_NUM2INT(vvt); if ((vt & VT_TYPEMASK) == VT_RECORD) { - rb_raise(rb_eArgError, "not supported VT_RECORD WIN32OLE_VARIANT object"); + rb_raise(rb_eArgError, "not supported VT_RECORD WIN32OLE::Variant object"); } ole_val2olevariantdata(val, vt, pvar); } @@ -482,22 +482,22 @@ unlock_safe_array(SAFEARRAY *psa) /* * call-seq: - * WIN32OLE_VARIANT[i,j,...] #=> element of OLE array. + * variant[i,j,...] #=> element of OLE array. * - * Returns the element of WIN32OLE_VARIANT object(OLE array). + * Returns the element of WIN32OLE::Variant object(OLE array). * This method is available only when the variant type of - * WIN32OLE_VARIANT object is VT_ARRAY. + * WIN32OLE::Variant object is VT_ARRAY. * * REMARK: * The all indices should be 0 or natural number and * lower than or equal to max indices. * (This point is different with Ruby Array indices.) * - * obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]]) + * obj = WIN32OLE::Variant.new([[1,2,3],[4,5,6]]) * p obj[0,0] # => 1 * p obj[1,0] # => 4 - * p obj[2,0] # => WIN32OLERuntimeError - * p obj[0, -1] # => WIN32OLERuntimeError + * p obj[2,0] # => WIN32OLE::RuntimeError + * p obj[0, -1] # => WIN32OLE::RuntimeError * */ static VALUE @@ -537,23 +537,23 @@ folevariant_ary_aref(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE_VARIANT[i,j,...] = val #=> set the element of OLE array + * variant[i,j,...] = val #=> set the element of OLE array * - * Set the element of WIN32OLE_VARIANT object(OLE array) to val. + * Set the element of WIN32OLE::Variant object(OLE array) to val. * This method is available only when the variant type of - * WIN32OLE_VARIANT object is VT_ARRAY. + * WIN32OLE::Variant object is VT_ARRAY. * * REMARK: * The all indices should be 0 or natural number and * lower than or equal to max indices. * (This point is different with Ruby Array indices.) * - * obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]]) + * obj = WIN32OLE::Variant.new([[1,2,3],[4,5,6]]) * obj[0,0] = 7 * obj[1,0] = 8 * p obj.value # => [[7,2,3], [8,5,6]] - * obj[2,0] = 9 # => WIN32OLERuntimeError - * obj[0, -1] = 9 # => WIN32OLERuntimeError + * obj[2,0] = 9 # => WIN32OLE::RuntimeError + * obj[0, -1] = 9 # => WIN32OLE::RuntimeError * */ static VALUE @@ -598,10 +598,10 @@ folevariant_ary_aset(int argc, VALUE *argv, VALUE self) /* * call-seq: - * WIN32OLE_VARIANT.value #=> Ruby object. + * value #=> Ruby object. * * Returns Ruby object value from OLE variant. - * obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR) + * obj = WIN32OLE::Variant.new(1, WIN32OLE::VARIANT::VT_BSTR) * obj.value # => "1" (not Integer object, but String object "1") * */ @@ -637,10 +637,10 @@ folevariant_value(VALUE self) /* * call-seq: - * WIN32OLE_VARIANT.vartype #=> OLE variant type. + * vartype #=> OLE variant type. * * Returns OLE variant type. - * obj = WIN32OLE_VARIANT.new("string") + * obj = WIN32OLE::Variant.new("string") * obj.vartype # => WIN32OLE::VARIANT::VT_BSTR * */ @@ -654,7 +654,7 @@ folevariant_vartype(VALUE self) /* * call-seq: - * WIN32OLE_VARIANT.value = val #=> set WIN32OLE_VARIANT value to val. + * variant.value = val #=> set WIN32OLE::Variant value to val. * * Sets variant value to val. If the val type does not match variant value * type(vartype), then val is changed to match variant value type(vartype) @@ -662,7 +662,7 @@ folevariant_vartype(VALUE self) * This method is not available when vartype is VT_ARRAY(except VT_UI1|VT_ARRAY). * If the vartype is VT_UI1|VT_ARRAY, the val should be String object. * - * obj = WIN32OLE_VARIANT.new(1) # obj.vartype is WIN32OLE::VARIANT::VT_I4 + * obj = WIN32OLE::Variant.new(1) # obj.vartype is WIN32OLE::VARIANT::VT_I4 * obj.value = 3.2 # 3.2 is changed to 3 when setting value. * p obj.value # => 3 */ @@ -696,6 +696,7 @@ Init_win32ole_variant(void) { #undef rb_intern cWIN32OLE_VARIANT = rb_define_class_under(cWIN32OLE, "Variant", rb_cObject); + /* Alias of WIN32OLE::Variant, for the backward compatibility */ rb_define_const(rb_cObject, "WIN32OLE_VARIANT", cWIN32OLE_VARIANT); rb_define_alloc_func(cWIN32OLE_VARIANT, folevariant_s_allocate); rb_define_singleton_method(cWIN32OLE_VARIANT, "array", folevariant_s_array, 2); @@ -729,7 +730,7 @@ Init_win32ole_variant(void) * This constants is used for not specified parameter. * * fso = WIN32OLE.new("Scripting.FileSystemObject") - * fso.openTextFile(filename, WIN32OLE_VARIANT::NoParam, false) + * fso.openTextFile(filename, WIN32OLE::Variant::NoParam, false) */ rb_define_const(cWIN32OLE_VARIANT, "NoParam", rb_funcall(cWIN32OLE_VARIANT, rb_intern("new"), 2, INT2NUM(DISP_E_PARAMNOTFOUND), RB_INT2FIX(VT_ERROR))); diff --git a/ext/win32ole/win32ole_variant_m.c b/ext/win32ole/win32ole_variant_m.c index c285a00177..d879506be3 100644 --- a/ext/win32ole/win32ole_variant_m.c +++ b/ext/win32ole/win32ole_variant_m.c @@ -5,16 +5,18 @@ VALUE mWIN32OLE_VARIANT; void Init_win32ole_variant_m(void) { /* - * Document-module: WIN32OLE::VARIANT + * Document-module: WIN32OLE::VariantType * - * The WIN32OLE::VARIANT module includes constants of VARIANT type constants. - * The constants is used when creating WIN32OLE_VARIANT object. + * The +WIN32OLE::VariantType+ module includes constants of VARIANT type constants. + * The constants is used when creating WIN32OLE::Variant object. * - * obj = WIN32OLE_VARIANT.new("2e3", WIN32OLE::VARIANT::VT_R4) + * obj = WIN32OLE::Variant.new("2e3", WIN32OLE::VARIANT::VT_R4) * obj.value # => 2000.0 * */ - mWIN32OLE_VARIANT = rb_define_module_under(cWIN32OLE, "VARIANT"); + mWIN32OLE_VARIANT = rb_define_module_under(cWIN32OLE, "VariantType"); + /* Alias of WIN32OLE::VariantType, for the backward compatibility */ + rb_define_const(cWIN32OLE, "VARIANT", mWIN32OLE_VARIANT); /* * represents VT_EMPTY type constant. diff --git a/ext/zlib/depend b/ext/zlib/depend index 15186f8266..bdce420264 100644 --- a/ext/zlib/depend +++ b/ext/zlib/depend @@ -53,6 +53,7 @@ zlib.o: $(hdrdir)/ruby/internal/attr/noexcept.h zlib.o: $(hdrdir)/ruby/internal/attr/noinline.h zlib.o: $(hdrdir)/ruby/internal/attr/nonnull.h zlib.o: $(hdrdir)/ruby/internal/attr/noreturn.h +zlib.o: $(hdrdir)/ruby/internal/attr/packed_struct.h zlib.o: $(hdrdir)/ruby/internal/attr/pure.h zlib.o: $(hdrdir)/ruby/internal/attr/restrict.h zlib.o: $(hdrdir)/ruby/internal/attr/returns_nonnull.h @@ -121,7 +122,6 @@ zlib.o: $(hdrdir)/ruby/internal/intern/enumerator.h zlib.o: $(hdrdir)/ruby/internal/intern/error.h zlib.o: $(hdrdir)/ruby/internal/intern/eval.h zlib.o: $(hdrdir)/ruby/internal/intern/file.h -zlib.o: $(hdrdir)/ruby/internal/intern/gc.h zlib.o: $(hdrdir)/ruby/internal/intern/hash.h zlib.o: $(hdrdir)/ruby/internal/intern/io.h zlib.o: $(hdrdir)/ruby/internal/intern/load.h @@ -152,12 +152,12 @@ zlib.o: $(hdrdir)/ruby/internal/memory.h zlib.o: $(hdrdir)/ruby/internal/method.h zlib.o: $(hdrdir)/ruby/internal/module.h zlib.o: $(hdrdir)/ruby/internal/newobj.h -zlib.o: $(hdrdir)/ruby/internal/rgengc.h zlib.o: $(hdrdir)/ruby/internal/scan_args.h zlib.o: $(hdrdir)/ruby/internal/special_consts.h zlib.o: $(hdrdir)/ruby/internal/static_assert.h zlib.o: $(hdrdir)/ruby/internal/stdalign.h zlib.o: $(hdrdir)/ruby/internal/stdbool.h +zlib.o: $(hdrdir)/ruby/internal/stdckdint.h zlib.o: $(hdrdir)/ruby/internal/symbol.h zlib.o: $(hdrdir)/ruby/internal/value.h zlib.o: $(hdrdir)/ruby/internal/value_type.h diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb index 5477f49178..2b2dbb1a5b 100644 --- a/ext/zlib/extconf.rb +++ b/ext/zlib/extconf.rb @@ -11,10 +11,9 @@ require 'rbconfig' dir_config 'zlib' libs = $libs -if %w'z libz zlib1 zlib zdll zlibwapi'.find {|z| have_library(z, 'deflateReset')} and - have_header('zlib.h') then - have_zlib = true -else +have_zlib = %w'z libz zlib1 zlib zdll zlibwapi'.any? {|z| have_library(z, 'deflateReset(NULL)', 'zlib.h')} + +unless have_zlib $libs = libs unless File.directory?(zsrc = "#{$srcdir}/zlib") dirs = Dir.open($srcdir) {|z| z.grep(/\Azlib-\d+[.\d]*\z/) {|x|"#{$srcdir}/#{x}"}} @@ -121,12 +120,18 @@ if have_zlib $defs << "-DHAVE_CRC32_COMBINE" $defs << "-DHAVE_ADLER32_COMBINE" $defs << "-DHAVE_TYPE_Z_CRC_T" - $defs << "-DHAVE_TYPE_Z_SIZE_T" + $defs << "-DHAVE_CRC32_Z" + $defs << "-DHAVE_ADLER32_Z" + $defs << "-DHAVE_ZLIB_SIZE_T_FUNCS" else have_func('crc32_combine', 'zlib.h') have_func('adler32_combine', 'zlib.h') have_type('z_crc_t', 'zlib.h') - have_type('z_size_t', 'zlib.h') + if (have_type('z_size_t', 'zlib.h') && + have_func('crc32_z', 'zlib.h') && + have_func('adler32_z', 'zlib.h')) + $defs << "-DHAVE_ZLIB_SIZE_T_FUNCS" + end end create_makefile('zlib') {|conf| diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 20079a5d4c..aad9f8d28a 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -25,7 +25,7 @@ # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0 #endif -#define RUBY_ZLIB_VERSION "2.1.1" +#define RUBY_ZLIB_VERSION "3.1.0" #ifndef RB_PASS_CALLED_KEYWORDS # define rb_class_new_instance_kw(argc, argv, klass, kw_splat) rb_class_new_instance(argc, argv, klass) @@ -44,7 +44,7 @@ #endif #endif -#if defined(HAVE_TYPE_Z_SIZE_T) +#if defined(HAVE_ZLIB_SIZE_T_FUNCS) typedef uLong (*checksum_func)(uLong, const Bytef*, z_size_t); # define crc32 crc32_z # define adler32 adler32_z @@ -90,7 +90,7 @@ static void zstream_expand_buffer_into(struct zstream*, unsigned long); static int zstream_expand_buffer_non_stream(struct zstream *z); static void zstream_append_buffer(struct zstream*, const Bytef*, long); static VALUE zstream_detach_buffer(struct zstream*); -static VALUE zstream_shift_buffer(struct zstream*, long); +static VALUE zstream_shift_buffer(struct zstream*, long, VALUE); static void zstream_buffer_ungets(struct zstream*, const Bytef*, unsigned long); static void zstream_buffer_ungetbyte(struct zstream*, int); static void zstream_append_input(struct zstream*, const Bytef*, long); @@ -170,8 +170,8 @@ static void gzfile_check_footer(struct gzfile*, VALUE outbuf); static void gzfile_write(struct gzfile*, Bytef*, long); static long gzfile_read_more(struct gzfile*, VALUE outbuf); static void gzfile_calc_crc(struct gzfile*, VALUE); -static VALUE gzfile_read(struct gzfile*, long); -static VALUE gzfile_read_all(struct gzfile*); +static VALUE gzfile_read(struct gzfile*, long, VALUE); +static VALUE gzfile_read_all(struct gzfile*, VALUE); static void gzfile_ungets(struct gzfile*, const Bytef*, long); static void gzfile_ungetbyte(struct gzfile*, int); static VALUE gzfile_writer_end_run(VALUE); @@ -388,7 +388,7 @@ rb_zlib_version(VALUE klass) # define mask32(x) (x) #endif -#if SIZEOF_LONG > SIZEOF_INT && !defined(HAVE_TYPE_Z_SIZE_T) +#if SIZEOF_LONG > SIZEOF_INT && !defined(HAVE_ZLIB_SIZE_T_FUNCS) static uLong checksum_long(uLong (*func)(uLong, const Bytef*, uInt), uLong sum, const Bytef *ptr, long len) { @@ -820,19 +820,31 @@ zstream_detach_buffer(struct zstream *z) } static VALUE -zstream_shift_buffer(struct zstream *z, long len) +zstream_shift_buffer(struct zstream *z, long len, VALUE dst) { - VALUE dst; char *bufptr; long buflen = ZSTREAM_BUF_FILLED(z); if (buflen <= len) { - return zstream_detach_buffer(z); + if (NIL_P(dst) || (!ZSTREAM_IS_FINISHED(z) && !ZSTREAM_IS_GZFILE(z) && + rb_block_given_p())) { + return zstream_detach_buffer(z); + } else { + bufptr = RSTRING_PTR(z->buf); + rb_str_resize(dst, buflen); + memcpy(RSTRING_PTR(dst), bufptr, buflen); + } + buflen = 0; + } else { + bufptr = RSTRING_PTR(z->buf); + if (NIL_P(dst)) { + dst = rb_str_new(bufptr, len); + } else { + rb_str_resize(dst, len); + memcpy(RSTRING_PTR(dst), bufptr, len); + } + buflen -= len; } - - bufptr = RSTRING_PTR(z->buf); - dst = rb_str_new(bufptr, len); - buflen -= len; memmove(bufptr, bufptr + len, buflen); rb_str_set_len(z->buf, buflen); z->stream.next_out = (Bytef*)RSTRING_END(z->buf); @@ -923,7 +935,7 @@ zstream_discard_input(struct zstream *z, long len) z->input = Qnil; } else { - z->input = rb_str_substr(z->input, len, + z->input = rb_str_subseq(z->input, len, RSTRING_LEN(z->input) - len); } } @@ -2874,18 +2886,18 @@ gzfile_newstr(struct gzfile *gz, VALUE str) } static long -gzfile_fill(struct gzfile *gz, long len) +gzfile_fill(struct gzfile *gz, long len, VALUE outbuf) { if (len < 0) rb_raise(rb_eArgError, "negative length %ld given", len); if (len == 0) return 0; while (!ZSTREAM_IS_FINISHED(&gz->z) && ZSTREAM_BUF_FILLED(&gz->z) < len) { - gzfile_read_more(gz, Qnil); + gzfile_read_more(gz, outbuf); } if (GZFILE_IS_FINISHED(gz)) { if (!(gz->z.flags & GZFILE_FLAG_FOOTER_FINISHED)) { - gzfile_check_footer(gz, Qnil); + gzfile_check_footer(gz, outbuf); } return -1; } @@ -2893,14 +2905,27 @@ gzfile_fill(struct gzfile *gz, long len) } static VALUE -gzfile_read(struct gzfile *gz, long len) +gzfile_read(struct gzfile *gz, long len, VALUE outbuf) { VALUE dst; - len = gzfile_fill(gz, len); - if (len == 0) return rb_str_new(0, 0); - if (len < 0) return Qnil; - dst = zstream_shift_buffer(&gz->z, len); + len = gzfile_fill(gz, len, outbuf); + + if (len < 0) { + if (!NIL_P(outbuf)) + rb_str_resize(outbuf, 0); + return Qnil; + } + if (len == 0) { + if (NIL_P(outbuf)) + return rb_str_new(0, 0); + else { + rb_str_resize(outbuf, 0); + return outbuf; + } + } + + dst = zstream_shift_buffer(&gz->z, len, outbuf); if (!NIL_P(dst)) gzfile_calc_crc(gz, dst); return dst; } @@ -2933,29 +2958,26 @@ gzfile_readpartial(struct gzfile *gz, long len, VALUE outbuf) rb_raise(rb_eEOFError, "end of file reached"); } - dst = zstream_shift_buffer(&gz->z, len); + dst = zstream_shift_buffer(&gz->z, len, outbuf); gzfile_calc_crc(gz, dst); - if (!NIL_P(outbuf)) { - rb_str_resize(outbuf, RSTRING_LEN(dst)); - memcpy(RSTRING_PTR(outbuf), RSTRING_PTR(dst), RSTRING_LEN(dst)); - dst = outbuf; - } return dst; } static VALUE -gzfile_read_all(struct gzfile *gz) +gzfile_read_all(struct gzfile *gz, VALUE dst) { - VALUE dst; - while (!ZSTREAM_IS_FINISHED(&gz->z)) { - gzfile_read_more(gz, Qnil); + gzfile_read_more(gz, dst); } if (GZFILE_IS_FINISHED(gz)) { if (!(gz->z.flags & GZFILE_FLAG_FOOTER_FINISHED)) { - gzfile_check_footer(gz, Qnil); + gzfile_check_footer(gz, dst); } + if (!NIL_P(dst)) { + rb_str_resize(dst, 0); + return dst; + } return rb_str_new(0, 0); } @@ -2993,7 +3015,7 @@ gzfile_getc(struct gzfile *gz) de = (unsigned char *)ds + GZFILE_CBUF_CAPA; (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); + dst = zstream_shift_buffer(&gz->z, sp - ss, Qnil); gzfile_calc_crc(gz, dst); rb_str_resize(cbuf, dp - ds); return cbuf; @@ -3001,7 +3023,7 @@ gzfile_getc(struct gzfile *gz) else { buf = gz->z.buf; len = rb_enc_mbclen(RSTRING_PTR(buf), RSTRING_END(buf), gz->enc); - dst = gzfile_read(gz, len); + dst = gzfile_read(gz, len, Qnil); if (NIL_P(dst)) return dst; return gzfile_newstr(gz, dst); } @@ -3500,6 +3522,9 @@ static VALUE rb_gzfile_eof_p(VALUE obj) { struct gzfile *gz = get_gzfile(obj); + while (!ZSTREAM_IS_FINISHED(&gz->z) && ZSTREAM_BUF_FILLED(&gz->z) == 0) { + gzfile_read_more(gz, Qnil); + } return GZFILE_IS_FINISHED(gz) ? Qtrue : Qfalse; } @@ -3906,7 +3931,7 @@ rb_gzreader_s_zcat(int argc, VALUE *argv, VALUE klass) if (!buf) { buf = rb_str_new(0, 0); } - tmpbuf = gzfile_read_all(get_gzfile(obj)); + tmpbuf = gzfile_read_all(get_gzfile(obj), Qnil); rb_str_cat(buf, RSTRING_PTR(tmpbuf), RSTRING_LEN(tmpbuf)); } @@ -4008,19 +4033,19 @@ static VALUE rb_gzreader_read(int argc, VALUE *argv, VALUE obj) { struct gzfile *gz = get_gzfile(obj); - VALUE vlen; + VALUE vlen, outbuf; long len; - rb_scan_args(argc, argv, "01", &vlen); + rb_scan_args(argc, argv, "02", &vlen, &outbuf); if (NIL_P(vlen)) { - return gzfile_read_all(gz); + return gzfile_read_all(gz, outbuf); } len = NUM2INT(vlen); if (len < 0) { rb_raise(rb_eArgError, "negative length %ld given", len); } - return gzfile_read(gz, len); + return gzfile_read(gz, len, outbuf); } /* @@ -4093,7 +4118,7 @@ rb_gzreader_getbyte(VALUE obj) struct gzfile *gz = get_gzfile(obj); VALUE dst; - dst = gzfile_read(gz, 1); + dst = gzfile_read(gz, 1, Qnil); if (!NIL_P(dst)) { dst = INT2FIX((unsigned int)(RSTRING_PTR(dst)[0]) & 0xff); } @@ -4214,7 +4239,7 @@ gzreader_skip_linebreaks(struct gzfile *gz) } } - str = zstream_shift_buffer(&gz->z, n - 1); + str = zstream_shift_buffer(&gz->z, n - 1, Qnil); gzfile_calc_crc(gz, str); } @@ -4235,7 +4260,7 @@ gzreader_charboundary(struct gzfile *gz, long n) if (l < n) { int n_bytes = rb_enc_precise_mbclen(p, e, gz->enc); if (MBCLEN_NEEDMORE_P(n_bytes)) { - if ((l = gzfile_fill(gz, n + MBCLEN_NEEDMORE_LEN(n_bytes))) > 0) { + if ((l = gzfile_fill(gz, n + MBCLEN_NEEDMORE_LEN(n_bytes), Qnil)) > 0) { return l; } } @@ -4287,10 +4312,10 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj) if (NIL_P(rs)) { if (limit < 0) { - dst = gzfile_read_all(gz); + dst = gzfile_read_all(gz, Qnil); if (RSTRING_LEN(dst) == 0) return Qnil; } - else if ((n = gzfile_fill(gz, limit)) <= 0) { + else if ((n = gzfile_fill(gz, limit, Qnil)) <= 0) { return Qnil; } else { @@ -4300,7 +4325,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj) else { n = limit; } - dst = zstream_shift_buffer(&gz->z, n); + dst = zstream_shift_buffer(&gz->z, n, Qnil); if (NIL_P(dst)) return dst; gzfile_calc_crc(gz, dst); dst = gzfile_newstr(gz, dst); @@ -4327,7 +4352,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj) while (ZSTREAM_BUF_FILLED(&gz->z) < rslen) { if (ZSTREAM_IS_FINISHED(&gz->z)) { if (ZSTREAM_BUF_FILLED(&gz->z) > 0) gz->lineno++; - return gzfile_read(gz, rslen); + return gzfile_read(gz, rslen, Qnil); } gzfile_read_more(gz, Qnil); } @@ -4364,7 +4389,7 @@ gzreader_gets(int argc, VALUE *argv, VALUE obj) } gz->lineno++; - dst = gzfile_read(gz, n); + dst = gzfile_read(gz, n, Qnil); if (NIL_P(dst)) return dst; if (rspara) { gzreader_skip_linebreaks(gz); diff --git a/ext/zlib/zlib.gemspec b/ext/zlib/zlib.gemspec index 4a5f8f2ee8..bb67ea156c 100644 --- a/ext/zlib/zlib.gemspec +++ b/ext/zlib/zlib.gemspec @@ -27,5 +27,5 @@ Gem::Specification.new do |spec| spec.executables = [] spec.require_paths = ["lib"] spec.extensions = "ext/zlib/extconf.rb" - spec.required_ruby_version = ">= 2.3.0" + spec.required_ruby_version = ">= 2.5.0" end |