1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

2000-02-01

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-02-01 03:12:21 +00:00
parent 1af83e4997
commit 73af1e949d
10 changed files with 219 additions and 137 deletions

View file

@ -1,3 +1,16 @@
Mon Jan 31 15:24:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* string.c (rb_str_sub): no bang method returns original string if
no change is made.
Wed Jan 26 22:30:47 2000 Shigeo Kobayashi <shigeo@tinyforest.gr.jp>
* numeric.c (flo_modulo): wrong result for negative modulo.
Wed Jan 26 11:43:41 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* file.c (test_c): should use S_ISCHR.
Sun Jan 16 20:12:13 2000 Koji Arai <JCA02266@nifty.ne.jp>
* eval.c (dvar_asgn): may need to push dvar.

93
configure vendored
View file

@ -3783,7 +3783,7 @@ else
int
main()
{
if (-1==(-1>>(unsigned)1))
if (-1==(-1>>1))
return 0;
return 1;
}
@ -3806,7 +3806,7 @@ 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)
#define RSHIFT(x,y) ((x)>>(int)y)
EOF
else
@ -3931,19 +3931,23 @@ if test "${with_default_kcode+set}" = set; then
utf8) cat >> confdefs.h <<\EOF
#define DEFAULT_KCODE KCODE_UTF8
EOF
;;
DEFAULT_KCODE="KCODE_UTF8";;
euc) cat >> confdefs.h <<\EOF
#define DEFAULT_KCODE KCODE_EUC
EOF
;;
DEFAULT_KCODE="KCODE_EUC";;
sjis) cat >> confdefs.h <<\EOF
#define DEFAULT_KCODE KCODE_SJIS
EOF
;;
DEFAULT_KCODE="KCODE_SJIS";;
none) cat >> confdefs.h <<\EOF
#define DEFAULT_KCODE KCODE_NONE
EOF
;;
DEFAULT_KCODE="KCODE_NONE";;
*) echo "configure: warning: $withval is not valid kcode; ignored" 1>&2;;
esac
fi
@ -3963,10 +3967,8 @@ fi
case "$host_os" in
linux*)
echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6
echo "configure:3970: checking whether ELF binaries are produced" >&5
echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6
echo "configure:3972: checking whether ELF binaries are produced" >&5
if eval "test \"`echo '$''{'rb_cv_binary_elf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@ -3974,7 +3976,7 @@ else
rb_cv_binary_elf=yes
else
cat > conftest.$ac_ext <<EOF
#line 3978 "configure"
#line 3980 "configure"
#include "confdefs.h"
/* Test for whether ELF binaries are produced */
@ -3994,7 +3996,7 @@ main() {
}
EOF
if { (eval echo configure:3998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:4000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
rb_cv_binary_elf=yes
else
@ -4009,6 +4011,16 @@ fi
fi
echo "$ac_t""$rb_cv_binary_elf" 1>&6
if test "$rb_cv_binary_elf" = yes; then
cat >> confdefs.h <<\EOF
#define USE_ELF 1
EOF
fi
case "$target_os" in
linux*)
if test "$rb_cv_binary_elf" = no; then
with_dln_a_out=yes
host_os=${host_os}-a_out
@ -4032,7 +4044,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:4036: checking whether OS depend dynamic link works" >&5
echo "configure:4048: checking whether OS depend dynamic link works" >&5
if test "$GCC" = yes; then
case "$host_os" in
nextstep*) ;;
@ -4051,9 +4063,8 @@ echo "configure:4036: checking whether OS depend dynamic link works" >&5
else
case "$host_os" in
hpux*) CCDLFLAGS='+z';;
solaris*) CCDLFLAGS='-K PIC' ;;
solaris*|irix*) CCDLFLAGS='-K PIC' ;;
sunos*) CCDLFLAGS='-PIC' ;;
irix*) CCDLFLAGS='-KPIC' ;;
esix*|uxpds*) CCDLFLAGS='-KPIC' ;;
*) CCDLFLAGS='' ;;
esac
@ -4073,7 +4084,7 @@ echo "configure:4036: checking whether OS depend dynamic link works" >&5
rb_cv_dlopen=yes;;
sunos*) LDSHARED='ld -assert nodefinitions'
rb_cv_dlopen=yes;;
irix*) LDSHARED='ld -shared'
irix*) LDSHARED='ld -ignore_unresolved'
rb_cv_dlopen=yes;;
sysv4*) LDSHARED='ld -G'
rb_cv_dlopen=yes;;
@ -4084,19 +4095,17 @@ echo "configure:4036: checking whether OS depend dynamic link works" >&5
linux*) LDSHARED="$CC -shared"
rb_cv_dlopen=yes ;;
freebsd*) LDSHARED="$CC -shared"
if test -x /usr/bin/objformat && \
test `/usr/bin/objformat` = "elf" ; then
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="-rdynamic"
DLDFLAGS='-Wl,-soname,$(.TARGET)'
rb_cv_freebsd_elf=yes
else
test "$GCC" = yes && `$CC --print-prog-name=ld` -v 2>&1 | grep "GNU ld" > /dev/null || LDSHARED="ld -Bshareable"
fi
rb_cv_dlopen=yes ;;
netbsd*) if test x"$netbsd_elf" = x"yes"; then
netbsd*) LDSHARED="ld -shared"
if test "$rb_cv_binary_elf" = yes; then
LDFLAGS="-export-dynamic"
fi
LDSHARED="ld -shared"
rb_cv_dlopen=yes ;;
openbsd*) LDSHARED="ld -Bforcearchive -Bshareable"
rb_cv_dlopen=yes ;;
@ -4153,12 +4162,12 @@ if test "$ac_cv_header_a_out_h" = yes; then
if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then
cat confdefs.h > config.h
echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6
echo "configure:4157: checking whether matz's dln works" >&5
echo "configure:4166: checking whether matz's dln works" >&5
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 4162 "configure"
#line 4171 "configure"
#include "confdefs.h"
#define USE_DLN_A_OUT
@ -4168,7 +4177,7 @@ int main() {
; return 0; }
EOF
if { (eval echo configure:4172: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:4181: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_dln_a_out=yes
else
@ -4275,7 +4284,7 @@ fi
case "$host_os" in
human*)
echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6
echo "configure:4279: checking for _harderr in -lsignal" >&5
echo "configure:4288: 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
@ -4283,7 +4292,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsignal $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4287 "configure"
#line 4296 "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
@ -4294,7 +4303,7 @@ int main() {
_harderr()
; return 0; }
EOF
if { (eval echo configure:4298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -4322,7 +4331,7 @@ else
fi
echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6
echo "configure:4326: checking for hmemset in -lhmem" >&5
echo "configure:4335: 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
@ -4330,7 +4339,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lhmem $LIBS"
cat > conftest.$ac_ext <<EOF
#line 4334 "configure"
#line 4343 "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
@ -4341,7 +4350,7 @@ int main() {
hmemset()
; return 0; }
EOF
if { (eval echo configure:4345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4354: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@ -4371,12 +4380,12 @@ fi
for ac_func in select gettimeofday
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4375: checking for $ac_func" >&5
echo "configure:4384: 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 4380 "configure"
#line 4389 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@ -4399,7 +4408,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:4403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:4412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@ -4424,7 +4433,7 @@ fi
done
echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6
echo "configure:4428: checking whether PD libc _dtos18 fail to convert big number" >&5
echo "configure:4437: 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
@ -4432,7 +4441,7 @@ else
rb_cv_missing__dtos18=no
else
cat > conftest.$ac_ext <<EOF
#line 4436 "configure"
#line 4445 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -4444,7 +4453,7 @@ main ()
}
EOF
if { (eval echo configure:4448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:4457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
rb_cv_missing__dtos18=yes
else
@ -4466,7 +4475,7 @@ EOF
fi
echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6
echo "configure:4470: checking whether PD libc fconvert fail to round" >&5
echo "configure:4479: 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
@ -4474,7 +4483,7 @@ else
rb_cv_missing_fconvert=no
else
cat > conftest.$ac_ext <<EOF
#line 4478 "configure"
#line 4487 "configure"
#include "confdefs.h"
#include <stdio.h>
@ -4487,7 +4496,7 @@ main ()
}
EOF
if { (eval echo configure:4491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:4500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
rb_cv_missing_fconvert=yes
else
@ -4585,15 +4594,17 @@ if test "$enable_shared" = 'yes'; then
;;
freebsd*)
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR)$(MINOR)'
if test "$rb_cv_freebsd_elf" != "yes" ; then
if test "$rb_cv_binary_elf" != "yes" ; then
LIBRUBY_SO="$LIBRUBY_SO.\$(TEENY)"
LIBRUBY_ALIASES=''
fi
;;
netbsd*)
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)'
if test x"$netbsd_elf" = "xyes"; then
if test "$rb_cv_binary_elf" = yes; then # ELF platforms
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR) lib$(RUBY_INSTALL_NAME).so'
else
LIBRUBY_ALIASES= # a.out platforms
fi
;;
solaris*)

5
dir.c
View file

@ -510,7 +510,7 @@ extract_path(p, pend)
len = pend - p;
alloc = ALLOC_N(char, len+1);
memcpy(alloc, p, len);
if (len > 0 && pend[-1] == '/') {
if (len > 1 && pend[-1] == '/') {
alloc[len-1] = 0;
}
else {
@ -579,8 +579,9 @@ glob(path, func, arg)
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
if (fnmatch(magic, dp->d_name, FNM_PERIOD|FNM_PATHNAME) == 0) {
char *fix = ALLOC_N(char, strlen(base)+NAMLEN(dp)+2);
#define BASE (*base && !(*base == '/' && !base[1]))
sprintf(fix, "%s%s%s", base, (*base)?"/":"", dp->d_name);
sprintf(fix, "%s%s%s", base, (BASE)?"/":"", dp->d_name);
if (!m) {
(*func)(fix, arg);
free(fix);

View file

@ -196,7 +196,9 @@ module TkComm
def _get_eval_string(str)
return nil if str == None
if str.kind_of?(Hash)
if str.kind_of?(String)
# do nothing
elsif str.kind_of?(Hash)
str = hash_kv(str).join(" ")
elsif str.kind_of?(Array)
str = array2tk_list(str)
@ -417,11 +419,11 @@ module TkCore
INTERP._invoke("proc", "rb_out", "args", "if {[set st [catch {ruby [format \"TkCore.callback %%Q!%s!\" $args]} ret]] != 0} {if {[regsub -all {!} $args {\\!} newargs] == 0} {return -code $st $ret} {if {[set st [catch {ruby [format \"TkCore.callback %%Q!%s!\" $newargs]} ret]] != 0} {return -code $st $ret} {return $ret}}} {return $ret}")
def callback_break
raise TkCallbackBreak, "Tk callback returns 'break' status"
fail TkCallbackBreak, "Tk callback returns 'break' status"
end
def callback_continue
raise TkCallbackContinue, "Tk callback returns 'continue' status"
fail TkCallbackContinue, "Tk callback returns 'continue' status"
end
def after(ms, cmd=Proc.new)
@ -527,8 +529,8 @@ module TkCore
args.unshift "unknown"
res = INTERP._invoke(*args)
rescue
raise unless /^invalid command/ =~ $!
raise err
fail unless /^invalid command/ =~ $!
fail err
end
end
if INTERP._return_value() != 0
@ -583,6 +585,32 @@ module Tk
def yscrollcommand(cmd=Proc.new)
configure_cmd 'yscrollcommand', cmd
end
def xview(*index)
v = tk_send('xview', *index)
list(v) if index.size == 0
end
def yview(*index)
v = tk_send('yview', *index)
list(v) if index.size == 0
end
def xscrollbar(bar=nil)
if bar
@xscrollbar = bar
@xscrollbar.orient 'horizontal'
self.xscrollcommand {|arg| @xscrollbar.set *arg}
@xscrollbar.command {|arg| self.xview *arg}
end
@xscrollbar
end
def yscrollbar(bar=nil)
if bar
@yscrollbar = bar
@yscrollbar.orient 'vertical'
self.yscrollcommand {|arg| @yscrollbar.set *arg}
@yscrollbar.command {|arg| self.yview *arg}
end
@yscrollbar
end
end
module Wm
@ -784,7 +812,7 @@ class TkVariable
INTERP._eval(format('global %s; set %s', @id, @id))
rescue
if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1"
raise
fail
else
Hash[*tk_split_simplelist(INTERP._eval(format('global %s; array get %s',
@id, @id)))]
@ -798,7 +826,7 @@ class TkVariable
INTERP._eval(format('global %s; set %s %s', @id, @id, s))
rescue
if INTERP._eval(format('global %s; array exists %s', @id, @id)) != "1"
raise
fail
else
if val == []
INTERP._eval(format('global %s; unset %s; set %s(0) 0; unset %s(0)',
@ -815,7 +843,7 @@ class TkVariable
INTERP._eval(format('global %s; unset %s; array set %s %s',
@id, @id, @id, s))
else
raise
fail
end
end
end
@ -2149,7 +2177,7 @@ end
class TkTextWin<TkWindow
def create_self
raise TypeError, "TkTextWin is abstract class"
fail TypeError, "TkTextWin is abstract class"
end
def bbox(index)
@ -2195,6 +2223,14 @@ class TkListbox<TkTextWin
def curselection
list(tk_send('curselection'))
end
def get(*index)
v = tk_send('get', *index)
if index.size == 1
v
else
tk_split_simplelist(v)
end
end
def nearest(y)
tk_send('nearest', y).to_i
end
@ -2213,14 +2249,6 @@ class TkListbox<TkTextWin
def selection_set(first, last=None)
tk_send 'selection', 'set', first, last
end
def xview(cmd, *more)
v = tk_send('xview', cmd, *more)
v.to_i if more.size == 0
end
def yview(cmd, *more)
v = tk_send('yview', cmd, *more)
v.to_i if more.size == 0
end
end
module TkTreatMenuEntryFont

View file

@ -6,6 +6,8 @@
require 'tk.rb'
class TkEntry<TkLabel
include Scrollable
WidgetClassName = 'Entry'.freeze
WidgetClassNames[WidgetClassName] = self
def self.to_eval
@ -15,9 +17,6 @@ class TkEntry<TkLabel
def create_self
tk_call 'entry', @path
end
def xscrollcommand(cmd=Proc.new)
configure_cmd 'xscrollcommand', cmd
end
def delete(s, e=None)
tk_send 'delete', s, e
@ -59,9 +58,6 @@ class TkEntry<TkLabel
def selection_to(index)
tk_send 'selection', 'to', index
end
def xview(*index)
tk_send 'xview', *index
end
def value
tk_send 'get'

2
file.c
View file

@ -423,7 +423,7 @@ test_c(obj, fname)
struct stat st;
if (rb_stat(fname, &st) < 0) return Qfalse;
if (S_ISBLK(st.st_mode)) return Qtrue;
if (S_ISCHR(st.st_mode)) return Qtrue;
return Qfalse;
}

View file

@ -330,8 +330,7 @@ flo_modulo(x, y, modulo)
result = value1 - value2 * value;
}
#endif
if (modulo &&
(RFLOAT(x)->value < 0.0) != (result < 0.0) && result != 0.0) {
if (modulo && value*result<0.0) {
result += value;
}
return rb_float_new(result);

29
parse.y
View file

@ -6,7 +6,7 @@
$Date$
created at: Fri May 28 18:02:42 JST 1993
Copyright (C) 1993-2000 Yukihiro Matsumoto
Copyright (C) 1993-1999 Yukihiro Matsumoto
************************************************/
@ -527,6 +527,10 @@ mlhs_node : variable
{
$$ = attrset($1, $3);
}
| primary tCOLON2 tIDENTIFIER
{
$$ = attrset($1, $3);
}
| backref
{
rb_backref_error($1);
@ -545,6 +549,10 @@ lhs : variable
{
$$ = attrset($1, $3);
}
| primary tCOLON2 tIDENTIFIER
{
$$ = attrset($1, $3);
}
| backref
{
rb_backref_error($1);
@ -678,6 +686,17 @@ arg : lhs '=' arg
$$ = NEW_OP_ASGN2($1, $3, $4, $5);
fixpos($$, $1);
}
| primary tCOLON2 tIDENTIFIER tOP_ASGN arg
{
if ($4 == tOROP) {
$4 = 0;
}
else if ($4 == tANDOP) {
$4 = 1;
}
$$ = NEW_OP_ASGN2($1, $3, $4, $5);
fixpos($$, $1);
}
| backref tOP_ASGN arg
{
rb_backref_error($1);
@ -721,7 +740,7 @@ arg : lhs '=' arg
$$ = $2;
}
else {
$$ = call_op($2, tUPLUS, 0);
$$ = call_op($2, tUPLUS, 0, 0);
}
}
| tUMINUS arg
@ -733,7 +752,7 @@ arg : lhs '=' arg
$$ = $2;
}
else {
$$ = call_op($2, tUMINUS, 0);
$$ = call_op($2, tUMINUS, 0, 0);
}
}
| arg '|' arg
@ -795,7 +814,7 @@ arg : lhs '=' arg
}
| '~' arg
{
$$ = call_op($2, '~', 0);
$$ = call_op($2, '~', 0, 0);
}
| arg tLSHFT arg
{
@ -3779,7 +3798,7 @@ arg_add(node1, node2)
return list_append(node1, node2);
}
else {
return NEW_ARGSCAT(node1, NEW_LIST(node2));
return NEW_ARGSCAT(node1, node2);
}
}

133
string.c
View file

@ -1043,10 +1043,11 @@ rb_str_sub(argc, argv, str)
VALUE *argv;
VALUE str;
{
VALUE val = rb_str_sub_bang(argc, argv, str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_sub_bang(argc, argv, dup)))
return str;
return dup;
}
static VALUE
@ -1150,10 +1151,11 @@ rb_str_gsub(argc, argv, str)
VALUE *argv;
VALUE str;
{
VALUE val = rb_str_gsub_bang(argc, argv, str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_gsub_bang(argc, argv, dup)))
return str;
return dup;
}
static VALUE
@ -1195,13 +1197,13 @@ rb_f_sub(argc, argv)
int argc;
VALUE *argv;
{
VALUE line, v;
VALUE line = uscore_get();
VALUE dup = rb_str_dup(line);
line = uscore_get();
v = rb_str_sub_bang(argc, argv, line = rb_str_dup(line));
if (NIL_P(v)) return line;
rb_lastline_set(v);
return v;
if (NIL_P(rb_str_sub_bang(argc, argv, dup)))
return line;
rb_lastline_set(dup);
return dup;
}
static VALUE
@ -1217,13 +1219,13 @@ rb_f_gsub(argc, argv)
int argc;
VALUE *argv;
{
VALUE line, v;
VALUE line = uscore_get();
VALUE dup = rb_str_dup(line);
line = uscore_get();
v = rb_str_gsub_bang(argc, argv, line = rb_str_dup(line));
if (NIL_P(v)) return line;
rb_lastline_set(v);
return v;
if (NIL_P(rb_str_gsub_bang(argc, argv, dup)))
return line;
rb_lastline_set(dup);
return dup;
}
static VALUE
@ -1518,10 +1520,11 @@ static VALUE
rb_str_upcase(str)
VALUE str;
{
VALUE val = rb_str_upcase_bang(str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_upcase_bang(dup)))
return str;
return dup;
}
static VALUE
@ -1552,10 +1555,11 @@ static VALUE
rb_str_downcase(str)
VALUE str;
{
VALUE val = rb_str_downcase_bang(str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_downcase_bang(dup)))
return str;
return dup;
}
static VALUE
@ -1588,10 +1592,11 @@ static VALUE
rb_str_capitalize(str)
VALUE str;
{
VALUE val = rb_str_capitalize_bang(str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_capitalize_bang(dup)))
return str;
return dup;
}
static VALUE
@ -1626,10 +1631,11 @@ static VALUE
rb_str_swapcase(str)
VALUE str;
{
VALUE val = rb_str_swapcase_bang(str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_swapcase_bang(dup)))
return str;
return dup;
}
typedef unsigned char *USTR;
@ -1777,10 +1783,11 @@ static VALUE
rb_str_tr(str, src, repl)
VALUE str, src, repl;
{
VALUE val = tr_trans(str = rb_str_dup(str), src, repl, 0);
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(tr_trans(dup, src, repl, 0)))
return str;
return dup;
}
static void
@ -1861,10 +1868,11 @@ rb_str_delete(argc, argv, str)
VALUE *argv;
VALUE str;
{
VALUE val = rb_str_delete_bang(argc, argv, str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_delete_bang(argc, argv, dup)))
return str;
return dup;
}
static VALUE
@ -1922,10 +1930,11 @@ rb_str_squeeze(argc, argv, str)
VALUE *argv;
VALUE str;
{
VALUE val = rb_str_squeeze_bang(argc, argv, str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_squeeze_bang(argc, argv, dup)))
return str;
return dup;
}
static VALUE
@ -1939,10 +1948,11 @@ static VALUE
rb_str_tr_s(str, src, repl)
VALUE str, src, repl;
{
VALUE val = tr_trans(str = rb_str_dup(str), src, repl, 1);
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(tr_trans(dup, src, repl, 1)))
return str;
return dup;
}
static VALUE
@ -2231,10 +2241,11 @@ static VALUE
rb_str_chop(str)
VALUE str;
{
VALUE val = rb_str_chop_bang(str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_chop_bang(dup)))
return str;
return dup;
}
static VALUE
@ -2248,11 +2259,12 @@ static VALUE
rb_f_chop()
{
VALUE str = uscore_get();
VALUE val = rb_str_chop_bang(str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
rb_lastline_set(val);
return val;
if (NIL_P(rb_str_chop_bang(dup)))
return str;
rb_lastline_set(dup);
return dup;
}
static VALUE
@ -2304,10 +2316,11 @@ rb_str_chomp(argc, argv, str)
VALUE *argv;
VALUE str;
{
VALUE val = rb_str_chomp_bang(argc, argv, str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_chomp_bang(argc, argv, dup)))
return str;
return dup;
}
static VALUE
@ -2324,11 +2337,12 @@ rb_f_chomp(argc, argv)
VALUE *argv;
{
VALUE str = uscore_get();
VALUE val = rb_str_chomp_bang(argc, argv, str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
rb_lastline_set(val);
return val;
if (NIL_P(rb_str_chomp_bang(argc, argv, dup)))
return str;
rb_lastline_set(dup);
return dup;
}
static VALUE
@ -2371,10 +2385,11 @@ static VALUE
rb_str_strip(str)
VALUE str;
{
VALUE val = rb_str_strip_bang(str = rb_str_dup(str));
VALUE dup = rb_str_dup(str);
if (NIL_P(val)) return str;
return val;
if (NIL_P(rb_str_strip_bang(dup)))
return str;
return dup;
}
static VALUE

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.4.4"
#define RUBY_RELEASE_DATE "2000-01-17"
#define RUBY_RELEASE_DATE "2000-02-01"
#define RUBY_VERSION_CODE 144
#define RUBY_RELEASE_CODE 20000117
#define RUBY_RELEASE_CODE 20000201