summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-10 08:01:49 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-10 08:01:49 +0000
commit3d31020aeb6e59bd3b6bd12de00c854f570d4381 (patch)
tree64bd410107d8fd3b0ef6b644f11cf9888f837f7c
parent91c7b7c465cd91d79a8809785490f77bbe97e631 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--eval.c3
-rw-r--r--ext/socket/socket.c26
-rw-r--r--ext/tcltklib/tcltklib.c9
-rw-r--r--ext/tk/lib/tk.rb6
-rw-r--r--misc/ruby-mode.el15
-rw-r--r--numeric.c12
-rw-r--r--parse.y2
-rw-r--r--win32/win32.c11
9 files changed, 65 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index ec54c9d147..f715e4db57 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Fri Jul 7 03:30:00 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * numeric.c (fix_aref): convert index by NUM2INT, not FIX2INT.
+ (ruby-bugs:#PR37)
+
+Mon Jul 3 23:46:56 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (myselect, myaccept): disable interrupt while
+ executing accept() or select() to avoid Ctrl-C causes
+ "unknown software exception (0xc0000029)".
+
Mon Jul 3 18:19:05 2000 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
* lib/net/protocol.rb, smtp.rb, pop.rb, http.rb: 1.1.26.
diff --git a/eval.c b/eval.c
index 60d8a64793..25f2b1c574 100644
--- a/eval.c
+++ b/eval.c
@@ -7159,6 +7159,9 @@ rb_thread_create_0(fn, arg, klass)
}
#endif
+ if (ruby_block) {
+ blk_copy_prev(ruby_block);
+ }
FL_SET(ruby_scope, SCOPE_SHARED);
if (THREAD_SAVE_CONTEXT(curr_thread)) {
return thread;
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 8af849e7d8..67f93945dc 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -518,7 +518,7 @@ mkipaddr0(addr, buf, len)
error = getnameinfo(addr, SA_LEN(addr), buf, len, NULL, 0, NI_NUMERICHOST);
if (error) {
- rb_raise(rb_eSocket, "%s", gai_strerror(error));
+ rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
}
}
@@ -604,7 +604,7 @@ ip_addrsetup(host, port)
if (hostp && hostp[strlen(hostp)-1] == '\n') {
rb_raise(rb_eSocket, "newline at the end of hostname");
}
- rb_raise(rb_eSocket, "%s", gai_strerror(error));
+ rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
}
return res;
@@ -648,14 +648,14 @@ ipaddr(sockaddr)
error = getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
NULL, 0, 0);
if (error) {
- rb_raise(rb_eSocket, "%s", gai_strerror(error));
+ rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
}
addr1 = rb_tainted_str_new2(hbuf);
}
error = getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
pbuf, sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV);
if (error) {
- rb_raise(rb_eSocket, "%s", gai_strerror(error));
+ rb_raise(rb_eSocket, "getnameinfo %s", gai_strerror(error));
}
addr2 = rb_tainted_str_new2(hbuf);
if (do_not_reverse_lookup) {
@@ -795,7 +795,7 @@ open_inet(class, h, serv, type)
}
error = getaddrinfo(host, portp, &hints, &res0);
if (error) {
- rb_raise(rb_eSocket, "%s", gai_strerror(error));
+ rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
}
fd = -1;
@@ -1842,7 +1842,7 @@ sock_s_getaddrinfo(argc, argv)
}
error = getaddrinfo(hptr, pptr, &hints, &res);
if (error) {
- rb_raise(rb_eSocket, "%s", gai_strerror(error));
+ rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
}
ret = mkaddrinfo(res);
@@ -1948,7 +1948,7 @@ sock_s_getnameinfo(argc, argv)
}
#endif
error = getaddrinfo(hptr, pptr, &hints, &res);
- if (error) goto error_exit;
+ if (error) goto error_exit_addr;
sap = res->ai_addr;
}
else {
@@ -1957,7 +1957,7 @@ sock_s_getnameinfo(argc, argv)
error = getnameinfo(sap, SA_LEN(sap), hbuf, sizeof(hbuf),
pbuf, sizeof(pbuf), fl);
- if (error) goto error_exit;
+ if (error) goto error_exit_name;
if (res) {
for (r = res->ai_next; r; r = r->ai_next) {
char hbuf2[1024], pbuf2[1024];
@@ -1965,7 +1965,7 @@ sock_s_getnameinfo(argc, argv)
sap = r->ai_addr;
error = getnameinfo(sap, SA_LEN(sap), hbuf2, sizeof(hbuf2),
pbuf2, sizeof(pbuf2), fl);
- if (error) goto error_exit;
+ if (error) goto error_exit_name;
if (strcmp(hbuf, hbuf2) != 0|| strcmp(pbuf, pbuf2) != 0) {
freeaddrinfo(res);
rb_raise(rb_eSocket, "sockaddr resolved to multiple nodename");
@@ -1975,9 +1975,13 @@ sock_s_getnameinfo(argc, argv)
}
return rb_assoc_new(rb_tainted_str_new2(hbuf), rb_tainted_str_new2(pbuf));
- error_exit:
+ error_exit_addr:
if (res) freeaddrinfo(res);
- rb_raise(rb_eSocket, "%s", gai_strerror(error));
+ rb_raise(rb_eSocket, "getaddrinfo: %s", gai_strerror(error));
+
+ error_exit_name:
+ if (res) freeaddrinfo(res);
+ rb_raise(rb_eSocket, "getnameinfo: %s", gai_strerror(error));
}
static VALUE mConst;
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index 462d594ec0..4347e9012d 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -4,12 +4,13 @@
* Oct. 24, 1997 Y. Matsumoto
*/
+#include "ruby.h"
+#include "rubysig.h"
+#undef EXTERN /* avoid conflict with tcl.h of tcl8.2 or before */
#include <stdio.h>
#include <string.h>
#include <tcl.h>
#include <tk.h>
-#include "ruby.h"
-#include "rubysig.h"
#ifdef __MACOS__
# include <tkMac.h>
@@ -230,11 +231,11 @@ ip_new(self)
/* add ruby command to the interpreter */
#if TCL_MAJOR_VERSION >= 8
DUMP1("Tcl_CreateObjCommand(\"ruby\")");
- Tcl_CreateObjCommand(ptr->ip, "ruby", ip_ruby, (ClientData *)NULL,
+ Tcl_CreateObjCommand(ptr->ip, "ruby", ip_ruby, (ClientData)NULL,
(Tcl_CmdDeleteProc *)NULL);
#else
DUMP1("Tcl_CreateCommand(\"ruby\")");
- Tcl_CreateCommand(ptr->ip, "ruby", ip_ruby, (ClientData *)NULL,
+ Tcl_CreateCommand(ptr->ip, "ruby", ip_ruby, (ClientData)NULL,
(Tcl_CmdDeleteProc *)NULL);
#endif
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 505211244d..73ea9c9bf5 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -527,15 +527,15 @@ module TkCore
tk_call 'tk_messageBox', *hash_kv(keys)
end
- def getOpenFile(keys)
+ def getOpenFile(keys = nil)
tk_call 'tk_getOpenFile', *hash_kv(keys)
end
- def getSaveFile(keys)
+ def getSaveFile(keys = nil)
tk_call 'tk_getSaveFile', *hash_kv(keys)
end
- def chooseColor(keys)
+ def chooseColor(keys = nil)
tk_call 'tk_chooseColor', *hash_kv(keys)
end
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index 763c076d8a..cffd853bb7 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -547,12 +547,15 @@ The variable ruby-indent-level controls the amount of indentation.
(setq bol (point))
(end-of-line)
(skip-chars-backward " \t")
- (and (re-search-backward "#" (save-excursion
- (beginning-of-line)
- (point)) t)
- (setq state (ruby-parse-region parse-start (point)))
- (nth 0 state)
- (goto-char (nth 0 state)))
+ (let ((pos (point)))
+ (and
+ (re-search-backward "#" (save-excursion
+ (beginning-of-line)
+ (point)) t)
+ (skip-chars-backward " \t")
+ (setq state (ruby-parse-region parse-start (point)))
+ (nth 0 state)
+ (goto-char pos)))
(or (bobp) (forward-char -1))
(and
(or (and (looking-at ruby-symbol-re)
diff --git a/numeric.c b/numeric.c
index 868fb99c29..07ac50551e 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1148,11 +1148,10 @@ static VALUE
fix_lshift(x, y)
VALUE x, y;
{
- long val;
- int width;
+ long val, width;
val = NUM2LONG(x);
- width = NUM2INT(y);
+ width = NUM2LONG(y);
if (width > (sizeof(VALUE)*CHAR_BIT-1)
|| ((unsigned long)val)>>(sizeof(VALUE)*CHAR_BIT-1-width) > 0) {
return rb_big_lshift(rb_int2big(val), y);
@@ -1170,6 +1169,11 @@ fix_rshift(x, y)
i = NUM2LONG(y);
if (i < 0)
return fix_lshift(x, INT2FIX(-i));
+ if (i == 0) return x;
+ if (i >= sizeof(long)*CHAR_BIT-1) {
+ if (i < 0) return INT2FIX(-1);
+ return INT2FIX(0);
+ }
val = RSHIFT(FIX2LONG(x), i);
return INT2FIX(val);
}
@@ -1179,7 +1183,7 @@ fix_aref(fix, idx)
VALUE fix, idx;
{
unsigned long val = FIX2LONG(fix);
- int i = FIX2LONG(idx);
+ int i = NUM2INT(idx);
if (i < 0 || sizeof(VALUE)*CHAR_BIT-1 < i)
return INT2FIX(0);
diff --git a/parse.y b/parse.y
index 2d3ca54bab..a852d7f485 100644
--- a/parse.y
+++ b/parse.y
@@ -419,7 +419,6 @@ expr : mlhs '=' mrhs
}
| '!' command_call
{
- value_expr($2);
$$ = NEW_NOT(cond($2));
}
| arg
@@ -868,7 +867,6 @@ opt_call_args : none
call_args : command_call
{
- value_expr($1);
$$ = NEW_LIST($1);
}
| args ','
diff --git a/win32/win32.c b/win32/win32.c
index e7b0c19de3..e186e2af12 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -11,6 +11,7 @@
*/
#include "ruby.h"
+#include "rubysig.h"
#include <fcntl.h>
#include <process.h>
#include <sys/stat.h>
@@ -1823,6 +1824,7 @@ myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
fd_set file_rd;
fd_set file_wr;
int file_nfds;
+ int trap_immediate = rb_trap_immediate;
if (!NtSocketsInitialized++) {
StartSockets();
@@ -1841,6 +1843,8 @@ myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
if (wr) *wr = file_wr;
return file_nfds;
}
+ if (trap_immediate)
+ TRAP_END;
if ((r = select (nfds, rd, wr, ex, timeout)) == SOCKET_ERROR) {
errno = WSAGetLastError();
switch (errno) {
@@ -1849,6 +1853,8 @@ myselect (int nfds, fd_set *rd, fd_set *wr, fd_set *ex,
break;
}
}
+ if (trap_immediate)
+ TRAP_BEG;
return r;
}
@@ -1888,12 +1894,17 @@ SOCKET
myaccept (SOCKET s, struct sockaddr *addr, int *addrlen)
{
SOCKET r;
+ int trap_immediate = rb_trap_immediate;
if (!NtSocketsInitialized++) {
StartSockets();
}
+ if (trap_immediate)
+ TRAP_END;
if ((r = accept (TO_SOCKET(s), addr, addrlen)) == INVALID_SOCKET)
errno = WSAGetLastError();
+ if (trap_immediate)
+ TRAP_BEG;
return r;
}