diff --git a/ChangeLog b/ChangeLog index b27c62d568..2a6d800d38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,66 @@ +Wed Jan 5 02:14:46 2000 EGUCHI Osamu + + * parse.y: Fix SEGV on empty parens with UMINUS or UPLUS. + +Tue Jan 4 22:25:54 2000 Yukihiro Matsumoto + + * parse.y (stmt): `() while cond' dumped core. + +Mon Dec 27 12:35:47 1999 Katsuyuki Komatsu + + * ext/socket/socket.c (sock_finalize): mswin32: fix socket handle leak. + + * win32/win32.c (myfdclose): ditto. + +Sun Dec 26 23:15:13 1999 Katsuyuki Komatsu + + * win32/win32.c (mypopen): raise catchable error instead of rb_fatal. + * win32/win32.c (mypclose): fix process handle laek. + +Sun Dec 26 16:17:11 1999 Katsuyuki Komatsu + + * ext/Win32API/Win32API.c (Win32API_initialize): use UINT2NUM + instead of INT2NUM to set __dll__ and __proc__. + +Sat Dec 25 00:08:59 1999 KANEKO Naoshi + + * ext/Win32API/Win32API.c (Win32API_Call): remove 'dword ptr' + from _asm. + +Fri Dec 24 10:26:47 1999 Koji Oda + + * win32/win32.h: use "C++" linkage. + +Fri Dec 24 02:00:57 1999 Yukihiro Matsumoto + + * eval.c (THREAD_ALLOC): should initialize th->trace. + +Fri Dec 24 00:43:39 1999 KANEKO Naoshi + + * io.c (pipe_open): check for `fptr->f == NULL'. + * win32/win32.c (mypopen): STDERR does not work during ` function. + +Tue Dec 21 17:21:28 1999 Koji Oda + + * ext/socket/socket.c (sock_finalize): mswin32: fix FILE* leak. + +Sun Dec 19 22:56:31 1999 KANEKO Naoshi + + * lib/find.rb: support dosish root directory. + * win32/Makefile: ditto. + * win32/config.status: ditto. + * win32/win32.c (opendir): ditto. + * win32/win32.c (opendir): use CharPrev() to get last character + of the directory name. + +Fri Dec 17 19:27:43 1999 IWAMURO Motonori + + * eval.c (rb_load): should initialize ruby_frame->last_class. + +Wed Dec 15 01:35:29 1999 Yukihiro Matsumoto + + * ruby.c (proc_options): argv boundary check for `-X'. + Sat Dec 11 03:34:38 1999 Yukihiro Matsumoto * gc.c (mark_hashentry): key should be VALUE, not ID. diff --git a/bignum.c b/bignum.c index 828e0cb9aa..e411e93f1b 100644 --- a/bignum.c +++ b/bignum.c @@ -16,9 +16,9 @@ VALUE rb_cBignum; typedef unsigned short USHORT; #define BDIGITS(x) RBIGNUM(x)->digits -#define BITSPERDIG (sizeof(short)*CHAR_BIT) +#define BITSPERDIG (sizeof(USHORT)*CHAR_BIT) #define BIGRAD (1L << BITSPERDIG) -#define DIGSPERINT ((unsigned int)(sizeof(long)/sizeof(short))) +#define DIGSPERLONG ((unsigned int)(sizeof(long)/sizeof(USHORT))) #define BIGUP(x) ((unsigned long)(x) << BITSPERDIG) #define BIGDN(x) RSHIFT(x,BITSPERDIG) #define BIGLO(x) ((USHORT)((x) & (BIGRAD-1))) @@ -33,7 +33,7 @@ bignew_1(klass, len, sign) OBJSETUP(big, klass, T_BIGNUM); big->sign = sign; big->len = len; - BDIGITS(big) = ALLOC_N(USHORT, len); + big->digits = ALLOC_N(USHORT, len); return (VALUE)big; } @@ -116,14 +116,14 @@ rb_uint2big(n) VALUE big; i = 0; - big = bignew(DIGSPERINT, 1); + big = bignew(DIGSPERLONG, 1); digits = BDIGITS(big); - while (i < DIGSPERINT) { + while (i < DIGSPERLONG) { digits[i++] = BIGLO(n); n = BIGDN(n); } - i = DIGSPERINT; + i = DIGSPERLONG; while (i-- && !digits[i]) ; RBIGNUM(big)->len = i+1; return big; diff --git a/configure b/configure index 56fe743679..bf5a6ceb99 100644 --- a/configure +++ b/configure @@ -1732,7 +1732,7 @@ case "$host_os" in nextstep*) ;; openstep*) ;; rhapsody*) ;; -human*) ;; +human*) ac_cv_func_getpgrp_void=yes;; beos*) ;; cygwin*) ;; *) LIBS="-lm $LIBS";; @@ -4361,7 +4361,7 @@ else echo "$ac_t""no" 1>&6 fi - for ac_func in select + for ac_func in select gettimeofday do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:4368: checking for $ac_func" >&5 @@ -4502,7 +4502,7 @@ EOF fi LIBOBJS="$LIBOBJS x68.o" - CFLAGS="$CFLAGS -fansi-only -cc1-stack=196608 -cpp-stack=2694144" + CFLAGS="$CFLAGS -fansi-only -cc1-stack=262144 -cpp-stack=2694144" EXEEXT=.x OBJEXT=o setup=Setup.x68 @@ -4573,7 +4573,7 @@ if test "$enable_shared" = 'yes'; then LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so' ;; linux*) - XLDFLAGS='-Wl,-rpath,${prefix}/lib':/usr/lib:/lib + LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)' LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so' ;; freebsd*) diff --git a/configure.in b/configure.in index 2e1167b688..a67b50a196 100644 --- a/configure.in +++ b/configure.in @@ -140,7 +140,7 @@ case "$host_os" in nextstep*) ;; openstep*) ;; rhapsody*) ;; -human*) ;; +human*) ac_cv_func_getpgrp_void=yes;; beos*) ;; cygwin*) ;; *) LIBS="-lm $LIBS";; @@ -564,7 +564,7 @@ case "$host_os" in human*) AC_CHECK_LIB(signal, _harderr) AC_CHECK_LIB(hmem, hmemset) - AC_CHECK_FUNCS(select) + AC_CHECK_FUNCS(select gettimeofday) AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number, rb_cv_missing__dtos18, [AC_TRY_RUN( @@ -603,7 +603,7 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no AC_DEFINE(MISSING_FCONVERT) fi LIBOBJS="$LIBOBJS x68.o" - CFLAGS="$CFLAGS -fansi-only -cc1-stack=196608 -cpp-stack=2694144" + CFLAGS="$CFLAGS -fansi-only -cc1-stack=262144 -cpp-stack=2694144" EXEEXT=.x OBJEXT=o setup=Setup.x68 @@ -672,7 +672,7 @@ if test "$enable_shared" = 'yes'; then LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so' ;; linux*) - XLDFLAGS='-Wl,-rpath,${prefix}/lib':/usr/lib:/lib + LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)' LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so' ;; freebsd*) diff --git a/cygwin/GNUmakefile.in b/cygwin/GNUmakefile.in index 970e90e24a..fb30e09ea1 100644 --- a/cygwin/GNUmakefile.in +++ b/cygwin/GNUmakefile.in @@ -5,5 +5,5 @@ RUBYCWDLL=rubycw.dll miniruby$(EXEEXT): $(RUBYCWDLL) $(RUBYCWDLL): $(OBJS) dmyext.o - dllwrap -o $(RUBYCWDLL) --export-all --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias -s $(OBJS) dmyext.o + $(LDSHARED) $(DLDFLAGS) -o $(RUBYCWDLL) --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias $(OBJS) dmyext.o nm --extern-only $(OBJS) dmyext.o | sed -n '/^........ [CD] _\(.*\)$$/s//#define \1 (*__imp_\1)/p' >import.h diff --git a/eval.c b/eval.c index 93b94acf7a..0962fc9723 100644 --- a/eval.c +++ b/eval.c @@ -4686,6 +4686,7 @@ rb_load(fname, wrap) } PUSH_FRAME(); ruby_frame->last_func = 0; + ruby_frame->last_class = 0; ruby_frame->self = ruby_top_self; ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_class,0,0); PUSH_SCOPE(); @@ -6068,7 +6069,6 @@ struct thread { VALUE klass; VALUE wrapper; - VALUE trace; int flags; /* misc. states (vmode/rb_trap_immediate/raised) */ char *file; @@ -6140,7 +6140,6 @@ thread_mark(th) rb_gc_mark(th->errinfo); rb_gc_mark(th->last_line); rb_gc_mark(th->last_match); - rb_gc_mark(th->trace); rb_mark_tbl(th->locals); /* mark data in copied stack */ @@ -6241,7 +6240,6 @@ rb_thread_save_context(th) th->last_match = rb_backref_get(); th->safe = safe_level; - th->trace = trace_func; th->file = ruby_sourcefile; th->line = ruby_sourceline; } @@ -6308,7 +6306,6 @@ rb_thread_restore_context(th, exit) rb_last_status = th->last_status; safe_level = th->safe; - trace_func = th->trace; ruby_sourcefile = th->file; ruby_sourceline = th->line; @@ -7548,7 +7545,7 @@ static VALUE catch_i(tag) ID tag; { - return rb_f_catch(0, FIX2INT(tag)); + return rb_funcall(Qnil, rb_intern("catch"), 0, FIX2INT(tag)); } VALUE diff --git a/ext/Win32API/Win32API.c b/ext/Win32API/Win32API.c index 8efb3ddad6..38268d0474 100644 --- a/ext/Win32API/Win32API.c +++ b/ext/Win32API/Win32API.c @@ -68,9 +68,9 @@ Win32API_initialize(self, dllname, proc, import, export) rb_raise(rb_eRuntimeError, "GetProcAddress: %s or %s\n", RSTRING(proc)->ptr, RSTRING(str)->ptr); } - rb_iv_set(self, "__dll__", INT2NUM((int)hdll)); + rb_iv_set(self, "__dll__", UINT2NUM((unsigned long)hdll)); rb_iv_set(self, "__dllname__", dllname); - rb_iv_set(self, "__proc__", INT2NUM((int)hproc)); + rb_iv_set(self, "__proc__", UINT2NUM((unsigned long)hproc)); a_import = rb_ary_new(); ptr = RARRAY(import)->ptr; @@ -124,7 +124,7 @@ Win32API_Call(argc, argv, obj) ApiVoid *ApiFunctionVoid; ApiInteger *ApiFunctionInteger; - long lParam; + long lParam; char *pParam; VALUE Return; @@ -144,7 +144,7 @@ Win32API_Call(argc, argv, obj) obj_import = rb_iv_get(obj, "__import__"); obj_export = rb_iv_get(obj, "__export__"); - nimport = RARRAY(obj_import)->len; + nimport = RARRAY(obj_import)->len; texport = FIX2INT(obj_export); if (items != nimport) @@ -165,7 +165,7 @@ Win32API_Call(argc, argv, obj) mov eax, lParam push eax } -#elif defined(__CYGWIN32__) || defined(__MINGW32__) +#elif defined(__CYGWIN__) || defined(__MINGW32__) asm volatile ("pushl %0" :: "g" (lParam)); #else #error @@ -184,10 +184,10 @@ Win32API_Call(argc, argv, obj) } #if defined(_MSC_VER) || defined(__LCC__) _asm { - mov eax, dword ptr pParam + mov eax, pParam push eax } -#elif defined(__CYGWIN32__) || defined(__MINGW32__) +#elif defined(__CYGWIN__) || defined(__MINGW32__) asm volatile ("pushl %0" :: "g" (pParam)); #else #error @@ -195,7 +195,6 @@ Win32API_Call(argc, argv, obj) break; } } - } switch (texport) { diff --git a/ext/socket/socket.c b/ext/socket/socket.c index b38cc48c98..543446dba6 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -93,16 +93,12 @@ sock_finalize(fptr) OpenFile *fptr; { SOCKET s; - extern int errno; if (!fptr->f) return; - - myfdclose(fptr->f); - if(fptr->f2) myfdclose(fptr->f); -/* - s = get_osfhandle(fileno(fptr->f)); + s = get_osfhandle(fileno(fptr->f)); + myfdclose(fptr->f); + if (fptr->f2) myfdclose(fptr->f2); closesocket(s); -*/ } #endif diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb index 9f1bae1d40..fd0a3bb2e4 100644 --- a/ext/tk/lib/tk.rb +++ b/ext/tk/lib/tk.rb @@ -1452,24 +1452,20 @@ module TkTreatFont alias fontobj font_configinfo def font_configure(slot) - if (fnt = slot['font']) - slot['font'] = nil + if (fnt = slot.delete('font')) if fnt.kind_of? TkFont return fnt.call_font_configure(self.path, self.path,'configure',slot) else latinfont_configure(fnt) if fnt end end - if (ltn = slot['latinfont']) - slot['latinfont'] = nil + if (ltn = slot.delete('latinfont')) latinfont_configure(ltn) if ltn end - if (ltn = slot['asciifont']) - slot['asciifont'] = nil + if (ltn = slot.delete('asciifont')) latinfont_configure(ltn) if ltn end - if (knj = slot['kanjifont']) - slot['kanjifont'] = nil + if (knj = slot.delete('kanjifont')) kanjifont_configure(knj) if knj end @@ -1878,42 +1874,24 @@ class TkToplevel= lines + if line >= lines and !ifp.eof? ofp.write("END--cut here--cut here\n") ofp.close part = part + 1 diff --git a/signal.c b/signal.c index fe1107d46d..f5f8d822d1 100644 --- a/signal.c +++ b/signal.c @@ -317,7 +317,7 @@ signal_exec(sig) case SIGINT: rb_thread_interrupt(); break; -#ifndef NT +#if !defined(NT) && !defined(__human68k__) case SIGHUP: #endif #ifdef SIGQUIT @@ -498,7 +498,7 @@ trap(arg) if (func == SIG_DFL) { switch (sig) { case SIGINT: -#ifndef NT +#if !defined(NT) && !defined(__human68k__) case SIGHUP: #endif #ifdef SIGQUIT diff --git a/win32/Makefile b/win32/Makefile index 24148b3c87..7573ef62cf 100644 --- a/win32/Makefile +++ b/win32/Makefile @@ -18,7 +18,7 @@ LDFLAGS = $(CFLAGS) -Fm #LDFLAGS = $(CFLAGS) -Fm XLDFLAGS = #EXTLIBS = -LIBS = advapi32.lib wsock32.lib $(EXTLIBS) +LIBS = user32.lib advapi32.lib wsock32.lib $(EXTLIBS) MISSING = crypt.obj alloca.obj win32.obj isinf.obj isnan.obj LDSHARED = DLDFLAGS = diff --git a/win32/config.status b/win32/config.status index ff19d709a6..6f77f19b01 100644 --- a/win32/config.status +++ b/win32/config.status @@ -7,7 +7,7 @@ s%@FFLAGS@%%g s%@DEFS@% -DUSE_THREAD -DSIZEOF_INT=4 -DSIZEOF_SHORT=2 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_FILE_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=int -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -DHAVE_FMOD=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_CHSIZE=1 -DHAVE_GETGROUPS=1 -DHAVE_GETLOGIN=1 -DRSHIFT=\(x,y\)\ \(\(x\)\>\>y\) -DFILE_COUNT=_cnt -DDLEXT=\".dll\" -DRUBY_LIB=\"/usr/local/lib/ruby/1.4\" -DRUBY_ARCHLIB=\"/usr/local/lib/ruby/1.4/i386-mswin32\" -DRUBY_PLATFORM=\"i386-mswin32\" %g s%@LDFLAGS@%%g -s%@LIBS@%advapi32.lib wsock32.lib%g +s%@LIBS@%user32.lib advapi32.lib wsock32.lib%g s%@exec_prefix@%${prefix}%g s%@prefix@%/usr/local%g s%@program_transform_name@%s,x,x,%g diff --git a/win32/win32.c b/win32/win32.c index 864fbfb5df..cd33fe1fd2 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -495,7 +495,7 @@ mypopen (char *cmd, char *mode) int p[2]; BOOL fRet; - HANDLE hInFile, hOutFile, hStdin, hStdout; + HANDLE hInFile, hOutFile; LPCSTR lpApplicationName = NULL; LPTSTR lpCommandLine; LPTSTR lpCmd2 = NULL; @@ -533,35 +533,14 @@ mypopen (char *cmd, char *mode) aStartupInfo.dwFlags = STARTF_USESTDHANDLES; if (reading) { - aStartupInfo.hStdInput = GetStdHandle(STD_OUTPUT_HANDLE);//hStdin; - aStartupInfo.hStdError = INVALID_HANDLE_VALUE; - //for save - DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_OUTPUT_HANDLE), - GetCurrentProcess(), &hStdout, - 0, FALSE, DUPLICATE_SAME_ACCESS - ); - //for redirect - DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_INPUT_HANDLE), - GetCurrentProcess(), &hStdin, - 0, TRUE, DUPLICATE_SAME_ACCESS - ); + aStartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE); aStartupInfo.hStdOutput = hOutFile; } else { - aStartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); //hStdout; - aStartupInfo.hStdError = INVALID_HANDLE_VALUE; - // for save - DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_INPUT_HANDLE), - GetCurrentProcess(), &hStdin, - 0, FALSE, DUPLICATE_SAME_ACCESS - ); - //for redirect - DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_OUTPUT_HANDLE), - GetCurrentProcess(), &hStdout, - 0, TRUE, DUPLICATE_SAME_ACCESS - ); - aStartupInfo.hStdInput = hInFile; + aStartupInfo.hStdInput = hInFile; + aStartupInfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); } + aStartupInfo.hStdError = GetStdHandle(STD_ERROR_HANDLE); dwCreationFlags = (NORMAL_PRIORITY_CLASS); @@ -587,24 +566,12 @@ mypopen (char *cmd, char *mode) CloseHandle(aProcessInformation.hThread); if (reading) { - HANDLE hDummy; - fd = _open_osfhandle((long)hInFile, (_O_RDONLY | pipemode)); CloseHandle(hOutFile); - DuplicateHandle(GetCurrentProcess(), hStdout, - GetCurrentProcess(), &hDummy, - 0, TRUE, (DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE) - ); } else { - HANDLE hDummy; - fd = _open_osfhandle((long)hOutFile, (_O_WRONLY | pipemode)); CloseHandle(hInFile); - DuplicateHandle(GetCurrentProcess(), hStdin, - GetCurrentProcess(), &hDummy, - 0, TRUE, (DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE) - ); } if (fd == -1) @@ -1245,8 +1212,10 @@ opendir(char *filename) // check to see if we\'ve got a directory // - if (stat (filename, &sbuf) < 0 || - sbuf.st_mode & _S_IFDIR == 0) { + if ((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; } @@ -1264,7 +1233,7 @@ opendir(char *filename) strcpy(scanname, filename); - if (index("/\\", *(scanname + strlen(scanname) - 1)) == NULL) + if (index("/\\:", *CharPrev(scanname, scanname + strlen(scanname))) == NULL) strcat(scanname, "/*"); else strcat(scanname, "*"); @@ -1660,7 +1629,8 @@ myfdopen (int fd, const char *mode) void myfdclose(FILE *fp) { - fclose(fp); + _free_osfhnd(fileno(fp)); + fclose(fp); } @@ -1802,6 +1772,10 @@ myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex, if (!NtSocketsInitialized++) { StartSockets(); } + if (nfds == 0 && timeout) { + Sleep(timeout->tv_sec * 1000 + timeout->tv_usec / 1000); + return 0; + } if ((r = select (nfds, rd, wr, ex, timeout)) == SOCKET_ERROR) { errno = WSAGetLastError(); switch (errno) { diff --git a/win32/win32.h b/win32/win32.h index 04cb192c43..a55641eada 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -87,7 +87,7 @@ #undef leave #if defined(__cplusplus) -} +extern "C++" { #endif #include @@ -103,7 +103,7 @@ #include #if defined(__cplusplus) -extern "C" { +} #endif #define UIDTYPE int