From ecd1aab5266315f947b0568cb56fab4f63453c83 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 5 Jun 2000 08:46:59 +0000 Subject: 2000-06-05 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 27 ++++++++++++++++++++++----- bignum.c | 22 ++++++++++++++++++++-- configure.in | 5 +++-- eval.c | 4 +++- ext/extmk.rb.in | 16 ++++++++++++++++ io.c | 6 ++---- lib/mkmf.rb | 16 ++++++++++++++++ parse.y | 18 ++++++++++-------- string.c | 4 ++-- 9 files changed, 94 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 176669215b..b31aaf0bc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,10 +14,32 @@ Sun Jun 4 02:01:10 2000 WATANABE Hirofumi * lib/mkmf.rb: do not need to add -L$(topdir) in --enable-shared case. +Sat Jun 3 13:50:06 2000 Yukihiro Matsumoto + + * parse.y (rb_id2name): should support constant attrset + identifiers. + + * bignum.c (rb_big_eq): Bignum#== should not raise exception. + +Fri Jun 2 11:24:48 2000 Yukihiro Matsumoto + + * io.c (rb_io_popen): open with a block returns the value from the + block. old behavior was back. + +Fri Jun 2 00:42:31 2000 Yukihiro Matsumoto + + + * eval.c (rb_thread_cleanup): should clear priority for thread + termination. + Thu Jun 1 00:59:15 2000 Yukihiro Matsumoto * eval.c (rb_yield_0): convert Qundef to []. +Wed May 31 20:45:59 2000 Dave Thomas + + * string.c (rb_str_slice_bang): wrong argument number. + Wed May 31 12:37:04 2000 Yukihiro Matsumoto * eval.c (rb_exec_end_proc): print error message from END procs. @@ -37,11 +59,6 @@ Wed May 31 01:54:21 2000 Yukihiro Matsumoto Tue May 30 23:33:41 2000 Katsuyuki Komatsu - * ext/extmk.rb.in (have_library, have_func): remove unnecessary - try_link() call from the mswin32 platform branch. - - * lib/mkmf.rb (have_library, have_func): ditto. - * lib/mkmf.rb (create_makefile): add $(TARGET).ilk and *.pdb to cleanup files for mswin32. diff --git a/bignum.c b/bignum.c index f4f387cd20..c40f94f4d8 100644 --- a/bignum.c +++ b/bignum.c @@ -520,6 +520,10 @@ rb_big_cmp(x, y) case T_BIGNUM: break; + case T_FLOAT: + y = rb_dbl2big(RFLOAT(y)->value); + break; + default: return rb_num_coerce_bin(x, y); } @@ -542,8 +546,22 @@ static VALUE rb_big_eq(x, y) VALUE x, y; { - if (rb_big_cmp(x, y) == INT2FIX(0)) return Qtrue; - return Qfalse; + switch (TYPE(y)) { + case T_FIXNUM: + y = rb_int2big(FIX2LONG(y)); + break; + case T_BIGNUM: + break; + case T_FLOAT: + y = rb_dbl2big(RFLOAT(y)->value); + break; + default: + return Qfalse; + } + if (RBIGNUM(x)->sign != RBIGNUM(y)->sign) return Qfalse; + if (RBIGNUM(x)->len != RBIGNUM(y)->len) return Qfalse; + if (memcmp(BDIGITS(x),BDIGITS(y),RBIGNUM(y)->len) != 0) return Qfalse; + return Qtrue; } static VALUE diff --git a/configure.in b/configure.in index a6e26f3ed2..71aaa29ed4 100644 --- a/configure.in +++ b/configure.in @@ -425,6 +425,7 @@ if test "$with_dln_a_out" != yes; then netbsd*) CCDLFLAGS=-fpic case "$target_cpu" in mips*) CCDLFLAGS=-fPIC ;; + sparc) CCDLFLAGS=-fPIC ;; *) ;; esac ;; *) CCDLFLAGS=-fPIC;; @@ -432,7 +433,7 @@ if test "$with_dln_a_out" != yes; then else case "$target_os" in hpux*) CCDLFLAGS='+z';; - solaris*|irix*) CCDLFLAGS='-K PIC' ;; + solaris*|irix*) CCDLFLAGS='-KPIC' ;; sunos*) CCDLFLAGS='-PIC' ;; esix*|uxpds*) CCDLFLAGS='-KPIC' ;; *) CCDLFLAGS='' ;; @@ -453,7 +454,7 @@ if test "$with_dln_a_out" != yes; then rb_cv_dlopen=yes;; sunos*) LDSHARED='ld -assert nodefinitions' rb_cv_dlopen=yes;; - irix*) LDSHARED='ld -ignore_unresolved' + irix*) LDSHARED='ld -shared' rb_cv_dlopen=yes;; sysv4*) LDSHARED='ld -G' rb_cv_dlopen=yes;; diff --git a/eval.c b/eval.c index 814924b83a..5c9d16967f 100644 --- a/eval.c +++ b/eval.c @@ -6880,7 +6880,7 @@ rb_thread_schedule() } FOREACH_THREAD_FROM(curr, th) { - if (!next && (th->status <= THREAD_RUNNABLE)) { + if (th->status <= THREAD_RUNNABLE) { if (!next || next->priority < th->priority) next = th; } @@ -7283,6 +7283,7 @@ rb_thread_priority_set(thread, prio) th = rb_thread_check(thread); th->priority = NUM2INT(prio); + rb_thread_schedule(); return thread; } @@ -7643,6 +7644,7 @@ rb_thread_cleanup() if (th != curr_thread && th->status != THREAD_KILLED) { rb_thread_ready(th); th->gid = 0; + th->priority = 0; th->status = THREAD_TO_KILL; } } diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index 0c134671ec..44232da7a1 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -174,8 +174,16 @@ def have_library(lib, func="main") #include #include int main() { return 0; } +int t() { #{func}(); return 0; } +SRC + unless r + r = try_link(<<"SRC", libs) +#include +#include +int main() { return 0; } int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; } SRC + end else r = try_link(<<"SRC", libs) int main() { return 0; } @@ -218,8 +226,16 @@ def have_func(func) #include #include int main() { return 0; } +int t() { #{func}(); return 0; } +SRC + unless r + r = try_link(<<"SRC", libs) +#include +#include +int main() { return 0; } int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; } SRC + end else r = try_link(<<"SRC", libs) int main() { return 0; } diff --git a/io.c b/io.c index f5b6e45e85..21d76994b5 100644 --- a/io.c +++ b/io.c @@ -1613,8 +1613,7 @@ rb_io_popen(str, argc, argv, klass) } RBASIC(port)->klass = klass; if (rb_block_given_p()) { - rb_ensure(rb_yield, port, rb_io_close, port); - return Qnil; + return rb_ensure(rb_yield, port, rb_io_close, port); } return port; } @@ -1665,8 +1664,7 @@ rb_file_s_open(argc, argv, klass) } if (rb_block_given_p()) { - rb_ensure(rb_yield, file, rb_io_close, file); - return Qnil; + return rb_ensure(rb_yield, file, rb_io_close, file); } return file; diff --git a/lib/mkmf.rb b/lib/mkmf.rb index d456438604..5dc843f47b 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -159,8 +159,16 @@ def have_library(lib, func="main") #include #include int main() { return 0; } +int t() { #{func}(); return 0; } +SRC + unless r + r = try_link(<<"SRC", libs) +#include +#include +int main() { return 0; } int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; } SRC + end else r = try_link(<<"SRC", libs) int main() { return 0; } @@ -213,8 +221,16 @@ def have_func(func) #include #include int main() { return 0; } +int t() { #{func}(); return 0; } +SRC + unless r + r = try_link(<<"SRC", libs) +#include +#include +int main() { return 0; } int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; } SRC + end else r = try_link(<<"SRC", libs) int main() { return 0; } diff --git a/parse.y b/parse.y index f365b1f575..75c0ad8acd 100644 --- a/parse.y +++ b/parse.y @@ -4737,20 +4737,22 @@ rb_id2name(id) return name; if (is_attrset_id(id)) { - char *res; - ID id2; + ID id2 = (id & ~ID_SCOPE_MASK) | ID_LOCAL; - id2 = (id & ~ID_SCOPE_MASK) | ID_LOCAL; - res = rb_id2name(id2); + again: + name = rb_id2name(id2); + if (name) { + char *buf = ALLOCA_N(char, strlen(name)+2); - if (res) { - char *buf = ALLOCA_N(char, strlen(res)+2); - - strcpy(buf, res); + strcpy(buf, name); strcat(buf, "="); rb_intern(buf); return rb_id2name(id); } + if (is_local_id(id2)) { + id2 = (id & ~ID_SCOPE_MASK) | ID_CONST; + goto again; + } } return 0; } diff --git a/string.c b/string.c index a7e6082f6c..73657fc0d4 100644 --- a/string.c +++ b/string.c @@ -1053,8 +1053,8 @@ rb_str_slice_bang(argc, argv, str) buf[i] = argv[i]; } buf[i] = rb_str_new(0,0); - result = rb_str_aref_m(2, buf, str); - rb_str_aset_m(3, buf, str); + result = rb_str_aref_m(argc, buf, str); + rb_str_aset_m(argc+1, buf, str); return result; } -- cgit v1.2.3