summaryrefslogtreecommitdiff
path: root/ext/dl/mkcbtable.rb
diff options
context:
space:
mode:
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
}