summaryrefslogtreecommitdiff
path: root/ext/socket/mkconstants.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-01 07:04:31 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-01 07:04:31 +0000
commit2b3e480bef31e3a1cb30e37ec92e5a59f8b0aa7a (patch)
tree7817fac0e89be0e79a381ad39a09791803a27400 /ext/socket/mkconstants.rb
parent1c0e798d5c7e2c326fc3116a2f8dc259c71eea72 (diff)
* ext/socket/mkconstants.rb (Socket::AF_INET6): moved from socket.c.
(Socket::PF_INET6): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/mkconstants.rb')
-rw-r--r--ext/socket/mkconstants.rb19
1 files changed, 16 insertions, 3 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index d74310c..02d7e17 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -43,19 +43,30 @@ def each_data
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 @@ SOCK_PACKET
AF_INET
PF_INET
+AF_INET6
+PF_INET6
AF_UNIX
PF_UNIX
AF_AX25