ruby-changes:9696
From: akr <ko1@a...>
Date: Thu, 1 Jan 2009 16:04:47 +0900 (JST)
Subject: [ruby-changes:9696] Ruby:r21237 (trunk): * ext/socket/mkconstants.rb (Socket::AF_INET6): moved from socket.c.
akr 2009-01-01 16:04:31 +0900 (Thu, 01 Jan 2009) New Revision: 21237 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21237 Log: * ext/socket/mkconstants.rb (Socket::AF_INET6): moved from socket.c. (Socket::PF_INET6): ditto. Modified files: trunk/ChangeLog trunk/ext/socket/mkconstants.rb trunk/ext/socket/socket.c Index: ChangeLog =================================================================== --- ChangeLog (revision 21236) +++ ChangeLog (revision 21237) @@ -1,3 +1,8 @@ +Thu Jan 1 16:03:04 2009 Tanaka Akira <akr@f...> + + * ext/socket/mkconstants.rb (Socket::AF_INET6): moved from socket.c. + (Socket::PF_INET6): ditto. + Thu Jan 1 15:27:07 2009 Tanaka Akira <akr@f...> * ext/socket/mkconstants.rb: use erb. Index: ext/socket/mkconstants.rb =================================================================== --- ext/socket/mkconstants.rb (revision 21236) +++ ext/socket/mkconstants.rb (revision 21237) @@ -43,19 +43,30 @@ else define = "sock_define_const" end - yield define, name, default_value + guard = nil + if /\A(AF_INET6|PF_INET6)\z/ =~ name + # IPv6 is not supported although AF_INET6 is defined on bcc32/mingw + guard = "defined(INET6)" + end + yield guard, define, name, default_value } end result << ERB.new(<<'EOS', nil, '%').result(binding) -% each_data {|define, name, default_value| -#ifdef <%=name%> +% each_data {|guard, define, name, default_value| +% if guard +#if <%=guard%> +% end +#if defined(<%=name%>) <%=define%>(<%=c_str name%>, <%=name%>); % if default_value #else <%=define%>(<%=c_str name%>, <%=default_value%>); % end #endif +% if guard +#endif +% end % } EOS @@ -79,6 +90,8 @@ AF_INET PF_INET +AF_INET6 +PF_INET6 AF_UNIX PF_UNIX AF_AX25 Index: ext/socket/socket.c =================================================================== --- ext/socket/socket.c (revision 21236) +++ ext/socket/socket.c (revision 21237) @@ -3733,8 +3733,4 @@ /* constants */ mConst = rb_define_module_under(rb_cSocket, "Constants"); #include "constants.h" -#ifdef INET6 /* IPv6 is not supported although AF_INET6 is defined on bcc32/mingw */ - sock_define_const("AF_INET6", AF_INET6); - sock_define_const("PF_INET6", PF_INET6); -#endif } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/