mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* configure.in, cygwin/GNUmakefile.in (mingw): use def file to alias
symbols. [ruby-dev:27532] * bcc32/mkexports.rb, win32/mkexports.rb: make aliases in DLL. * win32/win32.c, win32/win32.h: replace symbols only when RUBY_EXPORT is defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
479b27ac41
commit
49775b88e9
8 changed files with 260 additions and 184 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Sat Nov 5 13:42:50 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in, cygwin/GNUmakefile.in (mingw): use def file to alias
|
||||
symbols. [ruby-dev:27532]
|
||||
|
||||
* bcc32/mkexports.rb, win32/mkexports.rb: make aliases in DLL.
|
||||
|
||||
* win32/win32.c, win32/win32.h: replace symbols only when RUBY_EXPORT
|
||||
is defined.
|
||||
|
||||
Thu Nov 3 07:57:39 2005 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* lib/open-uri.rb (open_loop): find_proxy should return nil when
|
||||
|
|
|
@ -1,25 +1,24 @@
|
|||
#!./miniruby -s
|
||||
|
||||
SYM = {}
|
||||
STDIN.reopen(open("nul"))
|
||||
ARGV.each do |obj|
|
||||
IO.foreach("|tdump -q -oiPUBDEF -oiPUBD32 #{obj.tr('/', '\\')}") do |l|
|
||||
next unless /(?:PUBDEF|PUBD32)/ =~ l
|
||||
SYM[$1] = true if /'(.*?)'/ =~ l
|
||||
$:.unshift(File.expand_path("../..", __FILE__))
|
||||
require 'win32/mkexports'
|
||||
|
||||
class Exports::Bcc < Exports
|
||||
Forwards = /^rb_w32_(\w+)/
|
||||
|
||||
def forwarding(internal, export)
|
||||
internal[/\A_?/]+export
|
||||
end
|
||||
|
||||
def each_export(objs)
|
||||
objs.each do |obj|
|
||||
opt = /\.(?:so|dll)\z/i =~ obj ? "-ee" : "-oiPUBDEF -oiPUBD32"
|
||||
IO.foreach("|tdump -q #{opt} #{obj.tr('/', '\\')} < nul") do |l|
|
||||
next unless /(?:PUBDEF|PUBD32|EXPORT)/ =~ l
|
||||
yield $1 if /'(.*?)'/ =~ l
|
||||
end
|
||||
end
|
||||
yield "_strcasecmp", "_stricmp"
|
||||
yield "_strncasecmp", "_strnicmp"
|
||||
end
|
||||
end
|
||||
|
||||
exports = []
|
||||
if $name
|
||||
exports << "Name " + $name
|
||||
elsif $library
|
||||
exports << "Library " + $library
|
||||
end
|
||||
exports << "Description " + $description.dump if $description
|
||||
exports << "EXPORTS" << SYM.keys.sort
|
||||
|
||||
if $output
|
||||
open($output, 'w') {|f| f.puts exports.join("\n")}
|
||||
else
|
||||
puts exports.join("\n")
|
||||
end
|
||||
|
|
|
@ -1370,11 +1370,11 @@ case "$target_os" in
|
|||
esac
|
||||
;;
|
||||
cygwin*|mingw*)
|
||||
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
|
||||
case "$target_os" in
|
||||
cygwin*)
|
||||
if test x"$enable_shared" = xyes; then
|
||||
LIBRUBY_SO='cyg$(RUBY_SO_NAME)'${MAJOR}${MINOR}.dll
|
||||
LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
|
||||
fi
|
||||
AC_LIBOBJ([strftime])
|
||||
;;
|
||||
|
@ -1382,7 +1382,7 @@ case "$target_os" in
|
|||
RUBY_SO_NAME=${rb_cv_msvcrt}-'$(RUBY_INSTALL_NAME)'${MAJOR}${MINOR}
|
||||
if test x"$enable_shared" = xyes; then
|
||||
LIBRUBY_SO='$(RUBY_SO_NAME)'.dll
|
||||
LIBRUBY='lib$(LIBRUBY_SO).a'
|
||||
LIBRUBY_DLDFLAGS="${LIBRUBY_DLDFLAGS}"' $(RUBYDEF)'
|
||||
fi
|
||||
AC_LIBOBJ([win32])
|
||||
COMMON_LIBS=m
|
||||
|
@ -1390,11 +1390,12 @@ case "$target_os" in
|
|||
COMMON_HEADERS="winsock2.h windows.h"
|
||||
;;
|
||||
esac
|
||||
LIBRUBY_DLDFLAGS="${DLDFLAGS}"' -Wl,--out-implib=$(LIBRUBY)'
|
||||
LIBRUBY_ALIASES=''
|
||||
FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
|
||||
SOLIBS='$(LIBS)'
|
||||
if test x"$enable_shared" = xno; then
|
||||
if test x"$enable_shared" = xyes; then
|
||||
LIBRUBY='lib$(RUBY_SO_NAME).dll.a'
|
||||
else
|
||||
LIBRUBY_SO=dummy
|
||||
LIBRUBY='lib$(RUBY_SO_NAME).a'
|
||||
LIBRUBYARG='-l$(RUBY_SO_NAME)'
|
||||
|
|
|
@ -28,6 +28,7 @@ WPROGRAM = $(RUBYW_INSTALL_NAME)$(EXEEXT)
|
|||
SOLIBS := $(DLL_BASE_NAME).res.@OBJEXT@ $(SOLIBS)
|
||||
EXTOBJS += $(@:$(EXEEXT)=.res.@OBJEXT@)
|
||||
RCFILES = $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(DLL_BASE_NAME).rc
|
||||
RUBYDEF = $(RUBY_SO_NAME).def
|
||||
|
||||
ruby: $(PROGRAM)
|
||||
rubyw: $(WPROGRAM)
|
||||
|
@ -61,6 +62,11 @@ GNUmakefile: $(srcdir)/cygwin/GNUmakefile.in
|
|||
|
||||
ifeq (@target_os@,mingw32)
|
||||
$(OBJS) $(MAINOBJ): win32/win32.h
|
||||
|
||||
$(LIBRUBY_SO): $(RUBYDEF)
|
||||
|
||||
$(RUBYDEF): $(LIBRUBY_A) $(PREP) $(RBCONFIG)
|
||||
$(MINIRUBY) $(srcdir)/win32/mkexports.rb -output=$@ $(LIBRUBY_A)
|
||||
endif
|
||||
|
||||
ifeq (@target_os@,cygwin)
|
||||
|
|
2
ruby.c
2
ruby.c
|
@ -12,7 +12,7 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#ifdef __CYGWIN__
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#ifdef _WIN32_WCE
|
||||
|
|
|
@ -1,30 +1,134 @@
|
|||
#!./miniruby -s
|
||||
|
||||
SYM = {}
|
||||
module Config
|
||||
autoload :CONFIG, "rbconfig"
|
||||
end
|
||||
|
||||
objs = ARGV.collect {|s| s.tr('/', '\\')}
|
||||
IO.foreach("|dumpbin -symbols " + objs.join(' ')) do |l|
|
||||
next if /^[0-9A-F]+ 0+ UNDEF / =~ l
|
||||
class Exports
|
||||
@subclass = []
|
||||
def self.inherited(klass)
|
||||
@subclass << [/#{klass.name.sub(/.*::/, '').downcase}/i, klass]
|
||||
end
|
||||
|
||||
def self.create(*args, &block)
|
||||
platform = RUBY_PLATFORM
|
||||
pat, klass = @subclass.find {|pat, klass| pat =~ platform}
|
||||
unless klass
|
||||
raise ArgumentError, "unsupported platform: #{platform}"
|
||||
end
|
||||
klass.new(*args, &block)
|
||||
end
|
||||
|
||||
def self.extract(objs, *rest)
|
||||
create(objs).exports(*rest)
|
||||
end
|
||||
|
||||
def self.output(output = $output, &block)
|
||||
if output
|
||||
open(output, 'w', &block)
|
||||
else
|
||||
yield STDOUT
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(objs)
|
||||
syms = {}
|
||||
winapis = {}
|
||||
internal = export = nil
|
||||
each_export(objs) do |internal, export|
|
||||
syms[internal] = export
|
||||
winapis[$1] = internal if /^_?(rb_w32_\w+)(?:@\d+)?$/ =~ internal
|
||||
end
|
||||
win32h = File.join(File.dirname(__FILE__), "win32.h")
|
||||
IO.foreach(win32h) do |line|
|
||||
if /^#define (\w+)\((.*?)\)\s+(?:\(void\))?(rb_w32_\w+)\((.*?)\)\s*$/ =~ line and
|
||||
$2.delete(" ") == $4.delete(" ")
|
||||
export, internal = $1, $3
|
||||
if syms[internal] or internal = winapis[internal]
|
||||
syms[forwarding(internal, export)] = internal
|
||||
end
|
||||
end
|
||||
end
|
||||
@syms = syms
|
||||
end
|
||||
|
||||
def exports(name = $name, library = $library, description = $description)
|
||||
exports = []
|
||||
if name
|
||||
exports << "Name " + name
|
||||
elsif library
|
||||
exports << "Library " + library
|
||||
end
|
||||
exports << "Description " + description.dump if description
|
||||
k = v = nil
|
||||
exports << "EXPORTS" << symbols()
|
||||
exports
|
||||
end
|
||||
|
||||
private
|
||||
def forwarding(internal, export)
|
||||
internal.sub(/^[^@]+/, "\\1#{export}")
|
||||
end
|
||||
|
||||
def each_export(objs)
|
||||
end
|
||||
|
||||
def symbols()
|
||||
@syms.sort.collect {|k, v| v ? "#{k}=#{v}" : k}
|
||||
end
|
||||
end
|
||||
|
||||
class Exports::Mswin < Exports
|
||||
def each_export(objs)
|
||||
noprefix = ($arch and /^sh/ !~ $arch)
|
||||
objs = objs.collect {|s| s.tr('/', '\\')}
|
||||
filetype = nil
|
||||
IO.popen(%w"dumpbin -symbols -exports" + objs) do |f|
|
||||
f.each do |l|
|
||||
if (filetype = l[/^File Type: (.+)/, 1])..(/^\f/ =~ l)
|
||||
case filetype
|
||||
when /OBJECT/, /LIBRARY/
|
||||
next if /^[[:xdigit:]]+ 0+ UNDEF / =~ l
|
||||
next unless l.sub!(/.*\sExternal\s+\|\s+/, '')
|
||||
if l.sub!(/^_/, '')
|
||||
next if /@.*@/ =~ l || /@[0-9a-f]{16}$/ =~ l
|
||||
if noprefix or l.sub!(/^_/, '')
|
||||
next if /@.*@/ =~ l || /@[[:xdigit:]]{16}$/ =~ l
|
||||
l.sub!(/^/, '_') if /@\d+$/ =~ l
|
||||
elsif !l.sub!(/^(\S+) \([^@?\`\']*\)$/, '\1')
|
||||
next
|
||||
end
|
||||
SYM[l.strip] = true
|
||||
when /DLL/
|
||||
next unless l.sub!(/^\s*\d+\s+[[:xdigit:]]+\s+[[:xdigit:]]+\s+/, '')
|
||||
else
|
||||
next
|
||||
end
|
||||
yield l.strip
|
||||
end
|
||||
end
|
||||
end
|
||||
yield "strcasecmp", "msvcrt.stricmp"
|
||||
yield "strncasecmp", "msvcrt.strnicmp"
|
||||
end
|
||||
end
|
||||
|
||||
exports = []
|
||||
if $name
|
||||
exports << "Name " + $name
|
||||
elsif $library
|
||||
exports << "Library " + $library
|
||||
end
|
||||
exports << "Description " + $description.dump if $description
|
||||
exports << "EXPORTS" << SYM.keys.sort
|
||||
class Exports::Mingw < Exports
|
||||
def self.nm
|
||||
@@nm ||= Config::CONFIG["NM"]
|
||||
end
|
||||
|
||||
if $output
|
||||
open($output, 'w') {|f| f.puts exports.join("\n")}
|
||||
else
|
||||
puts exports.join("\n")
|
||||
def each_export(objs)
|
||||
IO.popen([self.class.nm, "--extern", "--defined", *objs]) do |f|
|
||||
f.each {|l| yield $1 if / [[:upper:]] _(.*)$/ =~ l}
|
||||
end
|
||||
yield "strcasecmp", "_stricmp"
|
||||
yield "strncasecmp", "_strnicmp"
|
||||
end
|
||||
|
||||
def symbols()
|
||||
@syms.select {|k, v| v}.sort.collect {|k, v| "#{k}=#{v}"}
|
||||
end
|
||||
end
|
||||
|
||||
END {
|
||||
exports = Exports.extract(ARGV)
|
||||
Exports.output {|f| f.puts exports}
|
||||
}
|
||||
|
|
|
@ -2009,11 +2009,11 @@ is_readable_console(SOCKET sock) /* call this for console only */
|
|||
}
|
||||
|
||||
static void catch_interrupt(void);
|
||||
static long
|
||||
static int
|
||||
do_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
long r = 0;
|
||||
int r = 0;
|
||||
|
||||
if (nfds == 0) {
|
||||
if (timeout)
|
||||
|
@ -2056,11 +2056,11 @@ subst(struct timeval *rest, const struct timeval *wait)
|
|||
return 1;
|
||||
}
|
||||
|
||||
long
|
||||
int WSAAPI
|
||||
rb_w32_select(int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
|
||||
struct timeval *timeout)
|
||||
{
|
||||
long r;
|
||||
int r;
|
||||
fd_set pipe_rd;
|
||||
fd_set cons_rd;
|
||||
fd_set else_rd;
|
||||
|
@ -2194,7 +2194,7 @@ StartSockets(void)
|
|||
|
||||
#undef accept
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_accept(int s, struct sockaddr *addr, int *addrlen)
|
||||
{
|
||||
SOCKET r;
|
||||
|
@ -2217,7 +2217,7 @@ rb_w32_accept(int s, struct sockaddr *addr, int *addrlen)
|
|||
|
||||
#undef bind
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_bind(int s, const struct sockaddr *addr, int addrlen)
|
||||
{
|
||||
int r;
|
||||
|
@ -2235,7 +2235,7 @@ rb_w32_bind(int s, const struct sockaddr *addr, int addrlen)
|
|||
|
||||
#undef connect
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_connect(int s, const struct sockaddr *addr, int addrlen)
|
||||
{
|
||||
int r;
|
||||
|
@ -2261,7 +2261,7 @@ rb_w32_connect(int s, const struct sockaddr *addr, int addrlen)
|
|||
|
||||
#undef getpeername
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_getpeername(int s, struct sockaddr *addr, int *addrlen)
|
||||
{
|
||||
int r;
|
||||
|
@ -2278,7 +2278,7 @@ rb_w32_getpeername(int s, struct sockaddr *addr, int *addrlen)
|
|||
|
||||
#undef getsockname
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_getsockname(int s, struct sockaddr *addr, int *addrlen)
|
||||
{
|
||||
int r;
|
||||
|
@ -2293,7 +2293,7 @@ rb_w32_getsockname(int s, struct sockaddr *addr, int *addrlen)
|
|||
return r;
|
||||
}
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_getsockopt(int s, int level, int optname, char *optval, int *optlen)
|
||||
{
|
||||
int r;
|
||||
|
@ -2310,7 +2310,7 @@ rb_w32_getsockopt(int s, int level, int optname, char *optval, int *optlen)
|
|||
|
||||
#undef ioctlsocket
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_ioctlsocket(int s, long cmd, u_long *argp)
|
||||
{
|
||||
int r;
|
||||
|
@ -2327,7 +2327,7 @@ rb_w32_ioctlsocket(int s, long cmd, u_long *argp)
|
|||
|
||||
#undef listen
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_listen(int s, int backlog)
|
||||
{
|
||||
int r;
|
||||
|
@ -2344,7 +2344,7 @@ rb_w32_listen(int s, int backlog)
|
|||
|
||||
#undef recv
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_recv(int s, char *buf, int len, int flags)
|
||||
{
|
||||
int r;
|
||||
|
@ -2361,7 +2361,7 @@ rb_w32_recv(int s, char *buf, int len, int flags)
|
|||
|
||||
#undef recvfrom
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_recvfrom(int s, char *buf, int len, int flags,
|
||||
struct sockaddr *from, int *fromlen)
|
||||
{
|
||||
|
@ -2379,7 +2379,7 @@ rb_w32_recvfrom(int s, char *buf, int len, int flags,
|
|||
|
||||
#undef send
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_send(int s, const char *buf, int len, int flags)
|
||||
{
|
||||
int r;
|
||||
|
@ -2396,7 +2396,7 @@ rb_w32_send(int s, const char *buf, int len, int flags)
|
|||
|
||||
#undef sendto
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_sendto(int s, const char *buf, int len, int flags,
|
||||
const struct sockaddr *to, int tolen)
|
||||
{
|
||||
|
@ -2414,7 +2414,7 @@ rb_w32_sendto(int s, const char *buf, int len, int flags,
|
|||
|
||||
#undef setsockopt
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_setsockopt(int s, int level, int optname, const char *optval, int optlen)
|
||||
{
|
||||
int r;
|
||||
|
@ -2431,7 +2431,7 @@ rb_w32_setsockopt(int s, int level, int optname, const char *optval, int optlen)
|
|||
|
||||
#undef shutdown
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_shutdown(int s, int how)
|
||||
{
|
||||
int r;
|
||||
|
@ -2488,7 +2488,7 @@ open_ifs_socket(int af, int type, int protocol)
|
|||
|
||||
#undef socket
|
||||
|
||||
int
|
||||
int WSAAPI
|
||||
rb_w32_socket(int af, int type, int protocol)
|
||||
{
|
||||
SOCKET s;
|
||||
|
@ -2512,8 +2512,8 @@ rb_w32_socket(int af, int type, int protocol)
|
|||
|
||||
#undef gethostbyaddr
|
||||
|
||||
struct hostent *
|
||||
rb_w32_gethostbyaddr (const char *addr, int len, int type)
|
||||
struct hostent * WSAAPI
|
||||
rb_w32_gethostbyaddr(const char *addr, int len, int type)
|
||||
{
|
||||
struct hostent *r;
|
||||
if (!NtSocketsInitialized) {
|
||||
|
@ -2529,8 +2529,8 @@ rb_w32_gethostbyaddr (const char *addr, int len, int type)
|
|||
|
||||
#undef gethostbyname
|
||||
|
||||
struct hostent *
|
||||
rb_w32_gethostbyname (const char *name)
|
||||
struct hostent * WSAAPI
|
||||
rb_w32_gethostbyname(const char *name)
|
||||
{
|
||||
struct hostent *r;
|
||||
if (!NtSocketsInitialized) {
|
||||
|
@ -2546,8 +2546,8 @@ rb_w32_gethostbyname (const char *name)
|
|||
|
||||
#undef gethostname
|
||||
|
||||
int
|
||||
rb_w32_gethostname (char *name, int len)
|
||||
int WSAAPI
|
||||
rb_w32_gethostname(char *name, int len)
|
||||
{
|
||||
int r;
|
||||
if (!NtSocketsInitialized) {
|
||||
|
@ -2563,8 +2563,8 @@ rb_w32_gethostname (char *name, int len)
|
|||
|
||||
#undef getprotobyname
|
||||
|
||||
struct protoent *
|
||||
rb_w32_getprotobyname (const char *name)
|
||||
struct protoent * WSAAPI
|
||||
rb_w32_getprotobyname(const char *name)
|
||||
{
|
||||
struct protoent *r;
|
||||
if (!NtSocketsInitialized) {
|
||||
|
@ -2580,8 +2580,8 @@ rb_w32_getprotobyname (const char *name)
|
|||
|
||||
#undef getprotobynumber
|
||||
|
||||
struct protoent *
|
||||
rb_w32_getprotobynumber (int num)
|
||||
struct protoent * WSAAPI
|
||||
rb_w32_getprotobynumber(int num)
|
||||
{
|
||||
struct protoent *r;
|
||||
if (!NtSocketsInitialized) {
|
||||
|
@ -2597,8 +2597,8 @@ rb_w32_getprotobynumber (int num)
|
|||
|
||||
#undef getservbyname
|
||||
|
||||
struct servent *
|
||||
rb_w32_getservbyname (const char *name, const char *proto)
|
||||
struct servent * WSAAPI
|
||||
rb_w32_getservbyname(const char *name, const char *proto)
|
||||
{
|
||||
struct servent *r;
|
||||
if (!NtSocketsInitialized) {
|
||||
|
@ -2614,8 +2614,8 @@ rb_w32_getservbyname (const char *name, const char *proto)
|
|||
|
||||
#undef getservbyport
|
||||
|
||||
struct servent *
|
||||
rb_w32_getservbyport (int port, const char *proto)
|
||||
struct servent * WSAAPI
|
||||
rb_w32_getservbyport(int port, const char *proto)
|
||||
{
|
||||
struct servent *r;
|
||||
if (!NtSocketsInitialized) {
|
||||
|
@ -3444,6 +3444,12 @@ rb_w32_main_context(int arg, void (*handler)(int))
|
|||
|
||||
int
|
||||
rb_w32_sleep(unsigned long msec)
|
||||
{
|
||||
return rb_w32_Sleep(msec);
|
||||
}
|
||||
|
||||
int WINAPI
|
||||
rb_w32_Sleep(unsigned long msec)
|
||||
{
|
||||
DWORD ret;
|
||||
RUBY_CRITICAL(ret = wait_events(NULL, msec));
|
||||
|
|
152
win32/win32.h
152
win32/win32.h
|
@ -20,10 +20,9 @@
|
|||
|
||||
// #include <stdarg.h> conflict with varargs.h?
|
||||
// There is function-name conflitct, so we rename it
|
||||
#if !defined(IN) && !defined(FLOAT)
|
||||
#if !defined(WSAAPI)
|
||||
#define OpenFile WINAPI_OpenFile
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#undef OpenFile
|
||||
#endif
|
||||
|
||||
|
@ -81,30 +80,28 @@ extern "C++" {
|
|||
#undef fputchar
|
||||
#undef utime
|
||||
#define getc(_stream) rb_w32_getc(_stream)
|
||||
#define getchar() rb_w32_getc(stdin)
|
||||
#define putc(_c, _stream) rb_w32_putc(_c, _stream)
|
||||
#define putchar(_c) rb_w32_putc(_c, stdout)
|
||||
#ifdef RUBY_EXPORT
|
||||
#define fgetc(_stream) getc(_stream)
|
||||
#define fputc(_c, _stream) putc(_c, _stream)
|
||||
#define getchar() rb_w32_getc(stdin)
|
||||
#define putchar(_c) rb_w32_putc(_c, stdout)
|
||||
#define fgetchar() getchar()
|
||||
#define fputchar(_c) putchar(_c)
|
||||
#define utime(_p, _t) rb_w32_utime(_p, _t)
|
||||
|
||||
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
||||
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
||||
|
||||
#define pipe(p) _pipe(p, 2048L, O_BINARY)
|
||||
#define close(h) rb_w32_close(h)
|
||||
#define fclose(f) rb_w32_fclose(f)
|
||||
#define getpid() rb_w32_getpid()
|
||||
#define sleep(x) rb_w32_sleep((x)*1000)
|
||||
#define sleep(x) rb_w32_Sleep((x)*1000)
|
||||
#define Sleep(msec) (void)rb_w32_Sleep(msec)
|
||||
#ifdef __BORLANDC__
|
||||
#define creat(p, m) _creat(p, m)
|
||||
#define eof() _eof()
|
||||
#define filelength(h) _filelength(h)
|
||||
#define mktemp(t) _mktemp(t)
|
||||
#define tell(h) _tell(h)
|
||||
#define unlink(p) _unlink(p)
|
||||
#define write(h, b, l) _write(h, b, l)
|
||||
#define _open _sopen
|
||||
#define sopen _sopen
|
||||
|
@ -118,7 +115,6 @@ extern "C++" {
|
|||
#define fsopen(p, m, sh) rb_w32_fsopen(p, m, sh)
|
||||
#endif
|
||||
|
||||
#define fsync(h) _commit(h)
|
||||
#undef stat
|
||||
#define stat(path,st) rb_w32_stat(path,st)
|
||||
#undef execv
|
||||
|
@ -134,6 +130,11 @@ extern "C++" {
|
|||
#define rmdir(p) rb_w32_rmdir(p)
|
||||
#undef unlink
|
||||
#define unlink(p) rb_w32_unlink(p)
|
||||
#endif
|
||||
|
||||
#define strcasecmp(s1, s2) stricmp(s1, s2)
|
||||
#define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
|
||||
#define fsync(h) _commit(h)
|
||||
|
||||
#ifdef __MINGW32__
|
||||
struct timezone {
|
||||
|
@ -146,33 +147,33 @@ extern int rb_w32_cmdvector(const char *, char ***);
|
|||
extern rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *);
|
||||
extern int flock(int fd, int oper);
|
||||
extern int rb_w32_is_socket(int);
|
||||
extern int rb_w32_accept(int, struct sockaddr *, int *);
|
||||
extern int rb_w32_bind(int, const struct sockaddr *, int);
|
||||
extern int rb_w32_connect(int, const struct sockaddr *, int);
|
||||
extern int WSAAPI rb_w32_accept(int, struct sockaddr *, int *);
|
||||
extern int WSAAPI rb_w32_bind(int, const struct sockaddr *, int);
|
||||
extern int WSAAPI rb_w32_connect(int, const struct sockaddr *, int);
|
||||
extern void rb_w32_fdset(int, fd_set*);
|
||||
extern void rb_w32_fdclr(int, fd_set*);
|
||||
extern int rb_w32_fdisset(int, fd_set*);
|
||||
extern long rb_w32_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
extern int rb_w32_getpeername(int, struct sockaddr *, int *);
|
||||
extern int rb_w32_getsockname(int, struct sockaddr *, int *);
|
||||
extern int rb_w32_getsockopt(int, int, int, char *, int *);
|
||||
extern int rb_w32_ioctlsocket(int, long, u_long *);
|
||||
extern int rb_w32_listen(int, int);
|
||||
extern int rb_w32_recv(int, char *, int, int);
|
||||
extern int rb_w32_recvfrom(int, char *, int, int, struct sockaddr *, int *);
|
||||
extern int rb_w32_send(int, const char *, int, int);
|
||||
extern int rb_w32_sendto(int, const char *, int, int, const struct sockaddr *, int);
|
||||
extern int rb_w32_setsockopt(int, int, int, const char *, int);
|
||||
extern int rb_w32_shutdown(int, int);
|
||||
extern int rb_w32_socket(int, int, int);
|
||||
extern int WSAAPI rb_w32_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||
extern int WSAAPI rb_w32_getpeername(int, struct sockaddr *, int *);
|
||||
extern int WSAAPI rb_w32_getsockname(int, struct sockaddr *, int *);
|
||||
extern int WSAAPI rb_w32_getsockopt(int, int, int, char *, int *);
|
||||
extern int WSAAPI rb_w32_ioctlsocket(int, long, u_long *);
|
||||
extern int WSAAPI rb_w32_listen(int, int);
|
||||
extern int WSAAPI rb_w32_recv(int, char *, int, int);
|
||||
extern int WSAAPI rb_w32_recvfrom(int, char *, int, int, struct sockaddr *, int *);
|
||||
extern int WSAAPI rb_w32_send(int, const char *, int, int);
|
||||
extern int WSAAPI rb_w32_sendto(int, const char *, int, int, const struct sockaddr *, int);
|
||||
extern int WSAAPI rb_w32_setsockopt(int, int, int, const char *, int);
|
||||
extern int WSAAPI rb_w32_shutdown(int, int);
|
||||
extern int WSAAPI rb_w32_socket(int, int, int);
|
||||
extern SOCKET rb_w32_get_osfhandle(int);
|
||||
extern struct hostent * rb_w32_gethostbyaddr(const char *, int, int);
|
||||
extern struct hostent * rb_w32_gethostbyname(const char *);
|
||||
extern int rb_w32_gethostname(char *, int);
|
||||
extern struct protoent * rb_w32_getprotobyname(const char *);
|
||||
extern struct protoent * rb_w32_getprotobynumber(int);
|
||||
extern struct servent * rb_w32_getservbyname(const char *, const char *);
|
||||
extern struct servent * rb_w32_getservbyport(int, const char *);
|
||||
extern struct hostent *WSAAPI rb_w32_gethostbyaddr(const char *, int, int);
|
||||
extern struct hostent *WSAAPI rb_w32_gethostbyname(const char *);
|
||||
extern int WSAAPI rb_w32_gethostname(char *, int);
|
||||
extern struct protoent *WSAAPI rb_w32_getprotobyname(const char *);
|
||||
extern struct protoent *WSAAPI rb_w32_getprotobynumber(int);
|
||||
extern struct servent *WSAAPI rb_w32_getservbyname(const char *, const char *);
|
||||
extern struct servent *WSAAPI rb_w32_getservbyport(int, const char *);
|
||||
extern int rb_w32_socketpair(int, int, int, int *);
|
||||
extern char * rb_w32_getenv(const char *);
|
||||
extern int rb_w32_rename(const char *, const char *);
|
||||
|
@ -288,7 +289,9 @@ extern int setgid (rb_gid_t);
|
|||
|
||||
extern char *rb_w32_strerror(int);
|
||||
|
||||
#ifdef RUBY_EXPORT
|
||||
#define strerror(e) rb_w32_strerror(e)
|
||||
#endif
|
||||
|
||||
#define PIPE_BUF 1024
|
||||
|
||||
|
@ -351,21 +354,6 @@ extern char *rb_w32_strerror(int);
|
|||
#define F_SETFL 1
|
||||
#define O_NONBLOCK 1
|
||||
|
||||
#ifdef accept
|
||||
#undef accept
|
||||
#endif
|
||||
#define accept(s, a, l) rb_w32_accept(s, a, l)
|
||||
|
||||
#ifdef bind
|
||||
#undef bind
|
||||
#endif
|
||||
#define bind(s, a, l) rb_w32_bind(s, a, l)
|
||||
|
||||
#ifdef connect
|
||||
#undef connect
|
||||
#endif
|
||||
#define connect(s, a, l) rb_w32_connect(s, a, l)
|
||||
|
||||
#undef FD_SET
|
||||
#define FD_SET(f, s) rb_w32_fdset(f, s)
|
||||
|
||||
|
@ -375,129 +363,95 @@ extern char *rb_w32_strerror(int);
|
|||
#undef FD_ISSET
|
||||
#define FD_ISSET(f, s) rb_w32_fdisset(f, s)
|
||||
|
||||
#ifdef RUBY_EXPORT
|
||||
#undef accept
|
||||
#define accept(s, a, l) rb_w32_accept(s, a, l)
|
||||
|
||||
#undef bind
|
||||
#define bind(s, a, l) rb_w32_bind(s, a, l)
|
||||
|
||||
#undef connect
|
||||
#define connect(s, a, l) rb_w32_connect(s, a, l)
|
||||
|
||||
#undef select
|
||||
#define select(n, r, w, e, t) rb_w32_select(n, r, w, e, t)
|
||||
|
||||
#ifdef getpeername
|
||||
#undef getpeername
|
||||
#endif
|
||||
#define getpeername(s, a, l) rb_w32_getpeername(s, a, l)
|
||||
|
||||
#ifdef getsockname
|
||||
#undef getsockname
|
||||
#endif
|
||||
#define getsockname(s, a, l) rb_w32_getsockname(s, a, l)
|
||||
|
||||
#ifdef getsockopt
|
||||
#undef getsockopt
|
||||
#endif
|
||||
#define getsockopt(s, v, n, o, l) rb_w32_getsockopt(s, v, n, o, l)
|
||||
|
||||
#ifdef ioctlsocket
|
||||
#undef ioctlsocket
|
||||
#endif
|
||||
#define ioctlsocket(s, c, a) rb_w32_ioctlsocket(s, c, a)
|
||||
|
||||
#ifdef listen
|
||||
#undef listen
|
||||
#endif
|
||||
#define listen(s, b) rb_w32_listen(s, b)
|
||||
|
||||
#ifdef recv
|
||||
#undef recv
|
||||
#endif
|
||||
#define recv(s, b, l, f) rb_w32_recv(s, b, l, f)
|
||||
|
||||
#ifdef recvfrom
|
||||
#undef recvfrom
|
||||
#endif
|
||||
#define recvfrom(s, b, l, f, fr, frl) rb_w32_recvfrom(s, b, l, f, fr, frl)
|
||||
|
||||
#ifdef send
|
||||
#undef send
|
||||
#endif
|
||||
#define send(s, b, l, f) rb_w32_send(s, b, l, f)
|
||||
|
||||
#ifdef sendto
|
||||
#undef sendto
|
||||
#endif
|
||||
#define sendto(s, b, l, f, t, tl) rb_w32_sendto(s, b, l, f, t, tl)
|
||||
|
||||
#ifdef setsockopt
|
||||
#undef setsockopt
|
||||
#endif
|
||||
#define setsockopt(s, v, n, o, l) rb_w32_setsockopt(s, v, n, o, l)
|
||||
|
||||
#ifdef shutdown
|
||||
#undef shutdown
|
||||
#endif
|
||||
#define shutdown(s, h) rb_w32_shutdown(s, h)
|
||||
|
||||
#ifdef socket
|
||||
#undef socket
|
||||
#endif
|
||||
#define socket(s, t, p) rb_w32_socket(s, t, p)
|
||||
|
||||
#ifdef gethostbyaddr
|
||||
#undef gethostbyaddr
|
||||
#endif
|
||||
#define gethostbyaddr(a, l, t) rb_w32_gethostbyaddr(a, l, t)
|
||||
|
||||
#ifdef gethostbyname
|
||||
#undef gethostbyname
|
||||
#endif
|
||||
#define gethostbyname(n) rb_w32_gethostbyname(n)
|
||||
|
||||
#ifdef gethostname
|
||||
#undef gethostname
|
||||
#endif
|
||||
#define gethostname(n, l) rb_w32_gethostname(n, l)
|
||||
|
||||
#ifdef getprotobyname
|
||||
#undef getprotobyname
|
||||
#endif
|
||||
#define getprotobyname(n) rb_w32_getprotobyname(n)
|
||||
|
||||
#ifdef getprotobynumber
|
||||
#undef getprotobynumber
|
||||
#endif
|
||||
#define getprotobynumber(n) rb_w32_getprotobynumber(n)
|
||||
|
||||
#ifdef getservbyname
|
||||
#undef getservbyname
|
||||
#endif
|
||||
#define getservbyname(n, p) rb_w32_getservbyname(n, p)
|
||||
|
||||
#ifdef getservbyport
|
||||
#undef getservbyport
|
||||
#endif
|
||||
#define getservbyport(p, pr) rb_w32_getservbyport(p, pr)
|
||||
|
||||
#ifdef socketpair
|
||||
#undef socketpair
|
||||
#endif
|
||||
#define socketpair(a, t, p, s) rb_w32_socketpair(a, t, p, s)
|
||||
|
||||
#ifdef get_osfhandle
|
||||
#undef get_osfhandle
|
||||
#endif
|
||||
#define get_osfhandle(h) rb_w32_get_osfhandle(h)
|
||||
|
||||
#ifdef getcwd
|
||||
#undef getcwd
|
||||
#endif
|
||||
#define getcwd(b, s) rb_w32_getcwd(b, s)
|
||||
|
||||
#ifdef getenv
|
||||
#undef getenv
|
||||
#endif
|
||||
#define getenv(n) rb_w32_getenv(n)
|
||||
|
||||
#ifdef rename
|
||||
#undef rename
|
||||
#endif
|
||||
#define rename(o, n) rb_w32_rename(o, n)
|
||||
|
||||
#undef times
|
||||
#define times(t) rb_w32_times(t)
|
||||
#endif
|
||||
|
||||
struct tms {
|
||||
long tms_utime;
|
||||
long tms_stime;
|
||||
|
@ -505,10 +459,6 @@ struct tms {
|
|||
long tms_cstime;
|
||||
};
|
||||
|
||||
#ifdef times
|
||||
#undef times
|
||||
#endif
|
||||
#define times(t) rb_w32_times(t)
|
||||
int rb_w32_times(struct tms *);
|
||||
|
||||
/* thread stuff */
|
||||
|
@ -522,7 +472,7 @@ int rb_w32_getc(FILE*);
|
|||
int rb_w32_close(int);
|
||||
int rb_w32_fclose(FILE*);
|
||||
int rb_w32_utime(const char *, const struct utimbuf *);
|
||||
#define Sleep(msec) (void)rb_w32_sleep(msec)
|
||||
int WINAPI rb_w32_Sleep(unsigned long msec);
|
||||
|
||||
/*
|
||||
== ***CAUTION***
|
||||
|
|
Loading…
Add table
Reference in a new issue