diff options
Diffstat (limited to 'ruby_2_2/ext/-test-')
133 files changed, 0 insertions, 3270 deletions
diff --git a/ruby_2_2/ext/-test-/array/resize/extconf.rb b/ruby_2_2/ext/-test-/array/resize/extconf.rb deleted file mode 100644 index 6500a878fc..0000000000 --- a/ruby_2_2/ext/-test-/array/resize/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/array/resize") diff --git a/ruby_2_2/ext/-test-/array/resize/resize.c b/ruby_2_2/ext/-test-/array/resize/resize.c deleted file mode 100644 index 08bcee3e7a..0000000000 --- a/ruby_2_2/ext/-test-/array/resize/resize.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "ruby/ruby.h" - -static VALUE -ary_resize(VALUE ary, VALUE len) -{ - rb_ary_resize(ary, NUM2LONG(len)); - return ary; -} - -void -Init_resize(void) -{ - rb_define_method(rb_cArray, "__resize__", ary_resize, 1); -} diff --git a/ruby_2_2/ext/-test-/bignum/big2str.c b/ruby_2_2/ext/-test-/bignum/big2str.c deleted file mode 100644 index ec4bde2915..0000000000 --- a/ruby_2_2/ext/-test-/bignum/big2str.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "internal.h" - -static VALUE -big(VALUE x) -{ - if (FIXNUM_P(x)) - return rb_int2big(FIX2LONG(x)); - if (RB_TYPE_P(x, T_BIGNUM)) - return x; - rb_raise(rb_eTypeError, "can't convert %s to Bignum", - rb_obj_classname(x)); -} - -static VALUE -big2str_generic(VALUE x, VALUE vbase) -{ - int base = NUM2INT(vbase); - if (base < 2 || 36 < base) - rb_raise(rb_eArgError, "invalid radix %d", base); - return rb_big2str_generic(big(x), base); -} - -#define POW2_P(x) (((x)&((x)-1))==0) - -static VALUE -big2str_poweroftwo(VALUE x, VALUE vbase) -{ - int base = NUM2INT(vbase); - if (base < 2 || 36 < base || !POW2_P(base)) - rb_raise(rb_eArgError, "invalid radix %d", base); - return rb_big2str_poweroftwo(big(x), base); -} - -#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) -static VALUE -big2str_gmp(VALUE x, VALUE vbase) -{ - int base = NUM2INT(vbase); - if (base < 2 || 36 < base) - rb_raise(rb_eArgError, "invalid radix %d", base); - return rb_big2str_gmp(big(x), base); -} -#else -#define big2str_gmp rb_f_notimplement -#endif - -void -Init_big2str(VALUE klass) -{ - rb_define_method(rb_cInteger, "big2str_generic", big2str_generic, 1); - rb_define_method(rb_cInteger, "big2str_poweroftwo", big2str_poweroftwo, 1); - rb_define_method(rb_cInteger, "big2str_gmp", big2str_gmp, 1); -} diff --git a/ruby_2_2/ext/-test-/bignum/bigzero.c b/ruby_2_2/ext/-test-/bignum/bigzero.c deleted file mode 100644 index 35117db7ae..0000000000 --- a/ruby_2_2/ext/-test-/bignum/bigzero.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "internal.h" - -static VALUE -bug_big_zero(VALUE self, VALUE length) -{ - long len = NUM2ULONG(length); - VALUE z = rb_big_new(len, 1); - MEMZERO(BIGNUM_DIGITS(z), BDIGIT, len); - return z; -} - -static VALUE -bug_big_negzero(VALUE self, VALUE length) -{ - long len = NUM2ULONG(length); - VALUE z = rb_big_new(len, 0); - MEMZERO(BIGNUM_DIGITS(z), BDIGIT, len); - return z; -} - -void -Init_bigzero(VALUE klass) -{ - rb_define_singleton_method(klass, "zero", bug_big_zero, 1); - rb_define_singleton_method(klass, "negzero", bug_big_negzero, 1); -} diff --git a/ruby_2_2/ext/-test-/bignum/depend b/ruby_2_2/ext/-test-/bignum/depend deleted file mode 100644 index 26cb890dbf..0000000000 --- a/ruby_2_2/ext/-test-/bignum/depend +++ /dev/null @@ -1,102 +0,0 @@ -big2str.o: big2str.c -div.o: div.c -intpack.o: intpack.c -mul.o: mul.c -str2big.o: str2big.c - -# AUTOGENERATED DEPENDENCIES START -big2str.o: $(RUBY_EXTCONF_H) -big2str.o: $(arch_hdrdir)/ruby/config.h -big2str.o: $(hdrdir)/ruby/defines.h -big2str.o: $(hdrdir)/ruby/encoding.h -big2str.o: $(hdrdir)/ruby/intern.h -big2str.o: $(hdrdir)/ruby/io.h -big2str.o: $(hdrdir)/ruby/missing.h -big2str.o: $(hdrdir)/ruby/oniguruma.h -big2str.o: $(hdrdir)/ruby/ruby.h -big2str.o: $(hdrdir)/ruby/st.h -big2str.o: $(hdrdir)/ruby/subst.h -big2str.o: $(top_srcdir)/include/ruby.h -big2str.o: $(top_srcdir)/internal.h -big2str.o: big2str.c -bigzero.o: $(RUBY_EXTCONF_H) -bigzero.o: $(arch_hdrdir)/ruby/config.h -bigzero.o: $(hdrdir)/ruby/defines.h -bigzero.o: $(hdrdir)/ruby/encoding.h -bigzero.o: $(hdrdir)/ruby/intern.h -bigzero.o: $(hdrdir)/ruby/io.h -bigzero.o: $(hdrdir)/ruby/missing.h -bigzero.o: $(hdrdir)/ruby/oniguruma.h -bigzero.o: $(hdrdir)/ruby/ruby.h -bigzero.o: $(hdrdir)/ruby/st.h -bigzero.o: $(hdrdir)/ruby/subst.h -bigzero.o: $(top_srcdir)/include/ruby.h -bigzero.o: $(top_srcdir)/internal.h -bigzero.o: bigzero.c -div.o: $(RUBY_EXTCONF_H) -div.o: $(arch_hdrdir)/ruby/config.h -div.o: $(hdrdir)/ruby/defines.h -div.o: $(hdrdir)/ruby/encoding.h -div.o: $(hdrdir)/ruby/intern.h -div.o: $(hdrdir)/ruby/io.h -div.o: $(hdrdir)/ruby/missing.h -div.o: $(hdrdir)/ruby/oniguruma.h -div.o: $(hdrdir)/ruby/ruby.h -div.o: $(hdrdir)/ruby/st.h -div.o: $(hdrdir)/ruby/subst.h -div.o: $(top_srcdir)/include/ruby.h -div.o: $(top_srcdir)/internal.h -div.o: div.c -init.o: $(RUBY_EXTCONF_H) -init.o: $(arch_hdrdir)/ruby/config.h -init.o: $(hdrdir)/ruby/defines.h -init.o: $(hdrdir)/ruby/intern.h -init.o: $(hdrdir)/ruby/missing.h -init.o: $(hdrdir)/ruby/ruby.h -init.o: $(hdrdir)/ruby/st.h -init.o: $(hdrdir)/ruby/subst.h -init.o: $(top_srcdir)/include/ruby.h -init.o: init.c -intpack.o: $(RUBY_EXTCONF_H) -intpack.o: $(arch_hdrdir)/ruby/config.h -intpack.o: $(hdrdir)/ruby/defines.h -intpack.o: $(hdrdir)/ruby/encoding.h -intpack.o: $(hdrdir)/ruby/intern.h -intpack.o: $(hdrdir)/ruby/io.h -intpack.o: $(hdrdir)/ruby/missing.h -intpack.o: $(hdrdir)/ruby/oniguruma.h -intpack.o: $(hdrdir)/ruby/ruby.h -intpack.o: $(hdrdir)/ruby/st.h -intpack.o: $(hdrdir)/ruby/subst.h -intpack.o: $(top_srcdir)/include/ruby.h -intpack.o: $(top_srcdir)/internal.h -intpack.o: intpack.c -mul.o: $(RUBY_EXTCONF_H) -mul.o: $(arch_hdrdir)/ruby/config.h -mul.o: $(hdrdir)/ruby/defines.h -mul.o: $(hdrdir)/ruby/encoding.h -mul.o: $(hdrdir)/ruby/intern.h -mul.o: $(hdrdir)/ruby/io.h -mul.o: $(hdrdir)/ruby/missing.h -mul.o: $(hdrdir)/ruby/oniguruma.h -mul.o: $(hdrdir)/ruby/ruby.h -mul.o: $(hdrdir)/ruby/st.h -mul.o: $(hdrdir)/ruby/subst.h -mul.o: $(top_srcdir)/include/ruby.h -mul.o: $(top_srcdir)/internal.h -mul.o: mul.c -str2big.o: $(RUBY_EXTCONF_H) -str2big.o: $(arch_hdrdir)/ruby/config.h -str2big.o: $(hdrdir)/ruby/defines.h -str2big.o: $(hdrdir)/ruby/encoding.h -str2big.o: $(hdrdir)/ruby/intern.h -str2big.o: $(hdrdir)/ruby/io.h -str2big.o: $(hdrdir)/ruby/missing.h -str2big.o: $(hdrdir)/ruby/oniguruma.h -str2big.o: $(hdrdir)/ruby/ruby.h -str2big.o: $(hdrdir)/ruby/st.h -str2big.o: $(hdrdir)/ruby/subst.h -str2big.o: $(top_srcdir)/include/ruby.h -str2big.o: $(top_srcdir)/internal.h -str2big.o: str2big.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ruby_2_2/ext/-test-/bignum/div.c b/ruby_2_2/ext/-test-/bignum/div.c deleted file mode 100644 index a1db21dc30..0000000000 --- a/ruby_2_2/ext/-test-/bignum/div.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "internal.h" - -static VALUE -big(VALUE x) -{ - if (FIXNUM_P(x)) - return rb_int2big(FIX2LONG(x)); - if (RB_TYPE_P(x, T_BIGNUM)) - return x; - rb_raise(rb_eTypeError, "can't convert %s to Bignum", - rb_obj_classname(x)); -} - -static VALUE -divrem_normal(VALUE x, VALUE y) -{ - return rb_big_norm(rb_big_divrem_normal(big(x), big(y))); -} - -#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) -static VALUE -divrem_gmp(VALUE x, VALUE y) -{ - return rb_big_norm(rb_big_divrem_gmp(big(x), big(y))); -} -#else -#define divrem_gmp rb_f_notimplement -#endif - -void -Init_div(VALUE klass) -{ - rb_define_method(rb_cInteger, "big_divrem_normal", divrem_normal, 1); - rb_define_method(rb_cInteger, "big_divrem_gmp", divrem_gmp, 1); -} diff --git a/ruby_2_2/ext/-test-/bignum/extconf.rb b/ruby_2_2/ext/-test-/bignum/extconf.rb deleted file mode 100644 index e8c1febc82..0000000000 --- a/ruby_2_2/ext/-test-/bignum/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/bignum") diff --git a/ruby_2_2/ext/-test-/bignum/init.c b/ruby_2_2/ext/-test-/bignum/init.c deleted file mode 100644 index 82a159bf1d..0000000000 --- a/ruby_2_2/ext/-test-/bignum/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_bignum(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_class_under(mBug, "Bignum", rb_cString); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/bignum/intpack.c b/ruby_2_2/ext/-test-/bignum/intpack.c deleted file mode 100644 index 2d19442cf2..0000000000 --- a/ruby_2_2/ext/-test-/bignum/intpack.c +++ /dev/null @@ -1,87 +0,0 @@ -#include "internal.h" - -static VALUE -rb_integer_pack_raw_m(VALUE val, VALUE buf, VALUE numwords_arg, VALUE wordsize_arg, VALUE nails, VALUE flags) -{ - int sign; - size_t numwords = 0; - size_t wordsize = NUM2SIZET(wordsize_arg); - - StringValue(buf); - rb_str_modify(buf); - sign = rb_integer_pack(val, - RSTRING_PTR(buf), NUM2SIZET(numwords_arg), - NUM2SIZET(wordsize_arg), NUM2SIZET(nails), NUM2INT(flags)); - - return rb_ary_new_from_args(2, INT2NUM(sign), rb_str_new(RSTRING_PTR(buf), wordsize * numwords)); -} - -static VALUE -rb_integer_pack_m(VALUE val, VALUE numwords_arg, VALUE wordsize_arg, VALUE nails, VALUE flags) -{ - int sign; - size_t numwords = NUM2SIZET(numwords_arg); - size_t wordsize = NUM2SIZET(wordsize_arg); - VALUE buf; - - if (numwords != 0 && wordsize != 0 && LONG_MAX / wordsize < numwords) - rb_raise(rb_eArgError, "too big numwords * wordsize"); - buf = rb_str_new(NULL, numwords * wordsize); - sign = rb_integer_pack(val, - RSTRING_PTR(buf), numwords, - wordsize, NUM2SIZET(nails), NUM2INT(flags)); - - return rb_assoc_new(INT2NUM(sign), buf); -} - -static VALUE -rb_integer_unpack_m(VALUE klass, VALUE buf, VALUE numwords, VALUE wordsize, VALUE nails, VALUE flags) -{ - StringValue(buf); - - return rb_integer_unpack(RSTRING_PTR(buf), - NUM2SIZET(numwords), NUM2SIZET(wordsize), - NUM2SIZET(nails), NUM2INT(flags)); -} - -static VALUE -rb_integer_test_numbits_2comp_without_sign(VALUE val) -{ - size_t size; - int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_NEGATIVE_P(val); - size = rb_absint_numwords(val, 1, NULL) - (neg && rb_absint_singlebit_p(val)); - return SIZET2NUM(size); -} - -static VALUE -rb_integer_test_numbytes_2comp_with_sign(VALUE val) -{ - int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_NEGATIVE_P(val); - int nlz_bits; - size_t size = rb_absint_size(val, &nlz_bits); - if (nlz_bits == 0 && !(neg && rb_absint_singlebit_p(val))) - size++; - return SIZET2NUM(size); -} - -void -Init_intpack(VALUE klass) -{ - rb_define_method(rb_cInteger, "test_pack_raw", rb_integer_pack_raw_m, 5); - rb_define_method(rb_cInteger, "test_pack", rb_integer_pack_m, 4); - rb_define_singleton_method(rb_cInteger, "test_unpack", rb_integer_unpack_m, 5); - rb_define_const(rb_cInteger, "INTEGER_PACK_MSWORD_FIRST", INT2NUM(INTEGER_PACK_MSWORD_FIRST)); - rb_define_const(rb_cInteger, "INTEGER_PACK_LSWORD_FIRST", INT2NUM(INTEGER_PACK_LSWORD_FIRST)); - rb_define_const(rb_cInteger, "INTEGER_PACK_MSBYTE_FIRST", INT2NUM(INTEGER_PACK_MSBYTE_FIRST)); - rb_define_const(rb_cInteger, "INTEGER_PACK_LSBYTE_FIRST", INT2NUM(INTEGER_PACK_LSBYTE_FIRST)); - rb_define_const(rb_cInteger, "INTEGER_PACK_NATIVE_BYTE_ORDER", INT2NUM(INTEGER_PACK_NATIVE_BYTE_ORDER)); - rb_define_const(rb_cInteger, "INTEGER_PACK_2COMP", INT2NUM(INTEGER_PACK_2COMP)); - rb_define_const(rb_cInteger, "INTEGER_PACK_LITTLE_ENDIAN", INT2NUM(INTEGER_PACK_LITTLE_ENDIAN)); - rb_define_const(rb_cInteger, "INTEGER_PACK_BIG_ENDIAN", INT2NUM(INTEGER_PACK_BIG_ENDIAN)); - rb_define_const(rb_cInteger, "INTEGER_PACK_FORCE_BIGNUM", INT2NUM(INTEGER_PACK_FORCE_BIGNUM)); - rb_define_const(rb_cInteger, "INTEGER_PACK_NEGATIVE", INT2NUM(INTEGER_PACK_NEGATIVE)); - rb_define_const(rb_cInteger, "INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION", INT2NUM(INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION)); - - rb_define_method(rb_cInteger, "test_numbits_2comp_without_sign", rb_integer_test_numbits_2comp_without_sign, 0); - rb_define_method(rb_cInteger, "test_numbytes_2comp_with_sign", rb_integer_test_numbytes_2comp_with_sign, 0); -} diff --git a/ruby_2_2/ext/-test-/bignum/mul.c b/ruby_2_2/ext/-test-/bignum/mul.c deleted file mode 100644 index d34e98fabb..0000000000 --- a/ruby_2_2/ext/-test-/bignum/mul.c +++ /dev/null @@ -1,65 +0,0 @@ -#include "internal.h" - -static VALUE -big(VALUE x) -{ - if (FIXNUM_P(x)) - return rb_int2big(FIX2LONG(x)); - if (RB_TYPE_P(x, T_BIGNUM)) - return x; - rb_raise(rb_eTypeError, "can't convert %s to Bignum", - rb_obj_classname(x)); -} - -static VALUE -mul_normal(VALUE x, VALUE y) -{ - return rb_big_norm(rb_big_mul_normal(big(x), big(y))); -} - -static VALUE -sq_fast(VALUE x) -{ - return rb_big_norm(rb_big_sq_fast(big(x))); -} - -static VALUE -mul_balance(VALUE x, VALUE y) -{ - return rb_big_norm(rb_big_mul_balance(big(x), big(y))); -} - -static VALUE -mul_karatsuba(VALUE x, VALUE y) -{ - return rb_big_norm(rb_big_mul_karatsuba(big(x), big(y))); -} - -static VALUE -mul_toom3(VALUE x, VALUE y) -{ - return rb_big_norm(rb_big_mul_toom3(big(x), big(y))); -} - -#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) -static VALUE -mul_gmp(VALUE x, VALUE y) -{ - return rb_big_norm(rb_big_mul_gmp(big(x), big(y))); -} -#else -#define mul_gmp rb_f_notimplement -#endif - -void -Init_mul(VALUE klass) -{ - rb_define_const(rb_cBignum, "SIZEOF_BDIGIT", INT2NUM(SIZEOF_BDIGIT)); - rb_define_const(rb_cBignum, "BITSPERDIG", INT2NUM(SIZEOF_BDIGIT * CHAR_BIT)); - rb_define_method(rb_cInteger, "big_mul_normal", mul_normal, 1); - rb_define_method(rb_cInteger, "big_sq_fast", sq_fast, 0); - rb_define_method(rb_cInteger, "big_mul_balance", mul_balance, 1); - rb_define_method(rb_cInteger, "big_mul_karatsuba", mul_karatsuba, 1); - rb_define_method(rb_cInteger, "big_mul_toom3", mul_toom3, 1); - rb_define_method(rb_cInteger, "big_mul_gmp", mul_gmp, 1); -} diff --git a/ruby_2_2/ext/-test-/bignum/str2big.c b/ruby_2_2/ext/-test-/bignum/str2big.c deleted file mode 100644 index bc79ef0329..0000000000 --- a/ruby_2_2/ext/-test-/bignum/str2big.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "internal.h" - -static VALUE -str2big_poweroftwo(VALUE str, VALUE vbase, VALUE badcheck) -{ - return rb_str2big_poweroftwo(str, NUM2INT(vbase), RTEST(badcheck)); -} - -static VALUE -str2big_normal(VALUE str, VALUE vbase, VALUE badcheck) -{ - return rb_str2big_normal(str, NUM2INT(vbase), RTEST(badcheck)); -} - -static VALUE -str2big_karatsuba(VALUE str, VALUE vbase, VALUE badcheck) -{ - return rb_str2big_karatsuba(str, NUM2INT(vbase), RTEST(badcheck)); -} - -#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) -static VALUE -str2big_gmp(VALUE str, VALUE vbase, VALUE badcheck) -{ - return rb_str2big_gmp(str, NUM2INT(vbase), RTEST(badcheck)); -} -#else -#define str2big_gmp rb_f_notimplement -#endif - -void -Init_str2big(VALUE klass) -{ - rb_define_method(rb_cString, "str2big_poweroftwo", str2big_poweroftwo, 2); - rb_define_method(rb_cString, "str2big_normal", str2big_normal, 2); - rb_define_method(rb_cString, "str2big_karatsuba", str2big_karatsuba, 2); - rb_define_method(rb_cString, "str2big_gmp", str2big_gmp, 2); -} diff --git a/ruby_2_2/ext/-test-/bug-3571/bug.c b/ruby_2_2/ext/-test-/bug-3571/bug.c deleted file mode 100644 index 87a5df0588..0000000000 --- a/ruby_2_2/ext/-test-/bug-3571/bug.c +++ /dev/null @@ -1,23 +0,0 @@ -#include <ruby.h> - -static VALUE -bug_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg)) -{ - rb_notimplement(); - return ID2SYM(rb_frame_this_func()); -} - -static VALUE -bug_start(VALUE self, VALUE hash) -{ - VALUE ary = rb_ary_new3(1, Qnil); - rb_block_call(ary, rb_intern("map"), 0, 0, bug_i, self); - return ary; -} - -void -Init_bug(void) -{ - VALUE mBug = rb_define_module("Bug"); - rb_define_module_function(mBug, "start", bug_start, 0); -} diff --git a/ruby_2_2/ext/-test-/bug-3571/extconf.rb b/ruby_2_2/ext/-test-/bug-3571/extconf.rb deleted file mode 100644 index 6390fce219..0000000000 --- a/ruby_2_2/ext/-test-/bug-3571/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/bug-3571/bug") diff --git a/ruby_2_2/ext/-test-/bug-3662/bug.c b/ruby_2_2/ext/-test-/bug-3662/bug.c deleted file mode 100644 index 9375dace10..0000000000 --- a/ruby_2_2/ext/-test-/bug-3662/bug.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <ruby.h> - -static VALUE -bug_funcall(int argc, VALUE *argv, VALUE self) -{ - if (argc < 1) rb_raise(rb_eArgError, "not enough argument"); - return rb_funcall2(self, rb_to_id(*argv), argc-1, argv+1); -} - -void -Init_bug(void) -{ - VALUE mBug = rb_define_module("Bug"); - rb_define_module_function(mBug, "funcall", bug_funcall, -1); - rb_define_module_function(mBug, "notimplement", rb_f_notimplement, -1); -} diff --git a/ruby_2_2/ext/-test-/bug-3662/extconf.rb b/ruby_2_2/ext/-test-/bug-3662/extconf.rb deleted file mode 100644 index 7a1b73023c..0000000000 --- a/ruby_2_2/ext/-test-/bug-3662/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/bug-3662/bug") diff --git a/ruby_2_2/ext/-test-/bug-5832/bug.c b/ruby_2_2/ext/-test-/bug-5832/bug.c deleted file mode 100644 index 67be5844b6..0000000000 --- a/ruby_2_2/ext/-test-/bug-5832/bug.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <ruby.h> - -static VALUE -bug_funcall_callback(VALUE self, VALUE obj) -{ - return rb_funcall(obj, rb_intern("callback"), 0); -} - -void -Init_bug(void) -{ - VALUE mBug = rb_define_module("Bug"); - rb_define_module_function(mBug, "funcall_callback", bug_funcall_callback, 1); -} diff --git a/ruby_2_2/ext/-test-/bug-5832/extconf.rb b/ruby_2_2/ext/-test-/bug-5832/extconf.rb deleted file mode 100644 index 55a4b7d93f..0000000000 --- a/ruby_2_2/ext/-test-/bug-5832/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/bug-5832/bug") diff --git a/ruby_2_2/ext/-test-/bug_reporter/bug_reporter.c b/ruby_2_2/ext/-test-/bug_reporter/bug_reporter.c deleted file mode 100644 index e9ea9e3db0..0000000000 --- a/ruby_2_2/ext/-test-/bug_reporter/bug_reporter.c +++ /dev/null @@ -1,24 +0,0 @@ -#include <ruby.h> -#include <stdio.h> - -int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data); - -static void -sample_bug_reporter(FILE *out, void *ptr) -{ - int n = (int)(uintptr_t)ptr; - fprintf(out, "Sample bug reporter: %d\n", n); -} - -static VALUE -register_sample_bug_reporter(VALUE self, VALUE obj) -{ - rb_bug_reporter_add(sample_bug_reporter, (void *)(uintptr_t)NUM2INT(obj)); - return Qnil; -} - -void -Init_bug_reporter(void) -{ - rb_define_global_function("register_sample_bug_reporter", register_sample_bug_reporter, 1); -} diff --git a/ruby_2_2/ext/-test-/bug_reporter/extconf.rb b/ruby_2_2/ext/-test-/bug_reporter/extconf.rb deleted file mode 100644 index 0fccd81a41..0000000000 --- a/ruby_2_2/ext/-test-/bug_reporter/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/bug_reporter/bug_reporter") diff --git a/ruby_2_2/ext/-test-/class/class2name.c b/ruby_2_2/ext/-test-/class/class2name.c deleted file mode 100644 index c48df6fb2a..0000000000 --- a/ruby_2_2/ext/-test-/class/class2name.c +++ /dev/null @@ -1,14 +0,0 @@ -#include <ruby/ruby.h> - -static VALUE -class2name(VALUE self, VALUE klass) -{ - const char *name = rb_class2name(klass); - return name ? rb_str_new_cstr(name) : Qnil; -} - -void -Init_class2name(VALUE klass) -{ - rb_define_singleton_method(klass, "class2name", class2name, 1); -} diff --git a/ruby_2_2/ext/-test-/class/extconf.rb b/ruby_2_2/ext/-test-/class/extconf.rb deleted file mode 100644 index a07d660b87..0000000000 --- a/ruby_2_2/ext/-test-/class/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/class") diff --git a/ruby_2_2/ext/-test-/class/init.c b/ruby_2_2/ext/-test-/class/init.c deleted file mode 100644 index ed715c1942..0000000000 --- a/ruby_2_2/ext/-test-/class/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE mod); Init_##n(mod);} - -void -Init_class(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE mod = rb_define_module_under(mBug, "Class"); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/debug/depend b/ruby_2_2/ext/-test-/debug/depend deleted file mode 100644 index 5178d85673..0000000000 --- a/ruby_2_2/ext/-test-/debug/depend +++ /dev/null @@ -1,32 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -init.o: $(RUBY_EXTCONF_H) -init.o: $(arch_hdrdir)/ruby/config.h -init.o: $(hdrdir)/ruby/defines.h -init.o: $(hdrdir)/ruby/intern.h -init.o: $(hdrdir)/ruby/missing.h -init.o: $(hdrdir)/ruby/ruby.h -init.o: $(hdrdir)/ruby/st.h -init.o: $(hdrdir)/ruby/subst.h -init.o: $(top_srcdir)/include/ruby.h -init.o: init.c -inspector.o: $(RUBY_EXTCONF_H) -inspector.o: $(arch_hdrdir)/ruby/config.h -inspector.o: $(hdrdir)/ruby/debug.h -inspector.o: $(hdrdir)/ruby/defines.h -inspector.o: $(hdrdir)/ruby/intern.h -inspector.o: $(hdrdir)/ruby/missing.h -inspector.o: $(hdrdir)/ruby/ruby.h -inspector.o: $(hdrdir)/ruby/st.h -inspector.o: $(hdrdir)/ruby/subst.h -inspector.o: inspector.c -profile_frames.o: $(RUBY_EXTCONF_H) -profile_frames.o: $(arch_hdrdir)/ruby/config.h -profile_frames.o: $(hdrdir)/ruby/debug.h -profile_frames.o: $(hdrdir)/ruby/defines.h -profile_frames.o: $(hdrdir)/ruby/intern.h -profile_frames.o: $(hdrdir)/ruby/missing.h -profile_frames.o: $(hdrdir)/ruby/ruby.h -profile_frames.o: $(hdrdir)/ruby/st.h -profile_frames.o: $(hdrdir)/ruby/subst.h -profile_frames.o: profile_frames.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ruby_2_2/ext/-test-/debug/extconf.rb b/ruby_2_2/ext/-test-/debug/extconf.rb deleted file mode 100644 index 8f7922e1a6..0000000000 --- a/ruby_2_2/ext/-test-/debug/extconf.rb +++ /dev/null @@ -1,6 +0,0 @@ -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/debug") diff --git a/ruby_2_2/ext/-test-/debug/init.c b/ruby_2_2/ext/-test-/debug/init.c deleted file mode 100644 index fe3979cbc5..0000000000 --- a/ruby_2_2/ext/-test-/debug/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_debug(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_module_under(mBug, "Debug"); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/debug/inspector.c b/ruby_2_2/ext/-test-/debug/inspector.c deleted file mode 100644 index f0c58e59f9..0000000000 --- a/ruby_2_2/ext/-test-/debug/inspector.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/debug.h" - -static VALUE -callback(const rb_debug_inspector_t *dbg_context, void *data) -{ - VALUE locs = rb_debug_inspector_backtrace_locations(dbg_context); - long i, len = RARRAY_LEN(locs); - VALUE binds = rb_ary_new(); - for (i = 0; i < len; ++i) { - VALUE entry = rb_ary_new(); - rb_ary_push(binds, entry); - rb_ary_push(entry, rb_debug_inspector_frame_self_get(dbg_context, i)); - rb_ary_push(entry, rb_debug_inspector_frame_binding_get(dbg_context, i)); - rb_ary_push(entry, rb_debug_inspector_frame_class_get(dbg_context, i)); - rb_ary_push(entry, rb_debug_inspector_frame_iseq_get(dbg_context, i)); - rb_ary_push(entry, rb_ary_entry(locs, i)); - } - return binds; -} - -static VALUE -debug_inspector(VALUE self) -{ - return rb_debug_inspector_open(callback, NULL); -} - -void -Init_inspector(VALUE klass) -{ - rb_define_module_function(klass, "inspector", debug_inspector, 0); -} diff --git a/ruby_2_2/ext/-test-/debug/profile_frames.c b/ruby_2_2/ext/-test-/debug/profile_frames.c deleted file mode 100644 index 1656ff7d4b..0000000000 --- a/ruby_2_2/ext/-test-/debug/profile_frames.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/debug.h" - -#define MAX_BUF_SIZE 0x100 - -static VALUE -profile_frames(VALUE self, VALUE start_v, VALUE num_v) -{ - int i, collected_size; - int start = NUM2INT(start_v); - int buff_size = NUM2INT(num_v); - VALUE buff[MAX_BUF_SIZE]; - int lines[MAX_BUF_SIZE]; - VALUE result = rb_ary_new(); - - if (buff_size > MAX_BUF_SIZE) rb_raise(rb_eRuntimeError, "too long buff_size"); - - collected_size = rb_profile_frames(start, buff_size, buff, lines); - - for (i=0; i<collected_size; i++) { - VALUE ary = rb_ary_new(); - rb_ary_push(ary, rb_profile_frame_path(buff[i])); - rb_ary_push(ary, rb_profile_frame_absolute_path(buff[i])); - rb_ary_push(ary, rb_profile_frame_label(buff[i])); - rb_ary_push(ary, rb_profile_frame_base_label(buff[i])); - rb_ary_push(ary, rb_profile_frame_full_label(buff[i])); - rb_ary_push(ary, rb_profile_frame_first_lineno(buff[i])); - rb_ary_push(ary, rb_profile_frame_classpath(buff[i])); - rb_ary_push(ary, rb_profile_frame_singleton_method_p(buff[i])); - rb_ary_push(ary, rb_profile_frame_method_name(buff[i])); - rb_ary_push(ary, rb_profile_frame_qualified_method_name(buff[i])); - - rb_ary_push(result, ary); - } - - return result; -} - -void -Init_profile_frames(VALUE klass) -{ - rb_define_module_function(klass, "profile_frames", profile_frames, 2); -} diff --git a/ruby_2_2/ext/-test-/dln/empty/empty.c b/ruby_2_2/ext/-test-/dln/empty/empty.c deleted file mode 100644 index c4f94f1644..0000000000 --- a/ruby_2_2/ext/-test-/dln/empty/empty.c +++ /dev/null @@ -1,4 +0,0 @@ -void -Init_empty(void) -{ -} diff --git a/ruby_2_2/ext/-test-/dln/empty/extconf.rb b/ruby_2_2/ext/-test-/dln/empty/extconf.rb deleted file mode 100644 index 6110887b3d..0000000000 --- a/ruby_2_2/ext/-test-/dln/empty/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/dln/empty") diff --git a/ruby_2_2/ext/-test-/exception/dataerror.c b/ruby_2_2/ext/-test-/exception/dataerror.c deleted file mode 100644 index d8beba8aa4..0000000000 --- a/ruby_2_2/ext/-test-/exception/dataerror.c +++ /dev/null @@ -1,31 +0,0 @@ -#include <ruby/ruby.h> - -static void -dataerror_mark(void *ptr) -{ - rb_gc_mark((VALUE)ptr); -} - -static void -dataerror_free(void *ptr) -{ -} - -static const rb_data_type_t dataerror_type = { - "Bug #9167", - {dataerror_mark, dataerror_free}, -}; - -static VALUE -dataerror_alloc(VALUE klass) -{ - VALUE n = rb_str_new_cstr("[Bug #9167] error"); - return TypedData_Wrap_Struct(klass, &dataerror_type, (void *)n); -} - -void -Init_dataerror(VALUE klass) -{ - VALUE rb_eDataErr = rb_define_class_under(klass, "DataError", rb_eStandardError); - rb_define_alloc_func(rb_eDataErr, dataerror_alloc); -} diff --git a/ruby_2_2/ext/-test-/exception/depend b/ruby_2_2/ext/-test-/exception/depend deleted file mode 100644 index a89ecf7a4f..0000000000 --- a/ruby_2_2/ext/-test-/exception/depend +++ /dev/null @@ -1,43 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -dataerror.o: $(RUBY_EXTCONF_H) -dataerror.o: $(arch_hdrdir)/ruby/config.h -dataerror.o: $(hdrdir)/ruby/defines.h -dataerror.o: $(hdrdir)/ruby/intern.h -dataerror.o: $(hdrdir)/ruby/missing.h -dataerror.o: $(hdrdir)/ruby/ruby.h -dataerror.o: $(hdrdir)/ruby/st.h -dataerror.o: $(hdrdir)/ruby/subst.h -dataerror.o: dataerror.c -enc_raise.o: $(RUBY_EXTCONF_H) -enc_raise.o: $(arch_hdrdir)/ruby/config.h -enc_raise.o: $(hdrdir)/ruby/defines.h -enc_raise.o: $(hdrdir)/ruby/encoding.h -enc_raise.o: $(hdrdir)/ruby/intern.h -enc_raise.o: $(hdrdir)/ruby/missing.h -enc_raise.o: $(hdrdir)/ruby/oniguruma.h -enc_raise.o: $(hdrdir)/ruby/ruby.h -enc_raise.o: $(hdrdir)/ruby/st.h -enc_raise.o: $(hdrdir)/ruby/subst.h -enc_raise.o: $(top_srcdir)/include/ruby.h -enc_raise.o: enc_raise.c -ensured.o: $(RUBY_EXTCONF_H) -ensured.o: $(arch_hdrdir)/ruby/config.h -ensured.o: $(hdrdir)/ruby/defines.h -ensured.o: $(hdrdir)/ruby/intern.h -ensured.o: $(hdrdir)/ruby/missing.h -ensured.o: $(hdrdir)/ruby/ruby.h -ensured.o: $(hdrdir)/ruby/st.h -ensured.o: $(hdrdir)/ruby/subst.h -ensured.o: $(top_srcdir)/include/ruby.h -ensured.o: ensured.c -init.o: $(RUBY_EXTCONF_H) -init.o: $(arch_hdrdir)/ruby/config.h -init.o: $(hdrdir)/ruby/defines.h -init.o: $(hdrdir)/ruby/intern.h -init.o: $(hdrdir)/ruby/missing.h -init.o: $(hdrdir)/ruby/ruby.h -init.o: $(hdrdir)/ruby/st.h -init.o: $(hdrdir)/ruby/subst.h -init.o: $(top_srcdir)/include/ruby.h -init.o: init.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ruby_2_2/ext/-test-/exception/enc_raise.c b/ruby_2_2/ext/-test-/exception/enc_raise.c deleted file mode 100644 index dc8a42cf3f..0000000000 --- a/ruby_2_2/ext/-test-/exception/enc_raise.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <ruby.h> -#include <ruby/encoding.h> - -static VALUE -enc_raise(VALUE exc, VALUE encoding, VALUE mesg) -{ - rb_enc_raise(rb_to_encoding(encoding), exc, "%s", StringValueCStr(mesg)); - UNREACHABLE; -} - -void -Init_enc_raise(VALUE klass) -{ - rb_define_module_function(klass, "enc_raise", enc_raise, 2); -} diff --git a/ruby_2_2/ext/-test-/exception/ensured.c b/ruby_2_2/ext/-test-/exception/ensured.c deleted file mode 100644 index 365e1f4f79..0000000000 --- a/ruby_2_2/ext/-test-/exception/ensured.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <ruby.h> - -static VALUE -begin(VALUE object) -{ - return rb_funcall(object, rb_intern("try_method"), 0); -} - -static VALUE -ensure(VALUE object) -{ - return rb_funcall(object, rb_intern("ensured_method"), 0); -} - -static VALUE -ensured(VALUE module, VALUE object) -{ - return rb_ensure(begin, object, ensure, object); -} - -void -Init_ensured(VALUE klass) -{ - rb_define_module_function(klass, "ensured", ensured, 1); -} diff --git a/ruby_2_2/ext/-test-/exception/extconf.rb b/ruby_2_2/ext/-test-/exception/extconf.rb deleted file mode 100644 index 0faf6d53ed..0000000000 --- a/ruby_2_2/ext/-test-/exception/extconf.rb +++ /dev/null @@ -1,6 +0,0 @@ -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/exception") diff --git a/ruby_2_2/ext/-test-/exception/init.c b/ruby_2_2/ext/-test-/exception/init.c deleted file mode 100644 index 853bb68f79..0000000000 --- a/ruby_2_2/ext/-test-/exception/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_exception(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_class_under(mBug, "Exception", rb_eStandardError); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/fatal/extconf.rb b/ruby_2_2/ext/-test-/fatal/extconf.rb deleted file mode 100644 index e0cfeb2095..0000000000 --- a/ruby_2_2/ext/-test-/fatal/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/fatal/rb_fatal") diff --git a/ruby_2_2/ext/-test-/fatal/rb_fatal.c b/ruby_2_2/ext/-test-/fatal/rb_fatal.c deleted file mode 100644 index 71aef4658a..0000000000 --- a/ruby_2_2/ext/-test-/fatal/rb_fatal.c +++ /dev/null @@ -1,19 +0,0 @@ -#include <ruby.h> - -static VALUE -ruby_fatal(VALUE obj, VALUE msg) -{ - const char *cmsg = NULL; - - (void)obj; - - cmsg = RSTRING_PTR(msg); - rb_fatal("%s", cmsg); - return 0; /* never reached */ -} - -void -Init_rb_fatal(void) -{ - rb_define_method(rb_mKernel, "rb_fatal", ruby_fatal, 1); -} diff --git a/ruby_2_2/ext/-test-/file/depend b/ruby_2_2/ext/-test-/file/depend deleted file mode 100644 index a43b4275dc..0000000000 --- a/ruby_2_2/ext/-test-/file/depend +++ /dev/null @@ -1,36 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -fs.o: $(RUBY_EXTCONF_H) -fs.o: $(arch_hdrdir)/ruby/config.h -fs.o: $(hdrdir)/ruby/defines.h -fs.o: $(hdrdir)/ruby/encoding.h -fs.o: $(hdrdir)/ruby/intern.h -fs.o: $(hdrdir)/ruby/io.h -fs.o: $(hdrdir)/ruby/missing.h -fs.o: $(hdrdir)/ruby/oniguruma.h -fs.o: $(hdrdir)/ruby/ruby.h -fs.o: $(hdrdir)/ruby/st.h -fs.o: $(hdrdir)/ruby/subst.h -fs.o: fs.c -init.o: $(RUBY_EXTCONF_H) -init.o: $(arch_hdrdir)/ruby/config.h -init.o: $(hdrdir)/ruby/defines.h -init.o: $(hdrdir)/ruby/intern.h -init.o: $(hdrdir)/ruby/missing.h -init.o: $(hdrdir)/ruby/ruby.h -init.o: $(hdrdir)/ruby/st.h -init.o: $(hdrdir)/ruby/subst.h -init.o: $(top_srcdir)/include/ruby.h -init.o: init.c -stat.o: $(RUBY_EXTCONF_H) -stat.o: $(arch_hdrdir)/ruby/config.h -stat.o: $(hdrdir)/ruby/defines.h -stat.o: $(hdrdir)/ruby/encoding.h -stat.o: $(hdrdir)/ruby/intern.h -stat.o: $(hdrdir)/ruby/io.h -stat.o: $(hdrdir)/ruby/missing.h -stat.o: $(hdrdir)/ruby/oniguruma.h -stat.o: $(hdrdir)/ruby/ruby.h -stat.o: $(hdrdir)/ruby/st.h -stat.o: $(hdrdir)/ruby/subst.h -stat.o: stat.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ruby_2_2/ext/-test-/file/extconf.rb b/ruby_2_2/ext/-test-/file/extconf.rb deleted file mode 100644 index 44aa828b25..0000000000 --- a/ruby_2_2/ext/-test-/file/extconf.rb +++ /dev/null @@ -1,22 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" - -headers = %w[sys/param.h sys/mount.h sys/vfs.h].select {|h| have_header(h)} -if have_type("struct statfs", headers) - have_struct_member("struct statfs", "f_fstypename", headers) - have_struct_member("struct statfs", "f_type", headers) - have_struct_member("struct statfs", "f_flags", headers) -end - -headers = %w[sys/statvfs.h].select {|h| have_header(h)} -if have_type("struct statvfs", headers) - have_struct_member("struct statvfs", "f_fstypename", headers) - have_struct_member("struct statvfs", "f_basetype", headers) - have_struct_member("struct statvfs", "f_type", headers) -end - -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/file") diff --git a/ruby_2_2/ext/-test-/file/fs.c b/ruby_2_2/ext/-test-/file/fs.c deleted file mode 100644 index 657a7d20a5..0000000000 --- a/ruby_2_2/ext/-test-/file/fs.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/io.h" - -#ifdef HAVE_SYS_MOUNT_H -#include <sys/mount.h> -#endif -#ifdef HAVE_SYS_VFS_H -#include <sys/vfs.h> -#endif -#ifdef HAVE_SYS_STATVFS_H -#include <sys/statvfs.h> -#endif - -#if defined HAVE_STRUCT_STATFS_F_FSTYPENAME -typedef struct statfs statfs_t; -# define STATFS(f, s) statfs((f), (s)) -# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1 -# if defined HAVE_STRUCT_STATFS_F_TYPE -# define HAVE_STRUCT_STATFS_T_F_TYPE 1 -# endif -#elif defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME) /* NetBSD */ -typedef struct statvfs statfs_t; -# define STATFS(f, s) statvfs((f), (s)) -# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1 -# if defined HAVE_STRUCT_STATVFS_F_TYPE -# define HAVE_STRUCT_STATFS_T_F_TYPE 1 -# endif -#elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE) /* AIX, HP-UX, Solaris */ -typedef struct statvfs statfs_t; -# define STATFS(f, s) statvfs((f), (s)) -# define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1 -# define f_fstypename f_basetype -# if defined HAVE_STRUCT_STATVFS_F_TYPE -# define HAVE_STRUCT_STATFS_T_F_TYPE 1 -# endif -#elif defined(HAVE_STRUCT_STATFS_F_TYPE) /* Linux */ -typedef struct statfs statfs_t; -# define STATFS(f, s) statfs((f), (s)) -# if defined HAVE_STRUCT_STATFS_F_TYPE -# define HAVE_STRUCT_STATFS_T_F_TYPE 1 -# endif -#endif - -VALUE -get_fsname(VALUE self, VALUE str) -{ -#ifdef STATFS - statfs_t st; -# define CSTR(s) rb_str_new_cstr(s) - - FilePathValue(str); - str = rb_str_encode_ospath(str); - if (STATFS(StringValueCStr(str), &st) == -1) { - rb_sys_fail_str(str); - } -# ifdef HAVE_STRUCT_STATFS_T_F_FSTYPENAME - if (st.f_fstypename[0]) - return CSTR(st.f_fstypename); -# endif -# ifdef HAVE_STRUCT_STATFS_T_F_TYPE - switch (st.f_type) { - case 0x9123683E: /* BTRFS_SUPER_MAGIC */ - return CSTR("btrfs"); - case 0x7461636f: /* OCFS2_SUPER_MAGIC */ - return CSTR("ocfs"); - case 0xEF53: /* EXT2_SUPER_MAGIC EXT3_SUPER_MAGIC EXT4_SUPER_MAGIC */ - return CSTR("ext4"); - case 0x58465342: /* XFS_SUPER_MAGIC */ - return CSTR("xfs"); - case 0x01021994: /* TMPFS_MAGIC */ - return CSTR("tmpfs"); - } -# endif -#endif - return Qnil; -} - -VALUE -get_noatime_p(VALUE self, VALUE str) -{ -#ifdef STATFS - statfs_t st; - FilePathValue(str); - str = rb_str_encode_ospath(str); - if (STATFS(StringValueCStr(str), &st) == -1) { - rb_sys_fail_str(str); - } -# ifdef HAVE_STRUCT_STATFS_F_FLAGS -# ifdef MNT_NOATIME - return st.f_flags & MNT_NOATIME ? Qtrue : Qfalse; -# elif defined(ST_NOATIME) - return st.f_flags & ST_NOATIME ? Qtrue : Qfalse; -# endif -# endif -#endif - return Qnil; -} - -void -Init_fs(VALUE module) -{ - VALUE fs = rb_define_module_under(module, "Fs"); - rb_define_module_function(fs, "fsname", get_fsname, 1); - rb_define_module_function(fs, "noatime?", get_noatime_p, 1); -} diff --git a/ruby_2_2/ext/-test-/file/init.c b/ruby_2_2/ext/-test-/file/init.c deleted file mode 100644 index 1117993d6c..0000000000 --- a/ruby_2_2/ext/-test-/file/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(module);} - -void -Init_file(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE module = rb_define_module_under(mBug, "File"); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/file/stat.c b/ruby_2_2/ext/-test-/file/stat.c deleted file mode 100644 index fed5d389eb..0000000000 --- a/ruby_2_2/ext/-test-/file/stat.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/io.h" - -static VALUE -stat_for_fd(VALUE self, VALUE fileno) -{ - struct stat st; - if (fstat(NUM2INT(fileno), &st)) rb_sys_fail(0); - return rb_stat_new(&st); -} - -static VALUE -stat_for_path(VALUE self, VALUE path) -{ - struct stat st; - FilePathValue(path); - if (stat(RSTRING_PTR(path), &st)) rb_sys_fail(0); - return rb_stat_new(&st); -} - -void -Init_stat(VALUE module) -{ - VALUE st = rb_define_module_under(module, "Stat"); - rb_define_module_function(st, "for_fd", stat_for_fd, 1); - rb_define_module_function(st, "for_path", stat_for_path, 1); -} diff --git a/ruby_2_2/ext/-test-/float/depend b/ruby_2_2/ext/-test-/float/depend deleted file mode 100644 index dff14550f7..0000000000 --- a/ruby_2_2/ext/-test-/float/depend +++ /dev/null @@ -1,3 +0,0 @@ -$(OBJS): $(HDRS) $(ruby_headers) - -nextafter.o: nextafter.c $(top_srcdir)/missing/nextafter.c diff --git a/ruby_2_2/ext/-test-/float/extconf.rb b/ruby_2_2/ext/-test-/float/extconf.rb deleted file mode 100644 index 0a9a299aa5..0000000000 --- a/ruby_2_2/ext/-test-/float/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/float") diff --git a/ruby_2_2/ext/-test-/float/init.c b/ruby_2_2/ext/-test-/float/init.c deleted file mode 100644 index d962108e39..0000000000 --- a/ruby_2_2/ext/-test-/float/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_float(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_class_under(mBug, "Float", rb_cObject); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/float/nextafter.c b/ruby_2_2/ext/-test-/float/nextafter.c deleted file mode 100644 index 30fb71f520..0000000000 --- a/ruby_2_2/ext/-test-/float/nextafter.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "ruby.h" - -static VALUE -system_nextafter_m(VALUE klass, VALUE vx, VALUE vy) -{ - double x, y, z; - - x = NUM2DBL(vx); - y = NUM2DBL(vy); - z = nextafter(x, y); - - return DBL2NUM(z); -} - -#define nextafter missing_nextafter -#include "../../../missing/nextafter.c" -#undef nextafter - -static VALUE -missing_nextafter_m(VALUE klass, VALUE vx, VALUE vy) -{ - double x, y, z; - - x = NUM2DBL(vx); - y = NUM2DBL(vy); - z = missing_nextafter(x, y); - - return DBL2NUM(z); -} - -void -Init_nextafter(VALUE klass) -{ - rb_define_singleton_method(klass, "system_nextafter", system_nextafter_m, 2); - rb_define_singleton_method(klass, "missing_nextafter", missing_nextafter_m, 2); -} diff --git a/ruby_2_2/ext/-test-/funcall/extconf.rb b/ruby_2_2/ext/-test-/funcall/extconf.rb deleted file mode 100644 index 8a9179ab2f..0000000000 --- a/ruby_2_2/ext/-test-/funcall/extconf.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'mkmf' -create_makefile("-test-/funcall/funcall") diff --git a/ruby_2_2/ext/-test-/funcall/passing_block.c b/ruby_2_2/ext/-test-/funcall/passing_block.c deleted file mode 100644 index 0200f80369..0000000000 --- a/ruby_2_2/ext/-test-/funcall/passing_block.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "ruby.h" - -VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE*); - -static VALUE -with_funcall2(int argc, VALUE *argv, VALUE self) -{ - return rb_funcall2(self, rb_intern("target"), argc, argv); -} - -static VALUE -with_funcall_passing_block(int argc, VALUE *argv, VALUE self) -{ - return rb_funcall_passing_block(self, rb_intern("target"), argc, argv); -} - -void -Init_funcall(void) -{ - VALUE cRelay = rb_path2class("TestFuncall::Relay"); - - rb_define_singleton_method(cRelay, - "with_funcall2", - with_funcall2, - -1); - rb_define_singleton_method(cRelay, - "with_funcall_passing_block", - with_funcall_passing_block, - -1); -} diff --git a/ruby_2_2/ext/-test-/hash/delete.c b/ruby_2_2/ext/-test-/hash/delete.c deleted file mode 100644 index 10d4aec6e7..0000000000 --- a/ruby_2_2/ext/-test-/hash/delete.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "ruby.h" - -extern VALUE rb_hash_delete_entry(VALUE hash, VALUE key); - -static VALUE -hash_delete(VALUE hash, VALUE key) -{ - VALUE ret = rb_hash_delete_entry(hash, key); - return ret == Qundef ? Qnil : rb_ary_new_from_values(1, &ret); -} - -void -Init_delete(VALUE klass) -{ - rb_define_method(klass, "delete!", hash_delete, 1); -} diff --git a/ruby_2_2/ext/-test-/hash/extconf.rb b/ruby_2_2/ext/-test-/hash/extconf.rb deleted file mode 100644 index 9d4ef4f935..0000000000 --- a/ruby_2_2/ext/-test-/hash/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/hash") diff --git a/ruby_2_2/ext/-test-/hash/init.c b/ruby_2_2/ext/-test-/hash/init.c deleted file mode 100644 index 9f6cbde652..0000000000 --- a/ruby_2_2/ext/-test-/hash/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_hash(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_class_under(mBug, "Hash", rb_cHash); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/iseq_load/extconf.rb b/ruby_2_2/ext/-test-/iseq_load/extconf.rb deleted file mode 100644 index 860f30befd..0000000000 --- a/ruby_2_2/ext/-test-/iseq_load/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/iseq_load/iseq_load") diff --git a/ruby_2_2/ext/-test-/iseq_load/iseq_load.c b/ruby_2_2/ext/-test-/iseq_load/iseq_load.c deleted file mode 100644 index b4b9a8aa3d..0000000000 --- a/ruby_2_2/ext/-test-/iseq_load/iseq_load.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <ruby.h> - -VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt); - -static VALUE -iseq_load(int argc, VALUE *argv, VALUE self) -{ - VALUE data, opt = Qnil; - - rb_scan_args(argc, argv, "11", &data, &opt); - - return rb_iseq_load(data, 0, opt); -} - -void -Init_iseq_load(void) -{ - VALUE rb_cISeq = rb_path2class("RubyVM::InstructionSequence"); - - rb_define_singleton_method(rb_cISeq, "iseq_load", iseq_load, -1); -} diff --git a/ruby_2_2/ext/-test-/iter/break.c b/ruby_2_2/ext/-test-/iter/break.c deleted file mode 100644 index 66ed26a9b8..0000000000 --- a/ruby_2_2/ext/-test-/iter/break.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <ruby.h> - -static VALUE -iter_break(VALUE self) -{ - rb_iter_break(); - - UNREACHABLE; -} - -static VALUE -iter_break_value(VALUE self, VALUE val) -{ - rb_iter_break_value(val); - - UNREACHABLE; -} - -void -Init_break(VALUE klass) -{ - VALUE breakable = rb_define_module_under(klass, "Breakable"); - rb_define_module_function(breakable, "iter_break", iter_break, 0); - rb_define_module_function(breakable, "iter_break_value", iter_break_value, 1); -} diff --git a/ruby_2_2/ext/-test-/iter/extconf.rb b/ruby_2_2/ext/-test-/iter/extconf.rb deleted file mode 100644 index 0ba99691bd..0000000000 --- a/ruby_2_2/ext/-test-/iter/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/iter") diff --git a/ruby_2_2/ext/-test-/iter/init.c b/ruby_2_2/ext/-test-/iter/init.c deleted file mode 100644 index a074ec46a9..0000000000 --- a/ruby_2_2/ext/-test-/iter/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_iter(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_module_under(mBug, "Iter"); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/iter/yield.c b/ruby_2_2/ext/-test-/iter/yield.c deleted file mode 100644 index 3cd408a928..0000000000 --- a/ruby_2_2/ext/-test-/iter/yield.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <ruby.h> - -static VALUE -yield_block(int argc, VALUE *argv, VALUE self) -{ - rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS); - return rb_block_call(self, rb_to_id(argv[0]), argc-1, argv+1, rb_yield_block, 0); -} - -void -Init_yield(VALUE klass) -{ - VALUE yield = rb_define_module_under(klass, "Yield"); - - rb_define_method(yield, "yield_block", yield_block, -1); -} diff --git a/ruby_2_2/ext/-test-/load/dot.dot/dot.dot.c b/ruby_2_2/ext/-test-/load/dot.dot/dot.dot.c deleted file mode 100644 index 936d28931a..0000000000 --- a/ruby_2_2/ext/-test-/load/dot.dot/dot.dot.c +++ /dev/null @@ -1 +0,0 @@ -void Init_dot(void) {} diff --git a/ruby_2_2/ext/-test-/load/dot.dot/extconf.rb b/ruby_2_2/ext/-test-/load/dot.dot/extconf.rb deleted file mode 100644 index 6287db6bd8..0000000000 --- a/ruby_2_2/ext/-test-/load/dot.dot/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/load/dot.dot/dot.dot") diff --git a/ruby_2_2/ext/-test-/marshal/compat/extconf.rb b/ruby_2_2/ext/-test-/marshal/compat/extconf.rb deleted file mode 100644 index bb11ebfb8c..0000000000 --- a/ruby_2_2/ext/-test-/marshal/compat/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/marshal/compat") diff --git a/ruby_2_2/ext/-test-/marshal/compat/usrcompat.c b/ruby_2_2/ext/-test-/marshal/compat/usrcompat.c deleted file mode 100644 index f812df5631..0000000000 --- a/ruby_2_2/ext/-test-/marshal/compat/usrcompat.c +++ /dev/null @@ -1,32 +0,0 @@ -#include <ruby.h> - -static VALUE -usr_dumper(VALUE self) -{ - return self; -} - -static VALUE -usr_loader(VALUE self, VALUE m) -{ - VALUE val = rb_ivar_get(m, rb_intern("@value")); - *(int *)DATA_PTR(self) = NUM2INT(val); - return self; -} - -static VALUE -compat_mload(VALUE self, VALUE data) -{ - rb_ivar_set(self, rb_intern("@value"), data); - return self; -} - -void -Init_compat(void) -{ - VALUE newclass = rb_path2class("Bug::Marshal::UsrMarshal"); - VALUE oldclass = rb_define_class_under(newclass, "compat", rb_cObject); - - rb_define_method(oldclass, "marshal_load", compat_mload, 1); - rb_marshal_define_compat(newclass, oldclass, usr_dumper, usr_loader); -} diff --git a/ruby_2_2/ext/-test-/marshal/usr/extconf.rb b/ruby_2_2/ext/-test-/marshal/usr/extconf.rb deleted file mode 100644 index c662b23dd5..0000000000 --- a/ruby_2_2/ext/-test-/marshal/usr/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/marshal/usr") diff --git a/ruby_2_2/ext/-test-/marshal/usr/usrmarshal.c b/ruby_2_2/ext/-test-/marshal/usr/usrmarshal.c deleted file mode 100644 index 0c9e079af2..0000000000 --- a/ruby_2_2/ext/-test-/marshal/usr/usrmarshal.c +++ /dev/null @@ -1,50 +0,0 @@ -#include <ruby.h> - -static size_t -usr_size(const void *ptr) -{ - return sizeof(int); -} - -static const rb_data_type_t usrmarshal_type = { - "UsrMarshal", - {0, RUBY_DEFAULT_FREE, usr_size,}, - 0, 0, - RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED, -}; - -static VALUE -usr_alloc(VALUE klass) -{ - int *p; - return TypedData_Make_Struct(klass, int, &usrmarshal_type, p); -} - -static VALUE -usr_init(VALUE self, VALUE val) -{ - int *ptr = Check_TypedStruct(self, &usrmarshal_type); - *ptr = NUM2INT(val); - return self; -} - -static VALUE -usr_value(VALUE self) -{ - int *ptr = Check_TypedStruct(self, &usrmarshal_type); - int val = *ptr; - return INT2NUM(val); -} - -void -Init_usr(void) -{ - VALUE mMarshal = rb_define_module_under(rb_define_module("Bug"), "Marshal"); - VALUE newclass = rb_define_class_under(mMarshal, "UsrMarshal", rb_cObject); - - rb_define_alloc_func(newclass, usr_alloc); - rb_define_method(newclass, "initialize", usr_init, 1); - rb_define_method(newclass, "value", usr_value, 0); - rb_define_method(newclass, "marshal_load", usr_init, 1); - rb_define_method(newclass, "marshal_dump", usr_value, 0); -} diff --git a/ruby_2_2/ext/-test-/method/arity.c b/ruby_2_2/ext/-test-/method/arity.c deleted file mode 100644 index 239b9f7f10..0000000000 --- a/ruby_2_2/ext/-test-/method/arity.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "ruby.h" - -static VALUE -obj_method_arity(VALUE self, VALUE obj, VALUE mid) -{ - int arity = rb_obj_method_arity(obj, rb_check_id(&mid)); - return INT2FIX(arity); -} - -static VALUE -mod_method_arity(VALUE self, VALUE mod, VALUE mid) -{ - int arity = rb_mod_method_arity(mod, rb_check_id(&mid)); - return INT2FIX(arity); -} - -void -Init_arity(VALUE mod) -{ - rb_define_module_function(mod, "obj_method_arity", obj_method_arity, 2); - rb_define_module_function(mod, "mod_method_arity", mod_method_arity, 2); -} diff --git a/ruby_2_2/ext/-test-/method/extconf.rb b/ruby_2_2/ext/-test-/method/extconf.rb deleted file mode 100644 index 658b7af1f1..0000000000 --- a/ruby_2_2/ext/-test-/method/extconf.rb +++ /dev/null @@ -1,6 +0,0 @@ -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/method") diff --git a/ruby_2_2/ext/-test-/method/init.c b/ruby_2_2/ext/-test-/method/init.c deleted file mode 100644 index cea2346240..0000000000 --- a/ruby_2_2/ext/-test-/method/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_method(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_module_under(mBug, "Method"); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/num2int/extconf.rb b/ruby_2_2/ext/-test-/num2int/extconf.rb deleted file mode 100644 index 2bc820e480..0000000000 --- a/ruby_2_2/ext/-test-/num2int/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/num2int/num2int") diff --git a/ruby_2_2/ext/-test-/num2int/num2int.c b/ruby_2_2/ext/-test-/num2int/num2int.c deleted file mode 100644 index 3aec3ccf3b..0000000000 --- a/ruby_2_2/ext/-test-/num2int/num2int.c +++ /dev/null @@ -1,136 +0,0 @@ -#include <ruby.h> - -static VALUE -test_num2short(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%d", NUM2SHORT(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_num2ushort(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%u", NUM2USHORT(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_num2int(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%d", NUM2INT(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_num2uint(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%u", NUM2UINT(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_num2long(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%ld", NUM2LONG(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_num2ulong(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%lu", NUM2ULONG(num)); - return rb_str_new_cstr(buf); -} - -#ifdef HAVE_LONG_LONG -static VALUE -test_num2ll(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%"PRI_LL_PREFIX"d", NUM2LL(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_num2ull(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%"PRI_LL_PREFIX"u", NUM2ULL(num)); - return rb_str_new_cstr(buf); -} -#endif - -static VALUE -test_fix2short(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%d", FIX2SHORT(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_fix2int(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%d", FIX2INT(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_fix2uint(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%u", FIX2UINT(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_fix2long(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%ld", FIX2LONG(num)); - return rb_str_new_cstr(buf); -} - -static VALUE -test_fix2ulong(VALUE obj, VALUE num) -{ - char buf[128]; - sprintf(buf, "%lu", FIX2ULONG(num)); - return rb_str_new_cstr(buf); -} - -void -Init_num2int(void) -{ - VALUE mNum2int = rb_define_module("Num2int"); - - rb_define_module_function(mNum2int, "NUM2SHORT", test_num2short, 1); - rb_define_module_function(mNum2int, "NUM2USHORT", test_num2ushort, 1); - - rb_define_module_function(mNum2int, "NUM2INT", test_num2int, 1); - rb_define_module_function(mNum2int, "NUM2UINT", test_num2uint, 1); - - rb_define_module_function(mNum2int, "NUM2LONG", test_num2long, 1); - rb_define_module_function(mNum2int, "NUM2ULONG", test_num2ulong, 1); - -#ifdef HAVE_LONG_LONG - rb_define_module_function(mNum2int, "NUM2LL", test_num2ll, 1); - rb_define_module_function(mNum2int, "NUM2ULL", test_num2ull, 1); -#endif - - rb_define_module_function(mNum2int, "FIX2SHORT", test_fix2short, 1); - - rb_define_module_function(mNum2int, "FIX2INT", test_fix2int, 1); - rb_define_module_function(mNum2int, "FIX2UINT", test_fix2uint, 1); - - rb_define_module_function(mNum2int, "FIX2LONG", test_fix2long, 1); - rb_define_module_function(mNum2int, "FIX2ULONG", test_fix2ulong, 1); -} - diff --git a/ruby_2_2/ext/-test-/path_to_class/extconf.rb b/ruby_2_2/ext/-test-/path_to_class/extconf.rb deleted file mode 100644 index e1072b1443..0000000000 --- a/ruby_2_2/ext/-test-/path_to_class/extconf.rb +++ /dev/null @@ -1,6 +0,0 @@ -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/path_to_class/path_to_class") diff --git a/ruby_2_2/ext/-test-/path_to_class/path_to_class.c b/ruby_2_2/ext/-test-/path_to_class/path_to_class.c deleted file mode 100644 index c8c2831b09..0000000000 --- a/ruby_2_2/ext/-test-/path_to_class/path_to_class.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "ruby.h" - -static VALUE -path_to_class(VALUE klass, VALUE path) -{ - return rb_path_to_class(path); -} - -void -Init_path_to_class(void) -{ - VALUE klass = rb_path2class("Test_PathToClass"); - - rb_define_singleton_method(klass, "path_to_class", path_to_class, 1); -} diff --git a/ruby_2_2/ext/-test-/postponed_job/depend b/ruby_2_2/ext/-test-/postponed_job/depend deleted file mode 100644 index d672e53f00..0000000000 --- a/ruby_2_2/ext/-test-/postponed_job/depend +++ /dev/null @@ -1 +0,0 @@ -postponed_job.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h diff --git a/ruby_2_2/ext/-test-/postponed_job/extconf.rb b/ruby_2_2/ext/-test-/postponed_job/extconf.rb deleted file mode 100644 index aa29b593f4..0000000000 --- a/ruby_2_2/ext/-test-/postponed_job/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile('-test-/postponed_job') diff --git a/ruby_2_2/ext/-test-/postponed_job/postponed_job.c b/ruby_2_2/ext/-test-/postponed_job/postponed_job.c deleted file mode 100644 index 157230e33b..0000000000 --- a/ruby_2_2/ext/-test-/postponed_job/postponed_job.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "ruby.h" -#include "ruby/debug.h" - -static void -pjob_callback(void *data) -{ - VALUE ary = (VALUE)data; - Check_Type(ary, T_ARRAY); - - rb_ary_replace(ary, rb_funcall(Qnil, rb_intern("caller"), 0)); -} - -static VALUE -pjob_register(VALUE self, VALUE obj) -{ - rb_postponed_job_register(0, pjob_callback, (void *)obj); - return self; -} - -static void -pjob_one_callback(void *data) -{ - VALUE ary = (VALUE)data; - Check_Type(ary, T_ARRAY); - - rb_ary_push(ary, INT2FIX(1)); -} - -static VALUE -pjob_register_one(VALUE self, VALUE obj) -{ - rb_postponed_job_register_one(0, pjob_one_callback, (void *)obj); - rb_postponed_job_register_one(0, pjob_one_callback, (void *)obj); - rb_postponed_job_register_one(0, pjob_one_callback, (void *)obj); - return self; -} - -static VALUE -pjob_call_direct(VALUE self, VALUE obj) -{ - pjob_callback((void *)obj); - return self; -} - -void -Init_postponed_job(VALUE self) -{ - VALUE mBug = rb_define_module("Bug"); - rb_define_module_function(mBug, "postponed_job_register", pjob_register, 1); - rb_define_module_function(mBug, "postponed_job_register_one", pjob_register_one, 1); - rb_define_module_function(mBug, "postponed_job_call_direct", pjob_call_direct, 1); -} - diff --git a/ruby_2_2/ext/-test-/printf/depend b/ruby_2_2/ext/-test-/printf/depend deleted file mode 100644 index 79b6c53f50..0000000000 --- a/ruby_2_2/ext/-test-/printf/depend +++ /dev/null @@ -1,3 +0,0 @@ -$(OBJS): $(HDRS) $(ruby_headers) \ - $(hdrdir)/ruby/encoding.h \ - $(hdrdir)/ruby/oniguruma.h diff --git a/ruby_2_2/ext/-test-/printf/extconf.rb b/ruby_2_2/ext/-test-/printf/extconf.rb deleted file mode 100644 index 7b96da0c85..0000000000 --- a/ruby_2_2/ext/-test-/printf/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/printf") diff --git a/ruby_2_2/ext/-test-/printf/printf.c b/ruby_2_2/ext/-test-/printf/printf.c deleted file mode 100644 index 666f5592e5..0000000000 --- a/ruby_2_2/ext/-test-/printf/printf.c +++ /dev/null @@ -1,101 +0,0 @@ -#include <ruby.h> -#include <ruby/encoding.h> - -static VALUE -printf_test_s(VALUE self, VALUE obj) -{ - return rb_enc_sprintf(rb_usascii_encoding(), "<%"PRIsVALUE">", obj); -} - -static VALUE -printf_test_v(VALUE self, VALUE obj) -{ - return rb_enc_sprintf(rb_usascii_encoding(), "{%+"PRIsVALUE"}", obj); -} - -static VALUE -printf_test_q(VALUE self, VALUE obj) -{ - return rb_enc_sprintf(rb_usascii_encoding(), "[% "PRIsVALUE"]", obj); -} - -static char * -uint_to_str(char *p, char *e, unsigned int x) -{ - char *e0 = e; - if (e <= p) return p; - do { - *--e = x % 10 + '0'; - } while ((x /= 10) != 0 && e > p); - memmove(p, e, e0 - e); - return p + (e0 - e); -} - -static VALUE -printf_test_call(int argc, VALUE *argv, VALUE self) -{ - VALUE opt, type, num, result; - char format[sizeof(int) * 6 + 8], *p = format, cnv; - int n = 0; - const char *s = 0; - - rb_scan_args(argc, argv, "2:", &type, &num, &opt); - Check_Type(type, T_STRING); - if (RSTRING_LEN(type) != 1) rb_raise(rb_eArgError, "wrong length(%ld)", RSTRING_LEN(type)); - switch (cnv = RSTRING_PTR(type)[0]) { - case 'd': case 'x': case 'o': case 'X': - n = NUM2INT(num); - break; - case 's': - s = StringValueCStr(num); - break; - default: rb_raise(rb_eArgError, "wrong conversion(%c)", cnv); - } - *p++ = '%'; - if (!NIL_P(opt)) { - VALUE v; - Check_Type(opt, T_HASH); - if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("space"))))) { - *p++ = ' '; - } - if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("hash"))))) { - *p++ = '#'; - } - if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("plus"))))) { - *p++ = '+'; - } - if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("minus"))))) { - *p++ = '-'; - } - if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("zero"))))) { - *p++ = '0'; - } - if (!NIL_P(v = rb_hash_aref(opt, ID2SYM(rb_intern("width"))))) { - p = uint_to_str(p, format + sizeof(format), NUM2UINT(v)); - } - if (!NIL_P(v = rb_hash_aref(opt, ID2SYM(rb_intern("prec"))))) { - *p++ = '.'; - if (FIXNUM_P(v)) - p = uint_to_str(p, format + sizeof(format), NUM2UINT(v)); - } - } - *p++ = cnv; - *p++ = '\0'; - if (cnv == 's') { - result = rb_enc_sprintf(rb_usascii_encoding(), format, s); - } - else { - result = rb_enc_sprintf(rb_usascii_encoding(), format, n); - } - return rb_assoc_new(result, rb_usascii_str_new_cstr(format)); -} - -void -Init_printf(void) -{ - VALUE m = rb_define_module_under(rb_define_module("Bug"), "Printf"); - rb_define_singleton_method(m, "s", printf_test_s, 1); - rb_define_singleton_method(m, "v", printf_test_v, 1); - rb_define_singleton_method(m, "q", printf_test_q, 1); - rb_define_singleton_method(m, "call", printf_test_call, -1); -} diff --git a/ruby_2_2/ext/-test-/proc/extconf.rb b/ruby_2_2/ext/-test-/proc/extconf.rb deleted file mode 100644 index 40741d07cc..0000000000 --- a/ruby_2_2/ext/-test-/proc/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/proc") diff --git a/ruby_2_2/ext/-test-/proc/init.c b/ruby_2_2/ext/-test-/proc/init.c deleted file mode 100644 index 814c55d98b..0000000000 --- a/ruby_2_2/ext/-test-/proc/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_proc(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_module_under(mBug, "Proc"); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/proc/receiver.c b/ruby_2_2/ext/-test-/proc/receiver.c deleted file mode 100644 index fe44a2246c..0000000000 --- a/ruby_2_2/ext/-test-/proc/receiver.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "ruby.h" - -VALUE rb_current_receiver(void); - -static VALUE -bug_proc_call_receiver(RB_BLOCK_CALL_FUNC_ARGLIST(yieldarg, procarg)) -{ - return rb_current_receiver(); -} - -static VALUE -bug_proc_make_call_receiver(VALUE self, VALUE procarg) -{ - return rb_proc_new(bug_proc_call_receiver, procarg); -} - -void -Init_receiver(VALUE klass) -{ - rb_define_singleton_method(klass, "make_call_receiver", bug_proc_make_call_receiver, 1); -} diff --git a/ruby_2_2/ext/-test-/proc/super.c b/ruby_2_2/ext/-test-/proc/super.c deleted file mode 100644 index dbe8af08f1..0000000000 --- a/ruby_2_2/ext/-test-/proc/super.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "ruby.h" - -static VALUE -bug_proc_call_super(RB_BLOCK_CALL_FUNC_ARGLIST(yieldarg, procarg)) -{ - VALUE args[2]; - VALUE ret; - args[0] = yieldarg; - args[1] = procarg; - ret = rb_call_super(2, args); - if (!NIL_P(blockarg)) { - ret = rb_proc_call(blockarg, ret); - } - return ret; -} - -static VALUE -bug_proc_make_call_super(VALUE self, VALUE procarg) -{ - return rb_proc_new(bug_proc_call_super, procarg); -} - -void -Init_super(VALUE klass) -{ - rb_define_singleton_method(klass, "make_call_super", bug_proc_make_call_super, 1); -} diff --git a/ruby_2_2/ext/-test-/rational/depend b/ruby_2_2/ext/-test-/rational/depend deleted file mode 100644 index bff4981ed6..0000000000 --- a/ruby_2_2/ext/-test-/rational/depend +++ /dev/null @@ -1,20 +0,0 @@ -$(OBJS): $(HDRS) $(ruby_headers) - -rat.o: rat.c $(top_srcdir)/internal.h - -# AUTOGENERATED DEPENDENCIES START -rat.o: $(RUBY_EXTCONF_H) -rat.o: $(arch_hdrdir)/ruby/config.h -rat.o: $(hdrdir)/ruby/defines.h -rat.o: $(hdrdir)/ruby/encoding.h -rat.o: $(hdrdir)/ruby/intern.h -rat.o: $(hdrdir)/ruby/io.h -rat.o: $(hdrdir)/ruby/missing.h -rat.o: $(hdrdir)/ruby/oniguruma.h -rat.o: $(hdrdir)/ruby/ruby.h -rat.o: $(hdrdir)/ruby/st.h -rat.o: $(hdrdir)/ruby/subst.h -rat.o: $(top_srcdir)/include/ruby.h -rat.o: $(top_srcdir)/internal.h -rat.o: rat.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ruby_2_2/ext/-test-/rational/extconf.rb b/ruby_2_2/ext/-test-/rational/extconf.rb deleted file mode 100644 index bd658def46..0000000000 --- a/ruby_2_2/ext/-test-/rational/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/rational") diff --git a/ruby_2_2/ext/-test-/rational/rat.c b/ruby_2_2/ext/-test-/rational/rat.c deleted file mode 100644 index 772546fca8..0000000000 --- a/ruby_2_2/ext/-test-/rational/rat.c +++ /dev/null @@ -1,37 +0,0 @@ -#include "internal.h" - -#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) -static VALUE -big(VALUE x) -{ - if (FIXNUM_P(x)) - return rb_int2big(FIX2LONG(x)); - if (RB_TYPE_P(x, T_BIGNUM)) - return x; - rb_raise(rb_eTypeError, "can't convert %s to Bignum", - rb_obj_classname(x)); -} -#endif - -static VALUE -gcd_normal(VALUE x, VALUE y) -{ - return rb_big_norm(rb_gcd_normal(rb_to_int(x), rb_to_int(y))); -} - -#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H) -static VALUE -gcd_gmp(VALUE x, VALUE y) -{ - return rb_big_norm(rb_gcd_gmp(big(x), big(y))); -} -#else -#define gcd_gmp rb_f_notimplement -#endif - -void -Init_rational(VALUE klass) -{ - rb_define_method(rb_cInteger, "gcd_normal", gcd_normal, 1); - rb_define_method(rb_cInteger, "gcd_gmp", gcd_gmp, 1); -} diff --git a/ruby_2_2/ext/-test-/recursion/extconf.rb b/ruby_2_2/ext/-test-/recursion/extconf.rb deleted file mode 100644 index 92b28657f0..0000000000 --- a/ruby_2_2/ext/-test-/recursion/extconf.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'mkmf' -create_makefile("-test-/recursion") diff --git a/ruby_2_2/ext/-test-/recursion/recursion.c b/ruby_2_2/ext/-test-/recursion/recursion.c deleted file mode 100644 index 13d41f0ba8..0000000000 --- a/ruby_2_2/ext/-test-/recursion/recursion.c +++ /dev/null @@ -1,28 +0,0 @@ -#include <ruby.h> - -static VALUE -recursive_i(VALUE obj, VALUE mid, int recur) -{ - if (recur) return Qnil; - return rb_funcallv(obj, rb_to_id(mid), 0, 0); -} - -static VALUE -exec_recursive(VALUE self, VALUE mid) -{ - return rb_exec_recursive(recursive_i, self, mid); -} - -static VALUE -exec_recursive_outer(VALUE self, VALUE mid) -{ - return rb_exec_recursive_outer(recursive_i, self, mid); -} - -void -Init_recursion(void) -{ - VALUE m = rb_define_module_under(rb_define_module("Bug"), "Recursive"); - rb_define_method(m, "exec_recursive", exec_recursive, 1); - rb_define_method(m, "exec_recursive_outer", exec_recursive_outer, 1); -} diff --git a/ruby_2_2/ext/-test-/st/foreach/extconf.rb b/ruby_2_2/ext/-test-/st/foreach/extconf.rb deleted file mode 100644 index 969f386ff9..0000000000 --- a/ruby_2_2/ext/-test-/st/foreach/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/st/foreach") diff --git a/ruby_2_2/ext/-test-/st/foreach/foreach.c b/ruby_2_2/ext/-test-/st/foreach/foreach.c deleted file mode 100644 index 1e0fd515c9..0000000000 --- a/ruby_2_2/ext/-test-/st/foreach/foreach.c +++ /dev/null @@ -1,175 +0,0 @@ -#include <ruby.h> -#include <ruby/st.h> - -static st_data_t expect_size = 32; -struct checker { - st_table *tbl; - st_index_t nr; - VALUE test; -}; - -static void -force_unpack_check(struct checker *c, st_data_t key, st_data_t val) -{ - if (c->nr == 0) { - st_data_t i; - - if (!c->tbl->entries_packed) rb_bug("should be packed\n"); - - /* force unpacking during iteration: */ - for (i = 1; i < expect_size; i++) - st_add_direct(c->tbl, i, i); - - if (c->tbl->entries_packed) rb_bug("should be unpacked\n"); - } - - if (key != c->nr) { - rb_bug("unexpected key: %"PRIuVALUE" (expected %"PRIuVALUE")\n", (VALUE)key, (VALUE)c->nr); - } - if (val != c->nr) { - rb_bug("unexpected val: %"PRIuVALUE" (expected %"PRIuVALUE")\n", (VALUE)val, (VALUE)c->nr); - } - - c->nr++; -} - -static int -unp_fec_i(st_data_t key, st_data_t val, st_data_t args, int error) -{ - struct checker *c = (struct checker *)args; - - if (error) { - if (c->test == ID2SYM(rb_intern("delete2"))) - return ST_STOP; - - rb_bug("unexpected error"); - } - - force_unpack_check(c, key, val); - - if (c->test == ID2SYM(rb_intern("check"))) { - return ST_CHECK; - } - if (c->test == ID2SYM(rb_intern("delete1"))) { - if (c->nr == 1) return ST_DELETE; - return ST_CHECK; - } - if (c->test == ID2SYM(rb_intern("delete2"))) { - if (c->nr == 1) { - st_data_t k = 0; - st_data_t v; - - if (!st_delete(c->tbl, &k, &v)) { - rb_bug("failed to delete\n"); - } - if (v != 0) { - rb_bug("unexpected value deleted: %"PRIuVALUE" (expected 0)", (VALUE)v); - } - } - return ST_CHECK; - } - - rb_raise(rb_eArgError, "unexpected arg: %+"PRIsVALUE, c->test); -} - -static VALUE -unp_fec(VALUE self, VALUE test) -{ - st_table *tbl = st_init_numtable(); - struct checker c; - - c.tbl = tbl; - c.nr = 0; - c.test = test; - - st_add_direct(tbl, 0, 0); - - if (!tbl->entries_packed) rb_bug("should still be packed\n"); - - st_foreach_check(tbl, unp_fec_i, (st_data_t)&c, -1); - - if (c.test == ID2SYM(rb_intern("delete2"))) { - if (c.nr != 1) { - rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)\n", (VALUE)c.nr); - } - } - else if (c.nr != expect_size) { - rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE")\n", - (VALUE)c.nr, (VALUE)expect_size); - } - - if (tbl->entries_packed) rb_bug("should be unpacked\n"); - - st_free_table(tbl); - - return Qnil; -} - -static int -unp_fe_i(st_data_t key, st_data_t val, st_data_t args, int error) -{ - struct checker *c = (struct checker *)args; - - force_unpack_check(c, key, val); - if (c->test == ID2SYM(rb_intern("unpacked"))) { - return ST_CONTINUE; - } - else if (c->test == ID2SYM(rb_intern("unpack_delete"))) { - if (c->nr == 1) { - st_data_t k = 0; - st_data_t v; - - if (!st_delete(c->tbl, &k, &v)) { - rb_bug("failed to delete\n"); - } - if (v != 0) { - rb_bug("unexpected value deleted: %"PRIuVALUE" (expected 0)", (VALUE)v); - } - return ST_CONTINUE; - } - rb_bug("should never get here\n"); - } - - rb_raise(rb_eArgError, "unexpected arg: %+"PRIsVALUE, c->test); -} - -static VALUE -unp_fe(VALUE self, VALUE test) -{ - st_table *tbl = st_init_numtable(); - struct checker c; - - c.tbl = tbl; - c.nr = 0; - c.test = test; - - st_add_direct(tbl, 0, 0); - - if (!tbl->entries_packed) rb_bug("should still be packed\n"); - - st_foreach(tbl, unp_fe_i, (st_data_t)&c); - - if (c.test == ID2SYM(rb_intern("unpack_delete"))) { - if (c.nr != 1) { - rb_bug("mismatched iteration: %"PRIuVALUE" (expected 1)\n", (VALUE)c.nr); - } - } - else if (c.nr != expect_size) { - rb_bug("mismatched iteration: %"PRIuVALUE" (expected %"PRIuVALUE"o)\n", - (VALUE)c.nr, (VALUE)expect_size); - } - - if (tbl->entries_packed) rb_bug("should be unpacked\n"); - - st_free_table(tbl); - - return Qnil; -} - -void -Init_foreach(void) -{ - VALUE bug = rb_define_module("Bug"); - rb_define_singleton_method(bug, "unp_st_foreach_check", unp_fec, 1); - rb_define_singleton_method(bug, "unp_st_foreach", unp_fe, 1); -} diff --git a/ruby_2_2/ext/-test-/st/numhash/extconf.rb b/ruby_2_2/ext/-test-/st/numhash/extconf.rb deleted file mode 100644 index 867fd75d2a..0000000000 --- a/ruby_2_2/ext/-test-/st/numhash/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/st/numhash") diff --git a/ruby_2_2/ext/-test-/st/numhash/numhash.c b/ruby_2_2/ext/-test-/st/numhash/numhash.c deleted file mode 100644 index e033886f9d..0000000000 --- a/ruby_2_2/ext/-test-/st/numhash/numhash.c +++ /dev/null @@ -1,138 +0,0 @@ -#include <ruby.h> -#include <ruby/st.h> - -static void -numhash_free(void *ptr) -{ - if (ptr) st_free_table(ptr); -} - -static size_t -numhash_memsize(const void *ptr) -{ - return ptr ? st_memsize(ptr) : 0; -} - -static const rb_data_type_t numhash_type = { - "numhash", - {0, numhash_free, numhash_memsize,}, - 0, 0, - RUBY_TYPED_FREE_IMMEDIATELY|RUBY_TYPED_WB_PROTECTED, -}; - -static VALUE -numhash_alloc(VALUE klass) -{ - return TypedData_Wrap_Struct(klass, &numhash_type, 0); -} - -static VALUE -numhash_init(VALUE self) -{ - st_table *tbl = (st_table *)Check_TypedStruct(self, &numhash_type); - if (tbl) st_free_table(tbl); - DATA_PTR(self) = st_init_numtable(); - return self; -} - -static VALUE -numhash_aref(VALUE self, VALUE key) -{ - st_data_t data; - st_table *tbl = (st_table *)Check_TypedStruct(self, &numhash_type); - if (!SPECIAL_CONST_P(key)) rb_raise(rb_eArgError, "not a special const"); - if (st_lookup(tbl, (st_data_t)key, &data)) - return (VALUE)data; - return Qnil; -} - -static VALUE -numhash_aset(VALUE self, VALUE key, VALUE data) -{ - st_table *tbl = (st_table *)Check_TypedStruct(self, &numhash_type); - if (!SPECIAL_CONST_P(key)) rb_raise(rb_eArgError, "not a special const"); - if (!SPECIAL_CONST_P(data)) rb_raise(rb_eArgError, "not a special const"); - st_insert(tbl, (st_data_t)key, (st_data_t)data); - return self; -} - -static int -numhash_i(st_data_t key, st_data_t value, st_data_t arg) -{ - VALUE ret; - ret = rb_yield_values(3, (VALUE)key, (VALUE)value, (VALUE)arg); - if (ret == Qtrue) return ST_CHECK; - return ST_CONTINUE; -} - -static VALUE -numhash_each(VALUE self) -{ - st_table *table = (st_table *)Check_TypedStruct(self, &numhash_type); - st_data_t data = (st_data_t)self; - return st_foreach_check(table, numhash_i, data, data) ? Qtrue : Qfalse; -} - -static int -update_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing) -{ - VALUE ret = rb_yield_values(existing ? 2 : 1, (VALUE)*key, (VALUE)*value); - switch (ret) { - case Qfalse: - return ST_STOP; - case Qnil: - return ST_DELETE; - default: - *value = ret; - return ST_CONTINUE; - } -} - -static VALUE -numhash_update(VALUE self, VALUE key) -{ - st_table *table = (st_table *)Check_TypedStruct(self, &numhash_type); - if (st_update(table, (st_data_t)key, update_func, 0)) - return Qtrue; - else - return Qfalse; -} - -#if SIZEOF_LONG == SIZEOF_VOIDP -# define ST2NUM(x) ULONG2NUM(x) -#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP -# define ST2NUM(x) ULL2NUM(x) -#endif - -static VALUE -numhash_size(VALUE self) -{ - st_table *table = (st_table *)Check_TypedStruct(self, &numhash_type); - return ST2NUM(table->num_entries); -} - -static VALUE -numhash_delete_safe(VALUE self, VALUE key) -{ - st_table *table = (st_table *)Check_TypedStruct(self, &numhash_type); - st_data_t val, k = (st_data_t)key; - if (st_delete_safe(table, &k, &val, (st_data_t)self)) { - return val; - } - return Qnil; -} - -void -Init_numhash(void) -{ - VALUE st = rb_define_class_under(rb_define_module("Bug"), "StNumHash", rb_cData); - rb_define_alloc_func(st, numhash_alloc); - rb_define_method(st, "initialize", numhash_init, 0); - rb_define_method(st, "[]", numhash_aref, 1); - rb_define_method(st, "[]=", numhash_aset, 2); - rb_define_method(st, "each", numhash_each, 0); - rb_define_method(st, "update", numhash_update, 1); - rb_define_method(st, "size", numhash_size, 0); - rb_define_method(st, "delete_safe", numhash_delete_safe, 1); -} - diff --git a/ruby_2_2/ext/-test-/st/update/extconf.rb b/ruby_2_2/ext/-test-/st/update/extconf.rb deleted file mode 100644 index 96dbae43ab..0000000000 --- a/ruby_2_2/ext/-test-/st/update/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/st/update") diff --git a/ruby_2_2/ext/-test-/st/update/update.c b/ruby_2_2/ext/-test-/st/update/update.c deleted file mode 100644 index 979ad3e334..0000000000 --- a/ruby_2_2/ext/-test-/st/update/update.c +++ /dev/null @@ -1,34 +0,0 @@ -#include <ruby.h> -#include <ruby/st.h> - -static int -update_func(st_data_t *key, st_data_t *value, st_data_t arg, int existing) -{ - VALUE ret = rb_yield_values(existing ? 2 : 1, (VALUE)*key, (VALUE)*value); - switch (ret) { - case Qfalse: - return ST_STOP; - case Qnil: - return ST_DELETE; - default: - *value = ret; - return ST_CONTINUE; - } -} - -static VALUE -test_st_update(VALUE self, VALUE key) -{ - if (st_update(RHASH_TBL(self), (st_data_t)key, update_func, 0)) - return Qtrue; - else - return Qfalse; -} - -void -Init_update(void) -{ - VALUE st = rb_define_class_under(rb_define_module("Bug"), "StTable", rb_cHash); - rb_define_method(st, "st_update", test_st_update, 1); -} - diff --git a/ruby_2_2/ext/-test-/string/coderange.c b/ruby_2_2/ext/-test-/string/coderange.c deleted file mode 100644 index b93172d72d..0000000000 --- a/ruby_2_2/ext/-test-/string/coderange.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/encoding.h" - -static VALUE sym_7bit, sym_valid, sym_unknown, sym_broken; - -static VALUE -coderange_int2sym(int coderange) -{ - switch (coderange) { - case ENC_CODERANGE_7BIT: - return sym_7bit; - case ENC_CODERANGE_VALID: - return sym_valid; - case ENC_CODERANGE_UNKNOWN: - return sym_unknown; - case ENC_CODERANGE_BROKEN: - return sym_broken; - } - rb_bug("wrong condition of coderange"); - UNREACHABLE; -} - -/* return coderange without scan */ -static VALUE -str_coderange(VALUE str) -{ - return coderange_int2sym(ENC_CODERANGE(str)); -} - -/* scan coderange and return the result */ -static VALUE -str_coderange_scan(VALUE str) -{ - ENC_CODERANGE_SET(str, ENC_CODERANGE_UNKNOWN); - return coderange_int2sym(rb_enc_str_coderange(str)); -} - -void -Init_coderange(VALUE klass) -{ - sym_7bit = ID2SYM(rb_intern("7bit")); - sym_valid = ID2SYM(rb_intern("valid")); - sym_unknown = ID2SYM(rb_intern("unknown")); - sym_broken = ID2SYM(rb_intern("broken")); - rb_define_method(klass, "coderange", str_coderange, 0); - rb_define_method(klass, "coderange_scan", str_coderange_scan, 0); -} diff --git a/ruby_2_2/ext/-test-/string/cstr.c b/ruby_2_2/ext/-test-/string/cstr.c deleted file mode 100644 index ba2e46bc55..0000000000 --- a/ruby_2_2/ext/-test-/string/cstr.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "ruby.h" -#include "ruby/encoding.h" - -static VALUE -bug_str_cstr_term(VALUE str) -{ - long len; - char *s; - int c; - rb_encoding *enc; - - rb_str_modify(str); - len = RSTRING_LEN(str); - RSTRING_PTR(str)[len] = 'x'; - s = StringValueCStr(str); - rb_gc(); - enc = rb_enc_get(str); - c = rb_enc_codepoint(&s[len], &s[len+rb_enc_mbminlen(enc)], enc); - return INT2NUM(c); -} - -static VALUE -bug_str_cstr_term_char(VALUE str) -{ - long len; - char *s; - int c; - rb_encoding *enc = rb_enc_get(str); - - RSTRING_GETMEM(str, s, len); - s += len; - len = rb_enc_mbminlen(enc); - c = rb_enc_precise_mbclen(s, s + len, enc); - if (!MBCLEN_CHARFOUND_P(c)) { - c = (unsigned char)*s; - } - else { - c = rb_enc_mbc_to_codepoint(s, s + len, enc); - if (!c) return Qnil; - } - return rb_enc_uint_chr((unsigned int)c, enc); -} - -static VALUE -bug_str_s_cstr_term_char(VALUE self, VALUE str) -{ - Check_Type(str, T_STRING); - return bug_str_cstr_term_char(str); -} - -void -Init_cstr(VALUE klass) -{ - rb_define_method(klass, "cstr_term", bug_str_cstr_term, 0); - rb_define_method(klass, "cstr_term_char", bug_str_cstr_term_char, 0); - rb_define_singleton_method(klass, "cstr_term_char", bug_str_s_cstr_term_char, 1); -} diff --git a/ruby_2_2/ext/-test-/string/depend b/ruby_2_2/ext/-test-/string/depend deleted file mode 100644 index ef13e44df5..0000000000 --- a/ruby_2_2/ext/-test-/string/depend +++ /dev/null @@ -1,115 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -coderange.o: $(RUBY_EXTCONF_H) -coderange.o: $(arch_hdrdir)/ruby/config.h -coderange.o: $(hdrdir)/ruby/defines.h -coderange.o: $(hdrdir)/ruby/encoding.h -coderange.o: $(hdrdir)/ruby/intern.h -coderange.o: $(hdrdir)/ruby/missing.h -coderange.o: $(hdrdir)/ruby/oniguruma.h -coderange.o: $(hdrdir)/ruby/ruby.h -coderange.o: $(hdrdir)/ruby/st.h -coderange.o: $(hdrdir)/ruby/subst.h -coderange.o: coderange.c -cstr.o: $(RUBY_EXTCONF_H) -cstr.o: $(arch_hdrdir)/ruby/config.h -cstr.o: $(hdrdir)/ruby/defines.h -cstr.o: $(hdrdir)/ruby/encoding.h -cstr.o: $(hdrdir)/ruby/intern.h -cstr.o: $(hdrdir)/ruby/missing.h -cstr.o: $(hdrdir)/ruby/oniguruma.h -cstr.o: $(hdrdir)/ruby/ruby.h -cstr.o: $(hdrdir)/ruby/st.h -cstr.o: $(hdrdir)/ruby/subst.h -cstr.o: $(top_srcdir)/include/ruby.h -cstr.o: cstr.c -ellipsize.o: $(RUBY_EXTCONF_H) -ellipsize.o: $(arch_hdrdir)/ruby/config.h -ellipsize.o: $(hdrdir)/ruby/defines.h -ellipsize.o: $(hdrdir)/ruby/intern.h -ellipsize.o: $(hdrdir)/ruby/missing.h -ellipsize.o: $(hdrdir)/ruby/ruby.h -ellipsize.o: $(hdrdir)/ruby/st.h -ellipsize.o: $(hdrdir)/ruby/subst.h -ellipsize.o: $(top_srcdir)/include/ruby.h -ellipsize.o: ellipsize.c -enc_associate.o: $(RUBY_EXTCONF_H) -enc_associate.o: $(arch_hdrdir)/ruby/config.h -enc_associate.o: $(hdrdir)/ruby/defines.h -enc_associate.o: $(hdrdir)/ruby/encoding.h -enc_associate.o: $(hdrdir)/ruby/intern.h -enc_associate.o: $(hdrdir)/ruby/missing.h -enc_associate.o: $(hdrdir)/ruby/oniguruma.h -enc_associate.o: $(hdrdir)/ruby/ruby.h -enc_associate.o: $(hdrdir)/ruby/st.h -enc_associate.o: $(hdrdir)/ruby/subst.h -enc_associate.o: $(top_srcdir)/include/ruby.h -enc_associate.o: enc_associate.c -enc_str_buf_cat.o: $(RUBY_EXTCONF_H) -enc_str_buf_cat.o: $(arch_hdrdir)/ruby/config.h -enc_str_buf_cat.o: $(hdrdir)/ruby/defines.h -enc_str_buf_cat.o: $(hdrdir)/ruby/encoding.h -enc_str_buf_cat.o: $(hdrdir)/ruby/intern.h -enc_str_buf_cat.o: $(hdrdir)/ruby/missing.h -enc_str_buf_cat.o: $(hdrdir)/ruby/oniguruma.h -enc_str_buf_cat.o: $(hdrdir)/ruby/ruby.h -enc_str_buf_cat.o: $(hdrdir)/ruby/st.h -enc_str_buf_cat.o: $(hdrdir)/ruby/subst.h -enc_str_buf_cat.o: enc_str_buf_cat.c -init.o: $(RUBY_EXTCONF_H) -init.o: $(arch_hdrdir)/ruby/config.h -init.o: $(hdrdir)/ruby/defines.h -init.o: $(hdrdir)/ruby/intern.h -init.o: $(hdrdir)/ruby/missing.h -init.o: $(hdrdir)/ruby/ruby.h -init.o: $(hdrdir)/ruby/st.h -init.o: $(hdrdir)/ruby/subst.h -init.o: $(top_srcdir)/include/ruby.h -init.o: init.c -modify.o: $(RUBY_EXTCONF_H) -modify.o: $(arch_hdrdir)/ruby/config.h -modify.o: $(hdrdir)/ruby/defines.h -modify.o: $(hdrdir)/ruby/intern.h -modify.o: $(hdrdir)/ruby/missing.h -modify.o: $(hdrdir)/ruby/ruby.h -modify.o: $(hdrdir)/ruby/st.h -modify.o: $(hdrdir)/ruby/subst.h -modify.o: $(top_srcdir)/include/ruby.h -modify.o: modify.c -normalize.o: $(RUBY_EXTCONF_H) -normalize.o: $(arch_hdrdir)/ruby/config.h -normalize.o: $(hdrdir)/ruby/defines.h -normalize.o: $(hdrdir)/ruby/encoding.h -normalize.o: $(hdrdir)/ruby/intern.h -normalize.o: $(hdrdir)/ruby/io.h -normalize.o: $(hdrdir)/ruby/missing.h -normalize.o: $(hdrdir)/ruby/oniguruma.h -normalize.o: $(hdrdir)/ruby/ruby.h -normalize.o: $(hdrdir)/ruby/st.h -normalize.o: $(hdrdir)/ruby/subst.h -normalize.o: $(top_srcdir)/include/ruby.h -normalize.o: $(top_srcdir)/internal.h -normalize.o: normalize.c -qsort.o: $(RUBY_EXTCONF_H) -qsort.o: $(arch_hdrdir)/ruby/config.h -qsort.o: $(hdrdir)/ruby/defines.h -qsort.o: $(hdrdir)/ruby/encoding.h -qsort.o: $(hdrdir)/ruby/intern.h -qsort.o: $(hdrdir)/ruby/missing.h -qsort.o: $(hdrdir)/ruby/oniguruma.h -qsort.o: $(hdrdir)/ruby/ruby.h -qsort.o: $(hdrdir)/ruby/st.h -qsort.o: $(hdrdir)/ruby/subst.h -qsort.o: $(hdrdir)/ruby/util.h -qsort.o: $(top_srcdir)/include/ruby.h -qsort.o: qsort.c -set_len.o: $(RUBY_EXTCONF_H) -set_len.o: $(arch_hdrdir)/ruby/config.h -set_len.o: $(hdrdir)/ruby/defines.h -set_len.o: $(hdrdir)/ruby/intern.h -set_len.o: $(hdrdir)/ruby/missing.h -set_len.o: $(hdrdir)/ruby/ruby.h -set_len.o: $(hdrdir)/ruby/st.h -set_len.o: $(hdrdir)/ruby/subst.h -set_len.o: $(top_srcdir)/include/ruby.h -set_len.o: set_len.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ruby_2_2/ext/-test-/string/ellipsize.c b/ruby_2_2/ext/-test-/string/ellipsize.c deleted file mode 100644 index 0451519492..0000000000 --- a/ruby_2_2/ext/-test-/string/ellipsize.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "ruby.h" - -static VALUE -bug_str_ellipsize(VALUE str, VALUE len) -{ - return rb_str_ellipsize(str, NUM2LONG(len)); -} - -void -Init_ellipsize(VALUE klass) -{ - rb_define_method(klass, "ellipsize", bug_str_ellipsize, 1); -} diff --git a/ruby_2_2/ext/-test-/string/enc_associate.c b/ruby_2_2/ext/-test-/string/enc_associate.c deleted file mode 100644 index d6614fb298..0000000000 --- a/ruby_2_2/ext/-test-/string/enc_associate.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "ruby.h" -#include "ruby/encoding.h" - -VALUE -bug_str_enc_associate(VALUE str, VALUE enc) -{ - return rb_enc_associate(str, rb_to_encoding(enc)); -} - -void -Init_enc_associate(VALUE klass) -{ - rb_define_method(klass, "associate_encoding!", bug_str_enc_associate, 1); -} diff --git a/ruby_2_2/ext/-test-/string/enc_str_buf_cat.c b/ruby_2_2/ext/-test-/string/enc_str_buf_cat.c deleted file mode 100644 index 5d583c65dc..0000000000 --- a/ruby_2_2/ext/-test-/string/enc_str_buf_cat.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/encoding.h" - -static VALUE -enc_str_buf_cat(VALUE str, VALUE str2) -{ - return rb_enc_str_buf_cat(str, RSTRING_PTR(str2), RSTRING_LEN(str2), rb_enc_get(str2)); -} - -void -Init_enc_str_buf_cat(VALUE klass) -{ - rb_define_method(klass, "enc_str_buf_cat", enc_str_buf_cat, 1); -} diff --git a/ruby_2_2/ext/-test-/string/extconf.rb b/ruby_2_2/ext/-test-/string/extconf.rb deleted file mode 100644 index 10d33cbab9..0000000000 --- a/ruby_2_2/ext/-test-/string/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/string/string") diff --git a/ruby_2_2/ext/-test-/string/init.c b/ruby_2_2/ext/-test-/string/init.c deleted file mode 100644 index 0b3e4a6ff2..0000000000 --- a/ruby_2_2/ext/-test-/string/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_string(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_class_under(mBug, "String", rb_cString); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/string/modify.c b/ruby_2_2/ext/-test-/string/modify.c deleted file mode 100644 index ddd2efd8f0..0000000000 --- a/ruby_2_2/ext/-test-/string/modify.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "ruby.h" - -VALUE -bug_str_modify(VALUE str) -{ - rb_str_modify(str); - return str; -} - -VALUE -bug_str_modify_expand(VALUE str, VALUE expand) -{ - rb_str_modify_expand(str, NUM2LONG(expand)); - return str; -} - -void -Init_modify(VALUE klass) -{ - rb_define_method(klass, "modify!", bug_str_modify, 0); - rb_define_method(klass, "modify_expand!", bug_str_modify_expand, 1); -} diff --git a/ruby_2_2/ext/-test-/string/nofree.c b/ruby_2_2/ext/-test-/string/nofree.c deleted file mode 100644 index d3d8071ff9..0000000000 --- a/ruby_2_2/ext/-test-/string/nofree.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "ruby.h" - -VALUE -bug_str_nofree(VALUE self) -{ - return rb_str_new_cstr("abcdef"); -} - -void -Init_nofree(VALUE klass) -{ - rb_define_singleton_method(klass, "nofree", bug_str_nofree, 0); -} diff --git a/ruby_2_2/ext/-test-/string/normalize.c b/ruby_2_2/ext/-test-/string/normalize.c deleted file mode 100644 index 2e16a4616f..0000000000 --- a/ruby_2_2/ext/-test-/string/normalize.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "internal.h" - -#ifdef __APPLE__ -static VALUE -normalize_ospath(VALUE str) -{ - return rb_str_normalize_ospath(RSTRING_PTR(str), RSTRING_LEN(str)); -} -#else -#define normalize_ospath rb_f_notimplement -#endif - -void -Init_normalize(VALUE klass) -{ - rb_define_method(klass, "normalize_ospath", normalize_ospath, 0); -} diff --git a/ruby_2_2/ext/-test-/string/qsort.c b/ruby_2_2/ext/-test-/string/qsort.c deleted file mode 100644 index 0b34936d38..0000000000 --- a/ruby_2_2/ext/-test-/string/qsort.c +++ /dev/null @@ -1,61 +0,0 @@ -#include "ruby.h" -#include "ruby/util.h" -#include "ruby/encoding.h" - -struct sort_data { - rb_encoding *enc; - long elsize; -}; - -static int -cmp_1(const void *ap, const void *bp, void *dummy) -{ - struct sort_data *d = dummy; - VALUE a = rb_enc_str_new(ap, d->elsize, d->enc); - VALUE b = rb_enc_str_new(bp, d->elsize, d->enc); - VALUE retval = rb_yield_values(2, a, b); - return rb_cmpint(retval, a, b); -} - -static int -cmp_2(const void *ap, const void *bp, void *dummy) -{ - int a = *(const unsigned char *)ap; - int b = *(const unsigned char *)bp; - return a - b; -} - -static VALUE -bug_str_qsort_bang(int argc, VALUE *argv, VALUE str) -{ - VALUE beg, len, size; - long l, b = 0, n, s = 1; - struct sort_data d; - - rb_scan_args(argc, argv, "03", &beg, &len, &size); - l = RSTRING_LEN(str); - if (!NIL_P(beg) && (b = NUM2INT(beg)) < 0 && (b += l) < 0) { - rb_raise(rb_eArgError, "out of bounds"); - } - if (!NIL_P(size) && (s = NUM2INT(size)) < 0) { - rb_raise(rb_eArgError, "negative size"); - } - if (NIL_P(len) || - (((n = NUM2INT(len)) < 0) ? - (rb_raise(rb_eArgError, "negative length"), 0) : - (b + n * s > l))) { - n = (l - b) / s; - } - rb_str_modify(str); - d.enc = rb_enc_get(str); - d.elsize = s; - ruby_qsort(RSTRING_PTR(str) + b, n, s, - rb_block_given_p() ? cmp_1 : cmp_2, &d); - return str; -} - -void -Init_qsort(VALUE klass) -{ - rb_define_method(klass, "qsort!", bug_str_qsort_bang, -1); -} diff --git a/ruby_2_2/ext/-test-/string/set_len.c b/ruby_2_2/ext/-test-/string/set_len.c deleted file mode 100644 index 3c7d19d778..0000000000 --- a/ruby_2_2/ext/-test-/string/set_len.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "ruby.h" - -static VALUE -bug_str_set_len(VALUE str, VALUE len) -{ - rb_str_set_len(str, NUM2LONG(len)); - return str; -} - -void -Init_set_len(VALUE klass) -{ - rb_define_method(klass, "set_len", bug_str_set_len, 1); -} diff --git a/ruby_2_2/ext/-test-/struct/duplicate.c b/ruby_2_2/ext/-test-/struct/duplicate.c deleted file mode 100644 index 596d32aad8..0000000000 --- a/ruby_2_2/ext/-test-/struct/duplicate.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "ruby.h" - -static VALUE -bug_struct_new_duplicate(VALUE obj, VALUE name, VALUE mem) -{ - const char *n = NIL_P(name) ? 0 : StringValueCStr(name); - const char *m = StringValueCStr(mem); - return rb_struct_define(n, m, m, NULL); -} - -static VALUE -bug_struct_new_duplicate_under(VALUE obj, VALUE name, VALUE mem) -{ - const char *n = StringValueCStr(name); - const char *m = StringValueCStr(mem); - return rb_struct_define_under(obj, n, m, m, NULL); -} - -void -Init_duplicate(VALUE klass) -{ - rb_define_singleton_method(klass, "new_duplicate", bug_struct_new_duplicate, 2); - rb_define_singleton_method(klass, "new_duplicate_under", bug_struct_new_duplicate_under, 2); -} diff --git a/ruby_2_2/ext/-test-/struct/extconf.rb b/ruby_2_2/ext/-test-/struct/extconf.rb deleted file mode 100644 index 0e4f9551f2..0000000000 --- a/ruby_2_2/ext/-test-/struct/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$INCFLAGS << " -I$(topdir) -I$(top_srcdir)" -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -create_makefile("-test-/struct") diff --git a/ruby_2_2/ext/-test-/struct/init.c b/ruby_2_2/ext/-test-/struct/init.c deleted file mode 100644 index 459a939e79..0000000000 --- a/ruby_2_2/ext/-test-/struct/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -void -Init_struct(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_class_under(mBug, "Struct", rb_cStruct); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/struct/member.c b/ruby_2_2/ext/-test-/struct/member.c deleted file mode 100644 index 1d404039b4..0000000000 --- a/ruby_2_2/ext/-test-/struct/member.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "ruby.h" - -static VALUE -bug_struct_get(VALUE obj, VALUE name) -{ - ID id = rb_check_id(&name); - - if (!id) { - rb_name_error_str(name, "`%"PRIsVALUE"' is not a struct member", name); - } - return rb_struct_getmember(obj, id); -} - -void -Init_member(VALUE klass) -{ - rb_define_method(klass, "get", bug_struct_get, 1); -} diff --git a/ruby_2_2/ext/-test-/symbol/extconf.rb b/ruby_2_2/ext/-test-/symbol/extconf.rb deleted file mode 100644 index fc00ec9abf..0000000000 --- a/ruby_2_2/ext/-test-/symbol/extconf.rb +++ /dev/null @@ -1,7 +0,0 @@ -$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] -inits = $srcs.map {|s| File.basename(s, ".*")} -inits.delete("init") -inits.map! {|s|"X(#{s})"} -$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" -have_func("rb_pin_dynamic_symbol") -create_makefile("-test-/symbol") diff --git a/ruby_2_2/ext/-test-/symbol/init.c b/ruby_2_2/ext/-test-/symbol/init.c deleted file mode 100644 index 9e42e1a38b..0000000000 --- a/ruby_2_2/ext/-test-/symbol/init.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);} - -static VALUE -sym_find(VALUE dummy, VALUE sym) -{ - return rb_check_symbol(&sym); -} - -static VALUE -sym_pinneddown_p(VALUE dummy, VALUE sym) -{ - return rb_check_id(&sym) ? Qtrue : Qfalse; -} - -void -Init_symbol(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_class_under(mBug, "Symbol", rb_cSymbol); - rb_define_singleton_method(klass, "find", sym_find, 1); - rb_define_singleton_method(klass, "pinneddown?", sym_pinneddown_p, 1); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/symbol/type.c b/ruby_2_2/ext/-test-/symbol/type.c deleted file mode 100644 index e51e09eb26..0000000000 --- a/ruby_2_2/ext/-test-/symbol/type.c +++ /dev/null @@ -1,78 +0,0 @@ -#include "ruby.h" - -#ifdef HAVE_RB_IS_CONST_NAME -# define get_symbol_type(type, t, name) do { \ - ID id = rb_check_id(&name); \ - t = (id ? rb_is_##type##_id(id) : rb_is_##type##_name(name)); \ - } while (0) -#else -# define get_symbol_type(type, t, name) do { \ - t = rb_is_##type##_id(rb_to_id(name)); \ - } while (0) -#endif - -#define define_symbol_type_p(type) \ -static VALUE \ -bug_sym_##type##_p(VALUE self, VALUE name) \ -{ \ - int t; \ - get_symbol_type(type, t, name); \ - return (t ? Qtrue : Qfalse); \ -} - -#define declare_symbol_type_p(type) \ - rb_define_singleton_method(klass, #type"?", bug_sym_##type##_p, 1); - -#define FOREACH_ID_TYPES(x) x(const) x(class) x(global) x(instance) x(attrset) x(local) x(junk) - -FOREACH_ID_TYPES(define_symbol_type_p) - -static VALUE -bug_sym_attrset(VALUE self, VALUE name) -{ - ID id = rb_to_id(name); - id = rb_id_attrset(id); - return ID2SYM(id); -} - -static VALUE -bug_id2str(VALUE self, VALUE sym) -{ - return rb_sym2str(sym); -} - -static VALUE -bug_static_p(VALUE self, VALUE sym) -{ - return STATIC_SYM_P(sym) ? Qtrue : Qfalse; -} - -static VALUE -bug_dynamic_p(VALUE self, VALUE sym) -{ - return DYNAMIC_SYM_P(sym) ? Qtrue : Qfalse; -} - -#ifdef HAVE_RB_PIN_DYNAMIC_SYMBOL -ID rb_pin_dynamic_symbol(VALUE); - -static VALUE -bug_pindown(VALUE self, VALUE sym) -{ - rb_pin_dynamic_symbol(sym); - return sym; -} -#endif - -void -Init_type(VALUE klass) -{ - FOREACH_ID_TYPES(declare_symbol_type_p); - rb_define_singleton_method(klass, "attrset", bug_sym_attrset, 1); - rb_define_singleton_method(klass, "id2str", bug_id2str, 1); - rb_define_singleton_method(klass, "static?", bug_static_p, 1); - rb_define_singleton_method(klass, "dynamic?", bug_dynamic_p, 1); -#ifdef HAVE_RB_PIN_DYNAMIC_SYMBOL - rb_define_singleton_method(klass, "pindown", bug_pindown, 1); -#endif -} diff --git a/ruby_2_2/ext/-test-/tracepoint/depend b/ruby_2_2/ext/-test-/tracepoint/depend deleted file mode 100644 index 741bad0386..0000000000 --- a/ruby_2_2/ext/-test-/tracepoint/depend +++ /dev/null @@ -1,22 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -gc_hook.o: $(RUBY_EXTCONF_H) -gc_hook.o: $(arch_hdrdir)/ruby/config.h -gc_hook.o: $(hdrdir)/ruby/debug.h -gc_hook.o: $(hdrdir)/ruby/defines.h -gc_hook.o: $(hdrdir)/ruby/intern.h -gc_hook.o: $(hdrdir)/ruby/missing.h -gc_hook.o: $(hdrdir)/ruby/ruby.h -gc_hook.o: $(hdrdir)/ruby/st.h -gc_hook.o: $(hdrdir)/ruby/subst.h -gc_hook.o: gc_hook.c -tracepoint.o: $(RUBY_EXTCONF_H) -tracepoint.o: $(arch_hdrdir)/ruby/config.h -tracepoint.o: $(hdrdir)/ruby/debug.h -tracepoint.o: $(hdrdir)/ruby/defines.h -tracepoint.o: $(hdrdir)/ruby/intern.h -tracepoint.o: $(hdrdir)/ruby/missing.h -tracepoint.o: $(hdrdir)/ruby/ruby.h -tracepoint.o: $(hdrdir)/ruby/st.h -tracepoint.o: $(hdrdir)/ruby/subst.h -tracepoint.o: tracepoint.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ruby_2_2/ext/-test-/tracepoint/extconf.rb b/ruby_2_2/ext/-test-/tracepoint/extconf.rb deleted file mode 100644 index c0c2399eb4..0000000000 --- a/ruby_2_2/ext/-test-/tracepoint/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/tracepoint") diff --git a/ruby_2_2/ext/-test-/tracepoint/gc_hook.c b/ruby_2_2/ext/-test-/tracepoint/gc_hook.c deleted file mode 100644 index 6d8485ecb1..0000000000 --- a/ruby_2_2/ext/-test-/tracepoint/gc_hook.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/debug.h" - -static int invoking; /* TODO: should not be global variable */ - -static VALUE -invoke_proc_ensure(void *dmy) -{ - invoking = 0; - return Qnil; -} - -static VALUE -invoke_proc_begin(VALUE proc) -{ - return rb_proc_call(proc, rb_ary_new()); -} - -static void -invoke_proc(void *data) -{ - VALUE proc = (VALUE)data; - invoking += 1; - rb_ensure(invoke_proc_begin, proc, invoke_proc_ensure, 0); -} - -static void -gc_start_end_i(VALUE tpval, void *data) -{ - if (0) { - rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval); - fprintf(stderr, "trace: %s\n", rb_tracearg_event_flag(tparg) == RUBY_INTERNAL_EVENT_GC_START ? "gc_start" : "gc_end"); - } - - if (invoking == 0) { - rb_postponed_job_register(0, invoke_proc, data); - } -} - -static VALUE -set_gc_hook(VALUE module, VALUE proc, rb_event_flag_t event, const char *tp_str, const char *proc_str) -{ - VALUE tpval; - ID tp_key = rb_intern(tp_str); - ID proc_key = rb_intern(proc_str); - - /* disable previous keys */ - if (rb_ivar_defined(module, tp_key) != 0 && - RTEST(tpval = rb_ivar_get(module, tp_key))) { - rb_tracepoint_disable(tpval); - rb_ivar_set(module, tp_key, Qnil); - rb_ivar_set(module, proc_key, Qnil); - } - - if (RTEST(proc)) { - if (!rb_obj_is_proc(proc)) { - rb_raise(rb_eTypeError, "trace_func needs to be Proc"); - } - - tpval = rb_tracepoint_new(0, event, gc_start_end_i, (void *)proc); - rb_ivar_set(module, tp_key, tpval); - rb_ivar_set(module, proc_key, proc); /* GC guard */ - rb_tracepoint_enable(tpval); - } - - return proc; -} - -static VALUE -set_after_gc_start(VALUE module, VALUE proc) -{ - return set_gc_hook(module, proc, RUBY_INTERNAL_EVENT_GC_START, - "__set_after_gc_start_tpval__", "__set_after_gc_start_proc__"); -} - -void -Init_gc_hook(VALUE module) -{ - rb_define_module_function(module, "after_gc_start_hook=", set_after_gc_start, 1); -} diff --git a/ruby_2_2/ext/-test-/tracepoint/tracepoint.c b/ruby_2_2/ext/-test-/tracepoint/tracepoint.c deleted file mode 100644 index aa8c212f99..0000000000 --- a/ruby_2_2/ext/-test-/tracepoint/tracepoint.c +++ /dev/null @@ -1,96 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/debug.h" - -struct tracepoint_track { - size_t newobj_count; - size_t free_count; - size_t gc_start_count; - size_t gc_end_mark_count; - size_t gc_end_sweep_count; - size_t objects_count; - VALUE objects[10]; -}; - -#define objects_max (sizeof(((struct tracepoint_track *)NULL)->objects)/sizeof(VALUE)) - -static void -tracepoint_track_objspace_events_i(VALUE tpval, void *data) -{ - rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval); - struct tracepoint_track *track = data; - - switch (rb_tracearg_event_flag(tparg)) { - case RUBY_INTERNAL_EVENT_NEWOBJ: - { - VALUE obj = rb_tracearg_object(tparg); - if (track->objects_count < objects_max) - track->objects[track->objects_count++] = obj; - track->newobj_count++; - break; - } - case RUBY_INTERNAL_EVENT_FREEOBJ: - { - track->free_count++; - break; - } - case RUBY_INTERNAL_EVENT_GC_START: - { - track->gc_start_count++; - break; - } - case RUBY_INTERNAL_EVENT_GC_END_MARK: - { - track->gc_end_mark_count++; - break; - } - case RUBY_INTERNAL_EVENT_GC_END_SWEEP: - { - track->gc_end_sweep_count++; - break; - } - default: - rb_raise(rb_eRuntimeError, "unknown event"); - } -} - -static VALUE -tracepoint_track_objspace_events(VALUE self) -{ - struct tracepoint_track track = {0, 0, 0, 0, 0,}; - VALUE tpval = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ | RUBY_INTERNAL_EVENT_FREEOBJ | - RUBY_INTERNAL_EVENT_GC_START | RUBY_INTERNAL_EVENT_GC_END_MARK | - RUBY_INTERNAL_EVENT_GC_END_SWEEP, - tracepoint_track_objspace_events_i, &track); - VALUE result = rb_ary_new(); - - rb_tracepoint_enable(tpval); - rb_ensure(rb_yield, Qundef, rb_tracepoint_disable, tpval); - - rb_ary_push(result, SIZET2NUM(track.newobj_count)); - rb_ary_push(result, SIZET2NUM(track.free_count)); - rb_ary_push(result, SIZET2NUM(track.gc_start_count)); - rb_ary_push(result, SIZET2NUM(track.gc_end_mark_count)); - rb_ary_push(result, SIZET2NUM(track.gc_end_sweep_count)); - rb_ary_cat(result, track.objects, track.objects_count); - - return result; -} - -static VALUE -tracepoint_specify_normal_and_internal_events(VALUE self) -{ - VALUE tpval = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ | RUBY_EVENT_CALL, 0, 0); - rb_tracepoint_enable(tpval); - return Qnil; /* should not be reached */ -} - -void Init_gc_hook(VALUE); - -void -Init_tracepoint(void) -{ - VALUE mBug = rb_define_module("Bug"); - Init_gc_hook(mBug); - rb_define_module_function(mBug, "tracepoint_track_objspace_events", tracepoint_track_objspace_events, 0); - rb_define_module_function(mBug, "tracepoint_specify_normal_and_internal_events", tracepoint_specify_normal_and_internal_events, 0); -} diff --git a/ruby_2_2/ext/-test-/typeddata/extconf.rb b/ruby_2_2/ext/-test-/typeddata/extconf.rb deleted file mode 100644 index 02e3e41c8b..0000000000 --- a/ruby_2_2/ext/-test-/typeddata/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/typeddata/typeddata") diff --git a/ruby_2_2/ext/-test-/typeddata/typeddata.c b/ruby_2_2/ext/-test-/typeddata/typeddata.c deleted file mode 100644 index 1c5d677713..0000000000 --- a/ruby_2_2/ext/-test-/typeddata/typeddata.c +++ /dev/null @@ -1,20 +0,0 @@ -#include <ruby.h> - -static const rb_data_type_t test_data = { - "typed_data", -}; - -static VALUE -test_check(VALUE self, VALUE obj) -{ - rb_check_typeddata(obj, &test_data); - return obj; -} - -void -Init_typeddata(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE klass = rb_define_class_under(mBug, "TypedData", rb_cData); - rb_define_singleton_method(klass, "check", test_check, 1); -} diff --git a/ruby_2_2/ext/-test-/vm/at_exit.c b/ruby_2_2/ext/-test-/vm/at_exit.c deleted file mode 100644 index 6cfbfafa9e..0000000000 --- a/ruby_2_2/ext/-test-/vm/at_exit.c +++ /dev/null @@ -1,44 +0,0 @@ -#include <ruby/ruby.h> -#include <ruby/vm.h> - -static void -do_nothing(ruby_vm_t *vm) -{ -} - -static void -print_begin(ruby_vm_t *vm) -{ - printf("begin\n"); -} - -static void -print_end(ruby_vm_t *vm) -{ - printf("end\n"); -} - -static VALUE -register_at_exit(VALUE self, VALUE t) -{ - switch (t) { - case Qtrue: - ruby_vm_at_exit(print_begin); - break; - case Qfalse: - ruby_vm_at_exit(print_end); - break; - default: - ruby_vm_at_exit(do_nothing); - break; - } - return self; -} - -void -Init_at_exit(void) -{ - VALUE m = rb_define_module("Bug"); - VALUE c = rb_define_class_under(m, "VM", rb_cObject); - rb_define_singleton_method(c, "register_at_exit", register_at_exit, 1); -} diff --git a/ruby_2_2/ext/-test-/vm/extconf.rb b/ruby_2_2/ext/-test-/vm/extconf.rb deleted file mode 100644 index 614ec960d8..0000000000 --- a/ruby_2_2/ext/-test-/vm/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile('-test-/vm/at_exit') diff --git a/ruby_2_2/ext/-test-/wait_for_single_fd/depend b/ruby_2_2/ext/-test-/wait_for_single_fd/depend deleted file mode 100644 index fddd41053f..0000000000 --- a/ruby_2_2/ext/-test-/wait_for_single_fd/depend +++ /dev/null @@ -1,14 +0,0 @@ -# AUTOGENERATED DEPENDENCIES START -wait_for_single_fd.o: $(RUBY_EXTCONF_H) -wait_for_single_fd.o: $(arch_hdrdir)/ruby/config.h -wait_for_single_fd.o: $(hdrdir)/ruby/defines.h -wait_for_single_fd.o: $(hdrdir)/ruby/encoding.h -wait_for_single_fd.o: $(hdrdir)/ruby/intern.h -wait_for_single_fd.o: $(hdrdir)/ruby/io.h -wait_for_single_fd.o: $(hdrdir)/ruby/missing.h -wait_for_single_fd.o: $(hdrdir)/ruby/oniguruma.h -wait_for_single_fd.o: $(hdrdir)/ruby/ruby.h -wait_for_single_fd.o: $(hdrdir)/ruby/st.h -wait_for_single_fd.o: $(hdrdir)/ruby/subst.h -wait_for_single_fd.o: wait_for_single_fd.c -# AUTOGENERATED DEPENDENCIES END diff --git a/ruby_2_2/ext/-test-/wait_for_single_fd/extconf.rb b/ruby_2_2/ext/-test-/wait_for_single_fd/extconf.rb deleted file mode 100644 index 1a28b23da3..0000000000 --- a/ruby_2_2/ext/-test-/wait_for_single_fd/extconf.rb +++ /dev/null @@ -1 +0,0 @@ -create_makefile("-test-/wait_for_single_fd/wait_for_single_fd") diff --git a/ruby_2_2/ext/-test-/wait_for_single_fd/wait_for_single_fd.c b/ruby_2_2/ext/-test-/wait_for_single_fd/wait_for_single_fd.c deleted file mode 100644 index d406724a3f..0000000000 --- a/ruby_2_2/ext/-test-/wait_for_single_fd/wait_for_single_fd.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "ruby/ruby.h" -#include "ruby/io.h" - -static VALUE -wait_for_single_fd(VALUE ign, VALUE fd, VALUE events, VALUE timeout) -{ - struct timeval tv; - struct timeval *tvp = NULL; - int rc; - - if (!NIL_P(timeout)) { - tv = rb_time_timeval(timeout); - tvp = &tv; - } - - rc = rb_wait_for_single_fd(NUM2INT(fd), NUM2INT(events), tvp); - if (rc == -1) - rb_sys_fail("rb_wait_for_single_fd"); - return INT2NUM(rc); -} - -void -Init_wait_for_single_fd(void) -{ - rb_define_const(rb_cObject, "RB_WAITFD_IN", INT2NUM(RB_WAITFD_IN)); - rb_define_const(rb_cObject, "RB_WAITFD_OUT", INT2NUM(RB_WAITFD_OUT)); - rb_define_const(rb_cObject, "RB_WAITFD_PRI", INT2NUM(RB_WAITFD_PRI)); - rb_define_singleton_method(rb_cIO, "wait_for_single_fd", - wait_for_single_fd, 3); -} diff --git a/ruby_2_2/ext/-test-/win32/console/attribute.c b/ruby_2_2/ext/-test-/win32/console/attribute.c deleted file mode 100644 index a2c07fc4fe..0000000000 --- a/ruby_2_2/ext/-test-/win32/console/attribute.c +++ /dev/null @@ -1,56 +0,0 @@ -#include <ruby.h> - -static VALUE rb_cConsoleScreenBufferInfo; - -static VALUE -console_info(VALUE io) -{ - int fd = NUM2INT(rb_funcallv(io, rb_intern("fileno"), 0, 0)); - HANDLE h = (HANDLE)rb_w32_get_osfhandle(fd); - CONSOLE_SCREEN_BUFFER_INFO csbi; - - if (h == (HANDLE)-1) rb_raise(rb_eIOError, "invalid io"); - if (!GetConsoleScreenBufferInfo(h, &csbi)) - rb_syserr_fail(rb_w32_map_errno(GetLastError()), "not console"); - return rb_struct_new(rb_cConsoleScreenBufferInfo, - INT2FIX(csbi.dwSize.X), INT2FIX(csbi.dwSize.Y), - INT2FIX(csbi.dwCursorPosition.X), INT2FIX(csbi.dwCursorPosition.Y), - INT2FIX(csbi.wAttributes)); -} - -static VALUE -console_set_attribute(VALUE io, VALUE attr) -{ - int fd = NUM2INT(rb_funcallv(io, rb_intern("fileno"), 0, 0)); - HANDLE h = (HANDLE)rb_w32_get_osfhandle(fd); - - if (h == (HANDLE)-1) rb_raise(rb_eIOError, "invalid io"); - SetConsoleTextAttribute(h, (WORD)NUM2INT(attr)); - return Qnil; -} - -#define FOREGROUND_MASK (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY) -#define BACKGROUND_MASK (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY) - -void -Init_attribute(VALUE m) -{ - rb_cConsoleScreenBufferInfo = rb_struct_define_under(m, "ConsoleScreenBufferInfo", - "size_x", "size_y", - "cur_x", "cur_y", - "attr", NULL); - rb_define_method(rb_cIO, "console_info", console_info, 0); - rb_define_method(rb_cIO, "console_attribute", console_set_attribute, 1); - - rb_define_const(m, "FOREGROUND_MASK", INT2FIX(FOREGROUND_MASK)); - rb_define_const(m, "FOREGROUND_BLUE", INT2FIX(FOREGROUND_BLUE)); - rb_define_const(m, "FOREGROUND_GREEN", INT2FIX(FOREGROUND_GREEN)); - rb_define_const(m, "FOREGROUND_RED", INT2FIX(FOREGROUND_RED)); - rb_define_const(m, "FOREGROUND_INTENSITY", INT2FIX(FOREGROUND_INTENSITY)); - - rb_define_const(m, "BACKGROUND_MASK", INT2FIX(BACKGROUND_MASK)); - rb_define_const(m, "BACKGROUND_BLUE", INT2FIX(BACKGROUND_BLUE)); - rb_define_const(m, "BACKGROUND_GREEN", INT2FIX(BACKGROUND_GREEN)); - rb_define_const(m, "BACKGROUND_RED", INT2FIX(BACKGROUND_RED)); - rb_define_const(m, "BACKGROUND_INTENSITY", INT2FIX(BACKGROUND_INTENSITY)); -} diff --git a/ruby_2_2/ext/-test-/win32/console/depend b/ruby_2_2/ext/-test-/win32/console/depend deleted file mode 100644 index f4f65adf9a..0000000000 --- a/ruby_2_2/ext/-test-/win32/console/depend +++ /dev/null @@ -1 +0,0 @@ -attribute.o: $(ruby_headers) $(hdrdir)/ruby/win32.h diff --git a/ruby_2_2/ext/-test-/win32/console/extconf.rb b/ruby_2_2/ext/-test-/win32/console/extconf.rb deleted file mode 100644 index 4de9fa7e4f..0000000000 --- a/ruby_2_2/ext/-test-/win32/console/extconf.rb +++ /dev/null @@ -1,8 +0,0 @@ -if $mingw or $mswin - $srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] - inits = $srcs.map {|s| File.basename(s, ".*")} - inits.delete("init") - inits.map! {|s|"X(#{s})"} - $defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" - create_makefile("-test-/win32/console") -end diff --git a/ruby_2_2/ext/-test-/win32/console/init.c b/ruby_2_2/ext/-test-/win32/console/init.c deleted file mode 100644 index f2e0d1c821..0000000000 --- a/ruby_2_2/ext/-test-/win32/console/init.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "ruby.h" - -#define init(n) {void Init_##n(VALUE m); Init_##n(m);} - -void -Init_console(void) -{ - VALUE mBug = rb_define_module("Bug"); - VALUE m = rb_define_module_under(mBug, "Win32"); - TEST_INIT_FUNCS(init); -} diff --git a/ruby_2_2/ext/-test-/win32/dln/dlntest.c b/ruby_2_2/ext/-test-/win32/dln/dlntest.c deleted file mode 100644 index 3e6037ac07..0000000000 --- a/ruby_2_2/ext/-test-/win32/dln/dlntest.c +++ /dev/null @@ -1,17 +0,0 @@ -#include <ruby.h> - -extern __declspec(dllimport) void dlntest_ordinal(void); - -static VALUE -dln_dlntest(VALUE self) -{ - dlntest_ordinal(); - return self; -} - -void -Init_dln(void) -{ - VALUE m = rb_define_module_under(rb_define_module("Bug"), "Win32"); - rb_define_module_function(m, "dlntest", dln_dlntest, 0); -} diff --git a/ruby_2_2/ext/-test-/win32/dln/extconf.rb b/ruby_2_2/ext/-test-/win32/dln/extconf.rb deleted file mode 100644 index 57cee23b40..0000000000 --- a/ruby_2_2/ext/-test-/win32/dln/extconf.rb +++ /dev/null @@ -1,37 +0,0 @@ -if $mingw or $mswin - $objs = ["dlntest.o"] - testdll = "$(topdir)/dlntest.dll" - $cleanfiles << testdll - $cleanfiles << "dlntest.#{$LIBEXT}" - config_string('cleanobjs') {|t| $cleanfiles.concat(t.gsub(/\$\*/, 'dlntest').split)} - - create_makefile("-test-/win32/dln") - m = File.read("Makefile") - dlntestlib = "dlntest.#{$LIBEXT}" - m.sub!(/^OBJS =.*/) {"#{$&} #{dlntestlib}"} - FileUtils.rm_f(RbConfig.expand(testdll.dup)) - open("Makefile", "wb") do |mf| - mf.puts m, "\n" - sodir = $extout ? "$(RUBYARCHDIR)/" : '' - mf.print "#{sodir}$(DLLIB): #{dlntestlib}" - mf.puts - mf.puts "#{dlntestlib}: $(topdir)/dlntest.dll" - mf.puts - if $mingw - mf.puts "$(topdir)/dlntest.dll: DEFFILE := $(srcdir)/libdlntest.def" - mf.puts "$(topdir)/dlntest.dll: DLDFLAGS += -Wl,--out-implib,#{dlntestlib}" - end - mf.puts depend_rules("$(topdir)/dlntest.dll: libdlntest.o libdlntest.def") - mf.puts "\t$(ECHO) linking shared-object $(@F)\n" - mf.print "\t-$(Q)$(RM) $@\n" - mf.print "\t-$(Q)$(MAKEDIRS) $(@D)\n" if $extout - link_so = LINK_SO.gsub(/^/, "\t$(Q) ") - link_so.sub!(/\$\(LOCAL_LIBS\)/, '') - link_so.gsub!(/-\$\(arch\)/, '') - link_so.gsub!(/:.so=/, ':.dll=') - link_so.sub!(/\$\(OBJS\)/, "libdlntest.#{$OBJEXT}") - link_so.sub!(/\$\(DEFFILE\)/, "$(srcdir)/libdlntest.def") - mf.puts link_so - mf.puts - end -end diff --git a/ruby_2_2/ext/-test-/win32/dln/libdlntest.c b/ruby_2_2/ext/-test-/win32/dln/libdlntest.c deleted file mode 100644 index 5923b732c8..0000000000 --- a/ruby_2_2/ext/-test-/win32/dln/libdlntest.c +++ /dev/null @@ -1,4 +0,0 @@ -void -dlntest_ordinal(void) -{ -} diff --git a/ruby_2_2/ext/-test-/win32/dln/libdlntest.def b/ruby_2_2/ext/-test-/win32/dln/libdlntest.def deleted file mode 100644 index 85bc9c7a55..0000000000 --- a/ruby_2_2/ext/-test-/win32/dln/libdlntest.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS -dlntest_ordinal @1 NONAME diff --git a/ruby_2_2/ext/-test-/win32/fd_setsize/depend b/ruby_2_2/ext/-test-/win32/fd_setsize/depend deleted file mode 100644 index 7d40e8d572..0000000000 --- a/ruby_2_2/ext/-test-/win32/fd_setsize/depend +++ /dev/null @@ -1 +0,0 @@ -fd_setsize.o: $(ruby_headers) $(hdrdir)/ruby/win32.h diff --git a/ruby_2_2/ext/-test-/win32/fd_setsize/extconf.rb b/ruby_2_2/ext/-test-/win32/fd_setsize/extconf.rb deleted file mode 100644 index ed40f8b1d7..0000000000 --- a/ruby_2_2/ext/-test-/win32/fd_setsize/extconf.rb +++ /dev/null @@ -1,3 +0,0 @@ -if $mingw or $mswin - create_makefile("-test-/win32/fd_setsize") -end diff --git a/ruby_2_2/ext/-test-/win32/fd_setsize/fd_setsize.c b/ruby_2_2/ext/-test-/win32/fd_setsize/fd_setsize.c deleted file mode 100644 index 8da8b1eaa0..0000000000 --- a/ruby_2_2/ext/-test-/win32/fd_setsize/fd_setsize.c +++ /dev/null @@ -1,55 +0,0 @@ -#undef FD_SETSIZE -/* redefine smaller size then default 64 */ -#define FD_SETSIZE 32 -#include <ruby.h> - -static VALUE -test_select(VALUE self) -{ - int sd = socket(AF_INET, SOCK_DGRAM, 0); - struct timeval zero; - fd_set read; - fd_set write; - fd_set error; - - zero.tv_sec = 0; - zero.tv_usec = 0; - - FD_ZERO(&read); - FD_ZERO(&write); - FD_ZERO(&error); - - FD_SET(sd, &read); - FD_SET(sd, &write); - FD_SET(sd, &error); - - select(sd+1, &read, &write, &error, &zero); - - return Qtrue; -} - -static VALUE -test_fdset(VALUE self) -{ - int i; - fd_set set; - - FD_ZERO(&set); - - for (i = 0; i < FD_SETSIZE * 2; i++) { - int sd = socket(AF_INET, SOCK_DGRAM, 0); - FD_SET(sd, &set); - if (set.fd_count > FD_SETSIZE) { - return Qfalse; - } - } - return Qtrue; -} - -void -Init_fd_setsize(void) -{ - VALUE m = rb_define_module_under(rb_define_module("Bug"), "Win32"); - rb_define_module_function(m, "test_select", test_select, 0); - rb_define_module_function(m, "test_fdset", test_fdset, 0); -} |