summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-08 00:21:41 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-11-08 00:21:41 +0000
commit5de564634df7b97c4004b152f40008938c638dcc (patch)
tree759c9b5049bd3f0f4fa29786cc83a4b086c2fb0e /ext
parent355a7bc3a552fda0fb1d1988bc3b2d600685f831 (diff)
* ext/dl/cfunc.c (**) updating documentation
* test/dl/test_cfunc.rb (test_ptr=, test_ptr) testing the pointer accessor methods on CFunc git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/dl/cfunc.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index 77c680b897..729dbe9ac6 100644
--- a/ext/dl/cfunc.c
+++ b/ext/dl/cfunc.c
@@ -112,7 +112,7 @@ rb_dlcfunc2ptr(VALUE val)
return func;
}
-VALUE
+static VALUE
rb_dlcfunc_s_allocate(VALUE klass)
{
VALUE obj;
@@ -241,8 +241,13 @@ rb_dlcfunc_set_calltype(VALUE self, VALUE sym)
return sym;
}
-
-VALUE
+/*
+ * call-seq:
+ * cfunc.ptr
+ *
+ * Get the underlying function pointer as a DL::CPtr object.
+ */
+static VALUE
rb_dlcfunc_ptr(VALUE self)
{
struct cfunc_data *cfunc;
@@ -251,7 +256,13 @@ rb_dlcfunc_ptr(VALUE self)
return PTR2NUM(cfunc->ptr);
}
-VALUE
+/*
+ * call-seq:
+ * cfunc.ptr = pointer
+ *
+ * Set the underlying function pointer to a DL::CPtr named +pointer+.
+ */
+static VALUE
rb_dlcfunc_set_ptr(VALUE self, VALUE addr)
{
struct cfunc_data *cfunc;
@@ -262,7 +273,13 @@ rb_dlcfunc_set_ptr(VALUE self, VALUE addr)
return Qnil;
}
-VALUE
+/*
+ * call-seq: inspect
+ *
+ * Returns a string formatted with an easily readable representation of the
+ * internal state of the DL::CFunc
+ */
+static VALUE
rb_dlcfunc_inspect(VALUE self)
{
VALUE val;
@@ -302,6 +319,14 @@ rb_dlcfunc_inspect(VALUE self)
}
+/*
+ * call-seq:
+ * dlcfunc.call(ary) => some_value
+ * dlcfunc[ary] => some_value
+ *
+ * Calls the function pointer passing in +ary+ as values to the underlying
+ * C function. The return value depends on the ctype.
+ */
static VALUE
rb_dlcfunc_call(VALUE self, VALUE ary)
{
@@ -550,7 +575,13 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
return result;
}
-VALUE
+/*
+ * call-seq:
+ * dlfunc.to_i => integer
+ *
+ * Returns the memory location of this function pointer as an integer.
+ */
+static VALUE
rb_dlcfunc_to_i(VALUE self)
{
struct cfunc_data *cfunc;