diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-09 18:48:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-09 18:48:34 +0000 |
commit | 53f011e662e74a846abf2c53ad2d1b096811f4f7 (patch) | |
tree | c9307d28a27aa9eebe922769830b68dbcd167f9f /ext/dl/callback/mkcallback.rb | |
parent | d3c4a4686a8f4533380c24d17736db3f6124de34 (diff) |
* ext/dl/callback/depend: fix for parallel build.
* ext/dl/callback/extconf.rb: callback.h is no longer created.
* ext/dl/callback/mkcallback.rb: creates main source first.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/callback/mkcallback.rb')
-rw-r--r-- | ext/dl/callback/mkcallback.rb | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/ext/dl/callback/mkcallback.rb b/ext/dl/callback/mkcallback.rb index 81bfb82e9a..b62a2eadf1 100644 --- a/ext/dl/callback/mkcallback.rb +++ b/ext/dl/callback/mkcallback.rb @@ -1,4 +1,6 @@ -$out = open("callback.c", "w") +#!ruby -s +$output ||= "callback" +$out = open("#{$output}.c", "w") $dl_h = ARGV[0] || "dl.h" @@ -157,10 +159,9 @@ def gen_push_addr_ary(ty, aryname, calltype) end def gen_callback_file(ty) - filename = "callback-#{ty}.c" + filename = "#{$output}-#{ty}.c" initname = "rb_dl_init_callbacks_#{ty}" - open(filename, "w") {|f| - f.puts <<-EOS + body = <<-EOS #include "dl.h" extern VALUE rb_DLCdeclCallbackAddrs, rb_DLCdeclCallbackProcs; @@ -169,8 +170,8 @@ extern VALUE rb_DLStdcallCallbackAddrs, rb_DLStdcallCallbackProcs; #endif extern ID rb_dl_cb_call; EOS - yield f - f.puts <<-EOS + yield body + body << <<-EOS void #{initname}() { @@ -182,12 +183,12 @@ void #endif } EOS - } - initname + [filename, initname, body] end +callbacks = [] for ty in 0...MAX_DLTYPE - initname = gen_callback_file(ty) {|f| + filename, initname, body = gen_callback_file(ty) {|f| foreach_proc_entry do |calltype, proc_entry| for argc in 0...DLSTACK_SIZE for n in 0...MAX_CALLBACK @@ -197,6 +198,7 @@ for ty in 0...MAX_DLTYPE end } $out << "void #{initname}();\n" + callbacks << [filename, body] end $out << (<<EOS) @@ -229,3 +231,8 @@ Init_callback(void) } } EOS +$out.close + +for filename, body in callbacks + open(filename, "wb") {|f| f.puts body} +end |