diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-06 18:02:30 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-11-06 18:02:30 +0000 |
commit | c2d7621d8d379980afd0b74870588c1438418fed (patch) | |
tree | 2fcd356477cdc2d12af29f099024d643673082d3 /ext | |
parent | 32acedd2867d9577b824d0ab255e533d4ff14ea9 (diff) | |
download | ruby-c2d7621d8d379980afd0b74870588c1438418fed.tar.gz |
* ext/dl/cptr.c (rb_dlptr_inspect, rb_dlptr_plus, rb_dlptr_minus)
documenting +, -, inspect
* text/dl/test_cptr.rb (test_minus, test_plus, test_inspect) testing
minus, plus, and inspect
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25675 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/dl/cptr.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/ext/dl/cptr.c b/ext/dl/cptr.c index cdcc23c727..393cc11650 100644 --- a/ext/dl/cptr.c +++ b/ext/dl/cptr.c @@ -331,7 +331,13 @@ rb_dlptr_to_str(int argc, VALUE argv[], VALUE self) return val; } -VALUE +/* + * call-seq: inspect + * + * Returns a string formatted with an easily readable representation of the + * internal state of the DL::CPtr + */ +static VALUE rb_dlptr_inspect(VALUE self) { struct ptr_data *data; @@ -386,7 +392,13 @@ rb_dlptr_cmp(VALUE self, VALUE other) return diff > 0 ? INT2NUM(1) : INT2NUM(-1); } -VALUE +/* + * call-seq: + * ptr + n => new cptr + * + * Returns a new DL::CPtr that has been advanced +n+ bytes. + */ +static VALUE rb_dlptr_plus(VALUE self, VALUE other) { void *ptr; @@ -398,7 +410,13 @@ rb_dlptr_plus(VALUE self, VALUE other) return rb_dlptr_new((char *)ptr + num, size - num, 0); } -VALUE +/* + * call-seq: + * ptr - n => new cptr + * + * Returns a new DL::CPtr that has been moved back +n+ bytes. + */ +static VALUE rb_dlptr_minus(VALUE self, VALUE other) { void *ptr; |