summaryrefslogtreecommitdiff
path: root/ext/dl/mkcbtable.rb
diff options
context:
space:
mode:
authorttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-09 17:47:34 +0000
committerttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-06-09 17:47:34 +0000
commit2d5b7f736518fb343469cd2bee721120309d8dca (patch)
tree2b087bbd1f6160b6c4b4fb787bc32f96fb889873 /ext/dl/mkcbtable.rb
parentd5ceb6ef829a4913e045015ea0deb2269eef9093 (diff)
* ext/dl: change the callback mechanism.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/mkcbtable.rb')
-rw-r--r--ext/dl/mkcbtable.rb34
1 files changed, 5 insertions, 29 deletions
diff --git a/ext/dl/mkcbtable.rb b/ext/dl/mkcbtable.rb
index f25f012e4c..165c4bdc88 100644
--- a/ext/dl/mkcbtable.rb
+++ b/ext/dl/mkcbtable.rb
@@ -5,38 +5,14 @@ $:.unshift File.dirname(__FILE__)
require 'type'
require 'dlconfig'
-$int_eq_long = try_run(<<EOF)
-int main() {
- return sizeof(int) == sizeof(long) ? 0 : 1;
-}
-EOF
-
-def output_func(types, n = 0)
+def mktable(rettype, fnum, argc)
code =
- "/* #{types2ctypes(types).inspect} */\n" +
- "rb_dl_func_table[#{types2num(types)}][#{n}] " +
- "= rb_dl_func#{types2num(types)}_#{n};\n"
- if( n < MAX_CBENT - 1)
- return code + output_func(types, n+1)
- else
- return code
- end
-end
-
-
-def rec_output(types = [VOID])
- print output_func(types)
- if( types.length <= MAX_CBARG )
- DLTYPE.keys.sort.each{|t|
- if( t != VOID && DLTYPE[t][:cb] )
- rec_output(types + [t])
- end
- }
- end
+ "rb_dl_callback_table[#{rettype}][#{fnum}] = &rb_dl_callback_func_#{rettype.to_s}_#{fnum};"
+ return code
end
DLTYPE.keys.sort.each{|t|
- if( DLTYPE[t][:cb] )
- rec_output([t])
+ for n in 0..(MAX_CALLBACK - 1)
+ print(mktable(t, n, 15), "\n")
end
}