diff options
author | H_Konishi <H_Konishi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-11 01:27:48 +0000 |
---|---|---|
committer | H_Konishi <H_Konishi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-11 01:27:48 +0000 |
commit | d0b3651906aa943423e430a61437a42f7dd39422 () | |
tree | 9d8c8beee149c50f44406ee8cd6dee4c3913c28f /win32 | |
parent | ceade7b9268e9620b123843afeb25a7136f8a576 (diff) |
new platform [bccwin32] merged.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | win32/dir.h | 7 | ||||
-rw-r--r-- | win32/resource.rb | 2 | ||||
-rw-r--r-- | win32/win32.c | 71 | ||||
-rw-r--r-- | win32/win32.h | 79 |
4 files changed, 134 insertions, 25 deletions
@@ -1,3 +1,10 @@ struct direct { long d_namlen; @@ -55,7 +55,9 @@ end f.binmode if /mingw/ =~ RUBY_PLATFORM f.print <<EOF #include <windows.h> #{icons} VS_VERSION_INFO VERSIONINFO @@ -45,6 +45,11 @@ # undef WIN95 #endif #if HAVE_WSAWAITFORMULTIPLEEVENTS # define USE_INTERRUPT_WINSOCK #endif @@ -1115,7 +1120,11 @@ rb_w32_opendir(const char *filename) // if ((rb_w32_stat (filename, &sbuf) < 0 || sbuf.st_mode & _S_IFDIR == 0) && (!ISALPHA(filename[0]) || filename[1] != ':' || filename[2] != '\0' || ((1 << (filename[0] & 0x5f) - 'A') & GetLogicalDrives()) == 0)) { return NULL; @@ -1320,6 +1329,9 @@ EXTERN_C void __cdecl _unlock(int); #ifdef MSVCRT_THREADS # define MTHREAD_ONLY(x) x # define STHREAD_ONLY(x) #else # define MTHREAD_ONLY(x) # define STHREAD_ONLY(x) x @@ -1339,15 +1351,16 @@ typedef struct { #define _CRTIMP __declspec(dllimport) #endif EXTERN_C _CRTIMP ioinfo * __pioinfo[]; #define IOINFO_L2E 5 #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) #define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1))) - #define _osfhnd(i) (_pioinfo(i)->osfhnd) #define _osfile(i) (_pioinfo(i)->osfile) #define _pipech(i) (_pioinfo(i)->pipech) #define FOPEN 0x01 /* file handle open */ #define FNOINHERIT 0x10 /* file handle opened O_NOINHERIT */ @@ -1375,6 +1388,29 @@ rb_w32_open_osfhandle(long osfhandle, int flags) if (flags & O_NOINHERIT) fileflags |= FNOINHERIT; RUBY_CRITICAL({ /* attempt to allocate a C Runtime file handle */ HANDLE hF = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL); @@ -1396,7 +1432,7 @@ rb_w32_open_osfhandle(long osfhandle, int flags) MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fh)->lock)); } }); - return fh; /* return handle */ } @@ -1538,7 +1574,11 @@ setgid(int gid) int /* ioctl(int i, unsigned int u, char *data) */ -ioctl(int i, unsigned int u, long data) { return -1; } @@ -1713,10 +1753,18 @@ StartSockets () atexit((void (*)(void)) WSACleanup); iSockOpt = SO_SYNCHRONOUS_NONALERT; /* * Enable the use of sockets as filehandles */ setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&iSockOpt, sizeof(iSockOpt)); @@ -1955,7 +2003,11 @@ rb_w32_socket (int af, int type, int protocol) errno = WSAGetLastError(); //fprintf(stderr, "socket fail (%d)", WSAGetLastError()); } return rb_w32_open_osfhandle(s, O_RDWR|O_BINARY); } #undef gethostbyaddr @@ -2211,7 +2263,12 @@ rb_w32_getcwd(buffer, size) int length; char *bp; if (_getcwd(buffer, size) == NULL) { return NULL; } length = strlen(buffer); @@ -2671,8 +2728,8 @@ static void catch_interrupt(void) int rb_w32_getc(FILE* stream) { int c, trap_immediate = rb_trap_immediate; - if (--stream->_cnt >= 0) { - c = (unsigned char)*stream->_ptr++; rb_trap_immediate = trap_immediate; } else { @@ -2687,8 +2744,8 @@ int rb_w32_getc(FILE* stream) int rb_w32_putc(int c, FILE* stream) { int trap_immediate = rb_trap_immediate; - if (--stream->_cnt >= 0) { - c = (unsigned char)(*stream->_ptr++ = (char)c); rb_trap_immediate = trap_immediate; } else { @@ -89,28 +89,16 @@ extern "C++" { #define fgetchar(_stream) getchar() #define fputchar(_c, _stream) putchar(_c) #define access _access #define chmod _chmod #define chsize _chsize -#define close _close -#define creat _creat #define dup _dup #define dup2 _dup2 -#define eof _eof -#define filelength _filelength #define isatty _isatty -#define locking _locking -#define lseek _lseek -#define mktemp _mktemp #define open _open -#define perror _perror -#define read _read #define setmode _setmode -#define sopen _sopen -#define tell _tell -#define umask _umask -#define unlink _unlink -#define write _write #define execl _execl #define execle _execle #define execlp _execlp @@ -119,8 +107,7 @@ extern "C++" { #define execve _execve #define execvp _execvp #define execvpe _execvpe -#define getpid _getpid -#define sleep(x) rb_w32_sleep((x)*1000) #define spawnl _spawnl #define spawnle _spawnle #define spawnlp _spawnlp @@ -132,13 +119,34 @@ extern "C++" { #if _MSC_VER < 800 #define fileno _fileno #endif #define utime _utime #define vsnprintf _vsnprintf #define snprintf _snprintf #define popen _popen #define pclose _pclose -#define strcasecmp _stricmp -#define strncasecmp _strnicmp #undef stat #define stat(path,st) rb_w32_stat(path,st) /* these are defined in nt.c */ @@ -196,9 +204,44 @@ extern int gettimeofday(struct timeval *, struct timezone *); extern pid_t waitpid (pid_t, int *, int); extern int do_spawn(char *); extern int kill(int, int); extern int isinf(double); extern int isnan(double); // // define this so we can do inplace editing |