Wed May 29 18:55:47 2002 KONISHI Hiromasa <H_Konishi@ruby-lang.org>

* function renames my* and win32_* to rb_w32_* in win32/win32.c
	  fixed files win32/win32.c, win32/win32.h, win32/dir.h,
	              hash.c, rubysig.h, signal.c, ext/socket/socket.c


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
H_Konishi 2002-05-29 10:22:19 +00:00
parent 1715197c37
commit d7c1784297
8 changed files with 177 additions and 163 deletions

View File

@ -1,3 +1,9 @@
Wed May 29 18:55:47 2002 KONISHI Hiromasa <H_Konishi@ruby-lang.org>
* function renames my* and win32_* to rb_w32_* in win32/win32.c
fixed files win32/win32.c, win32/win32.h, win32/dir.h,
hash.c, rubysig.h, signal.c, ext/socket/socket.c
Wed May 29 17:32:55 2002 WATANABE Hirofumi <eban@ruby-lang.org> Wed May 29 17:32:55 2002 WATANABE Hirofumi <eban@ruby-lang.org>
* time.c (tmcmp, search_time_t): activate unless HAVE_TIMEGM. * time.c (tmcmp, search_time_t): activate unless HAVE_TIMEGM.

View File

@ -169,8 +169,8 @@ sock_finalize(fptr)
if (!fptr->f) return; if (!fptr->f) return;
s = get_osfhandle(fileno(fptr->f)); s = get_osfhandle(fileno(fptr->f));
myfdclose(fptr->f); rb_w32_fdclose(fptr->f);
if (fptr->f2) myfdclose(fptr->f2); if (fptr->f2) rb_w32_fdclose(fptr->f2);
closesocket(s); closesocket(s);
} }
#endif #endif

4
hash.c
View File

@ -921,8 +921,8 @@ static int path_tainted = -1;
static char **origenviron; static char **origenviron;
#ifdef NT #ifdef NT
#define GET_ENVIRON(e) (e = win32_get_environ()) #define GET_ENVIRON(e) (e = rb_w32_get_environ())
#define FREE_ENVIRON(e) win32_free_environ(e) #define FREE_ENVIRON(e) rb_w32_free_environ(e)
static char **my_environ; static char **my_environ;
#undef environ #undef environ
#define environ my_environ #define environ my_environ

View File

@ -28,9 +28,9 @@ typedef LONG rb_atomic_t;
ATOMIC_SET(rb_trap_immediate, trap_immediate);\ ATOMIC_SET(rb_trap_immediate, trap_immediate);\
} while (0) } while (0)
# define RUBY_CRITICAL(statements) do {\ # define RUBY_CRITICAL(statements) do {\
win32_enter_critical();\ rb_w32_enter_critical();\
statements;\ statements;\
win32_leave_critical();\ rb_w32_leave_critical();\
} while (0) } while (0)
#else #else
typedef int rb_atomic_t; typedef int rb_atomic_t;

View File

@ -368,7 +368,7 @@ sighandler(sig)
int sig; int sig;
{ {
#ifdef NT #ifdef NT
#define IN_MAIN_CONTEXT(f, a) (win32_main_context(a, f) ? (void)0 : f(a)) #define IN_MAIN_CONTEXT(f, a) (rb_w32_main_context(a, f) ? (void)0 : f(a))
#else #else
#define IN_MAIN_CONTEXT(f, a) f(a) #define IN_MAIN_CONTEXT(f, a) f(a)
#endif #endif

View File

@ -12,9 +12,17 @@ typedef struct {
struct direct dirstr; struct direct dirstr;
} DIR; } DIR;
DIR* opendir(const char*);
struct direct* readdir(DIR *); DIR* rb_w32_opendir(const char*);
long telldir(DIR *); struct direct* rb_w32_readdir(DIR *);
void seekdir(DIR *, long); long rb_w32_telldir(DIR *);
void rewinddir(DIR *); void rb_w32_seekdir(DIR *, long);
void closedir(DIR *); void rb_w32_rewinddir(DIR *);
void rb_w32_closedir(DIR *);
#define opendir rb_w32_opendir
#define readdir rb_w32_readdir
#define telldir rb_w32_telldir
#define seekdir rb_w32_seekdir
#define rewinddir rb_w32_rewinddir
#define closedir rb_w32_closedir

View File

@ -237,7 +237,7 @@ flock(int fd, int oper)
const asynchronous_func_t locker = flock_winnt; const asynchronous_func_t locker = flock_winnt;
#endif #endif
return win32_asynchronize(locker, return rb_w32_asynchronize(locker,
(VALUE)_get_osfhandle(fd), oper, NULL, (VALUE)_get_osfhandle(fd), oper, NULL,
(DWORD)-1); (DWORD)-1);
} }
@ -432,7 +432,7 @@ isInternalCmd(char *cmd)
SOCKET SOCKET
myget_osfhandle(int fh) rb_w32_get_osfhandle(int fh)
{ {
return _get_osfhandle(fh); return _get_osfhandle(fh);
@ -440,7 +440,7 @@ myget_osfhandle(int fh)
FILE * FILE *
mypopen (char *cmd, char *mode) rb_w32_popen (char *cmd, char *mode)
{ {
FILE *fp; FILE *fp;
int reading; int reading;
@ -559,7 +559,7 @@ mypopen (char *cmd, char *mode)
extern VALUE rb_last_status; extern VALUE rb_last_status;
int int
mypclose(FILE *fp) rb_w32_pclose(FILE *fp)
{ {
struct ChildRecord *child = FindPipedChildSlot(fp); struct ChildRecord *child = FindPipedChildSlot(fp);
@ -1099,7 +1099,7 @@ NtMakeCmdVector (char *cmdline, char ***vec, int InputCmd)
// //
DIR * DIR *
opendir(const char *filename) rb_w32_opendir(const char *filename)
{ {
DIR *p; DIR *p;
long len; long len;
@ -1114,7 +1114,7 @@ opendir(const char *filename)
// check to see if we've got a directory // check to see if we've got a directory
// //
if ((win32_stat (filename, &sbuf) < 0 || if ((rb_w32_stat (filename, &sbuf) < 0 ||
sbuf.st_mode & _S_IFDIR == 0) && sbuf.st_mode & _S_IFDIR == 0) &&
(!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' || (!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' ||
((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) { ((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) {
@ -1196,7 +1196,7 @@ opendir(const char *filename)
// //
struct direct * struct direct *
readdir(DIR *dirp) rb_w32_readdir(DIR *dirp)
{ {
int len; int len;
static int dummy = 0; static int dummy = 0;
@ -1236,7 +1236,7 @@ readdir(DIR *dirp)
// //
long long
telldir(DIR *dirp) rb_w32_telldir(DIR *dirp)
{ {
return (long) dirp->curr; /* ouch! pointer to long cast */ return (long) dirp->curr; /* ouch! pointer to long cast */
} }
@ -1246,7 +1246,7 @@ telldir(DIR *dirp)
// (Saved by telldir). // (Saved by telldir).
void void
seekdir(DIR *dirp, long loc) rb_w32_seekdir(DIR *dirp, long loc)
{ {
dirp->curr = (char *) loc; /* ouch! long to pointer cast */ dirp->curr = (char *) loc; /* ouch! long to pointer cast */
} }
@ -1256,7 +1256,7 @@ seekdir(DIR *dirp, long loc)
// //
void void
rewinddir(DIR *dirp) rb_w32_rewinddir(DIR *dirp)
{ {
dirp->curr = dirp->start; dirp->curr = dirp->start;
} }
@ -1266,7 +1266,7 @@ rewinddir(DIR *dirp)
// //
void void
closedir(DIR *dirp) rb_w32_closedir(DIR *dirp)
{ {
free(dirp->start); free(dirp->start);
free(dirp); free(dirp);
@ -1358,7 +1358,7 @@ EXTERN_C _CRTIMP ioinfo * __pioinfo[];
#define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = osfh) #define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = osfh)
static int static int
my_open_osfhandle(long osfhandle, int flags) rb_w32_open_osfhandle(long osfhandle, int flags)
{ {
int fh; int fh;
char fileflags; /* _osfile flags */ char fileflags; /* _osfile flags */
@ -1427,19 +1427,19 @@ is_socket(SOCKET fd)
} }
int int
myfddup (int fd) rb_w32_fddup (int fd)
{ {
SOCKET s = TO_SOCKET(fd); SOCKET s = TO_SOCKET(fd);
if (s == -1) if (s == -1)
return -1; return -1;
return my_open_osfhandle(s, O_RDWR|O_BINARY); return rb_w32_open_osfhandle(s, O_RDWR|O_BINARY);
} }
void void
myfdclose(FILE *fp) rb_w32_fdclose(FILE *fp)
{ {
RUBY_CRITICAL({ RUBY_CRITICAL({
STHREAD_ONLY(_free_osfhnd(fileno(fp))); STHREAD_ONLY(_free_osfhnd(fileno(fp)));
@ -1456,7 +1456,7 @@ myfdclose(FILE *fp)
#undef strerror #undef strerror
char * char *
mystrerror(int e) rb_w32_strerror(int e)
{ {
static char buffer[512]; static char buffer[512];
#if !defined __MINGW32__ #if !defined __MINGW32__
@ -1546,7 +1546,7 @@ ioctl(int i, unsigned int u, long data)
#undef FD_SET #undef FD_SET
void void
myfdset(int fd, fd_set *set) rb_w32_fdset(int fd, fd_set *set)
{ {
unsigned int i; unsigned int i;
SOCKET s = TO_SOCKET(fd); SOCKET s = TO_SOCKET(fd);
@ -1567,7 +1567,7 @@ myfdset(int fd, fd_set *set)
#undef FD_CLR #undef FD_CLR
void void
myfdclr(int fd, fd_set *set) rb_w32_fdclr(int fd, fd_set *set)
{ {
unsigned int i; unsigned int i;
SOCKET s = TO_SOCKET(fd); SOCKET s = TO_SOCKET(fd);
@ -1587,7 +1587,7 @@ myfdclr(int fd, fd_set *set)
#undef FD_ISSET #undef FD_ISSET
int int
myfdisset(int fd, fd_set *set) rb_w32_fdisset(int fd, fd_set *set)
{ {
return __WSAFDIsSet(TO_SOCKET(fd), set); return __WSAFDIsSet(TO_SOCKET(fd), set);
} }
@ -1633,7 +1633,7 @@ extract_file_fd(fd_set *set, fd_set *fileset)
} }
long long
myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, rb_w32_select (int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
struct timeval *timeout) struct timeval *timeout)
{ {
long r; long r;
@ -1731,7 +1731,7 @@ StartSockets ()
#undef accept #undef accept
SOCKET SOCKET
myaccept (SOCKET s, struct sockaddr *addr, int *addrlen) rb_w32_accept (SOCKET s, struct sockaddr *addr, int *addrlen)
{ {
SOCKET r; SOCKET r;
@ -1741,13 +1741,13 @@ myaccept (SOCKET s, struct sockaddr *addr, int *addrlen)
RUBY_CRITICAL(r = accept (TO_SOCKET(s), addr, addrlen)); RUBY_CRITICAL(r = accept (TO_SOCKET(s), addr, addrlen));
if (r == INVALID_SOCKET) if (r == INVALID_SOCKET)
errno = WSAGetLastError(); errno = WSAGetLastError();
return my_open_osfhandle(r, O_RDWR|O_BINARY); return rb_w32_open_osfhandle(r, O_RDWR|O_BINARY);
} }
#undef bind #undef bind
int int
mybind (SOCKET s, struct sockaddr *addr, int addrlen) rb_w32_bind (SOCKET s, struct sockaddr *addr, int addrlen)
{ {
int r; int r;
@ -1763,7 +1763,7 @@ mybind (SOCKET s, struct sockaddr *addr, int addrlen)
#undef connect #undef connect
int int
myconnect (SOCKET s, struct sockaddr *addr, int addrlen) rb_w32_connect (SOCKET s, struct sockaddr *addr, int addrlen)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1779,7 +1779,7 @@ myconnect (SOCKET s, struct sockaddr *addr, int addrlen)
#undef getpeername #undef getpeername
int int
mygetpeername (SOCKET s, struct sockaddr *addr, int *addrlen) rb_w32_getpeername (SOCKET s, struct sockaddr *addr, int *addrlen)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1794,7 +1794,7 @@ mygetpeername (SOCKET s, struct sockaddr *addr, int *addrlen)
#undef getsockname #undef getsockname
int int
mygetsockname (SOCKET s, struct sockaddr *addr, int *addrlen) rb_w32_getsockname (SOCKET s, struct sockaddr *addr, int *addrlen)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1807,7 +1807,7 @@ mygetsockname (SOCKET s, struct sockaddr *addr, int *addrlen)
} }
int int
mygetsockopt (SOCKET s, int level, int optname, char *optval, int *optlen) rb_w32_getsockopt (SOCKET s, int level, int optname, char *optval, int *optlen)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1822,7 +1822,7 @@ mygetsockopt (SOCKET s, int level, int optname, char *optval, int *optlen)
#undef ioctlsocket #undef ioctlsocket
int int
myioctlsocket (SOCKET s, long cmd, u_long *argp) rb_w32_ioctlsocket (SOCKET s, long cmd, u_long *argp)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1837,7 +1837,7 @@ myioctlsocket (SOCKET s, long cmd, u_long *argp)
#undef listen #undef listen
int int
mylisten (SOCKET s, int backlog) rb_w32_listen (SOCKET s, int backlog)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1852,7 +1852,7 @@ mylisten (SOCKET s, int backlog)
#undef recv #undef recv
int int
myrecv (SOCKET s, char *buf, int len, int flags) rb_w32_recv (SOCKET s, char *buf, int len, int flags)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1867,7 +1867,7 @@ myrecv (SOCKET s, char *buf, int len, int flags)
#undef recvfrom #undef recvfrom
int int
myrecvfrom (SOCKET s, char *buf, int len, int flags, rb_w32_recvfrom (SOCKET s, char *buf, int len, int flags,
struct sockaddr *from, int *fromlen) struct sockaddr *from, int *fromlen)
{ {
int r; int r;
@ -1883,7 +1883,7 @@ myrecvfrom (SOCKET s, char *buf, int len, int flags,
#undef send #undef send
int int
mysend (SOCKET s, char *buf, int len, int flags) rb_w32_send (SOCKET s, char *buf, int len, int flags)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1898,7 +1898,7 @@ mysend (SOCKET s, char *buf, int len, int flags)
#undef sendto #undef sendto
int int
mysendto (SOCKET s, char *buf, int len, int flags, rb_w32_sendto (SOCKET s, char *buf, int len, int flags,
struct sockaddr *to, int tolen) struct sockaddr *to, int tolen)
{ {
int r; int r;
@ -1914,7 +1914,7 @@ mysendto (SOCKET s, char *buf, int len, int flags,
#undef setsockopt #undef setsockopt
int int
mysetsockopt (SOCKET s, int level, int optname, char *optval, int optlen) rb_w32_setsockopt (SOCKET s, int level, int optname, char *optval, int optlen)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1929,7 +1929,7 @@ mysetsockopt (SOCKET s, int level, int optname, char *optval, int optlen)
#undef shutdown #undef shutdown
int int
myshutdown (SOCKET s, int how) rb_w32_shutdown (SOCKET s, int how)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1944,7 +1944,7 @@ myshutdown (SOCKET s, int how)
#undef socket #undef socket
SOCKET SOCKET
mysocket (int af, int type, int protocol) rb_w32_socket (int af, int type, int protocol)
{ {
SOCKET s; SOCKET s;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1955,13 +1955,13 @@ mysocket (int af, int type, int protocol)
errno = WSAGetLastError(); errno = WSAGetLastError();
//fprintf(stderr, "socket fail (%d)", WSAGetLastError()); //fprintf(stderr, "socket fail (%d)", WSAGetLastError());
} }
return my_open_osfhandle(s, O_RDWR|O_BINARY); return rb_w32_open_osfhandle(s, O_RDWR|O_BINARY);
} }
#undef gethostbyaddr #undef gethostbyaddr
struct hostent * struct hostent *
mygethostbyaddr (char *addr, int len, int type) rb_w32_gethostbyaddr (char *addr, int len, int type)
{ {
struct hostent *r; struct hostent *r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1976,7 +1976,7 @@ mygethostbyaddr (char *addr, int len, int type)
#undef gethostbyname #undef gethostbyname
struct hostent * struct hostent *
mygethostbyname (char *name) rb_w32_gethostbyname (char *name)
{ {
struct hostent *r; struct hostent *r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -1991,7 +1991,7 @@ mygethostbyname (char *name)
#undef gethostname #undef gethostname
int int
mygethostname (char *name, int len) rb_w32_gethostname (char *name, int len)
{ {
int r; int r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -2006,7 +2006,7 @@ mygethostname (char *name, int len)
#undef getprotobyname #undef getprotobyname
struct protoent * struct protoent *
mygetprotobyname (char *name) rb_w32_getprotobyname (char *name)
{ {
struct protoent *r; struct protoent *r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -2021,7 +2021,7 @@ mygetprotobyname (char *name)
#undef getprotobynumber #undef getprotobynumber
struct protoent * struct protoent *
mygetprotobynumber (int num) rb_w32_getprotobynumber (int num)
{ {
struct protoent *r; struct protoent *r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -2036,7 +2036,7 @@ mygetprotobynumber (int num)
#undef getservbyname #undef getservbyname
struct servent * struct servent *
mygetservbyname (char *name, char *proto) rb_w32_getservbyname (char *name, char *proto)
{ {
struct servent *r; struct servent *r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -2051,7 +2051,7 @@ mygetservbyname (char *name, char *proto)
#undef getservbyport #undef getservbyport
struct servent * struct servent *
mygetservbyport (int port, char *proto) rb_w32_getservbyport (int port, char *proto)
{ {
struct servent *r; struct servent *r;
if (!NtSocketsInitialized++) { if (!NtSocketsInitialized++) {
@ -2204,7 +2204,7 @@ gettimeofday(struct timeval *tv, struct timezone *tz)
} }
char * char *
win32_getcwd(buffer, size) rb_w32_getcwd(buffer, size)
char *buffer; char *buffer;
int size; int size;
{ {
@ -2314,7 +2314,7 @@ wait()
} }
char * char *
win32_getenv(const char *name) rb_w32_getenv(const char *name)
{ {
static char *curitem = NULL; static char *curitem = NULL;
static DWORD curlen = 0; static DWORD curlen = 0;
@ -2341,7 +2341,7 @@ win32_getenv(const char *name)
} }
int int
myrename(const char *oldpath, const char *newpath) rb_w32_rename(const char *oldpath, const char *newpath)
{ {
int res = 0; int res = 0;
int oldatts; int oldatts;
@ -2413,7 +2413,7 @@ isUNCRoot(const char *path)
} }
int int
win32_stat(const char *path, struct stat *st) rb_w32_stat(const char *path, struct stat *st)
{ {
const char *p; const char *p;
char *buf1 = ALLOCA_N(char, strlen(path) + 1); char *buf1 = ALLOCA_N(char, strlen(path) + 1);
@ -2452,7 +2452,7 @@ filetime_to_clock(FILETIME *ft)
} }
int int
mytimes(struct tms *tmbuf) rb_w32_times(struct tms *tmbuf)
{ {
FILETIME create, exit, kernel, user; FILETIME create, exit, kernel, user;
@ -2511,7 +2511,7 @@ static CRITICAL_SECTION* system_state(void)
static LONG flag_interrupt = -1; static LONG flag_interrupt = -1;
static volatile DWORD tlsi_interrupt = TLS_OUT_OF_INDEXES; static volatile DWORD tlsi_interrupt = TLS_OUT_OF_INDEXES;
void win32_enter_critical(void) void rb_w32_enter_critical(void)
{ {
if (IsWinNT()) { if (IsWinNT()) {
EnterCriticalSection(system_state()); EnterCriticalSection(system_state());
@ -2532,7 +2532,7 @@ void win32_enter_critical(void)
} }
} }
void win32_leave_critical(void) void rb_w32_leave_critical(void)
{ {
if (IsWinNT()) { if (IsWinNT()) {
LeaveCriticalSection(system_state()); LeaveCriticalSection(system_state());
@ -2551,7 +2551,7 @@ struct handler_arg_t {
HANDLE handshake; HANDLE handshake;
}; };
static void win32_call_handler(struct handler_arg_t* h) static void rb_w32_call_handler(struct handler_arg_t* h)
{ {
int status; int status;
RUBY_CRITICAL(rb_protect((VALUE (*)(VALUE))h->handler, (VALUE)h->arg, &h->status); RUBY_CRITICAL(rb_protect((VALUE (*)(VALUE))h->handler, (VALUE)h->arg, &h->status);
@ -2584,13 +2584,13 @@ static void setup_call(CONTEXT* ctx, struct handler_arg_t *harg)
*--esp = (DWORD)harg; *--esp = (DWORD)harg;
*--esp = ctx->Eip; *--esp = ctx->Eip;
ctx->Esp = (DWORD)esp; ctx->Esp = (DWORD)esp;
ctx->Eip = (DWORD)win32_call_handler; ctx->Eip = (DWORD)rb_w32_call_handler;
#else #else
#error unsupported processor #error unsupported processor
#endif #endif
} }
int win32_main_context(int arg, void (*handler)(int)) int rb_w32_main_context(int arg, void (*handler)(int))
{ {
static HANDLE interrupt_done = NULL; static HANDLE interrupt_done = NULL;
struct handler_arg_t harg; struct handler_arg_t harg;
@ -2651,7 +2651,7 @@ int win32_main_context(int arg, void (*handler)(int))
return TRUE; return TRUE;
} }
int win32_sleep(unsigned long msec) int rb_w32_sleep(unsigned long msec)
{ {
DWORD ret; DWORD ret;
RUBY_CRITICAL(ret = wait_events(NULL, msec)); RUBY_CRITICAL(ret = wait_events(NULL, msec));
@ -2668,7 +2668,7 @@ static void catch_interrupt(void)
} }
#undef fgetc #undef fgetc
int win32_getc(FILE* stream) int rb_w32_getc(FILE* stream)
{ {
int c, trap_immediate = rb_trap_immediate; int c, trap_immediate = rb_trap_immediate;
if (--stream->_cnt >= 0) { if (--stream->_cnt >= 0) {
@ -2684,7 +2684,7 @@ int win32_getc(FILE* stream)
} }
#undef fputc #undef fputc
int win32_putc(int c, FILE* stream) int rb_w32_putc(int c, FILE* stream)
{ {
int trap_immediate = rb_trap_immediate; int trap_immediate = rb_trap_immediate;
if (--stream->_cnt >= 0) { if (--stream->_cnt >= 0) {
@ -2718,7 +2718,7 @@ call_asynchronous(PVOID argp)
return (DWORD)arg->func(arg->self, arg->argc, arg->argv); return (DWORD)arg->func(arg->self, arg->argc, arg->argv);
} }
VALUE win32_asynchronize(asynchronous_func_t func, VALUE rb_w32_asynchronize(asynchronous_func_t func,
VALUE self, int argc, VALUE* argv, VALUE intrval) VALUE self, int argc, VALUE* argv, VALUE intrval)
{ {
DWORD val; DWORD val;
@ -2779,7 +2779,7 @@ VALUE win32_asynchronize(asynchronous_func_t func,
return val; return val;
} }
char **win32_get_environ(void) char **rb_w32_get_environ(void)
{ {
char *envtop, *env; char *envtop, *env;
char **myenvtop, **myenv; char **myenvtop, **myenv;
@ -2788,7 +2788,7 @@ char **win32_get_environ(void)
/* /*
* We avoid values started with `='. If you want to deal those values, * We avoid values started with `='. If you want to deal those values,
* change this function, and some functions in hash.c which recognize * change this function, and some functions in hash.c which recognize
* `=' as delimiter or win32_getenv() and ruby_setenv(). * `=' as delimiter or rb_w32_getenv() and ruby_setenv().
* CygWin deals these values by changing first `=' to '!'. But we don't * CygWin deals these values by changing first `=' to '!'. But we don't
* use such trick and follow cmd.exe's way that just doesn't show these * use such trick and follow cmd.exe's way that just doesn't show these
* values. * values.
@ -2812,7 +2812,7 @@ char **win32_get_environ(void)
return myenvtop; return myenvtop;
} }
void win32_free_environ(char **env) void rb_w32_free_environ(char **env)
{ {
char **t = env; char **t = env;

View File

@ -80,12 +80,12 @@ extern "C++" {
#undef putchar #undef putchar
#undef fgetchar #undef fgetchar
#undef fputchar #undef fputchar
#define getc(_stream) win32_getc(_stream) #define getc(_stream) rb_w32_getc(_stream)
#define putc(_c, _stream) win32_putc(_c, _stream) #define putc(_c, _stream) rb_w32_putc(_c, _stream)
#define fgetc(_stream) getc(_stream) #define fgetc(_stream) getc(_stream)
#define fputc(_c, _stream) putc(_c, _stream) #define fputc(_c, _stream) putc(_c, _stream)
#define getchar() win32_getc(stdin) #define getchar() rb_w32_getc(stdin)
#define putchar(_c) win32_putc(_c, stdout) #define putchar(_c) rb_w32_putc(_c, stdout)
#define fgetchar(_stream) getchar() #define fgetchar(_stream) getchar()
#define fputchar(_c, _stream) putchar(_c) #define fputchar(_c, _stream) putchar(_c)
@ -120,7 +120,7 @@ extern "C++" {
#define execvp _execvp #define execvp _execvp
#define execvpe _execvpe #define execvpe _execvpe
#define getpid _getpid #define getpid _getpid
#define sleep(x) win32_sleep((x)*1000) #define sleep(x) rb_w32_sleep((x)*1000)
#define spawnl _spawnl #define spawnl _spawnl
#define spawnle _spawnle #define spawnle _spawnle
#define spawnlp _spawnlp #define spawnlp _spawnlp
@ -140,7 +140,7 @@ extern "C++" {
#define strcasecmp _stricmp #define strcasecmp _stricmp
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#undef stat #undef stat
#define stat(path,st) win32_stat(path,st) #define stat(path,st) rb_w32_stat(path,st)
/* these are defined in nt.c */ /* these are defined in nt.c */
#ifdef __MINGW32__ #ifdef __MINGW32__
@ -151,44 +151,44 @@ struct timezone {
#endif #endif
extern int NtMakeCmdVector(char *, char ***, int); extern int NtMakeCmdVector(char *, char ***, int);
extern void NtInitialize(int *, char ***); extern void NtInitialize(int *, char ***);
extern char *NtGetLib(void); extern char * NtGetLib(void);
extern char *NtGetBin(void); extern char * NtGetBin(void);
extern FILE *mypopen(char *, char *); extern FILE * rb_w32_popen(char *, char *);
extern int mypclose(FILE *); extern int rb_w32_pclose(FILE *);
extern int flock(int fd, int oper); extern int flock(int fd, int oper);
extern int myfddup(int); extern int rb_w32_fddup(int);
extern void myfdclose(FILE *); extern void rb_w32_fdclose(FILE *);
extern SOCKET myaccept(SOCKET, struct sockaddr *, int *); extern SOCKET rb_w32_accept(SOCKET, struct sockaddr *, int *);
extern int mybind(SOCKET, struct sockaddr *, int); extern int rb_w32_bind(SOCKET, struct sockaddr *, int);
extern int myconnect(SOCKET, struct sockaddr *, int); extern int rb_w32_connect(SOCKET, struct sockaddr *, int);
extern void myfdset(int, fd_set*); extern void rb_w32_fdset(int, fd_set*);
extern void myfdclr(int, fd_set*); extern void rb_w32_fdclr(int, fd_set*);
extern int myfdisset(int, fd_set*); extern int rb_w32_fdisset(int, fd_set*);
extern long myselect(int, fd_set *, fd_set *, fd_set *, struct timeval *); extern long rb_w32_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
extern int mygetpeername(SOCKET, struct sockaddr *, int *); extern int rb_w32_getpeername(SOCKET, struct sockaddr *, int *);
extern int mygetsockname(SOCKET, struct sockaddr *, int *); extern int rb_w32_getsockname(SOCKET, struct sockaddr *, int *);
extern int mygetsockopt(SOCKET, int, int, char *, int *); extern int rb_w32_getsockopt(SOCKET, int, int, char *, int *);
extern int myioctlsocket(SOCKET, long, u_long *); extern int rb_w32_ioctlsocket(SOCKET, long, u_long *);
extern int mylisten(SOCKET, int); extern int rb_w32_listen(SOCKET, int);
extern int myrecv(SOCKET, char *, int, int); extern int rb_w32_recv(SOCKET, char *, int, int);
extern int myrecvfrom(SOCKET, char *, int, int, struct sockaddr *, int *); extern int rb_w32_recvfrom(SOCKET, char *, int, int, struct sockaddr *, int *);
extern int mysend(SOCKET, char *, int, int); extern int rb_w32_send(SOCKET, char *, int, int);
extern int mysendto(SOCKET, char *, int, int, struct sockaddr *, int); extern int rb_w32_sendto(SOCKET, char *, int, int, struct sockaddr *, int);
extern int mysetsockopt(SOCKET, int, int, char *, int); extern int rb_w32_setsockopt(SOCKET, int, int, char *, int);
extern int myshutdown(SOCKET, int); extern int rb_w32_shutdown(SOCKET, int);
extern SOCKET mysocket(int, int, int); extern SOCKET rb_w32_socket(int, int, int);
extern SOCKET myget_osfhandle(int); extern SOCKET rb_w32_get_osfhandle(int);
extern struct hostent * mygethostbyaddr(char *, int, int); extern struct hostent * rb_w32_gethostbyaddr(char *, int, int);
extern struct hostent * mygethostbyname(char *); extern struct hostent * rb_w32_gethostbyname(char *);
extern int mygethostname(char *, int); extern int rb_w32_gethostname(char *, int);
extern struct protoent * mygetprotobyname(char *); extern struct protoent * rb_w32_getprotobyname(char *);
extern struct protoent * mygetprotobynumber(int); extern struct protoent * rb_w32_getprotobynumber(int);
extern struct servent * mygetservbyname(char *, char *); extern struct servent * rb_w32_getservbyname(char *, char *);
extern struct servent * mygetservbyport(int, char *); extern struct servent * rb_w32_getservbyport(int, char *);
extern char *win32_getenv(const char *); extern char * rb_w32_getenv(const char *);
extern int myrename(const char *, const char *); extern int rb_w32_rename(const char *, const char *);
extern char **win32_get_environ(void); extern char **rb_w32_get_environ(void);
extern void win32_free_environ(char **); extern void rb_w32_free_environ(char **);
extern int chown(const char *, int, int); extern int chown(const char *, int, int);
extern int link(char *, char *); extern int link(char *, char *);
@ -219,9 +219,9 @@ extern GIDTYPE getegid (void);
extern int setuid (int); extern int setuid (int);
extern int setgid (int); extern int setgid (int);
extern char *mystrerror(int); extern char *rb_w32_strerror(int);
#define strerror(e) mystrerror(e) #define strerror(e) rb_w32_strerror(e)
#define PIPE_BUF 1024 #define PIPE_BUF 1024
@ -235,11 +235,11 @@ extern char *mystrerror(int);
#ifdef popen #ifdef popen
#undef popen #undef popen
#define popen mypopen #define popen rb_w32_popen
#endif #endif
#ifdef pclose #ifdef pclose
#undef pclose #undef pclose
#define pclose mypclose #define pclose rb_w32_pclose
#endif #endif
/* #undef va_start */ /* #undef va_start */
@ -248,144 +248,144 @@ extern char *mystrerror(int);
#ifdef accept #ifdef accept
#undef accept #undef accept
#endif #endif
#define accept myaccept #define accept rb_w32_accept
#ifdef bind #ifdef bind
#undef bind #undef bind
#endif #endif
#define bind mybind #define bind rb_w32_bind
#ifdef connect #ifdef connect
#undef connect #undef connect
#endif #endif
#define connect myconnect #define connect rb_w32_connect
#undef FD_SET #undef FD_SET
#define FD_SET myfdset #define FD_SET rb_w32_fdset
#undef FD_CLR #undef FD_CLR
#define FD_CLR myfdclr #define FD_CLR rb_w32_fdclr
#undef FD_ISSET #undef FD_ISSET
#define FD_ISSET myfdisset #define FD_ISSET rb_w32_fdisset
#undef select #undef select
#define select myselect #define select rb_w32_select
#ifdef getpeername #ifdef getpeername
#undef getpeername #undef getpeername
#endif #endif
#define getpeername mygetpeername #define getpeername rb_w32_getpeername
#ifdef getsockname #ifdef getsockname
#undef getsockname #undef getsockname
#endif #endif
#define getsockname mygetsockname #define getsockname rb_w32_getsockname
#ifdef getsockopt #ifdef getsockopt
#undef getsockopt #undef getsockopt
#endif #endif
#define getsockopt mygetsockopt #define getsockopt rb_w32_getsockopt
#ifdef ioctlsocket #ifdef ioctlsocket
#undef ioctlsocket #undef ioctlsocket
#endif #endif
#define ioctlsocket myioctlsocket #define ioctlsocket rb_w32_ioctlsocket
#ifdef listen #ifdef listen
#undef listen #undef listen
#endif #endif
#define listen mylisten #define listen rb_w32_listen
#ifdef recv #ifdef recv
#undef recv #undef recv
#endif #endif
#define recv myrecv #define recv rb_w32_recv
#ifdef recvfrom #ifdef recvfrom
#undef recvfrom #undef recvfrom
#endif #endif
#define recvfrom myrecvfrom #define recvfrom rb_w32_recvfrom
#ifdef send #ifdef send
#undef send #undef send
#endif #endif
#define send mysend #define send rb_w32_send
#ifdef sendto #ifdef sendto
#undef sendto #undef sendto
#endif #endif
#define sendto mysendto #define sendto rb_w32_sendto
#ifdef setsockopt #ifdef setsockopt
#undef setsockopt #undef setsockopt
#endif #endif
#define setsockopt mysetsockopt #define setsockopt rb_w32_setsockopt
#ifdef shutdown #ifdef shutdown
#undef shutdown #undef shutdown
#endif #endif
#define shutdown myshutdown #define shutdown rb_w32_shutdown
#ifdef socket #ifdef socket
#undef socket #undef socket
#endif #endif
#define socket mysocket #define socket rb_w32_socket
#ifdef gethostbyaddr #ifdef gethostbyaddr
#undef gethostbyaddr #undef gethostbyaddr
#endif #endif
#define gethostbyaddr mygethostbyaddr #define gethostbyaddr rb_w32_gethostbyaddr
#ifdef gethostbyname #ifdef gethostbyname
#undef gethostbyname #undef gethostbyname
#endif #endif
#define gethostbyname mygethostbyname #define gethostbyname rb_w32_gethostbyname
#ifdef gethostname #ifdef gethostname
#undef gethostname #undef gethostname
#endif #endif
#define gethostname mygethostname #define gethostname rb_w32_gethostname
#ifdef getprotobyname #ifdef getprotobyname
#undef getprotobyname #undef getprotobyname
#endif #endif
#define getprotobyname mygetprotobyname #define getprotobyname rb_w32_getprotobyname
#ifdef getprotobynumber #ifdef getprotobynumber
#undef getprotobynumber #undef getprotobynumber
#endif #endif
#define getprotobynumber mygetprotobynumber #define getprotobynumber rb_w32_getprotobynumber
#ifdef getservbyname #ifdef getservbyname
#undef getservbyname #undef getservbyname
#endif #endif
#define getservbyname mygetservbyname #define getservbyname rb_w32_getservbyname
#ifdef getservbyport #ifdef getservbyport
#undef getservbyport #undef getservbyport
#endif #endif
#define getservbyport mygetservbyport #define getservbyport rb_w32_getservbyport
#ifdef get_osfhandle #ifdef get_osfhandle
#undef get_osfhandle #undef get_osfhandle
#endif #endif
#define get_osfhandle myget_osfhandle #define get_osfhandle rb_w32_get_osfhandle
#ifdef getcwd #ifdef getcwd
#undef getcwd #undef getcwd
#endif #endif
#define getcwd win32_getcwd #define getcwd rb_w32_getcwd
#ifdef getenv #ifdef getenv
#undef getenv #undef getenv
#endif #endif
#define getenv win32_getenv #define getenv rb_w32_getenv
#ifdef rename #ifdef rename
#undef rename #undef rename
#endif #endif
#define rename myrename #define rename rb_w32_rename
struct tms { struct tms {
long tms_utime; long tms_utime;
@ -397,17 +397,17 @@ struct tms {
#ifdef times #ifdef times
#undef times #undef times
#endif #endif
#define times mytimes #define times rb_w32_times
/* thread stuff */ /* thread stuff */
HANDLE GetCurrentThreadHandle(void); HANDLE GetCurrentThreadHandle(void);
int win32_main_context(int arg, void (*handler)(int)); int rb_w32_main_context(int arg, void (*handler)(int));
int win32_sleep(unsigned long msec); int rb_w32_sleep(unsigned long msec);
void win32_enter_critical(void); void rb_w32_enter_critical(void);
void win32_leave_critical(void); void rb_w32_leave_critical(void);
int win32_putc(int, FILE*); int rb_w32_putc(int, FILE*);
int win32_getc(FILE*); int rb_w32_getc(FILE*);
#define Sleep(msec) (void)win32_sleep(msec) #define Sleep(msec) (void)rb_w32_sleep(msec)
/* /*
== ***CAUTION*** == ***CAUTION***
@ -417,6 +417,6 @@ Since this function is very dangerous, ((*NEVER*))
in asynchronous_func_t. in asynchronous_func_t.
*/ */
typedef DWORD (*asynchronous_func_t)(DWORD self, int argc, DWORD* argv); typedef DWORD (*asynchronous_func_t)(DWORD self, int argc, DWORD* argv);
DWORD win32_asynchronize(asynchronous_func_t func, DWORD self, int argc, DWORD* argv, DWORD intrval); DWORD rb_w32_asynchronize(asynchronous_func_t func, DWORD self, int argc, DWORD* argv, DWORD intrval);
#endif #endif