summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--bignum.c2
-rw-r--r--configure130
-rw-r--r--configure.in24
-rw-r--r--eval.c71
-rw-r--r--file.c2
-rw-r--r--lib/cgi-lib.rb2
-rw-r--r--lib/tk.rb82
-rw-r--r--parse.y15
-rw-r--r--ruby.h5
-rw-r--r--sample/test.rb22
-rw-r--r--version.h4
12 files changed, 250 insertions, 123 deletions
diff --git a/ChangeLog b/ChangeLog
index 491b3e7557..98c706bdac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Fri Jun 19 18:28:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * experimental release 1.1b9_27.
+
+Fri Jun 19 14:34:49 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (assign): support hack for nested multiple assignment.
+
+ * parse.y (mlhs): nested multiple assignment.
+
+ * eval.c (rb_eval): in-block variables now honors static scope.
+
+ * configure.in: RSHIFT check moved to configure.
+
Thu Jun 18 16:46:04 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* experimental release 1.1b9_26.
diff --git a/bignum.c b/bignum.c
index b09713af69..dc0c5492d1 100644
--- a/bignum.c
+++ b/bignum.c
@@ -176,7 +176,7 @@ str2inum(str, base)
while (ISSPACE(*str)) str++;
- if (*str == '|') {
+ if (*str == '+') {
str++;
}
else if (*str == '-') {
diff --git a/configure b/configure
index 411407a9f5..aca499b3db 100644
--- a/configure
+++ b/configure
@@ -3166,20 +3166,67 @@ EOF
fi
+echo $ac_n "checking whether right shift preserve sign bit""... $ac_c" 1>&6
+echo "configure:3171: checking whether right shift preserve sign bit" >&5
+if eval "test \"`echo '$''{'rb_cv_rshift_sign'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3179 "configure"
+#include "confdefs.h"
+
+#define FIXNUM_FLAG 0x01
+int
+main()
+{
+ return (-1!=(((-1)<<1)&FIXNUM_FLAG)>>1);
+}
+
+EOF
+if { (eval echo configure:3190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ rb_cv_rshift_sign=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ rb_cv_rshift_sign=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+ echo "$ac_t""$rb_cv_rshift_sign" 1>&6
+if test "$rb_cv_rshift_sign" = yes; then
+ cat >> confdefs.h <<\EOF
+#define RSHIFT(x,y) ((x)>>y)
+EOF
+
+else
+ cat >> confdefs.h <<\EOF
+#define RSHIFT(x,y) (((x)<0) ? ~((~(x))>>y) : (x)>>y)
+EOF
+
+fi
+
echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6
-echo "configure:3171: checking count field in FILE structures" >&5
+echo "configure:3218: checking count field in FILE structures" >&5
if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3176 "configure"
+#line 3223 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = stdin; f->_cnt = 0;
; return 0; }
EOF
-if { (eval echo configure:3183: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3230: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_fcnt="_cnt"
else
@@ -3189,14 +3236,14 @@ fi
rm -f conftest*
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3193 "configure"
+#line 3240 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = stdin; f->__cnt = 0;
; return 0; }
EOF
-if { (eval echo configure:3200: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_fcnt="__cnt"
else
@@ -3207,14 +3254,14 @@ rm -f conftest*
fi
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3211 "configure"
+#line 3258 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = stdin; f->_r = 0;
; return 0; }
EOF
-if { (eval echo configure:3218: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3265: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_fcnt="_r"
else
@@ -3225,14 +3272,14 @@ rm -f conftest*
fi
if test "$rb_cv_fcnt" = ""; then
cat > conftest.$ac_ext <<EOF
-#line 3229 "configure"
+#line 3276 "configure"
#include "confdefs.h"
#include <stdio.h>
int main() {
FILE *f = stdin; f->readCount = 0;
; return 0; }
EOF
-if { (eval echo configure:3236: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_fcnt="readCount"
else
@@ -3257,9 +3304,9 @@ fi
if test "$ac_cv_func_getpwent" = yes; then
echo $ac_n "checking struct passwd""... $ac_c" 1>&6
-echo "configure:3261: checking struct passwd" >&5
+echo "configure:3308: checking struct passwd" >&5
cat > conftest.$ac_ext <<EOF
-#line 3263 "configure"
+#line 3310 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3274,7 +3321,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3278 "configure"
+#line 3325 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3289,7 +3336,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3293 "configure"
+#line 3340 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3304,7 +3351,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3308 "configure"
+#line 3355 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3319,7 +3366,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3323 "configure"
+#line 3370 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3334,7 +3381,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3338 "configure"
+#line 3385 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3349,7 +3396,7 @@ fi
rm -f conftest*
cat > conftest.$ac_ext <<EOF
-#line 3353 "configure"
+#line 3400 "configure"
#include "confdefs.h"
#include <pwd.h>
EOF
@@ -3382,7 +3429,7 @@ fi
case "$host_os" in
linux*)
echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6
-echo "configure:3386: checking whether ELF binaries are produced" >&5
+echo "configure:3433: checking whether ELF binaries are produced" >&5
if eval "test \"`echo '$''{'rb_cv_linux_elf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3390,7 +3437,7 @@ else
:
else
cat > conftest.$ac_ext <<EOF
-#line 3394 "configure"
+#line 3441 "configure"
#include "confdefs.h"
/* Test for whether ELF binaries are produced */
@@ -3410,7 +3457,7 @@ main() {
}
EOF
-if { (eval echo configure:3414: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
rb_cv_linux_elf=yes
else
@@ -3440,7 +3487,7 @@ STATIC=
if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=unknown
echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6
-echo "configure:3444: checking whether OS depend dynamic link works" >&5
+echo "configure:3491: checking whether OS depend dynamic link works" >&5
if test "$GCC" = yes; then
case "$host_os" in
nextstep*) ;;
@@ -3518,13 +3565,13 @@ dln_a_out_works=no
if test "$ac_cv_header_a_out_h" = yes; then
if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then
echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6
-echo "configure:3522: checking whether matz's dln works" >&5
+echo "configure:3569: checking whether matz's dln works" >&5
cat confdefs.h > config.h
if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3528 "configure"
+#line 3575 "configure"
#include "confdefs.h"
#define USE_DLN_A_OUT
@@ -3534,7 +3581,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:3538: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3585: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_dln_a_out=yes
else
@@ -3631,7 +3678,7 @@ fi
case "$host_os" in
human*)
echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6
-echo "configure:3635: checking for _harderr in -lsignal" >&5
+echo "configure:3682: checking for _harderr in -lsignal" >&5
ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3639,7 +3686,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsignal $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3643 "configure"
+#line 3690 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3650,7 +3697,7 @@ int main() {
_harderr()
; return 0; }
EOF
-if { (eval echo configure:3654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3678,7 +3725,7 @@ else
fi
echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6
-echo "configure:3682: checking for hmemset in -lhmem" >&5
+echo "configure:3729: checking for hmemset in -lhmem" >&5
ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -3686,7 +3733,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lhmem $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3690 "configure"
+#line 3737 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -3697,7 +3744,7 @@ int main() {
hmemset()
; return 0; }
EOF
-if { (eval echo configure:3701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -3727,12 +3774,12 @@ fi
for ac_func in select
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3731: checking for $ac_func" >&5
+echo "configure:3778: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3736 "configure"
+#line 3783 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -3755,7 +3802,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:3759: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -3780,7 +3827,7 @@ fi
done
echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6
-echo "configure:3784: checking whether PD libc _dtos18 fail to convert big number" >&5
+echo "configure:3831: checking whether PD libc _dtos18 fail to convert big number" >&5
if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3788,7 +3835,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3792 "configure"
+#line 3839 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -3800,7 +3847,7 @@ main ()
}
EOF
-if { (eval echo configure:3804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
rb_cv_missing__dtos18=yes
else
@@ -3822,7 +3869,7 @@ EOF
fi
echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6
-echo "configure:3826: checking whether PD libc fconvert fail to round" >&5
+echo "configure:3873: checking whether PD libc fconvert fail to round" >&5
if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -3830,7 +3877,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 3834 "configure"
+#line 3881 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -3843,7 +3890,7 @@ main ()
}
EOF
-if { (eval echo configure:3847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
rb_cv_missing_fconvert=yes
else
@@ -3905,6 +3952,11 @@ if test "$host_os" = "beos"; then
esac
fi
+if test "$enable_shared" = 'yes'; then
+ LIBRUBY='libruby.so'
+ LIBRUBYARG='-L./ -lruby'
+fi
+
if test "$host_os" = "rhapsody" ; then
CFLAGS="$CFLAGS -no-precomp"
fi
diff --git a/configure.in b/configure.in
index c8f534d556..40e082fa42 100644
--- a/configure.in
+++ b/configure.in
@@ -231,6 +231,25 @@ fi
AC_C_BIGENDIAN
AC_CHAR_UNSIGNED
+AC_MSG_CHECKING(whether right shift preserve sign bit)
+AC_CACHE_VAL(rb_cv_rshift_sign,
+ [AC_TRY_RUN([
+#define FIXNUM_FLAG 0x01
+int
+main()
+{
+ return (-1!=(((-1)<<1)&FIXNUM_FLAG)>>1);
+}
+],
+ rb_cv_rshift_sign=yes,
+ rb_cv_rshift_sign=no)])
+ AC_MSG_RESULT($rb_cv_rshift_sign)
+if test "$rb_cv_rshift_sign" = yes; then
+ AC_DEFINE(RSHIFT(x,y), ((x)>>y))
+else
+ AC_DEFINE(RSHIFT(x,y), (((x)<0) ? ~((~(x))>>y) : (x)>>y))
+fi
+
AC_MSG_CHECKING([count field in FILE structures])
AC_CACHE_VAL(rb_cv_fcnt,
[AC_TRY_COMPILE([#include <stdio.h>],
@@ -550,6 +569,11 @@ if test "$host_os" = "beos"; then
esac
fi
+if test "$enable_shared" = 'yes'; then
+ LIBRUBY='libruby.so'
+ LIBRUBYARG='-L./ -lruby'
+fi
+
if test "$host_os" = "rhapsody" ; then
CFLAGS="$CFLAGS -no-precomp"
fi
diff --git a/eval.c b/eval.c
index 1069ed8c1c..095b5be20d 100644
--- a/eval.c
+++ b/eval.c
@@ -455,24 +455,11 @@ new_dvar(id, value)
}
static void
-push_dvar(id, value)
- ID id;
- VALUE value;
-{
- the_dyna_vars = new_dvar(id, value);
-}
-
-static void
mark_dvar(vars)
- struct RVarmap* vars;
+ struct RVarmap *vars;
{
- if (!vars) {
- the_dyna_vars = new_dvar(0, 0);
- the_dyna_vars->next = vars;
- }
- else {
- the_dyna_vars = vars;
- }
+ the_dyna_vars = new_dvar(0, 0);
+ the_dyna_vars->next = vars;
}
VALUE
@@ -503,6 +490,14 @@ dyna_var_ref(id)
return Qnil;
}
+void
+dyna_var_push(id, value)
+ ID id;
+ VALUE value;
+{
+ the_dyna_vars = new_dvar(id, value);
+}
+
VALUE
dyna_var_asgn(id, value)
ID id;
@@ -517,10 +512,26 @@ dyna_var_asgn(id, value)
}
vars = vars->next;
}
- push_dvar(id, value);
+ dyna_var_push(id, value);
return value;
}
+static void
+dvar_asgn_push(id, value)
+ ID id;
+ VALUE value;
+{
+ if (the_dyna_vars && the_dyna_vars->id == 0) {
+ struct RVarmap* vars = new_dvar(id, value);
+
+ vars->next = the_dyna_vars->next;
+ the_dyna_vars->next = vars;
+ }
+ else {
+ dyna_var_push(id, value);
+ }
+}
+
struct iter {
int iter;
struct iter *prev;
@@ -2081,15 +2092,7 @@ rb_eval(self, node)
case NODE_DASGN_PUSH:
result = rb_eval(self, node->nd_value);
- if (the_dyna_vars && the_dyna_vars->id == 0) {
- struct RVarmap* vars = new_dvar(node->nd_vid, result);
-
- vars->next = the_dyna_vars->next;
- the_dyna_vars->next = vars;
- }
- else {
- push_dvar(node->nd_vid, result);
- }
+ dvar_asgn_push(node->nd_vid, result);
break;
case NODE_GASGN:
@@ -2972,13 +2975,17 @@ assign(self, lhs, val)
break;
case NODE_DASGN_PUSH:
- push_dvar(lhs->nd_vid, val);
+ dvar_asgn_push(lhs->nd_vid, val);
break;
case NODE_CASGN:
rb_const_set(the_class, lhs->nd_vid, val);
break;
+ case NODE_MASGN:
+ massign(self, lhs, val);
+ break;
+
case NODE_CALL:
{
VALUE recv;
@@ -3817,7 +3824,7 @@ eval(self, src, scope, file, line)
old_block = the_block;
the_block = data->prev;
old_d_vars = the_dyna_vars;
- mark_dvar(data->d_vars);
+ the_dyna_vars = data->d_vars;
old_vmode = scope_vmode;
scope_vmode = data->vmode;
@@ -4864,10 +4871,6 @@ f_binding(self)
data->prev = 0;
}
- if (data->d_vars && data->d_vars->id) {
- push_dvar(0, 0);
- data->d_vars = the_dyna_vars;
- }
scope_dup(data->scope);
POP_BLOCK();
@@ -4922,10 +4925,6 @@ proc_s_new(klass)
break;
}
}
- if (data->d_vars && data->d_vars->id) {
- push_dvar(0, 0);
- data->d_vars = the_dyna_vars;
- }
obj_call_init(proc);
return proc;
diff --git a/file.c b/file.c
index 0feb226d22..8063850ab4 100644
--- a/file.c
+++ b/file.c
@@ -707,7 +707,7 @@ file_s_ftype(obj, fname)
#if defined(MSDOS) || defined(NT)
if (rb_stat(fname, &st) < 0)
- rb_sys_fail(RSTRIN(fname)->ptr);
+ rb_sys_fail(RSTRING(fname)->ptr);
#else
Check_SafeStr(fname);
if (lstat(RSTRING(fname)->ptr, &st) == -1) {
diff --git a/lib/cgi-lib.rb b/lib/cgi-lib.rb
index 362d13f8d0..1a6d16a6da 100644
--- a/lib/cgi-lib.rb
+++ b/lib/cgi-lib.rb
@@ -81,7 +81,7 @@ class CGI < SimpleDelegator
end
def CGI.error
- m = $!.dup
+ m = $!.to_s.dup
m.gsub!(/&/, '&amp;')
m.gsub!(/</, '&lt;')
m.gsub!(/>/, '&gt;')
diff --git a/lib/tk.rb b/lib/tk.rb
index 8a772f5dda..5d1d68d902 100644
--- a/lib/tk.rb
+++ b/lib/tk.rb
@@ -142,6 +142,29 @@ module TkComm
end
private :bool, :number, :string, :list, :window, :procedure
+ def _get_eval_string(str)
+ return nil if str == None
+ if str.kind_of?(Hash)
+ str = hash_kv(str).join(" ")
+ elsif str.kind_of?(Array)
+ str = array2tk_list(str)
+ elsif str.kind_of?(Proc)
+ str = install_cmd(str)
+ elsif str == nil
+ str = ""
+ elsif str == false
+ str = "0"
+ elsif str == true
+ str = "1"
+ elsif (str.respond_to?(:to_eval))
+ str = str.to_eval()
+ else
+ str = str.to_s()
+ end
+ return str
+ end
+ private :_get_eval_string
+
Tk_IDs = [0] # [0]-cmdid, [1]-winid
def _curr_cmd_id
id = format("c%.4d", Tk_IDs[0])
@@ -262,12 +285,26 @@ module TkComm
end
def after(ms, cmd=Proc.new)
- myid = _curr_cmd_id
- tk_call 'after', ms,
- install_cmd(proc{
- TkUtil.eval_cmd cmd
- uninstall_cmd myid
- })
+ myid = _curr_cmd_id
+ INTERP._eval('after '+ms+' '+_get_eval_string(install_cmd(proc{
+ TkUtil.eval_cmd cmd
+ uninstall_cmd myid
+ })))
+ return
+ if false #defined? Thread
+ Thread.start do
+ ms = Float(ms)/1000
+ ms = 10 if ms == 0
+ sleep ms/1000
+ cmd.call
+ end
+ else
+ myid = _curr_cmd_id
+ INTERP._eval('after '+ms+' '+_get_eval_string(install_cmd(proc{
+ TkUtil.eval_cmd cmd
+ uninstall_cmd myid
+ })))
+ end
end
def update(idle=nil)
@@ -296,28 +333,6 @@ module TkCore
TclTkLib.mainloop
end
- def _get_eval_string(str)
- return nil if str == None
- if str.kind_of?(Hash)
- str = hash_kv(str).join(" ")
- elsif str.kind_of?(Array)
- str = array2tk_list(str)
- elsif str.kind_of?(Proc)
- str = install_cmd(v)
- elsif str == nil
- str = ""
- elsif str == false
- str = "0"
- elsif str == true
- str = "1"
- elsif (str.respond_to?(:to_eval))
- str = str.to_eval()
- else
- str = str.to_s()
- end
- return str
- end
-
def tk_call(*args)
print args.join(" "), "\n" if $DEBUG
args.filter {|x|_get_eval_string(x)}
@@ -981,11 +996,14 @@ class TkObject<TkKernel
private :tk_send
def method_missing(id, *args)
- if (args.length == 1)
- configure id.id2name, args[0]
+ name = id.id2name
+ case args.length
+ when 1
+ configure name, args[0]
+ when 0
+ fail NameError, "undefined local variable or method `#{name}' for #{self.to_s}", error_at
else
- $@ = error_at
- super
+ fail NameError, "undefined method `#{name}' for #{self.to_s}", error_at
end
end
diff --git a/parse.y b/parse.y
index 1ba5da4375..50c8e389d4 100644
--- a/parse.y
+++ b/parse.y
@@ -437,6 +437,11 @@ mlhs : mlhs_head
{
$$ = NEW_MASGN(NEW_LIST($1), 0);
}
+ | tLPAREN mlhs ')'
+ {
+ $$ = $2;
+ }
+
| mlhs_head tSTAR lhs
{
$$ = NEW_MASGN(NEW_LIST($1), $3);
@@ -455,11 +460,19 @@ mlhs : mlhs_head
}
mlhs_head : lhs ','
+ | tLPAREN mlhs ')' ','
+ {
+ $$ = $2;
+ }
mlhs_tail : lhs
{
$$ = NEW_LIST($1);
}
+ | tLPAREN mlhs ')'
+ {
+ $$ = NEW_LIST($2);
+ }
| mlhs_tail ',' lhs
{
$$ = list_append($1, $3);
@@ -3428,7 +3441,7 @@ assignable(id, val)
}
else{
if (!dyna_var_defined(id)) {
- dyna_var_asgn(id, 0);
+ dyna_var_push(id, 0);
lhs = NEW_DASGN_PUSH(id, val);
}
else {
diff --git a/ruby.h b/ruby.h
index 59c8528381..b8a2635091 100644
--- a/ruby.h
+++ b/ruby.h
@@ -120,11 +120,6 @@ typedef unsigned int ID;
VALUE int2inum _((long));
#define INT2NUM(v) int2inum(v)
-#if (-1==(((-1)<<1)&FIXNUM_FLAG)>>1)
-# define RSHIFT(x,y) ((x)>>y)
-#else
-# define RSHIFT(x,y) (((x)<0) ? ~((~(x))>>y) : (x)>>y)
-#endif
#define FIX2LONG(x) RSHIFT((long)x,1)
#define FIX2ULONG(x) (((unsigned long)(x))>>1)
#define FIXNUM_P(f) (((long)(f))&FIXNUM_FLAG)
diff --git a/sample/test.rb b/sample/test.rb
index eccbf23382..d8926c6c29 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -749,11 +749,23 @@ x = proc{proc{}}.call
eval "(0..9).each{|i4| $x[i4] = proc{i4*2}}", x
ok($x[4].call == 8)
+x = binding
+eval "i = 1", x
+ok(eval("i", x) == 1)
+x = proc{binding}.call
+eval "i = 22", x
+ok(eval("i", x) == 22)
+$x = []
+x = proc{binding}.call
+eval "(0..9).each{|i4| $x[i4] = proc{i4*2}}", x
+ok($x[4].call == 8)
+
proc {
- p = proc{}
- foo = 1
- eval "foo = 10", p
- ok(eval("foo", p) == eval("foo"))
+ p = binding
+ eval "foo11 = 1", p
+ proc{foo11=22}.call
+ ok(eval("foo11", p) == eval("foo11"))
+ ok(eval("foo11") == 1)
}.call
check "system"
@@ -808,7 +820,7 @@ File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"`
$bad = false
for script in Dir["{lib,sample}/*.rb"]
- unless `./ruby -c #{script}` == "Syntax OK\n"
+ unless `./ruby -c #{script}`.chomp == "Syntax OK"
$bad = true
end
end
diff --git a/version.h b/version.h
index a5dcad63c1..4ed0fc630e 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define RUBY_VERSION "1.1b9_26"
-#define VERSION_DATE "98/06/18"
+#define RUBY_VERSION "1.1b9_27"
+#define VERSION_DATE "98/06/19"