summaryrefslogtreecommitdiff
path: root/ext/ffi_c
diff options
context:
space:
mode:
authorWayne Meissner <wmeissner@gmail.com>2009-08-11 19:01:13 +1000
committerWayne Meissner <wmeissner@gmail.com>2009-08-11 19:01:13 +1000
commitbc1e80c2acd0603841618f99212318895539a100 (patch)
treed7ba1ffb5ce2a0d1f6d57f4d8a2ec668240d7306 /ext/ffi_c
parent4cb6565060c3d56167ad1ffb2a00d37f3f6226aa (diff)
downloadffi-bc1e80c2acd0603841618f99212318895539a100.tar.gz
Add result_type and param_types method to FunctionType
Diffstat (limited to 'ext/ffi_c')
-rw-r--r--ext/ffi_c/FunctionInfo.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/ffi_c/FunctionInfo.c b/ext/ffi_c/FunctionInfo.c
index 8f6ceaa..890a52c 100644
--- a/ext/ffi_c/FunctionInfo.c
+++ b/ext/ffi_c/FunctionInfo.c
@@ -175,6 +175,26 @@ fntype_initialize(int argc, VALUE* argv, VALUE self)
return self;
}
+static VALUE
+fntype_result_type(VALUE self)
+{
+ FunctionType* ft;
+
+ Data_Get_Struct(self, FunctionType, ft);
+
+ return ft->rbReturnType;
+}
+
+static VALUE
+fntype_param_types(VALUE self)
+{
+ FunctionType* ft;
+
+ Data_Get_Struct(self, FunctionType, ft);
+
+ return rb_ary_dup(ft->rbParameterTypes);
+}
+
void
rbffi_FunctionInfo_Init(VALUE moduleFFI)
{
@@ -186,6 +206,8 @@ rbffi_FunctionInfo_Init(VALUE moduleFFI)
rb_define_alloc_func(rbffi_FunctionTypeClass, fntype_allocate);
rb_define_method(rbffi_FunctionTypeClass, "initialize", fntype_initialize, -1);
+ rb_define_method(rbffi_FunctionTypeClass, "result_type", fntype_result_type, 0);
+ rb_define_method(rbffi_FunctionTypeClass, "param_types", fntype_param_types, 0);
}