diff options
Diffstat (limited to 'include/ruby/ruby.h')
-rw-r--r-- | include/ruby/ruby.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index ed91594bf1..3e6909d3e0 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -931,16 +931,22 @@ struct RFile { struct RRational { struct RBasic basic; - VALUE num; - VALUE den; + const VALUE num; + const VALUE den; }; +#define RRATIONAL_SET_NUM(rat, n) (*((VALUE *)(&((struct RRational *)(rat))->num)) = (n)) +#define RRATIONAL_SET_DEN(rat, d) (*((VALUE *)(&((struct RRational *)(rat))->den)) = (d)) + struct RComplex { struct RBasic basic; - VALUE real; - VALUE imag; + const VALUE real; + const VALUE imag; }; +#define RCOMPLEX_SET_REAL(cmp, r) (*((VALUE *)(&((struct RComplex *)(cmp))->real)) = (r)) +#define RCOMPLEX_SET_IMAG(cmp, i) (*((VALUE *)(&((struct RComplex *)(cmp))->imag)) = (i)) + struct RData { struct RBasic basic; void (*dmark)(void*); |