• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

include/ruby/win32.h

Go to the documentation of this file.
00001 #ifndef RUBY_WIN32_H
00002 #define RUBY_WIN32_H 1
00003 
00004 #if defined(__cplusplus)
00005 extern "C" {
00006 #if 0
00007 } /* satisfy cc-mode */
00008 #endif
00009 #endif
00010 
00011 /*
00012  *  Copyright (c) 1993, Intergraph Corporation
00013  *
00014  *  You may distribute under the terms of either the GNU General Public
00015  *  License or the Artistic License, as specified in the perl README file.
00016  *
00017  */
00018 
00019 //
00020 // Definitions for NT port of Perl
00021 //
00022 
00023 
00024 //
00025 // Ok now we can include the normal include files.
00026 //
00027 
00028 // #include <stdarg.h> conflict with varargs.h?
00029 #if !defined(WSAAPI)
00030 #if defined(__cplusplus) && defined(_MSC_VER)
00031 extern "C++" {                  /* template without extern "C++" */
00032 #endif
00033 #include <winsock2.h>
00034 #include <ws2tcpip.h>
00035 #if defined(__cplusplus) && defined(_MSC_VER)
00036 }
00037 #endif
00038 #endif
00039 
00040 #define NT 1                    /* deprecated */
00041 
00042 //
00043 // We're not using Microsoft's "extensions" to C for
00044 // Structured Exception Handling (SEH) so we can nuke these
00045 //
00046 #undef try
00047 #undef except
00048 #undef finally
00049 #undef leave
00050 
00051 #include <stdio.h>
00052 #include <stdlib.h>
00053 #include <string.h>
00054 #include <direct.h>
00055 #include <process.h>
00056 #include <time.h>
00057 #if defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER == 1200
00058 extern "C++" {                  /* template without extern "C++" */
00059 #endif
00060 #include <math.h>
00061 #if defined(__cplusplus) && defined(_MSC_VER) && _MSC_VER == 1200
00062 }
00063 #endif
00064 #include <signal.h>
00065 #include <sys/stat.h>
00066 #include <sys/types.h>
00067 #ifdef HAVE_SYS_UTIME_H
00068 # include <sys/utime.h>
00069 #else
00070 # include <utime.h>
00071 #endif
00072 #include <io.h>
00073 #include <malloc.h>
00074 #if defined __MINGW32__ || __BORLANDC__ >= 0x0580
00075 # include <stdint.h>
00076 #else
00077 # if !defined(_INTPTR_T_DEFINED)
00078 #  ifdef _WIN64
00079 typedef __int64 intptr_t;
00080 #  else
00081 typedef int intptr_t;
00082 #  endif
00083 #  define _INTPTR_T_DEFINED
00084 # endif
00085 # if !defined(_UINTPTR_T_DEFINED)
00086 #  ifdef _WIN64
00087 typedef unsigned __int64 uintptr_t;
00088 #  else
00089 typedef unsigned int uintptr_t;
00090 #  endif
00091 #  define _UINTPTR_T_DEFINED
00092 # endif
00093 #endif
00094 #ifndef __MINGW32__
00095 # define mode_t int
00096 #endif
00097 #ifdef HAVE_UNISTD_H
00098 # include <unistd.h>
00099 #endif
00100 
00101 #ifdef WIN95
00102 extern DWORD rb_w32_osid(void);
00103 #define rb_w32_iswinnt()  (rb_w32_osid() == VER_PLATFORM_WIN32_NT)
00104 #define rb_w32_iswin95()  (rb_w32_osid() == VER_PLATFORM_WIN32_WINDOWS)
00105 #else
00106 #define rb_w32_iswinnt()  TRUE
00107 #define rb_w32_iswin95()  FALSE
00108 #endif
00109 
00110 #define WNOHANG -1
00111 
00112 #undef getc
00113 #undef putc
00114 #undef fgetc
00115 #undef fputc
00116 #undef getchar
00117 #undef putchar
00118 #undef fgetchar
00119 #undef fputchar
00120 #undef utime
00121 #undef lseek
00122 #undef fstat
00123 #define getc(_stream)           rb_w32_getc(_stream)
00124 #define getchar()               rb_w32_getc(stdin)
00125 #define putc(_c, _stream)       rb_w32_putc(_c, _stream)
00126 #define putchar(_c)             rb_w32_putc(_c, stdout)
00127 #ifdef RUBY_EXPORT
00128 #define fgetc(_stream)          getc(_stream)
00129 #define fputc(_c, _stream)      putc(_c, _stream)
00130 #define fgetchar()              getchar()
00131 #define fputchar(_c)            putchar(_c)
00132 #define utime(_p, _t)           rb_w32_utime(_p, _t)
00133 #define lseek(_f, _o, _w)       _lseeki64(_f, _o, _w)
00134 
00135 #define pipe(p)                 rb_w32_pipe(p)
00136 #define open                    rb_w32_open
00137 #define close(h)                rb_w32_close(h)
00138 #define fclose(f)               rb_w32_fclose(f)
00139 #define read(f, b, s)           rb_w32_read(f, b, s)
00140 #define write(f, b, s)          rb_w32_write(f, b, s)
00141 #define getpid()                rb_w32_getpid()
00142 #define getppid()               rb_w32_getppid()
00143 #define sleep(x)                rb_w32_Sleep((x)*1000)
00144 #define Sleep(msec)             (void)rb_w32_Sleep(msec)
00145 #ifdef __BORLANDC__
00146 #define creat(p, m)             _creat(p, m)
00147 #define eof()                   _eof()
00148 #define filelength(h)           _filelength(h)
00149 #define mktemp(t)               _mktemp(t)
00150 #define tell(h)                 _tell(h)
00151 #define _open                   _sopen
00152 #define sopen                   _sopen
00153 #define _fstati64(fd,st)        rb_w32_fstati64(fd,st)
00154 #undef fopen
00155 #define fopen(p, m)             rb_w32_fopen(p, m)
00156 #undef fdopen
00157 #define fdopen(h, m)            rb_w32_fdopen(h, m)
00158 #undef fsopen
00159 #define fsopen(p, m, sh)        rb_w32_fsopen(p, m, sh)
00160 #endif /* __BORLANDC__ */
00161 
00162 #undef execv
00163 #define execv(path,argv)        rb_w32_aspawn(P_OVERLAY,path,argv)
00164 #if !defined(__BORLANDC__)
00165 #undef isatty
00166 #define isatty(h)               rb_w32_isatty(h)
00167 #endif /* __BORLANDC__ */
00168 
00169 #undef mkdir
00170 #define mkdir(p, m)             rb_w32_mkdir(p, m)
00171 #undef rmdir
00172 #define rmdir(p)                rb_w32_rmdir(p)
00173 #undef unlink
00174 #define unlink(p)               rb_w32_unlink(p)
00175 #endif /* RUBY_EXPORT */
00176 
00177 #if SIZEOF_OFF_T == 8
00178 #define off_t __int64
00179 #define stat stati64
00180 #define fstat(fd,st)            _fstati64(fd,st)
00181 #if defined(__BORLANDC__)
00182 #define stati64(path, st) rb_w32_stati64(path, st)
00183 #elif !defined(_MSC_VER) || RT_VER < 80
00184 #define stati64 _stati64
00185 #define _stati64(path, st) rb_w32_stati64(path, st)
00186 #else
00187 #define stati64 _stat64
00188 #define _stat64(path, st) rb_w32_stati64(path, st)
00189 #define _fstati64 _fstat64
00190 #endif
00191 #else
00192 #define stat(path,st)           rb_w32_stat(path,st)
00193 #define fstat(fd,st)            rb_w32_fstat(fd,st)
00194 extern int rb_w32_stat(const char *, struct stat *);
00195 extern int rb_w32_fstat(int, struct stat *);
00196 #endif
00197 #define access(path,mode)       rb_w32_access(path,mode)
00198 
00199 #define strcasecmp              _stricmp
00200 #define strncasecmp             _strnicmp
00201 #define fsync                   _commit
00202 
00203 struct timezone;
00204 
00205 #ifdef __MINGW32__
00206 #undef isascii
00207 #define isascii __isascii
00208 #endif
00209 
00210 struct iovec {
00211     void *iov_base;
00212     size_t iov_len;
00213 };
00214 struct msghdr {
00215     void *msg_name;
00216     int msg_namelen;
00217     struct iovec *msg_iov;
00218     int msg_iovlen;
00219     void *msg_control;
00220     int msg_controllen;
00221     int msg_flags;
00222 };
00223 
00224 #define NtInitialize ruby_sysinit
00225 extern int    rb_w32_cmdvector(const char *, char ***);
00226 extern rb_pid_t  rb_w32_pipe_exec(const char *, const char *, int, int *, int *);
00227 extern int    flock(int fd, int oper);
00228 extern int    rb_w32_has_cancel_io(void);
00229 extern int    rb_w32_is_socket(int);
00230 extern int    WSAAPI rb_w32_accept(int, struct sockaddr *, int *);
00231 extern int    WSAAPI rb_w32_bind(int, const struct sockaddr *, int);
00232 extern int    WSAAPI rb_w32_connect(int, const struct sockaddr *, int);
00233 extern void   rb_w32_fdset(int, fd_set*);
00234 extern void   rb_w32_fdclr(int, fd_set*);
00235 extern int    rb_w32_fdisset(int, fd_set*);
00236 extern int    WSAAPI rb_w32_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
00237 extern int    WSAAPI rb_w32_getpeername(int, struct sockaddr *, int *);
00238 extern int    WSAAPI rb_w32_getsockname(int, struct sockaddr *, int *);
00239 extern int    WSAAPI rb_w32_getsockopt(int, int, int, char *, int *);
00240 extern int    WSAAPI rb_w32_ioctlsocket(int, long, u_long *);
00241 extern int    WSAAPI rb_w32_listen(int, int);
00242 extern int    WSAAPI rb_w32_recv(int, char *, int, int);
00243 extern int    WSAAPI rb_w32_recvfrom(int, char *, int, int, struct sockaddr *, int *);
00244 extern int    WSAAPI rb_w32_send(int, const char *, int, int);
00245 extern int    WSAAPI rb_w32_sendto(int, const char *, int, int, const struct sockaddr *, int);
00246 extern int    recvmsg(int, struct msghdr *, int);
00247 extern int    sendmsg(int, const struct msghdr *, int);
00248 extern int    WSAAPI rb_w32_setsockopt(int, int, int, const char *, int);
00249 extern int    WSAAPI rb_w32_shutdown(int, int);
00250 extern int    WSAAPI rb_w32_socket(int, int, int);
00251 extern SOCKET rb_w32_get_osfhandle(int);
00252 extern struct hostent *WSAAPI rb_w32_gethostbyaddr(const char *, int, int);
00253 extern struct hostent *WSAAPI rb_w32_gethostbyname(const char *);
00254 extern int    WSAAPI rb_w32_gethostname(char *, int);
00255 extern struct protoent *WSAAPI rb_w32_getprotobyname(const char *);
00256 extern struct protoent *WSAAPI rb_w32_getprotobynumber(int);
00257 extern struct servent  *WSAAPI rb_w32_getservbyname(const char *, const char *);
00258 extern struct servent  *WSAAPI rb_w32_getservbyport(int, const char *);
00259 extern int    rb_w32_socketpair(int, int, int, int *);
00260 extern char * rb_w32_getcwd(char *, int);
00261 extern char * rb_w32_getenv(const char *);
00262 extern int    rb_w32_rename(const char *, const char *);
00263 extern int    rb_w32_urename(const char *, const char *);
00264 extern char **rb_w32_get_environ(void);
00265 extern void   rb_w32_free_environ(char **);
00266 extern int    rb_w32_map_errno(DWORD);
00267 
00268 extern int chown(const char *, int, int);
00269 extern int rb_w32_uchown(const char *, int, int);
00270 extern int link(const char *, const char *);
00271 extern int rb_w32_ulink(const char *, const char *);
00272 extern int gettimeofday(struct timeval *, struct timezone *);
00273 extern rb_pid_t waitpid (rb_pid_t, int *, int);
00274 extern rb_pid_t rb_w32_spawn(int, const char *, const char*);
00275 extern rb_pid_t rb_w32_aspawn(int, const char *, char *const *);
00276 extern int kill(int, int);
00277 extern int fcntl(int, int, ...);
00278 extern rb_pid_t rb_w32_getpid(void);
00279 extern rb_pid_t rb_w32_getppid(void);
00280 #if !defined(__BORLANDC__)
00281 extern int rb_w32_isatty(int);
00282 #endif
00283 extern int rb_w32_uchdir(const char *);
00284 extern int rb_w32_mkdir(const char *, int);
00285 extern int rb_w32_umkdir(const char *, int);
00286 extern int rb_w32_rmdir(const char *);
00287 extern int rb_w32_urmdir(const char *);
00288 extern int rb_w32_unlink(const char *);
00289 extern int rb_w32_uunlink(const char *);
00290 extern int rb_w32_uchmod(const char *, int);
00291 extern int rb_w32_stati64(const char *, struct stati64 *);
00292 extern int rb_w32_ustati64(const char *, struct stati64 *);
00293 extern int rb_w32_access(const char *, int);
00294 extern int rb_w32_uaccess(const char *, int);
00295 
00296 #ifdef __BORLANDC__
00297 extern int rb_w32_fstati64(int, struct stati64 *);
00298 extern off_t _lseeki64(int, off_t, int);
00299 extern FILE *rb_w32_fopen(const char *, const char *);
00300 extern FILE *rb_w32_fdopen(int, const char *);
00301 extern FILE *rb_w32_fsopen(const char *, const char *, int);
00302 #endif
00303 
00304 #include <float.h>
00305 #if !defined __MINGW32__ || defined __NO_ISOCEXT
00306 #ifndef isnan
00307 #define isnan(x) _isnan(x)
00308 #endif
00309 static inline int
00310 finite(double x)
00311 {
00312     return _finite(x);
00313 }
00314 #ifndef copysign
00315 #define copysign(a, b) _copysign(a, b)
00316 #endif
00317 static inline double
00318 scalb(double a, long b)
00319 {
00320     return _scalb(a, b);
00321 }
00322 #endif
00323 
00324 #if !defined S_IFIFO && defined _S_IFIFO
00325 #define S_IFIFO _S_IFIFO
00326 #endif
00327 
00328 #if 0 && defined __BORLANDC__
00329 #undef S_ISDIR
00330 #undef S_ISFIFO
00331 #undef S_ISBLK
00332 #undef S_ISCHR
00333 #undef S_ISREG
00334 #define S_ISDIR(m)  (((unsigned short)(m) & S_IFMT) == S_IFDIR)
00335 #define S_ISFIFO(m) (((unsigned short)(m) & S_IFMT) == S_IFIFO)
00336 #define S_ISBLK(m)  (((unsigned short)(m) & S_IFMT) == S_IFBLK)
00337 #define S_ISCHR(m)  (((unsigned short)(m) & S_IFMT) == S_IFCHR)
00338 #define S_ISREG(m)  (((unsigned short)(m) & S_IFMT) == S_IFREG)
00339 #endif
00340 
00341 #if !defined S_IRUSR && !defined __MINGW32__
00342 #define S_IRUSR 0400
00343 #endif
00344 #ifndef S_IRGRP
00345 #define S_IRGRP 0040
00346 #endif
00347 #ifndef S_IROTH
00348 #define S_IROTH 0004
00349 #endif
00350 
00351 #if !defined S_IWUSR && !defined __MINGW32__
00352 #define S_IWUSR 0200
00353 #endif
00354 #ifndef S_IWGRP
00355 #define S_IWGRP 0020
00356 #endif
00357 #ifndef S_IWOTH
00358 #define S_IWOTH 0002
00359 #endif
00360 
00361 #if !defined S_IXUSR && !defined __MINGW32__
00362 #define S_IXUSR 0100
00363 #endif
00364 #ifndef S_IXGRP
00365 #define S_IXGRP 0010
00366 #endif
00367 #ifndef S_IXOTH
00368 #define S_IXOTH 0001
00369 #endif
00370 
00371 //
00372 // define this so we can do inplace editing
00373 //
00374 
00375 #define SUFFIX
00376 
00377 extern int       rb_w32_ftruncate(int fd, off_t length);
00378 extern int       rb_w32_truncate(const char *path, off_t length);
00379 extern off_t     rb_w32_ftello(FILE *stream);
00380 extern int       rb_w32_fseeko(FILE *stream, off_t offset, int whence);
00381 
00382 #undef HAVE_FTRUNCATE
00383 #define HAVE_FTRUNCATE 1
00384 #if defined HAVE_FTRUNCATE64
00385 #define ftruncate ftruncate64
00386 #else
00387 #define ftruncate rb_w32_ftruncate
00388 #endif
00389 
00390 #undef HAVE_TRUNCATE
00391 #define HAVE_TRUNCATE 1
00392 #if defined HAVE_TRUNCATE64
00393 #define truncate truncate64
00394 #else
00395 #define truncate rb_w32_truncate
00396 #endif
00397 
00398 #undef HAVE_FSEEKO
00399 #define HAVE_FSEEKO 1
00400 #if defined HAVE_FSEEKO64
00401 #define fseeko fseeko64
00402 #else
00403 #define fseeko rb_w32_fseeko
00404 #endif
00405 
00406 #undef HAVE_FTELLO
00407 #define HAVE_FTELLO 1
00408 #if defined HAVE_FTELLO64
00409 #define ftello ftello64
00410 #else
00411 #define ftello rb_w32_ftello
00412 #endif
00413 
00414 //
00415 // stubs
00416 //
00417 extern int       ioctl (int, int, ...);
00418 extern rb_uid_t  getuid (void);
00419 extern rb_uid_t  geteuid (void);
00420 extern rb_gid_t  getgid (void);
00421 extern rb_gid_t  getegid (void);
00422 extern int       setuid (rb_uid_t);
00423 extern int       setgid (rb_gid_t);
00424 
00425 extern char *rb_w32_strerror(int);
00426 
00427 #ifdef RUBY_EXPORT
00428 #define strerror(e) rb_w32_strerror(e)
00429 #endif
00430 
00431 #define PIPE_BUF 1024
00432 
00433 #define LOCK_SH 1
00434 #define LOCK_EX 2
00435 #define LOCK_NB 4
00436 #define LOCK_UN 8
00437 
00438 
00439 #ifndef SIGINT
00440 #define SIGINT 2
00441 #endif
00442 #ifndef SIGKILL
00443 #define SIGKILL 9
00444 #endif
00445 
00446 
00447 /* #undef va_start */
00448 /* #undef va_end */
00449 
00450 /* winsock error map */
00451 #include <errno.h>
00452 
00453 #ifndef EWOULDBLOCK
00454 # define EWOULDBLOCK            WSAEWOULDBLOCK
00455 #endif
00456 #ifndef EINPROGRESS
00457 # define EINPROGRESS            WSAEINPROGRESS
00458 #endif
00459 #ifndef EALREADY
00460 # define EALREADY               WSAEALREADY
00461 #endif
00462 #ifndef ENOTSOCK
00463 # define ENOTSOCK               WSAENOTSOCK
00464 #endif
00465 #ifndef EDESTADDRREQ
00466 # define EDESTADDRREQ           WSAEDESTADDRREQ
00467 #endif
00468 #ifndef EMSGSIZE
00469 # define EMSGSIZE               WSAEMSGSIZE
00470 #endif
00471 #ifndef EPROTOTYPE
00472 # define EPROTOTYPE             WSAEPROTOTYPE
00473 #endif
00474 #ifndef ENOPROTOOPT
00475 # define ENOPROTOOPT            WSAENOPROTOOPT
00476 #endif
00477 #ifndef EPROTONOSUPPORT
00478 # define EPROTONOSUPPORT        WSAEPROTONOSUPPORT
00479 #endif
00480 #ifndef ESOCKTNOSUPPORT
00481 # define ESOCKTNOSUPPORT        WSAESOCKTNOSUPPORT
00482 #endif
00483 #ifndef EOPNOTSUPP
00484 # define EOPNOTSUPP             WSAEOPNOTSUPP
00485 #endif
00486 #ifndef EPFNOSUPPORT
00487 # define EPFNOSUPPORT           WSAEPFNOSUPPORT
00488 #endif
00489 #ifndef EAFNOSUPPORT
00490 # define EAFNOSUPPORT           WSAEAFNOSUPPORT
00491 #endif
00492 #ifndef EADDRINUSE
00493 # define EADDRINUSE             WSAEADDRINUSE
00494 #endif
00495 #ifndef EADDRNOTAVAIL
00496 # define EADDRNOTAVAIL          WSAEADDRNOTAVAIL
00497 #endif
00498 #ifndef ENETDOWN
00499 # define ENETDOWN               WSAENETDOWN
00500 #endif
00501 #ifndef ENETUNREACH
00502 # define ENETUNREACH            WSAENETUNREACH
00503 #endif
00504 #ifndef ENETRESET
00505 # define ENETRESET              WSAENETRESET
00506 #endif
00507 #ifndef ECONNABORTED
00508 # define ECONNABORTED           WSAECONNABORTED
00509 #endif
00510 #ifndef ECONNRESET
00511 # define ECONNRESET             WSAECONNRESET
00512 #endif
00513 #ifndef ENOBUFS
00514 # define ENOBUFS                WSAENOBUFS
00515 #endif
00516 #ifndef EISCONN
00517 # define EISCONN                WSAEISCONN
00518 #endif
00519 #ifndef ENOTCONN
00520 # define ENOTCONN               WSAENOTCONN
00521 #endif
00522 #ifndef ESHUTDOWN
00523 # define ESHUTDOWN              WSAESHUTDOWN
00524 #endif
00525 #ifndef ETOOMANYREFS
00526 # define ETOOMANYREFS           WSAETOOMANYREFS
00527 #endif
00528 #ifndef ETIMEDOUT
00529 # define ETIMEDOUT              WSAETIMEDOUT
00530 #endif
00531 #ifndef ECONNREFUSED
00532 # define ECONNREFUSED           WSAECONNREFUSED
00533 #endif
00534 #ifndef ELOOP
00535 # define ELOOP                  WSAELOOP
00536 #endif
00537 /*#define ENAMETOOLONG  WSAENAMETOOLONG*/
00538 #ifndef EHOSTDOWN
00539 # define EHOSTDOWN              WSAEHOSTDOWN
00540 #endif
00541 #ifndef EHOSTUNREACH
00542 # define EHOSTUNREACH           WSAEHOSTUNREACH
00543 #endif
00544 /*#define ENOTEMPTY     WSAENOTEMPTY*/
00545 #ifndef EPROCLIM
00546 # define EPROCLIM               WSAEPROCLIM
00547 #endif
00548 #ifndef EUSERS
00549 # define EUSERS                 WSAEUSERS
00550 #endif
00551 #ifndef EDQUOT
00552 # define EDQUOT                 WSAEDQUOT
00553 #endif
00554 #ifndef ESTALE
00555 # define ESTALE                 WSAESTALE
00556 #endif
00557 #ifndef EREMOTE
00558 # define EREMOTE                WSAEREMOTE
00559 #endif
00560 
00561 #define F_SETFL 1
00562 #define O_NONBLOCK 1
00563 
00564 #undef FD_SET
00565 #define FD_SET(f, s)            rb_w32_fdset(f, s)
00566 
00567 #undef FD_CLR
00568 #define FD_CLR(f, s)            rb_w32_fdclr(f, s)
00569 
00570 #undef FD_ISSET
00571 #define FD_ISSET(f, s)          rb_w32_fdisset(f, s)
00572 
00573 #ifdef RUBY_EXPORT
00574 #undef accept
00575 #define accept(s, a, l)         rb_w32_accept(s, a, l)
00576 
00577 #undef bind
00578 #define bind(s, a, l)           rb_w32_bind(s, a, l)
00579 
00580 #undef connect
00581 #define connect(s, a, l)        rb_w32_connect(s, a, l)
00582 
00583 #undef select
00584 #define select(n, r, w, e, t)   rb_w32_select(n, r, w, e, t)
00585 
00586 #undef getpeername
00587 #define getpeername(s, a, l)    rb_w32_getpeername(s, a, l)
00588 
00589 #undef getsockname
00590 #define getsockname(s, a, l)    rb_w32_getsockname(s, a, l)
00591 
00592 #undef getsockopt
00593 #define getsockopt(s, v, n, o, l) rb_w32_getsockopt(s, v, n, o, l)
00594 
00595 #undef ioctlsocket
00596 #define ioctlsocket(s, c, a)    rb_w32_ioctlsocket(s, c, a)
00597 
00598 #undef listen
00599 #define listen(s, b)            rb_w32_listen(s, b)
00600 
00601 #undef recv
00602 #define recv(s, b, l, f)        rb_w32_recv(s, b, l, f)
00603 
00604 #undef recvfrom
00605 #define recvfrom(s, b, l, f, fr, frl) rb_w32_recvfrom(s, b, l, f, fr, frl)
00606 
00607 #undef send
00608 #define send(s, b, l, f)        rb_w32_send(s, b, l, f)
00609 
00610 #undef sendto
00611 #define sendto(s, b, l, f, t, tl) rb_w32_sendto(s, b, l, f, t, tl)
00612 
00613 #undef setsockopt
00614 #define setsockopt(s, v, n, o, l) rb_w32_setsockopt(s, v, n, o, l)
00615 
00616 #undef shutdown
00617 #define shutdown(s, h)          rb_w32_shutdown(s, h)
00618 
00619 #undef socket
00620 #define socket(s, t, p)         rb_w32_socket(s, t, p)
00621 
00622 #undef gethostbyaddr
00623 #define gethostbyaddr(a, l, t)  rb_w32_gethostbyaddr(a, l, t)
00624 
00625 #undef gethostbyname
00626 #define gethostbyname(n)        rb_w32_gethostbyname(n)
00627 
00628 #undef gethostname
00629 #define gethostname(n, l)       rb_w32_gethostname(n, l)
00630 
00631 #undef getprotobyname
00632 #define getprotobyname(n)       rb_w32_getprotobyname(n)
00633 
00634 #undef getprotobynumber
00635 #define getprotobynumber(n)     rb_w32_getprotobynumber(n)
00636 
00637 #undef getservbyname
00638 #define getservbyname(n, p)     rb_w32_getservbyname(n, p)
00639 
00640 #undef getservbyport
00641 #define getservbyport(p, pr)    rb_w32_getservbyport(p, pr)
00642 
00643 #undef socketpair
00644 #define socketpair(a, t, p, s)  rb_w32_socketpair(a, t, p, s)
00645 
00646 #undef get_osfhandle
00647 #define get_osfhandle(h)        rb_w32_get_osfhandle(h)
00648 
00649 #undef getcwd
00650 #define getcwd(b, s)            rb_w32_getcwd(b, s)
00651 
00652 #undef getenv
00653 #define getenv(n)               rb_w32_getenv(n)
00654 
00655 #undef rename
00656 #define rename(o, n)            rb_w32_rename(o, n)
00657 
00658 #undef times
00659 #define times(t)                rb_w32_times(t)
00660 #endif
00661 
00662 struct tms {
00663         long    tms_utime;
00664         long    tms_stime;
00665         long    tms_cutime;
00666         long    tms_cstime;
00667 };
00668 
00669 int rb_w32_times(struct tms *);
00670 
00671 /* thread stuff */
00672 HANDLE GetCurrentThreadHandle(void);
00673 int  rb_w32_sleep(unsigned long msec);
00674 int  rb_w32_putc(int, FILE*);
00675 int  rb_w32_getc(FILE*);
00676 int  rb_w32_open(const char *, int, ...);
00677 int  rb_w32_uopen(const char *, int, ...);
00678 int  rb_w32_wopen(const WCHAR *, int, ...);
00679 int  rb_w32_close(int);
00680 int  rb_w32_fclose(FILE*);
00681 int  rb_w32_pipe(int[2]);
00682 size_t rb_w32_read(int, void *, size_t);
00683 size_t rb_w32_write(int, const void *, size_t);
00684 int  rb_w32_utime(const char *, const struct utimbuf *);
00685 int  rb_w32_uutime(const char *, const struct utimbuf *);
00686 long rb_w32_write_console(unsigned long, int);
00687 int  WINAPI rb_w32_Sleep(unsigned long msec);
00688 int  rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout);
00689 
00690 /*
00691 == ***CAUTION***
00692 Since this function is very dangerous, ((*NEVER*))
00693 * lock any HANDLEs(i.e. Mutex, Semaphore, CriticalSection and so on) or,
00694 * use anything like TRAP_BEG...TRAP_END block structure,
00695 in asynchronous_func_t.
00696 */
00697 typedef uintptr_t (*asynchronous_func_t)(uintptr_t self, int argc, uintptr_t* argv);
00698 uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc, uintptr_t* argv, uintptr_t intrval);
00699 
00700 #ifdef __MINGW_ATTRIB_PURE
00701 /* get rid of bugs in math.h of mingw */
00702 #define frexp(_X, _Y) __extension__ ({\
00703     int *intptr_frexp_bug = (_Y);\
00704     *intptr_frexp_bug = *intptr_frexp_bug;\
00705     frexp((_X), intptr_frexp_bug);\
00706 })
00707 #define modf(_X, _Y) __extension__ ({\
00708     double *intptr_modf_bug = (_Y);\
00709     *intptr_modf_bug = *intptr_modf_bug;\
00710     modf((_X), intptr_modf_bug);\
00711 })
00712 #endif
00713 
00714 #if defined(__cplusplus)
00715 #if 0
00716 { /* satisfy cc-mode */
00717 #endif
00718 }  /* extern "C" { */
00719 #endif
00720 
00721 #endif /* RUBY_WIN32_H */
00722 

Generated on Thu Sep 8 2011 03:50:42 for Ruby by  doxygen 1.7.1