summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--complex.c14
-rw-r--r--include/ruby/intern.h2
-rw-r--r--include/ruby/ruby.h7
-rw-r--r--internal.h15
5 files changed, 49 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 1809ba9..697b98a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+Mon Jun 23 13:30:11 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * include/ruby/ruby.h (struct RComplex): no longer. [Feature #9888]
+
+ * include/ruby/ruby.h (RCOMPLEX): ditto.
+
+ * include/ruby/ruby.h (RCOMPLEX_SET_REAL): deprecated. Will be deleted later.
+
+ * include/ruby/ruby.h (RCOMPLEX_SET_IMAG): ditto.
+
+ * internal.h (struct RFloat): moved here.
+
+ * internal.h (RCOMPLEX): ditto.
+
+ * complex.c (rb_complex_set_real): do not use this.
+
+ * complex.c (rb_complex_set_imag): ditto.
+
Mon Jun 23 13:10:15 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
* include/ruby/ruby.h (struct RFloat): no longer. [Feature #9863]
diff --git a/complex.c b/complex.c
index f9f9eed..bebce43 100644
--- a/complex.c
+++ b/complex.c
@@ -1342,6 +1342,20 @@ rb_Complex(VALUE x, VALUE y)
return nucomp_s_convert(2, a, rb_cComplex);
}
+VALUE
+rb_complex_set_real(VALUE cmp, VALUE r)
+{
+ RCOMPLEX_SET_REAL(cmp, r);
+ return cmp;
+}
+
+VALUE
+rb_complex_set_imag(VALUE cmp, VALUE i)
+{
+ RCOMPLEX_SET_REAL(cmp, i);
+ return cmp;
+}
+
/*
* call-seq:
* cmp.to_i -> integer
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index d3f2bdb..486b469 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -183,6 +183,8 @@ VALUE rb_complex_polar(VALUE, VALUE);
VALUE rb_Complex(VALUE, VALUE);
#define rb_Complex1(x) rb_Complex((x), INT2FIX(0))
#define rb_Complex2(x,y) rb_Complex((x), (y))
+DEPRECATED(VALUE rb_complex_set_real(VALUE, VALUE));
+DEPRECATED(VALUE rb_complex_set_imag(VALUE, VALUE));
/* class.c */
VALUE rb_class_boot(VALUE);
VALUE rb_class_new(VALUE);
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 284684e..9181382 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -938,12 +938,6 @@ struct RFile {
struct rb_io_t *fptr;
};
-struct RComplex {
- struct RBasic basic;
- const VALUE real;
- const VALUE imag;
-};
-
#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
@@ -1080,7 +1074,6 @@ struct RStruct {
#define RTYPEDDATA(obj) (R_CAST(RTypedData)(obj))
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
#define RFILE(obj) (R_CAST(RFile)(obj))
-#define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
#define FL_SINGLETON FL_USER0
#define FL_WB_PROTECTED (((VALUE)1)<<5)
diff --git a/internal.h b/internal.h
index db4961d..3f0fd30 100644
--- a/internal.h
+++ b/internal.h
@@ -427,6 +427,21 @@ struct RFloat {
#define RFLOAT(obj) (R_CAST(RFloat)(obj))
+struct RComplex {
+ struct RBasic basic;
+ const VALUE real;
+ const VALUE imag;
+};
+
+#define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
+
+#ifdef RCOMPLEX_SET_REAL /* shortcut macro for internal only */
+#undef RCOMPLEX_SET_REAL
+#undef RCOMPLEX_SET_REAL
+#define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
+#define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
+#endif
+
/* class.c */
void rb_class_subclass_add(VALUE super, VALUE klass);
void rb_class_remove_from_super_subclasses(VALUE);