summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-01-05 04:41:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-01-05 04:41:21 +0000
commit76f0202393a0afee6515cdc7d86dfdd80a8ab5c5 (patch)
tree638cf572ae7f4776965610fd0e2b3765cb228937
parent7ada9b8b5aa450ea8141686784d72e91caea719f (diff)
20000105
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog63
-rw-r--r--bignum.c12
-rw-r--r--configure8
-rw-r--r--configure.in8
-rw-r--r--cygwin/GNUmakefile.in2
-rw-r--r--eval.c7
-rw-r--r--ext/Win32API/Win32API.c15
-rw-r--r--ext/socket/socket.c10
-rw-r--r--ext/tk/lib/tk.rb94
-rw-r--r--ext/tk/lib/tkcanvas.rb12
-rw-r--r--ext/tk/lib/tktext.rb12
-rw-r--r--gc.c3
-rw-r--r--hash.c9
-rw-r--r--io.c3
-rw-r--r--lib/find.rb4
-rw-r--r--lib/mkmf.rb4
-rw-r--r--main.c2
-rw-r--r--missing/x68.c2
-rw-r--r--parse.y26
-rw-r--r--ruby.c5
-rw-r--r--sample/mpart.rb2
-rw-r--r--signal.c4
-rw-r--r--win32/Makefile2
-rw-r--r--win32/config.status2
-rw-r--r--win32/win32.c58
-rw-r--r--win32/win32.h4
26 files changed, 191 insertions, 182 deletions
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 <eguchi@shizuokanet.ne.jp>
+
+ * parse.y: Fix SEGV on empty parens with UMINUS or UPLUS.
+
+Tue Jan 4 22:25:54 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (stmt): `() while cond' dumped core.
+
+Mon Dec 27 12:35:47 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * 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 <komatsu@sarion.co.jp>
+
+ * 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 <komatsu@sarion.co.jp>
+
+ * 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 <wbs01621@mail.wbs.ne.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_Call): remove 'dword ptr'
+ from _asm.
+
+Fri Dec 24 10:26:47 1999 Koji Oda <oda@bsd1.qnes.nec.co.jp>
+
+ * win32/win32.h: use "C++" linkage.
+
+Fri Dec 24 02:00:57 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (THREAD_ALLOC): should initialize th->trace.
+
+Fri Dec 24 00:43:39 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * 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 <oda@bsd1.qnes.nec.co.jp>
+
+ * ext/socket/socket.c (sock_finalize): mswin32: fix FILE* leak.
+
+Sun Dec 19 22:56:31 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * 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 <iwa@mmp.fujitsu.co.jp>
+
+ * eval.c (rb_load): should initialize ruby_frame->last_class.
+
+Wed Dec 15 01:35:29 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (proc_options): argv boundary check for `-X'.
+
Sat Dec 11 03:34:38 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* 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<TkWindow
@classname = classname
if keys.kind_of? Hash
keys = keys.dup
- if keys['classname']
- @classname = keys['classname']
- keys['classname'] = nil
- end
- if keys['colormap']
- @colormap = keys['colormap']
- keys['colormap'] = nil
- end
- if keys['container']
- @classname = keys['container']
- keys['classname'] = nil
- end
- if keys['screen']
- @screen = keys['screen']
- keys['screen'] = nil
- end
- if keys['use']
- @use = keys['use']
- keys['use'] = nil
- end
- if keys['visual']
- @screen = keys['visual']
- keys['visual'] = nil
- end
+ @classname = keys.delete('classname')
+ @colormap = keys.delete('colormap')
+ @container = keys.delete('container')
+ @screen = keys.delete('screen')
+ @use = keys.delete('use')
+ @visual = keys.delete('visual')
end
super(parent, keys)
end
def create_self
s = []
- s.push << "-class" << @classname if @classname
- s.push << "-colormap" << @colormap if @colormap
- s.push << "-container" << @container if @container
- s.push << "-screen" << @screen if @screen
- s.push << "-use" << @use if @use
- s.push << "-visual" << @visual if @visual
+ s << "-class" << @classname if @classname
+ s << "-colormap" << @colormap if @colormap
+ s << "-container" << @container if @container
+ s << "-screen" << @screen if @screen
+ s << "-use" << @use if @use
+ s << "-visual" << @visual if @visual
tk_call 'toplevel', @path, *s
end
@@ -1932,32 +1910,20 @@ class TkFrame<TkWindow
def initialize(parent=nil, keys=nil)
if keys.kind_of? Hash
keys = keys.dup
- if keys['classname']
- @classname = keys['classname']
- keys['classname'] = nil
- end
- if keys['colormap']
- @colormap = keys['colormap']
- keys['colormap'] = nil
- end
- if keys['container']
- @classname = keys['container']
- keys['classname'] = nil
- end
- if keys['visual']
- @screen = keys['visual']
- keys['visual'] = nil
- end
+ @classname = keys.delete('classname')
+ @colormap = keys.delete('colormap')
+ @container = keys.delete('container')
+ @visual = keys.delete('visual')
end
super(parent, keys)
end
def create_self
s = []
- s.push << "-class" << @classname if @classname
- s.push << "-colormap" << @colormap if @colormap
- s.push << "-container" << @container if @container
- s.push << "-visual" << @visual if @visual
+ s << "-class" << @classname if @classname
+ s << "-colormap" << @colormap if @colormap
+ s << "-container" << @container if @container
+ s << "-visual" << @visual if @visual
tk_call 'frame', @path, *s
end
end
@@ -2189,8 +2155,7 @@ module TkTreatMenuEntryFont
def tagfont_configure(index, slot)
pathname = self.path + ';' + index
- if (fnt = slot['font'])
- slot['font'] = nil
+ if (fnt = slot.delete('font'))
if fnt.kind_of? TkFont
return fnt.call_font_configure(pathname,
self.path,'entryconfigure',index,slot)
@@ -2198,16 +2163,13 @@ module TkTreatMenuEntryFont
latintagfont_configure(index, fnt) if fnt
end
end
- if (ltn = slot['latinfont'])
- slot['latinfont'] = nil
+ if (ltn = slot.delete('latinfont'))
latintagfont_configure(index, ltn) if ltn
end
- if (ltn = slot['asciifont'])
- slot['asciifont'] = nil
+ if (ltn = slot.delete('asciifont'))
latintagfont_configure(index, ltn) if ltn
end
- if (knj = slot['kanjifont'])
- slot['kanjifont'] = nil
+ if (knj = slot.delete('kanjifont'))
kanjitagfont_configure(index, knj) if knj
end
diff --git a/ext/tk/lib/tkcanvas.rb b/ext/tk/lib/tkcanvas.rb
index c67bc456ed..5f03b0f3a9 100644
--- a/ext/tk/lib/tkcanvas.rb
+++ b/ext/tk/lib/tkcanvas.rb
@@ -30,8 +30,7 @@ module TkTreatCItemFont
else
pathname = self.path + ';' + tagOrId.to_s
end
- if (fnt = slot['font'])
- slot['font'] = nil
+ if (fnt = slot.delete('font'))
if fnt.kind_of? TkFont
return fnt.call_font_configure(pathname,
self.path,'itemconfigure',tagOrId,slot)
@@ -39,16 +38,13 @@ module TkTreatCItemFont
latintagfont_configure(tagOrId, fnt) if fnt
end
end
- if (ltn = slot['latinfont'])
- slot['latinfont'] = nil
+ if (ltn = slot.delete('latinfont'))
latintagfont_configure(tagOrId, ltn) if ltn
end
- if (ltn = slot['asciifont'])
- slot['asciifont'] = nil
+ if (ltn = slot.delete('asciifont'))
latintagfont_configure(tagOrId, ltn) if ltn
end
- if (knj = slot['kanjifont'])
- slot['kanjifont'] = nil
+ if (knj = slot.delete('kanjifont'))
kanjitagfont_configure(tagOrId, knj) if knj
end
diff --git a/ext/tk/lib/tktext.rb b/ext/tk/lib/tktext.rb
index 83999cb3e2..9d5037e4e2 100644
--- a/ext/tk/lib/tktext.rb
+++ b/ext/tk/lib/tktext.rb
@@ -28,8 +28,7 @@ module TkTreatTextTagFont
else
pathname = self.path + ';' + tag
end
- if (fnt = slot['font'])
- slot['font'] = nil
+ if (fnt = slot.delete('font'))
if fnt.kind_of? TkFont
return fnt.call_font_configure(pathname,
self.path,'tag','configure',tag,slot)
@@ -37,16 +36,13 @@ module TkTreatTextTagFont
latintagfont_configure(tag, fnt) if fnt
end
end
- if (ltn = slot['latinfont'])
- slot['latinfont'] = nil
+ if (ltn = slot.delete('latinfont'))
latintagfont_configure(tag, ltn) if ltn
end
- if (ltn = slot['asciifont'])
- slot['asciifont'] = nil
+ if (ltn = slot.delete('asciifont'))
latintagfont_configure(tag, ltn) if ltn
end
- if (knj = slot['kanjifont'])
- slot['kanjifont'] = nil
+ if (knj = slot.delete('kanjifont'))
kanjitagfont_configure(tag, knj) if knj
end
diff --git a/gc.c b/gc.c
index 465014c1d3..7291e4ad41 100644
--- a/gc.c
+++ b/gc.c
@@ -860,6 +860,9 @@ _rb_setjmp:
movem.l d3-d7/a3-a5,(a0)
moveq.l #0,d0
rts");
+#ifdef setjmp
+#undef setjmp
+#endif
#else
#if defined(DJGPP)
typedef unsigned long rb_jmp_buf[6];
diff --git a/hash.c b/hash.c
index b06b3535ea..da31fb3b47 100644
--- a/hash.c
+++ b/hash.c
@@ -688,10 +688,9 @@ rb_hash_inspect(hash)
}
static VALUE
-hash_to_s(hash)
+to_s_hash(hash)
VALUE hash;
{
- if (rb_inspecting_p(hash)) return rb_str_new2("{...}");
return rb_ary_to_s(rb_hash_to_a(hash));
}
@@ -699,8 +698,10 @@ static VALUE
rb_hash_to_s(hash)
VALUE hash;
{
+ VALUE str;
+
if (rb_inspecting_p(hash)) return rb_str_new2("{...}");
- return rb_protect_inspect(hash_to_s, hash, 0);
+ return rb_protect_inspect(to_s_hash, hash, 0);
}
static VALUE
@@ -1366,7 +1367,7 @@ env_index(dmy, value)
char *s = strchr(*env, '=')+1;
if (s) {
if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) {
- return rb_tainted_str_new(*env, s-*env);
+ return rb_tainted_str_new(*env, s-*env-1);
}
}
env++;
diff --git a/io.c b/io.c
index 60909af7a3..2dce9501ba 100644
--- a/io.c
+++ b/io.c
@@ -1254,6 +1254,9 @@ rb_fopen(fname, mode)
rb_sys_fail(fname);
}
}
+#ifdef __human68k__
+ fmode(file, _IOTEXT);
+#endif
return file;
}
diff --git a/lib/find.rb b/lib/find.rb
index 3f1b82d2b3..469dca80aa 100644
--- a/lib/find.rb
+++ b/lib/find.rb
@@ -17,7 +17,9 @@ module Find
begin
for f in d
next if f =~ /^\.\.?$/
- if file == "/" then
+ if File::ALT_SEPARATOR and file =~ /^([\/\\]|[A-Za-z]:[\/\\]?)$/ then
+ f = file + f
+ elsif file == "/" then
f = "/" + f
else
f = file + "/" + f
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 5df77bd3ab..f510e9c509 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -243,7 +243,7 @@ SRC
print "no\n"
return false
end
- header.tr!("a-z./\055", "A-Z___")
+ header.tr!("a-z\055./", "A-Z___")
$defs.push(format("-DHAVE_%s", header))
print "yes\n"
return true
@@ -367,6 +367,8 @@ CXXFLAGS = $(CFLAGS)
DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS}
LDSHARED = #{CONFIG["LDSHARED"]} #{defflag}
+RUBY_INSTALL_NAME = #{CONFIG["RUBY_INSTALL_NAME"]}
+
prefix = #{CONFIG["prefix"]}
exec_prefix = #{CONFIG["exec_prefix"]}
libdir = #{$libdir}
diff --git a/main.c b/main.c
index dccf0a8953..dd3f1f03d6 100644
--- a/main.c
+++ b/main.c
@@ -15,7 +15,7 @@ unsigned int _stklen = 0x180000;
#endif
#ifdef __human68k__
-int _stacksize = 131072;
+int _stacksize = 262144;
#endif
#if defined(__MACOS__) && defined(__MWERKS__)
diff --git a/missing/x68.c b/missing/x68.c
index dbfe662874..9a8f0a2a9c 100644
--- a/missing/x68.c
+++ b/missing/x68.c
@@ -18,6 +18,7 @@ link(const char *src, const char *dst)
return symlink(src, dst);
}
+#ifndef HAVE_GETTIMEOFDAY
#include <time.h>
#include <sys/time.h>
@@ -34,3 +35,4 @@ gettimeofday(struct timeval *tv, struct timezone *tz)
return 0;
}
+#endif
diff --git a/parse.y b/parse.y
index 5e516d2751..6d9616df71 100644
--- a/parse.y
+++ b/parse.y
@@ -330,21 +330,31 @@ stmt : block_call
| stmt kWHILE_MOD expr
{
value_expr($3);
- if (nd_type($1) == NODE_BEGIN) {
- $$ = NEW_WHILE(cond($3), $1->nd_body, 0);
+ if ($1) {
+ if (nd_type($1) == NODE_BEGIN) {
+ $$ = NEW_WHILE(cond($3), $1->nd_body, 0);
+ }
+ else {
+ $$ = NEW_WHILE(cond($3), $1, 1);
+ }
}
else {
- $$ = NEW_WHILE(cond($3), $1, 1);
+ $$ = 0;
}
}
| stmt kUNTIL_MOD expr
{
value_expr($3);
- if (nd_type($1) == NODE_BEGIN) {
- $$ = NEW_UNTIL(cond($3), $1->nd_body, 0);
+ if ($1) {
+ if (nd_type($1) == NODE_BEGIN) {
+ $$ = NEW_UNTIL(cond($3), $1->nd_body, 0);
+ }
+ else {
+ $$ = NEW_UNTIL(cond($3), $1, 1);
+ }
}
else {
- $$ = NEW_UNTIL(cond($3), $1, 1);
+ $$ = 0;
}
}
| klBEGIN
@@ -708,7 +718,7 @@ arg : lhs '=' arg
}
| tUPLUS arg
{
- if (nd_type($2) == NODE_LIT) {
+ if ($2 && nd_type($2) == NODE_LIT) {
$$ = $2;
}
else {
@@ -717,7 +727,7 @@ arg : lhs '=' arg
}
| tUMINUS arg
{
- if (nd_type($2) == NODE_LIT && FIXNUM_P($2->nd_lit)) {
+ if ($2 && nd_type($2) == NODE_LIT && FIXNUM_P($2->nd_lit)) {
long i = FIX2LONG($2->nd_lit);
$2->nd_lit = INT2FIX(-i);
diff --git a/ruby.c b/ruby.c
index 752b2b18fc..a923408942 100644
--- a/ruby.c
+++ b/ruby.c
@@ -392,7 +392,10 @@ proc_options(argcp, argvp)
s = argv[1];
argc--,argv++;
}
- if (*s && chdir(s) < 0) {
+ if (!s || !*s) {
+ rb_fatal("Can't chdir");
+ }
+ if (chdir(s) < 0) {
rb_fatal("Can't chdir to %s", s);
}
break;
diff --git a/sample/mpart.rb b/sample/mpart.rb
index 6c40d50e18..a88eba0ef6 100644
--- a/sample/mpart.rb
+++ b/sample/mpart.rb
@@ -31,7 +31,7 @@ for i in ifp = open(basename)
end
ofp.write(i)
line = line + 1
- if line >= 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 <stdio.h>
@@ -103,7 +103,7 @@
#include <malloc.h>
#if defined(__cplusplus)
-extern "C" {
+}
#endif
#define UIDTYPE int