From 1001173ccd68f728d28cf7fb8752326bc3ddf3eb Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 3 Mar 2009 06:40:40 +0000 Subject: [PATCH] * ext/dl/dl.c (rb_dl_init_callbacks): autoloads callbacks. * ext/dl/callback: split from dl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22722 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 +++++- ext/dl/callback/depend | 18 ++++++++++++++++++ ext/dl/callback/extconf.rb | 15 +++++++++++++++ ext/dl/{ => callback}/mkcallback.rb | 19 ++++++++++++++----- ext/dl/depend | 19 +------------------ ext/dl/dl.c | 19 +++++++++++++++---- ext/dl/extconf.rb | 8 -------- 7 files changed, 68 insertions(+), 36 deletions(-) create mode 100644 ext/dl/callback/depend create mode 100644 ext/dl/callback/extconf.rb rename ext/dl/{ => callback}/mkcallback.rb (95%) diff --git a/ChangeLog b/ChangeLog index 53b8d0384c..e529cae52f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -Tue Mar 3 15:09:12 2009 Nobuyoshi Nakada +Tue Mar 3 15:40:38 2009 Nobuyoshi Nakada + + * ext/dl/dl.c (rb_dl_init_callbacks): autoloads callbacks. + + * ext/dl/callback: split from dl. * ext/dl/lib/dl/cparser.rb (DL::CParser::parse_signature): fixed variable name. diff --git a/ext/dl/callback/depend b/ext/dl/callback/depend new file mode 100644 index 0000000000..aeca53f0cc --- /dev/null +++ b/ext/dl/callback/depend @@ -0,0 +1,18 @@ +callback.o: $(hdrdir)/ruby.h $(hdrdir)/io.h + +callback-0.o: callback-0.c $(hdrdir)/ruby.h +callback-1.o: callback-1.c $(hdrdir)/ruby.h +callback-2.o: callback-2.c $(hdrdir)/ruby.h +callback-3.o: callback-3.c $(hdrdir)/ruby.h +callback-4.o: callback-4.c $(hdrdir)/ruby.h +callback-5.o: callback-5.c $(hdrdir)/ruby.h +callback-6.o: callback-6.c $(hdrdir)/ruby.h +callback-7.o: callback-7.c $(hdrdir)/ruby.h +callback-8.o: callback-8.c $(hdrdir)/ruby.h + +callback-0.c callback-1.c callback-2.c \ +callback-3.c callback-4.c callback-5.c \ +callback-6.c callback-7.c callback-8.c \ +callback.c: $(srcdir)/mkcallback.rb $(srcdir)/../dl.h + @echo "generating callback.h" + @$(RUBY) $(srcdir)/mkcallback.rb $(srcdir)/../dl.h diff --git a/ext/dl/callback/extconf.rb b/ext/dl/callback/extconf.rb new file mode 100644 index 0000000000..46aba28397 --- /dev/null +++ b/ext/dl/callback/extconf.rb @@ -0,0 +1,15 @@ +require 'mkmf' + +if compiled?("dl") + CALLBACKS = (0..8).map{|i| "callback-#{i}"} + CALLBACK_SRCS = CALLBACKS.map{|basename| "#{basename}.c"} + CALLBACK_OBJS = CALLBACKS.map{|basename| "#{basename}.o"} + + $distcleanfiles += [ "callback.h", *CALLBACK_SRCS ] + + $objs = %w[ callback.o ] + CALLBACK_OBJS + + $INCFLAGS << " -I$(srcdir)/.." + + create_makefile("dl/callback") +end diff --git a/ext/dl/mkcallback.rb b/ext/dl/callback/mkcallback.rb similarity index 95% rename from ext/dl/mkcallback.rb rename to ext/dl/callback/mkcallback.rb index 1cac0857bb..a210a686e1 100644 --- a/ext/dl/mkcallback.rb +++ b/ext/dl/callback/mkcallback.rb @@ -1,4 +1,4 @@ -$out = open("callback.h", "w") +$out = open("callback.c", "w") $dl_h = ARGV[0] || "dl.h" @@ -91,10 +91,16 @@ def func_name(ty, argc, n, calltype) end $out << (<