[前][次][番号順一覧][スレッド一覧]

ruby-changes:26186

From: ngoto <ko1@a...>
Date: Fri, 7 Dec 2012 01:21:53 +0900 (JST)
Subject: [ruby-changes:26186] ngoto:r38243 (trunk): * ext/fiddle/lib/fiddle/function.rb (Fiddle::Function#name): new

ngoto	2012-12-07 01:21:43 +0900 (Fri, 07 Dec 2012)

  New Revision: 38243

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38243

  Log:
    * ext/fiddle/lib/fiddle/function.rb (Fiddle::Function#name): new
      attribute needed to switch Win32::Registry from DL to Fiddle.
    
    * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
      set function name to the returned Fiddle::Function object.

  Modified files:
    trunk/ChangeLog
    trunk/ext/fiddle/lib/fiddle/function.rb
    trunk/ext/fiddle/lib/fiddle/import.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38242)
+++ ChangeLog	(revision 38243)
@@ -1,3 +1,11 @@
+Fri Dec  7 01:15:07 2012  Naohisa Goto  <ngotogenome@g...>
+
+	* ext/fiddle/lib/fiddle/function.rb (Fiddle::Function#name): new
+	  attribute needed to switch Win32::Registry from DL to Fiddle.
+
+	* ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
+	  set function name to the returned Fiddle::Function object.
+
 Fri Dec  7 00:11:44 2012  Shugo Maeda  <shugo@r...>
 
 	* test/ruby/test_refinement.rb: fix some tests to use neither
Index: ext/fiddle/lib/fiddle/function.rb
===================================================================
--- ext/fiddle/lib/fiddle/function.rb	(revision 38242)
+++ ext/fiddle/lib/fiddle/function.rb	(revision 38243)
@@ -6,6 +6,9 @@
     # The address of this function
     attr_reader :ptr
 
+    # The name of this function
+    attr_reader :name
+
     # The integer memory location of this function
     def to_i
       ptr.to_i
Index: ext/fiddle/lib/fiddle/import.rb
===================================================================
--- ext/fiddle/lib/fiddle/import.rb	(revision 38242)
+++ ext/fiddle/lib/fiddle/import.rb	(revision 38243)
@@ -290,7 +290,9 @@
       if( !addr )
         raise(DLError, "cannot find the function: #{name}()")
       end
-      Function.new(addr, argtype, ctype, CALL_TYPE_TO_ABI[call_type])
+      f = Function.new(addr, argtype, ctype, CALL_TYPE_TO_ABI[call_type])
+      f.instance_eval { @name = name }
+      f
     end
 
     # Returns a new closure wrapper for the +name+ function.
@@ -307,7 +309,9 @@
         define_method(:call, block)
       }.new(ctype, argtype, abi)
 
-      Function.new(closure, argtype, ctype, abi)
+      f = Function.new(closure, argtype, ctype, abi)
+      f.instance_eval { @name = name }
+      f
     end
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]