From 9c831edbf4f30fdcf90d8c991ded624c27898874 Mon Sep 17 00:00:00 2001 From: zzak Date: Tue, 27 Nov 2012 23:26:07 +0000 Subject: * ext/fiddle/closure.c: Documentation for Fiddle * ext/fiddle/pointer.c: ditto * ext/fiddle/function.c: ditto * ext/fiddle/lib/fiddle.rb: ditto * ext/fiddle/fiddle.c: ditto * ext/fiddle/handle.c: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/fiddle/function.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'ext/fiddle/function.c') diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c index 7fc5127f9f..4c4bc13abc 100644 --- a/ext/fiddle/function.c +++ b/ext/fiddle/function.c @@ -161,25 +161,28 @@ Init_fiddle_function(void) * * === 'strcpy' * - * @libc = DL.dlopen "/lib/libc.so.6" - * => # - * f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP) - * => # + * @libc = Fiddle.dlopen "/lib/libc.so.6" + * #=> # + * f = Fiddle::Function.new( + * @libc['strcpy'], + * [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP], + * Fiddle::TYPE_VOIDP) + * #=> # * buff = "000" - * => "000" + * #=> "000" * str = f.call(buff, "123") - * => # + * #=> # * str.to_s * => "123" * * === ABI check * * @libc = DL.dlopen "/lib/libc.so.6" - * => # + * #=> # * f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP) - * => # + * #=> # * f.abi == Fiddle::Function::DEFAULT - * => true + * #=> true */ cFiddleFunction = rb_define_class_under(mFiddle, "Function", rb_cObject); @@ -218,7 +221,7 @@ Init_fiddle_function(void) * call-seq: new(ptr, *args, ret_type, abi = DEFAULT) * * Constructs a Function object. - * * +ptr+ is a referenced function, of a DL::Handle + * * +ptr+ is a referenced function, of a Fiddle::Handle * * +args+ is an Array of arguments, passed to the +ptr+ function * * +ret_type+ is the return type of the function * * +abi+ is the ABI of the function -- cgit v1.2.3