From 42c59aa31785793dd365c70bac10d807c0329a34 Mon Sep 17 00:00:00 2001 From: H_Konishi Date: Fri, 14 Jun 2002 12:21:50 +0000 Subject: *bcc32 fix for win9x. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2570 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ bcc32/configure.bat | 22 +++++++++++----------- bcc32/mkexports.rb | 2 +- win32/win32.c | 39 +++++++++++---------------------------- 4 files changed, 31 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3d63261eef..3949c5d752 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Jun 14 21:01:48 2002 KONISHI Hiromasa + + * bcc32/mkexports.rb: insert sleep(1) for win9x. + + * bcc32/configure.bat: change return code LF -> CRLF fo win9x. + + * win32/win32.c: fix rb_w32_open_osfhandle() + Fri Jun 14 15:22:19 2002 Nobuyoshi Nakada * parse.y (read_escape): deny zero-width hexadecimal character. diff --git a/bcc32/configure.bat b/bcc32/configure.bat index 813acba1d8..0025fa685e 100644 --- a/bcc32/configure.bat +++ b/bcc32/configure.bat @@ -1,11 +1,11 @@ -@echo off -::: Don't set environment variable in batch file other than autoexec.bat -::: to avoid "Out of environment space" problem on Windows 95/98. -::: set TMPMAKE=~tmp~.mak - -echo> ~tmp~.mak #### -echo>> ~tmp~.mak conf = %0 -echo>> ~tmp~.mak $(conf:\=/): nul -echo>> ~tmp~.mak @del ~tmp~.mak -echo>> ~tmp~.mak make -Dbcc32dir="$(@D)" -f$(@D)/setup.mak %1 -make -f ~tmp~.mak +@echo off +::: Don't set environment variable in batch file other than autoexec.bat +::: to avoid "Out of environment space" problem on Windows 95/98. +::: set TMPMAKE=~tmp~.mak + +echo> ~tmp~.mak #### +echo>> ~tmp~.mak conf = %0 +echo>> ~tmp~.mak $(conf:\=/): nul +echo>> ~tmp~.mak @del ~tmp~.mak +echo>> ~tmp~.mak make -Dbcc32dir="$(@D)" -f$(@D)/setup.mak %1 +make -f ~tmp~.mak diff --git a/bcc32/mkexports.rb b/bcc32/mkexports.rb index 46edf190ee..531ba3a001 100644 --- a/bcc32/mkexports.rb +++ b/bcc32/mkexports.rb @@ -3,7 +3,7 @@ SYM = {} objs = ARGV.collect {|s| s.tr('/', '\\')} system("tdump -oiPUBDEF -oiPUBD32 #{objs.join(' ')} > pub.def") - +sleep(1) IO.foreach('pub.def'){|l| next unless /(PUBDEF|PUBD32)/ =~ l /'(.*?)'/ =~ l diff --git a/win32/win32.c b/win32/win32.c index 81ce8b6ba0..24699be9cf 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -1323,7 +1323,7 @@ EXTERN_C void __cdecl _lock_fhandle(int); EXTERN_C void __cdecl _unlock_fhandle(int); EXTERN_C void __cdecl _unlock(int); -#if defined _MT || defined __MSVCRT__ +#if (defined _MT || defined __MSVCRT__) && !defined __BORLANDC__ #define MSVCRT_THREADS #endif #ifdef MSVCRT_THREADS @@ -1360,6 +1360,15 @@ EXTERN_C _CRTIMP ioinfo * __pioinfo[]; #define _osfhnd(i) (_pioinfo(i)->osfhnd) #define _osfile(i) (_pioinfo(i)->osfile) #define _pipech(i) (_pioinfo(i)->pipech) + +#define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = osfh) +#define _set_osflags(fh, flags) (_osfile(fh) = (flags)) + +#else + +#define _set_osfhnd(fh, osfh) (void)((fh), (osfh)) +#define _set_osflags(fh, flags) (void)((fh), (flags)) + #endif #define FOPEN 0x01 /* file handle open */ @@ -1368,8 +1377,6 @@ EXTERN_C _CRTIMP ioinfo * __pioinfo[]; #define FDEV 0x40 /* file handle refers to device */ #define FTEXT 0x80 /* file handle is in text mode */ -#define _set_osfhnd(fh, osfh) (void)(_osfhnd(fh) = osfh) - static int rb_w32_open_osfhandle(long osfhandle, int flags) { @@ -1388,29 +1395,6 @@ rb_w32_open_osfhandle(long osfhandle, int flags) if (flags & O_NOINHERIT) fileflags |= FNOINHERIT; -#ifdef __BORLANDC__ - { - /* attempt to allocate a C Runtime file handle */ - HANDLE hF = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL); - fh = _open_osfhandle((long)hF, 0); - CloseHandle(hF); - if (fh == -1) { - errno = EMFILE; /* too many open files */ - _doserrno = 0L; /* not an OS error */ - } - else { - - MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fh)->lock))); - /* the file is open. now, set the info in _osfhnd array */ - //_set_osfhnd(fh, osfhandle); - - fileflags |= FOPEN; /* mark as open */ - - //_osfile(fh) = fileflags; /* set osfile entry */ - MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fh)->lock)); - } - } -#else RUBY_CRITICAL({ /* attempt to allocate a C Runtime file handle */ HANDLE hF = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL); @@ -1428,11 +1412,10 @@ rb_w32_open_osfhandle(long osfhandle, int flags) fileflags |= FOPEN; /* mark as open */ - _osfile(fh) = fileflags; /* set osfile entry */ + _set_osflags(fh, fileflags); /* set osfile entry */ MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fh)->lock)); } }); -#endif return fh; /* return handle */ } -- cgit v1.2.3