summaryrefslogtreecommitdiff
path: root/ext/dl/callback
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-28 03:32:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-07-28 03:32:56 +0000
commitd3d44cd9287e47fd84f6a6c7dd9cadb99870e36a (patch)
treec0deb77d621fc82eab40852ad2153cf37f81b11a /ext/dl/callback
parenteda13c7ee2e3946790edad7e84740359367c90fa (diff)
* ext/dl/callback/mkcallback.rb (gencallback): use PTR2NUM.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/callback')
-rw-r--r--ext/dl/callback/mkcallback.rb14
1 files changed, 3 insertions, 11 deletions
diff --git a/ext/dl/callback/mkcallback.rb b/ext/dl/callback/mkcallback.rb
index d14072a9328..c6440993950 100644
--- a/ext/dl/callback/mkcallback.rb
+++ b/ext/dl/callback/mkcallback.rb
@@ -124,21 +124,13 @@ def gencallback(ty, calltype, proc_entry, argc, n)
<<-EOS
#{calltype == STDCALL ? "\n#ifdef FUNC_STDCALL" : ""}
static #{DLTYPE[ty][:type]}
-FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{(0...argc).collect{|i| "DLSTACK_TYPE stack" + i.to_s}.join(", ")})
+FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{(0...argc).collect{|i| "DLSTACK_TYPE stack#{i}"}.join(", ")})
{
VALUE ret, cb#{argc > 0 ? ", args[#{argc}]" : ""};
#{
- sizeof_voidp = [""].pack('p').size
- sizeof_long = [0].pack('l!').size
(0...argc).collect{|i|
- if sizeof_voidp == sizeof_long
- " args[%d] = LONG2NUM(stack%d);" % [i,i]
- elsif sizeof_voidp == 8 # should get sizeof_long_long...
- " args[%d] = LL2NUM(stack%d);" % [i,i]
- else
- raise "unknown size of void*"
- end
- }.join("\n")
+ "\n args[#{i}] = PTR2NUM(stack#{i});"
+ }.join("")
}
cb = rb_ary_entry(rb_ary_entry(#{proc_entry}, #{ty}), #{(n * DLSTACK_SIZE) + argc});
ret = rb_funcall2(cb, rb_dl_cb_call, #{argc}, #{argc > 0 ? 'args' : 'NULL'});