mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* regex.c (re_search): should consider reverse search.
* dir.c (dir_s_chdir): warn only when invoked from multiple threads or block is not given. * object.c (rb_convert_type): should use rb_rescue(), not rb_rescue2(). * range.c (range_init): ditto. * object.c (rb_obj_dup): should free generic_ivar if original owns them. * string.c (rb_str_each_line): should propagate taint mark. * ext/nkf/nkf.c (rb_nkf_kconv): ditto. * eval.c (rb_f_require): revamp for simpler implementation. * file.c (rb_find_file_noext): use String object, instead of passing char* around. * file.c (rb_find_file): ditto. * dln.c (dln_load): should use NSLINKMODULE_OPTION_BINDNOW. * ruby.c (load_file): local variables 'c' remain uninitialized on xflag. * regex.c (re_match): prefetched escaped character too early. * eval.c (rb_call0): add argument check for attr_readers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f4b516777b
commit
03d1c9cd82
18 changed files with 959 additions and 446 deletions
52
ChangeLog
52
ChangeLog
|
@ -16,6 +16,10 @@ Sat Jul 14 02:55:02 2001 Akinori MUSHA <knu@iDaemons.org>
|
|||
|
||||
* ext/.cvsignore: let cvs ignore extinit.c.
|
||||
|
||||
Fri Jul 13 23:47:35 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* regex.c (re_search): should consider reverse search.
|
||||
|
||||
Fri Jul 13 22:26:09 2001 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* lib/mkmf.rb: use File::split to split a target into a prefix and
|
||||
|
@ -24,6 +28,11 @@ Fri Jul 13 22:26:09 2001 Akinori MUSHA <knu@iDaemons.org>
|
|||
|
||||
* ext/extmk.rb.in: ditto.
|
||||
|
||||
Fri Jul 13 02:36:10 2001 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* dir.c (dir_s_chdir): warn only when invoked from multiple
|
||||
threads or block is not given.
|
||||
|
||||
Thu Jul 12 15:11:48 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||
|
||||
* ext/socket/socket.c (ruby_connect): workaround for the setup of
|
||||
|
@ -45,10 +54,53 @@ Sun Jul 8 16:04:35 2001 Minero Aoki <aamine@loveruby.net>
|
|||
|
||||
* lib/net/protocol.rb (ProtoSocket#read): modify typo.
|
||||
|
||||
Sat Jul 7 17:45:35 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* object.c (rb_convert_type): should use rb_rescue(), not rb_rescue2().
|
||||
|
||||
* range.c (range_init): ditto.
|
||||
|
||||
Fri Jul 6 18:01:10 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* object.c (rb_obj_dup): should free generic_ivar if original owns
|
||||
them.
|
||||
|
||||
Fri Jul 6 02:15:06 2001 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* lib/tempfile.rb: a tempfile must be created with mode 0600.
|
||||
|
||||
Thu Jul 5 20:28:53 2001 Tietew <tietew@tietew.net>
|
||||
|
||||
* string.c (rb_str_each_line): should propagate taint mark.
|
||||
|
||||
* ext/nkf/nkf.c (rb_nkf_kconv): ditto.
|
||||
|
||||
Fri Jul 6 14:54:27 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_f_require): revamp for simpler implementation.
|
||||
|
||||
* file.c (rb_find_file_noext): use String object, instead of
|
||||
passing char* around.
|
||||
|
||||
* file.c (rb_find_file): ditto.
|
||||
|
||||
Thu Jul 5 22:01:02 2001 Mitsuhiro Kondo <kondo@nik-prt.co.jp>
|
||||
|
||||
* dln.c (dln_load): should use NSLINKMODULE_OPTION_BINDNOW.
|
||||
|
||||
Thu Jul 5 13:44:03 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* ruby.c (load_file): local variables 'c' remain uninitialized on
|
||||
xflag.
|
||||
|
||||
Thu Jul 5 10:00:59 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* regex.c (re_match): prefetched escaped character too early.
|
||||
|
||||
Wed Jul 4 08:58:30 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (rb_call0): add argument check for attr_readers.
|
||||
|
||||
Wed Jul 4 04:22:44 2001 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* lib/net/http.rb (HTTP#request_by_name): arg order changes.
|
||||
|
|
26
array.c
26
array.c
|
@ -726,6 +726,18 @@ rb_ary_clone(ary)
|
|||
return clone;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_ary_dup(ary)
|
||||
VALUE ary;
|
||||
{
|
||||
VALUE dup = rb_ary_new2(RARRAY(ary)->len);
|
||||
|
||||
OBJSETUP(dup, rb_obj_type(ary), T_ARRAY);
|
||||
MEMCPY(RARRAY(dup)->ptr, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
|
||||
RARRAY(dup)->len = RARRAY(ary)->len;
|
||||
return dup;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
to_ary(ary)
|
||||
VALUE ary;
|
||||
|
@ -973,7 +985,7 @@ static VALUE
|
|||
rb_ary_reverse_m(ary)
|
||||
VALUE ary;
|
||||
{
|
||||
return rb_ary_reverse(rb_obj_dup(ary));
|
||||
return rb_ary_reverse(rb_ary_dup(ary));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1034,7 +1046,7 @@ VALUE
|
|||
rb_ary_sort(ary)
|
||||
VALUE ary;
|
||||
{
|
||||
ary = rb_obj_dup(ary);
|
||||
ary = rb_ary_dup(ary);
|
||||
rb_ary_sort_bang(ary);
|
||||
return ary;
|
||||
}
|
||||
|
@ -1047,7 +1059,7 @@ rb_ary_collect(ary)
|
|||
VALUE collect;
|
||||
|
||||
if (!rb_block_given_p()) {
|
||||
return rb_obj_dup(ary);
|
||||
return rb_ary_new4(RARRAY(ary)->len, RARRAY(ary)->ptr);
|
||||
}
|
||||
|
||||
len = RARRAY(ary)->len;
|
||||
|
@ -1566,7 +1578,7 @@ static VALUE
|
|||
rb_ary_uniq(ary)
|
||||
VALUE ary;
|
||||
{
|
||||
ary = rb_obj_dup(ary);
|
||||
ary = rb_ary_dup(ary);
|
||||
rb_ary_uniq_bang(ary);
|
||||
return ary;
|
||||
}
|
||||
|
@ -1597,7 +1609,7 @@ static VALUE
|
|||
rb_ary_compact(ary)
|
||||
VALUE ary;
|
||||
{
|
||||
ary = rb_obj_dup(ary);
|
||||
ary = rb_ary_dup(ary);
|
||||
rb_ary_compact_bang(ary);
|
||||
return ary;
|
||||
}
|
||||
|
@ -1675,7 +1687,7 @@ static VALUE
|
|||
rb_ary_flatten(ary)
|
||||
VALUE ary;
|
||||
{
|
||||
ary = rb_obj_dup(ary);
|
||||
ary = rb_ary_dup(ary);
|
||||
rb_ary_flatten_bang(ary);
|
||||
return ary;
|
||||
}
|
||||
|
@ -1724,6 +1736,7 @@ Init_Array()
|
|||
rb_define_method(rb_cArray, "indexes", rb_ary_indexes, -1);
|
||||
rb_define_method(rb_cArray, "indices", rb_ary_indexes, -1);
|
||||
rb_define_method(rb_cArray, "clone", rb_ary_clone, 0);
|
||||
rb_define_method(rb_cArray, "clone", rb_ary_dup, 0);
|
||||
rb_define_method(rb_cArray, "join", rb_ary_join_m, -1);
|
||||
rb_define_method(rb_cArray, "reverse", rb_ary_reverse_m, 0);
|
||||
rb_define_method(rb_cArray, "reverse!", rb_ary_reverse_bang, 0);
|
||||
|
@ -1731,6 +1744,7 @@ Init_Array()
|
|||
rb_define_method(rb_cArray, "sort!", rb_ary_sort_bang, 0);
|
||||
rb_define_method(rb_cArray, "collect", rb_ary_collect, 0);
|
||||
rb_define_method(rb_cArray, "collect!", rb_ary_collect_bang, 0);
|
||||
rb_define_method(rb_cArray, "map", rb_ary_collect, 0);
|
||||
rb_define_method(rb_cArray, "map!", rb_ary_collect_bang, 0);
|
||||
rb_define_method(rb_cArray, "filter", rb_ary_filter, 0);
|
||||
rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
|
||||
|
|
701
config.guess
vendored
701
config.guess
vendored
File diff suppressed because it is too large
Load diff
299
config.sub
vendored
299
config.sub
vendored
|
@ -1,6 +1,10 @@
|
|||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
# Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2001-04-20'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
|
@ -25,6 +29,8 @@
|
|||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
# If it is invalid, we print an error message on stderr and exit with code 1.
|
||||
|
@ -45,30 +51,73 @@
|
|||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# It is wrong to echo any other type of specification.
|
||||
|
||||
if [ x$1 = x ]
|
||||
then
|
||||
echo Configuration name missing. 1>&2
|
||||
echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
|
||||
echo "or $0 ALIAS" 1>&2
|
||||
echo where ALIAS is a recognized configuration type. 1>&2
|
||||
exit 1
|
||||
fi
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
# First pass through any local machine types.
|
||||
usage="\
|
||||
Usage: $0 [OPTION] CPU-MFR-OPSYS
|
||||
$0 [OPTION] ALIAS
|
||||
|
||||
Canonicalize a configuration name.
|
||||
|
||||
Operation modes:
|
||||
-h, --help print this help, then exit
|
||||
-t, --time-stamp print date of last modification, then exit
|
||||
-v, --version print version number, then exit
|
||||
|
||||
Report bugs and patches to <config-patches@gnu.org>."
|
||||
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
|
||||
help="
|
||||
Try \`$me --help' for more information."
|
||||
|
||||
# Parse command line
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
--time-stamp | --time* | -t )
|
||||
echo "$timestamp" ; exit 0 ;;
|
||||
--version | -v )
|
||||
echo "$version" ; exit 0 ;;
|
||||
--help | --h* | -h )
|
||||
echo "$usage"; exit 0 ;;
|
||||
-- ) # Stop option processing
|
||||
shift; break ;;
|
||||
- ) # Use stdin as input.
|
||||
break ;;
|
||||
-* )
|
||||
echo "$me: invalid option $1$help"
|
||||
exit 1 ;;
|
||||
|
||||
*local*)
|
||||
# First pass through any local machine types.
|
||||
echo $1
|
||||
exit 0
|
||||
;;
|
||||
exit 0;;
|
||||
|
||||
*)
|
||||
;;
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) echo "$me: missing argument$help" >&2
|
||||
exit 1;;
|
||||
1) ;;
|
||||
*) echo "$me: too many arguments$help" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
linux*)
|
||||
nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*)
|
||||
os=-$maybe_os
|
||||
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
|
||||
;;
|
||||
|
@ -94,7 +143,7 @@ case $os in
|
|||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple)
|
||||
-apple | -axis)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
|
@ -105,7 +154,7 @@ case $os in
|
|||
-scout)
|
||||
;;
|
||||
-wrs)
|
||||
os=vxworks
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
|
@ -156,61 +205,83 @@ case $os in
|
|||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
-mint | -mint[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \
|
||||
| arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \
|
||||
| pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
| 580 | i960 | h8300 \
|
||||
| x86 | ppcbe | mipsbe | mipsle | shbe | shle \
|
||||
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
|
||||
| alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
|
||||
| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
|
||||
| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
|
||||
| hppa64 \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
|
||||
| alphaev6[78] \
|
||||
| we32k | ns16k | clipper | i370 | sh | sh[34] \
|
||||
| powerpc | powerpcle \
|
||||
| 1750a | dsp16xx | pdp10 | pdp11 \
|
||||
| mips16 | mips64 | mipsel | mips64el \
|
||||
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
|
||||
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr5000 | miprs64vr5000el \
|
||||
| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
|
||||
| thumb | d10v)
|
||||
| mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \
|
||||
| sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \
|
||||
| v850 | c4x \
|
||||
| thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \
|
||||
| pj | pjl | h8500)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65)
|
||||
m6811 | m68hc11 | m6812 | m68hc12)
|
||||
# Motorola 68HC11/12.
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-none
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65)
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[34567]86)
|
||||
i*86 | x86_64)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
i[3456]86-TOWNS*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/-TOWNS.*/-TOWNS/'`
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
*-*-*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
# FIXME: clean up the formatting here.
|
||||
vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \
|
||||
| arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
||||
| xmp-* | ymp-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
|
||||
| alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
|
||||
| x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
|
||||
| hppa2.0n-* | hppa64-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
|
||||
| alphaev6[78]-* \
|
||||
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
|
||||
| clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
|
||||
| sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \
|
||||
| mips16-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| f301-* | armv*-* | t3e-* \
|
||||
| mipstx39-* | mipstx39el-* | mcore-* \
|
||||
| f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \
|
||||
| [cjt]90-* \
|
||||
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | c30-* )
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \
|
||||
| bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*)
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
|
@ -247,14 +318,14 @@ case $basic_machine in
|
|||
os=-sysv
|
||||
;;
|
||||
amiga | amiga-*)
|
||||
basic_machine=m68k-cbm
|
||||
basic_machine=m68k-unknown
|
||||
;;
|
||||
amigaos | amigados)
|
||||
basic_machine=m68k-cbm
|
||||
basic_machine=m68k-unknown
|
||||
os=-amigaos
|
||||
;;
|
||||
amigaunix | amix)
|
||||
basic_machine=m68k-cbm
|
||||
basic_machine=m68k-unknown
|
||||
os=-sysv4
|
||||
;;
|
||||
apollo68)
|
||||
|
@ -301,13 +372,16 @@ case $basic_machine in
|
|||
basic_machine=cray2-cray
|
||||
os=-unicos
|
||||
;;
|
||||
[ctj]90-cray)
|
||||
basic_machine=c90-cray
|
||||
[cjt]90)
|
||||
basic_machine=${basic_machine}-cray
|
||||
os=-unicos
|
||||
;;
|
||||
crds | unos)
|
||||
basic_machine=m68k-crds
|
||||
;;
|
||||
cris | cris-* | etrax*)
|
||||
basic_machine=cris-axis
|
||||
;;
|
||||
da30 | da30-*)
|
||||
basic_machine=m68k-da30
|
||||
;;
|
||||
|
@ -355,6 +429,10 @@ case $basic_machine in
|
|||
basic_machine=tron-gmicro
|
||||
os=-sysv
|
||||
;;
|
||||
go32)
|
||||
basic_machine=i386-pc
|
||||
os=-go32
|
||||
;;
|
||||
h3050r* | hiux*)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
|
@ -428,22 +506,21 @@ case $basic_machine in
|
|||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[34567]86v32)
|
||||
i*86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[34567]86v4*)
|
||||
i*86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[34567]86v)
|
||||
i*86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[34567]86sol2)
|
||||
i*86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
|
@ -455,14 +532,6 @@ case $basic_machine in
|
|||
basic_machine=i386-unknown
|
||||
os=-vsta
|
||||
;;
|
||||
i386-go32 | go32)
|
||||
basic_machine=i386-unknown
|
||||
os=-go32
|
||||
;;
|
||||
i386-mingw32 | mingw32)
|
||||
basic_machine=i386-unknown
|
||||
os=-mingw32
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
|
@ -488,10 +557,14 @@ case $basic_machine in
|
|||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
*mint | *MiNT)
|
||||
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
|
@ -509,14 +582,22 @@ case $basic_machine in
|
|||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
mmix*)
|
||||
basic_machine=mmix-knuth
|
||||
os=-mmixware
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-unknown
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
|
@ -525,12 +606,8 @@ case $basic_machine in
|
|||
basic_machine=i386-unknown
|
||||
os=-netbsd
|
||||
;;
|
||||
hpcmips*-*)
|
||||
basic_machine=hpcmips-unknown
|
||||
os=-netbsd
|
||||
;;
|
||||
netwinder)
|
||||
basic_machine=armv4l-corel
|
||||
basic_machine=armv4l-rebel
|
||||
os=-linux
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
|
@ -578,9 +655,16 @@ case $basic_machine in
|
|||
basic_machine=i960-intel
|
||||
os=-mon960
|
||||
;;
|
||||
nonstopux)
|
||||
basic_machine=mips-compaq
|
||||
os=-nonstopux
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
op50n-* | op60c-*)
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
|
@ -610,28 +694,28 @@ case $basic_machine in
|
|||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | k6 | nexen)
|
||||
pentium | p5 | k5 | k6 | nexgen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | 6x86)
|
||||
pentiumpro | p6 | 6x86 | athlon)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i786-pc
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | k6-* | nexen-*)
|
||||
pentium-* | p5-* | k5-* | k6-* | nexgen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | 6x86-*)
|
||||
pentiumpro-* | p6-* | 6x86-* | athlon-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
;;
|
||||
power) basic_machine=rs6000-ibm
|
||||
power) basic_machine=power-ibm
|
||||
;;
|
||||
ppc) basic_machine=powerpc-unknown
|
||||
;;
|
||||
|
@ -646,6 +730,10 @@ case $basic_machine in
|
|||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
pw32)
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rom68k)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
|
@ -725,6 +813,10 @@ case $basic_machine in
|
|||
sun386 | sun386i | roadrunner)
|
||||
basic_machine=i386-sun
|
||||
;;
|
||||
sv1)
|
||||
basic_machine=sv1-cray
|
||||
os=-unicos
|
||||
;;
|
||||
symmetry)
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
|
@ -733,6 +825,10 @@ case $basic_machine in
|
|||
basic_machine=t3e-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tic54x | c54x*)
|
||||
basic_machine=tic54x-unknown
|
||||
os=-coff
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
|
@ -828,13 +924,20 @@ case $basic_machine in
|
|||
vax)
|
||||
basic_machine=vax-dec
|
||||
;;
|
||||
pdp10)
|
||||
# there are many clones, so DEC is not a safe bet
|
||||
basic_machine=pdp10-unknown
|
||||
;;
|
||||
pdp11)
|
||||
basic_machine=pdp11-dec
|
||||
;;
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc | sparcv9)
|
||||
sh3 | sh4)
|
||||
basic_machine=sh-unknown
|
||||
;;
|
||||
sparc | sparcv9 | sparcv9b)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
|
@ -856,6 +959,9 @@ case $basic_machine in
|
|||
basic_machine=c4x-none
|
||||
os=-coff
|
||||
;;
|
||||
*-unknown)
|
||||
# Make sure to match an already-canonicalized machine name.
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
|
@ -914,13 +1020,26 @@ case $os in
|
|||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -openstep* | -oskit* \
|
||||
| -darwin*)
|
||||
| -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
case $basic_machine in
|
||||
x86-* | i*86-*)
|
||||
;;
|
||||
*)
|
||||
os=-nto$os
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-nto*)
|
||||
os=-nto-qnx
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
| -macos* | -mpw* | -magic* | -mon960* | -lnews*)
|
||||
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
|
||||
;;
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
|
@ -931,6 +1050,12 @@ case $os in
|
|||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-wince*)
|
||||
os=-wince
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
|
@ -955,6 +1080,9 @@ case $os in
|
|||
-ns2 )
|
||||
os=-nextstep2
|
||||
;;
|
||||
-nsk*)
|
||||
os=-nsk
|
||||
;;
|
||||
# Preserve the version number of sinix5.
|
||||
-sinix5.*)
|
||||
os=`echo $os | sed -e 's|sinix|sysv|'`
|
||||
|
@ -989,7 +1117,7 @@ case $os in
|
|||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-mint* | -MiNT*)
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
os=-mint
|
||||
;;
|
||||
-uxpds)
|
||||
|
@ -1025,12 +1153,15 @@ case $basic_machine in
|
|||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-corel)
|
||||
arm*-rebel)
|
||||
os=-linux
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
pdp10-*)
|
||||
os=-tops20
|
||||
;;
|
||||
pdp11-*)
|
||||
os=-none
|
||||
;;
|
||||
|
@ -1139,7 +1270,7 @@ case $basic_machine in
|
|||
*-masscomp)
|
||||
os=-rtu
|
||||
;;
|
||||
f301-fujitsu)
|
||||
f30[01]-fujitsu | f700-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*-rom68k)
|
||||
|
@ -1199,7 +1330,7 @@ case $basic_machine in
|
|||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
|
@ -1217,7 +1348,7 @@ case $basic_machine in
|
|||
-mpw* | -macos*)
|
||||
vendor=apple
|
||||
;;
|
||||
-*mint | -*MiNT)
|
||||
-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
|
||||
vendor=atari
|
||||
;;
|
||||
esac
|
||||
|
@ -1226,3 +1357,11 @@ case $basic_machine in
|
|||
esac
|
||||
|
||||
echo $basic_machine$os
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "timestamp='"
|
||||
# time-stamp-format: "%:y-%02m-%02d"
|
||||
# time-stamp-end: "'"
|
||||
# End:
|
||||
|
|
15
dir.c
15
dir.c
|
@ -399,12 +399,15 @@ dir_chdir(path)
|
|||
}
|
||||
|
||||
static int chdir_blocking = 0;
|
||||
static VALUE chdir_thread = Qnil;
|
||||
|
||||
static VALUE
|
||||
chdir_restore(path)
|
||||
const char *path;
|
||||
{
|
||||
chdir_blocking--;
|
||||
if (chdir_blocking == 0)
|
||||
chdir_thread = Qnil;
|
||||
dir_chdir(path);
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -436,14 +439,18 @@ dir_s_chdir(argc, argv, obj)
|
|||
}
|
||||
}
|
||||
|
||||
if (chdir_blocking > 0)
|
||||
rb_warn("chdir during chdir block");
|
||||
if (chdir_blocking > 0) {
|
||||
if (!rb_block_given_p() || rb_thread_current() != chdir_thread)
|
||||
rb_warn("conflicting chdir during another chdir block");
|
||||
}
|
||||
|
||||
if (rb_block_given_p()) {
|
||||
char cwd[MAXPATHLEN];
|
||||
|
||||
GETCWD(cwd);
|
||||
chdir_blocking++;
|
||||
if (chdir_thread == Qnil)
|
||||
chdir_thread = rb_thread_current();
|
||||
dir_chdir(dist);
|
||||
return rb_ensure(rb_yield, path, chdir_restore, (VALUE)cwd);
|
||||
}
|
||||
|
@ -618,7 +625,7 @@ static void
|
|||
glob_helper(path, flags, func, arg)
|
||||
char *path;
|
||||
int flags;
|
||||
void (*func)();
|
||||
void (*func) _((const char*, VALUE));
|
||||
VALUE arg;
|
||||
{
|
||||
struct stat st;
|
||||
|
@ -763,7 +770,7 @@ rb_glob(path, func, arg)
|
|||
void
|
||||
rb_globi(path, func, arg)
|
||||
char *path;
|
||||
void (*func)();
|
||||
void (*func) _((const char*, VALUE));
|
||||
VALUE arg;
|
||||
{
|
||||
glob_helper(path, FNM_PERIOD|FNM_CASEFOLD, func, arg);
|
||||
|
|
2
dln.c
2
dln.c
|
@ -1383,7 +1383,7 @@ dln_load(file)
|
|||
rb_loaderror("Failed to load %.200s", file);
|
||||
}
|
||||
|
||||
NSLinkModule(obj_file, file, TRUE);
|
||||
NSLinkModule(obj_file, file, NSLINKMODULE_OPTION_BINDNOW);
|
||||
|
||||
/* lookup the initial function */
|
||||
/*NSIsSymbolNameDefined require function name without "_" */
|
||||
|
|
135
eval.c
135
eval.c
|
@ -2584,7 +2584,7 @@ rb_eval(self, n)
|
|||
break;
|
||||
|
||||
case NODE_ARGSPUSH:
|
||||
result = rb_ary_push(rb_obj_dup(rb_eval(self, node->nd_head)),
|
||||
result = rb_ary_push(rb_ary_dup(rb_eval(self, node->nd_head)),
|
||||
rb_eval(self, node->nd_body));
|
||||
break;
|
||||
|
||||
|
@ -4421,11 +4421,14 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
|
|||
}
|
||||
break;
|
||||
|
||||
/* for attr get/set */
|
||||
case NODE_IVAR:
|
||||
if (argc != 0) {
|
||||
rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)", argc);
|
||||
}
|
||||
case NODE_ATTRSET:
|
||||
/* for re-scoped/renamed method */
|
||||
case NODE_ZSUPER:
|
||||
/* for attr get/set */
|
||||
case NODE_ATTRSET:
|
||||
case NODE_IVAR:
|
||||
result = rb_eval(recv, body);
|
||||
break;
|
||||
|
||||
|
@ -5217,8 +5220,8 @@ rb_load(fname, wrap)
|
|||
VALUE fname;
|
||||
int wrap;
|
||||
{
|
||||
VALUE tmp;
|
||||
int state;
|
||||
char *file;
|
||||
volatile ID last_func;
|
||||
volatile VALUE wrapper = 0;
|
||||
volatile VALUE self = ruby_top_self;
|
||||
|
@ -5231,10 +5234,11 @@ rb_load(fname, wrap)
|
|||
else {
|
||||
SafeStringValue(fname);
|
||||
}
|
||||
file = rb_find_file(RSTRING(fname)->ptr);
|
||||
if (!file) {
|
||||
tmp = rb_find_file(fname);
|
||||
if (!tmp) {
|
||||
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
|
||||
}
|
||||
fname = tmp;
|
||||
|
||||
ruby_errinfo = Qnil; /* ensure */
|
||||
PUSH_VARS();
|
||||
|
@ -5269,7 +5273,7 @@ rb_load(fname, wrap)
|
|||
|
||||
DEFER_INTS;
|
||||
ruby_in_eval++;
|
||||
rb_load_file(file);
|
||||
rb_load_file(RSTRING(fname)->ptr);
|
||||
ruby_in_eval--;
|
||||
node = ruby_eval_tree;
|
||||
ALLOW_INTS;
|
||||
|
@ -5382,33 +5386,39 @@ rb_provided(feature)
|
|||
return rb_feature_p(feature, Qfalse);
|
||||
}
|
||||
|
||||
void
|
||||
rb_provide(feature)
|
||||
const char *feature;
|
||||
static void
|
||||
rb_provide_feature(feature)
|
||||
VALUE feature;
|
||||
{
|
||||
char *buf, *ext;
|
||||
char *ext;
|
||||
char *f = RSTRING(feature)->ptr;
|
||||
|
||||
ext = strrchr(feature, '.');
|
||||
ext = strrchr(f, '.');
|
||||
if (ext && (strcmp(DLEXT, ext) == 0
|
||||
#ifdef DLEXT2
|
||||
|| strcmp(DLEXT2, ext) == 0
|
||||
#endif
|
||||
)) {
|
||||
buf = ALLOCA_N(char, strlen(feature)+4);
|
||||
strcpy(buf, feature);
|
||||
ext = strrchr(buf, '.');
|
||||
strcpy(ext, ".so");
|
||||
feature = buf;
|
||||
feature = rb_str_new(RSTRING(feature)->ptr, ext-RSTRING(feature)->ptr);
|
||||
rb_str_cat2(feature, ".so");
|
||||
}
|
||||
if (rb_feature_p(feature, Qtrue)) return;
|
||||
rb_ary_push(rb_features, rb_str_new2(feature));
|
||||
if (rb_feature_p(RSTRING(feature)->ptr, Qtrue)) return;
|
||||
rb_ary_push(rb_features, feature);
|
||||
}
|
||||
|
||||
void
|
||||
rb_provide(feature)
|
||||
const char *feature;
|
||||
{
|
||||
rb_provide_feature(rb_str_new2(feature));
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_f_require(obj, fname)
|
||||
VALUE obj, fname;
|
||||
{
|
||||
char *ext, *file, *feature, *buf; /* OK */
|
||||
VALUE feature, tmp;
|
||||
char *ext, *ftptr; /* OK */
|
||||
volatile VALUE load;
|
||||
int state;
|
||||
volatile int safe = ruby_safe_level;
|
||||
|
@ -5418,68 +5428,70 @@ rb_f_require(obj, fname)
|
|||
return Qfalse;
|
||||
ext = strrchr(RSTRING(fname)->ptr, '.');
|
||||
if (ext) {
|
||||
feature = file = RSTRING(fname)->ptr;
|
||||
if (strcmp(".rb", ext) == 0) {
|
||||
file = rb_find_file(file);
|
||||
if (file) goto load_rb;
|
||||
feature = rb_str_dup(fname);
|
||||
tmp = rb_find_file(fname);
|
||||
if (tmp) {
|
||||
fname = tmp;
|
||||
goto load_rb;
|
||||
}
|
||||
}
|
||||
else if (strcmp(".so", ext) == 0 || strcmp(".o", ext) == 0) {
|
||||
if (strcmp(ext, DLEXT) != 0) {
|
||||
buf = ALLOCA_N(char, strlen(file)+sizeof(DLEXT)+4);
|
||||
strcpy(buf, feature);
|
||||
ext = strrchr(buf, '.');
|
||||
strcpy(ext, DLEXT);
|
||||
file = feature = buf;
|
||||
fname = rb_str_new(RSTRING(fname)->ptr, ext-RSTRING(fname)->ptr);
|
||||
tmp = rb_str_dup(fname);
|
||||
rb_str_cat2(tmp, DLEXT);
|
||||
tmp = rb_find_file(tmp);
|
||||
if (tmp) {
|
||||
feature = fname = tmp;
|
||||
goto load_dyna;
|
||||
}
|
||||
file = rb_find_file(file);
|
||||
if (file) goto load_dyna;
|
||||
#ifdef DLEXT2
|
||||
file = feature = RSTRING(fname)->ptr;
|
||||
if (strcmp(ext, DLEXT2) != 0) {
|
||||
buf = ALLOCA_N(char, strlen(file)+sizeof(DLEXT2)+4);
|
||||
strcpy(buf, feature);
|
||||
ext = strrchr(buf, '.');
|
||||
strcpy(ext, DLEXT2);
|
||||
file = feature = buf;
|
||||
tmp = rb_str_dup(fname);
|
||||
rb_str_cat2(tmp, DLEXT);
|
||||
tmp = rb_find_file(tmp);
|
||||
if (tmp) {
|
||||
feature = fname = tmp;
|
||||
goto load_dyna;
|
||||
}
|
||||
file = rb_find_file(file);
|
||||
if (file) goto load_dyna;
|
||||
#endif
|
||||
}
|
||||
else if (strcmp(DLEXT, ext) == 0) {
|
||||
feature = RSTRING(fname)->ptr;
|
||||
file = rb_find_file(feature);
|
||||
if (file) goto load_dyna;
|
||||
tmp = rb_find_file(fname);
|
||||
if (tmp) {
|
||||
feature = fname = tmp;
|
||||
goto load_dyna;
|
||||
}
|
||||
}
|
||||
#ifdef DLEXT2
|
||||
else if (strcmp(DLEXT2, ext) == 0) {
|
||||
feature = RSTRING(fname)->ptr;
|
||||
file = rb_find_file(feature);
|
||||
if (file) goto load_dyna;
|
||||
tmp = rb_find_file(fname);
|
||||
if (tmp) {
|
||||
feature = fname = tmp;
|
||||
goto load_dyna;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
buf = ALLOCA_N(char, strlen(RSTRING(fname)->ptr) + 5);
|
||||
strcpy(buf, RSTRING(fname)->ptr);
|
||||
switch (rb_find_file_noext(buf)) {
|
||||
tmp = fname;
|
||||
switch (rb_find_file_noext(&tmp)) {
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
fname = rb_str_new2(buf);
|
||||
file = feature = buf;
|
||||
feature = fname;
|
||||
fname = tmp;
|
||||
goto load_rb;
|
||||
|
||||
default:
|
||||
feature = buf;
|
||||
file = rb_find_file(buf);
|
||||
feature = fname;
|
||||
fname = rb_find_file(tmp);
|
||||
goto load_dyna;
|
||||
}
|
||||
rb_raise(rb_eLoadError, "No such file to load -- %s",
|
||||
RSTRING(fname)->ptr);
|
||||
|
||||
load_dyna:
|
||||
rb_provide(feature);
|
||||
rb_provide_feature(feature);
|
||||
{
|
||||
int volatile old_vmode = scope_vmode;
|
||||
|
||||
|
@ -5488,9 +5500,7 @@ rb_f_require(obj, fname)
|
|||
void *handle;
|
||||
|
||||
SCOPE_SET(SCOPE_PUBLIC);
|
||||
load = rb_str_new2(file);
|
||||
file = RSTRING(load)->ptr;
|
||||
handle = dln_load(file);
|
||||
handle = dln_load(RSTRING(fname)->ptr);
|
||||
rb_ary_push(ruby_dln_librefs, INT2NUM((long)handle));
|
||||
}
|
||||
POP_TAG();
|
||||
|
@ -5502,21 +5512,22 @@ rb_f_require(obj, fname)
|
|||
|
||||
load_rb:
|
||||
ruby_safe_level = 0;
|
||||
rb_provide(feature);
|
||||
rb_provide_feature(feature);
|
||||
/* loading ruby library should be serialized. */
|
||||
if (!loading_tbl) {
|
||||
loading_tbl = st_init_strtable();
|
||||
}
|
||||
/* partial state */
|
||||
st_insert(loading_tbl, strdup(feature), curr_thread);
|
||||
ftptr = ruby_strdup(RSTRING(feature)->ptr);
|
||||
st_insert(loading_tbl, ftptr, curr_thread);
|
||||
|
||||
PUSH_TAG(PROT_NONE);
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
rb_load(fname, 0);
|
||||
}
|
||||
POP_TAG();
|
||||
st_delete(loading_tbl, &feature, 0); /* loading done */
|
||||
free(feature);
|
||||
st_delete(loading_tbl, &ftptr, 0); /* loading done */
|
||||
free(ftptr);
|
||||
ruby_safe_level = safe;
|
||||
if (state) JUMP_TAG(state);
|
||||
|
||||
|
|
96
file.c
96
file.c
|
@ -2202,26 +2202,27 @@ is_macos_native_path(path)
|
|||
}
|
||||
#endif
|
||||
|
||||
static char*
|
||||
static int
|
||||
file_load_ok(file)
|
||||
char *file;
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
if (!f) return 0;
|
||||
f = fopen(file, "r");
|
||||
if (f == NULL) return 0;
|
||||
fclose(f);
|
||||
return file;
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern VALUE rb_load_path;
|
||||
|
||||
int
|
||||
rb_find_file_noext(file)
|
||||
char *file;
|
||||
rb_find_file_noext(filep)
|
||||
VALUE *filep;
|
||||
{
|
||||
char *path, *e, *found;
|
||||
char *fend = file + strlen(file);
|
||||
char *f = RSTRING(*filep)->ptr;
|
||||
VALUE fname;
|
||||
int i, j;
|
||||
|
||||
|
@ -2233,16 +2234,22 @@ rb_find_file_noext(file)
|
|||
0
|
||||
};
|
||||
|
||||
if (file[0] == '~') {
|
||||
fname = rb_str_new2(file);
|
||||
if (f[0] == '~') {
|
||||
fname = *filep;
|
||||
fname = rb_file_s_expand_path(1, &fname);
|
||||
file = StringValuePtr(fname);
|
||||
if (rb_safe_level() >= 2 && OBJ_TAINTED(fname)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_absolute_path(file)) {
|
||||
if (is_absolute_path(f)) {
|
||||
for (i=0; ext[i]; i++) {
|
||||
strcpy(fend, ext[i]);
|
||||
if (file_load_ok(file)) return i+1;
|
||||
fname = rb_str_dup(*filep);
|
||||
rb_str_cat2(fname, ext[i]);
|
||||
if (file_load_ok(RSTRING(fname)->ptr)) {
|
||||
*filep = fname;
|
||||
return i+1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -2256,71 +2263,76 @@ rb_find_file_noext(file)
|
|||
SafeStringValue(str);
|
||||
path = RSTRING(str)->ptr;
|
||||
for (j=0; ext[j]; j++) {
|
||||
strcpy(fend, ext[j]);
|
||||
found = dln_find_file(file, path);
|
||||
if (found && file_load_ok(found)) return j+1;
|
||||
fname = rb_str_dup(*filep);
|
||||
rb_str_cat2(fname, ext[j]);
|
||||
found = dln_find_file(RSTRING(fname)->ptr, path);
|
||||
if (found && file_load_ok(found)) {
|
||||
*filep = fname;
|
||||
return j+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char*
|
||||
rb_find_file(file)
|
||||
char *file;
|
||||
VALUE
|
||||
rb_find_file(path)
|
||||
VALUE path;
|
||||
{
|
||||
VALUE vpath, fname;
|
||||
char *path;
|
||||
VALUE tmp, fname;
|
||||
char *f = RSTRING(path)->ptr;
|
||||
char *lpath;
|
||||
struct stat st;
|
||||
|
||||
if (file[0] == '~') {
|
||||
fname = rb_str_new2(file);
|
||||
fname = rb_file_s_expand_path(1, &fname);
|
||||
if (rb_safe_level() >= 2 && OBJ_TAINTED(fname)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe file %s", file);
|
||||
if (f[0] == '~') {
|
||||
tmp = rb_file_s_expand_path(1, &path);
|
||||
if (rb_safe_level() >= 2 && OBJ_TAINTED(tmp)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
|
||||
}
|
||||
file = StringValuePtr(fname);
|
||||
}
|
||||
|
||||
#if defined(__MACOS__) || defined(riscos)
|
||||
if (is_macos_native_path(file)) {
|
||||
if (rb_safe_level() >= 2 && !rb_path_check(file)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe file %s", file);
|
||||
if (is_macos_native_path(f)) {
|
||||
if (rb_safe_level() >= 2 && !rb_path_check(f)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
|
||||
}
|
||||
return file_load_ok(file);
|
||||
if (file_load_ok(f)) return path;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (is_absolute_path(file)) {
|
||||
if (rb_safe_level() >= 2 && !rb_path_check(file)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe file %s", file);
|
||||
if (is_absolute_path(f)) {
|
||||
if (rb_safe_level() >= 2 && !rb_path_check(f)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
|
||||
}
|
||||
return file_load_ok(file);
|
||||
if (file_load_ok(f)) return path;
|
||||
}
|
||||
|
||||
if (rb_load_path) {
|
||||
int i;
|
||||
|
||||
Check_Type(rb_load_path, T_ARRAY);
|
||||
vpath = rb_ary_new();
|
||||
tmp = rb_ary_new();
|
||||
for (i=0;i<RARRAY(rb_load_path)->len;i++) {
|
||||
VALUE str = RARRAY(rb_load_path)->ptr[i];
|
||||
SafeStringValue(str);
|
||||
if (RSTRING(str)->len > 0) {
|
||||
rb_ary_push(vpath, str);
|
||||
rb_ary_push(tmp, str);
|
||||
}
|
||||
}
|
||||
vpath = rb_ary_join(vpath, rb_str_new2(PATH_SEP));
|
||||
path = StringValuePtr(vpath);
|
||||
if (rb_safe_level() >= 2 && !rb_path_check(path)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe path %s", path);
|
||||
tmp = rb_ary_join(tmp, rb_str_new2(PATH_SEP));
|
||||
lpath = StringValuePtr(tmp);
|
||||
if (rb_safe_level() >= 2 && !rb_path_check(lpath)) {
|
||||
rb_raise(rb_eSecurityError, "loading from unsafe path %s", lpath);
|
||||
}
|
||||
}
|
||||
else {
|
||||
path = 0;
|
||||
lpath = 0;
|
||||
}
|
||||
|
||||
path = dln_find_file(file, path);
|
||||
return file_load_ok(path);
|
||||
f = dln_find_file(f, lpath);
|
||||
if (file_load_ok(f)) {
|
||||
return rb_str_new2(f);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
9
intern.h
9
intern.h
|
@ -27,6 +27,7 @@ VALUE rb_ary_new4 _((long, VALUE *));
|
|||
VALUE rb_ary_freeze _((VALUE));
|
||||
VALUE rb_ary_aref _((int, VALUE*, VALUE));
|
||||
void rb_ary_store _((VALUE, long, VALUE));
|
||||
VALUE rb_ary_dup _((VALUE));
|
||||
VALUE rb_ary_to_ary _((VALUE));
|
||||
VALUE rb_ary_to_s _((VALUE));
|
||||
VALUE rb_ary_push _((VALUE, VALUE));
|
||||
|
@ -181,8 +182,8 @@ void rb_thread_atfork _((void));
|
|||
int eaccess _((const char*, int));
|
||||
VALUE rb_file_s_expand_path _((int, VALUE *));
|
||||
void rb_file_const _((const char*, VALUE));
|
||||
int rb_find_file_noext _((char*));
|
||||
char *rb_find_file _((char*));
|
||||
int rb_find_file_noext _((VALUE*));
|
||||
VALUE rb_find_file _((VALUE));
|
||||
/* gc.c */
|
||||
void rb_gc_mark_locations _((VALUE*, VALUE*));
|
||||
void rb_mark_tbl _((struct st_table*));
|
||||
|
@ -240,6 +241,8 @@ VALUE rb_obj_tainted _((VALUE));
|
|||
VALUE rb_obj_untaint _((VALUE));
|
||||
VALUE rb_obj_freeze _((VALUE));
|
||||
VALUE rb_obj_id _((VALUE));
|
||||
VALUE rb_obj_type _((VALUE));
|
||||
VALUE rb_class_real _((VALUE));
|
||||
VALUE rb_convert_type _((VALUE,int,const char*,const char*));
|
||||
VALUE rb_to_int _((VALUE));
|
||||
VALUE rb_Integer _((VALUE));
|
||||
|
@ -364,7 +367,7 @@ VALUE rb_f_untrace_var _((int, VALUE*));
|
|||
VALUE rb_f_global_variables _((void));
|
||||
void rb_alias_variable _((ID, ID));
|
||||
struct st_table* rb_generic_ivar_table _((VALUE));
|
||||
void rb_clone_generic_ivar _((VALUE,VALUE));
|
||||
void rb_copy_generic_ivar _((VALUE,VALUE));
|
||||
void rb_mark_generic_ivar _((VALUE));
|
||||
void rb_mark_generic_ivar_tbl _((void));
|
||||
void rb_free_generic_ivar _((VALUE));
|
||||
|
|
10
io.c
10
io.c
|
@ -190,7 +190,7 @@ rb_read_check(fp)
|
|||
}
|
||||
|
||||
static int
|
||||
rb_dup(orig)
|
||||
ruby_dup(orig)
|
||||
int orig;
|
||||
{
|
||||
int fd;
|
||||
|
@ -329,7 +329,7 @@ rb_io_seek(io, offset, whence)
|
|||
long pos;
|
||||
|
||||
GetOpenFile(io, fptr);
|
||||
pos = fseek(fptr->f, NUM2INT(offset), whence);
|
||||
pos = fseek(fptr->f, NUM2LONG(offset), whence);
|
||||
if (pos != 0) rb_sys_fail(fptr->path);
|
||||
clearerr(fptr->f);
|
||||
|
||||
|
@ -360,7 +360,7 @@ rb_io_set_pos(io, offset)
|
|||
long pos;
|
||||
|
||||
GetOpenFile(io, fptr);
|
||||
pos = fseek(fptr->f, NUM2INT(offset), SEEK_SET);
|
||||
pos = fseek(fptr->f, NUM2LONG(offset), SEEK_SET);
|
||||
if (pos != 0) rb_sys_fail(fptr->path);
|
||||
clearerr(fptr->f);
|
||||
|
||||
|
@ -2042,11 +2042,11 @@ rb_io_clone(io)
|
|||
else mode = "r+";
|
||||
break;
|
||||
}
|
||||
fd = rb_dup(fileno(orig->f));
|
||||
fd = ruby_dup(fileno(orig->f));
|
||||
fptr->f = rb_fdopen(fd, mode);
|
||||
if (fptr->f2) {
|
||||
if (fileno(orig->f) != fileno(orig->f2)) {
|
||||
fd = rb_dup(fileno(orig->f2));
|
||||
fd = ruby_dup(fileno(orig->f2));
|
||||
}
|
||||
fptr->f = rb_fdopen(fd, "w");
|
||||
}
|
||||
|
|
20
object.c
20
object.c
|
@ -70,18 +70,23 @@ rb_obj_id(obj)
|
|||
return (VALUE)((long)obj|FIXNUM_FLAG);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_obj_type(obj)
|
||||
VALUE obj;
|
||||
VALUE
|
||||
rb_class_real(cl)
|
||||
VALUE cl;
|
||||
{
|
||||
VALUE cl = CLASS_OF(obj);
|
||||
|
||||
while (FL_TEST(cl, FL_SINGLETON) || TYPE(cl) == T_ICLASS) {
|
||||
cl = RCLASS(cl)->super;
|
||||
}
|
||||
return cl;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_obj_type(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
return rb_class_real(CLASS_OF(obj));
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_obj_clone(obj)
|
||||
VALUE obj;
|
||||
|
@ -113,6 +118,9 @@ rb_obj_dup(obj)
|
|||
if (!SPECIAL_CONST_P(dup)) {
|
||||
OBJSETUP(dup, rb_obj_type(obj), BUILTIN_TYPE(obj));
|
||||
OBJ_INFECT(dup, obj);
|
||||
if (FL_TEST(obj, FL_EXIVAR)) {
|
||||
FL_SET(dup, FL_EXIVAR);
|
||||
}
|
||||
}
|
||||
return dup;
|
||||
}
|
||||
|
@ -866,7 +874,7 @@ rb_convert_type(val, type, tname, method)
|
|||
arg1.val = arg2.val = val;
|
||||
arg1.s = method;
|
||||
arg2.s = tname;
|
||||
val = rb_rescue2(to_type, (VALUE)&arg1, fail_to_type, (VALUE)&arg2);
|
||||
val = rb_rescue(to_type, (VALUE)&arg1, fail_to_type, (VALUE)&arg2);
|
||||
if (TYPE(val) != type) {
|
||||
rb_raise(rb_eTypeError, "%s#%s should return %s",
|
||||
rb_class2name(CLASS_OF(arg1.val)), method, tname);
|
||||
|
|
2
range.c
2
range.c
|
@ -45,7 +45,7 @@ range_init(obj, beg, end, exclude_end)
|
|||
|
||||
args[0] = beg; args[1] = end;
|
||||
if (!FIXNUM_P(beg) || !FIXNUM_P(end)) {
|
||||
rb_rescue2(range_check, (VALUE)args, range_failed, 0);
|
||||
rb_rescue(range_check, (VALUE)args, range_failed, 0);
|
||||
}
|
||||
|
||||
SET_EXCL(obj, exclude_end);
|
||||
|
|
4
regex.c
4
regex.c
|
@ -3264,7 +3264,7 @@ re_search(bufp, string, size, startpos, range, regs)
|
|||
}
|
||||
|
||||
if (startpos > size) return -1;
|
||||
if ((anchor || !bufp->can_be_null) && size > 0 && startpos == size)
|
||||
if ((anchor || !bufp->can_be_null) && range > 0 && size > 0 && startpos == size)
|
||||
return -1;
|
||||
val = re_match(bufp, string, size, startpos, regs);
|
||||
if (val >= 0) return startpos;
|
||||
|
@ -4237,7 +4237,6 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||
unsigned char c;
|
||||
|
||||
PREFETCH;
|
||||
c = *d++;
|
||||
if (*p == 0xff) {
|
||||
p++;
|
||||
if (!--mcnt
|
||||
|
@ -4246,6 +4245,7 @@ re_match(bufp, string_arg, size, pos, regs)
|
|||
goto fail;
|
||||
continue;
|
||||
}
|
||||
c = *d++;
|
||||
if (ismbchar(c)) {
|
||||
int n;
|
||||
|
||||
|
|
2
ruby.c
2
ruby.c
|
@ -770,7 +770,7 @@ load_file(fname, script)
|
|||
}
|
||||
|
||||
if (script) {
|
||||
VALUE c;
|
||||
VALUE c = 1; /* something not nil */
|
||||
VALUE line;
|
||||
char *p;
|
||||
|
||||
|
|
2
ruby.h
2
ruby.h
|
@ -244,7 +244,7 @@ VALUE rb_newobj _((void));
|
|||
#define CLONESETUP(clone,obj) do {\
|
||||
OBJSETUP(clone,rb_singleton_class_clone(RBASIC(obj)->klass),RBASIC(obj)->flags);\
|
||||
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);\
|
||||
if (FL_TEST(obj, FL_EXIVAR)) rb_clone_generic_ivar((VALUE)clone,(VALUE)obj);\
|
||||
if (FL_TEST(obj, FL_EXIVAR)) rb_copy_generic_ivar((VALUE)clone,(VALUE)obj);\
|
||||
} while (0)
|
||||
|
||||
struct RBasic {
|
||||
|
|
13
string.c
13
string.c
|
@ -100,11 +100,7 @@ rb_str_new4(orig)
|
|||
{
|
||||
VALUE klass;
|
||||
|
||||
klass = CLASS_OF(orig);
|
||||
while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
|
||||
klass = (VALUE)RCLASS(klass)->super;
|
||||
}
|
||||
|
||||
klass = rb_obj_type(orig);
|
||||
if (RSTRING(orig)->orig) {
|
||||
VALUE str;
|
||||
|
||||
|
@ -252,10 +248,7 @@ rb_str_dup(str)
|
|||
VALUE klass;
|
||||
|
||||
StringValue(str);
|
||||
klass = CLASS_OF(str);
|
||||
while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
|
||||
klass = (VALUE)RCLASS(klass)->super;
|
||||
}
|
||||
klass = rb_obj_type(str);
|
||||
|
||||
if (OBJ_FROZEN(str)) str2 = rb_str_new3(str);
|
||||
else if (FL_TEST(str, STR_NO_ORIG)) {
|
||||
|
@ -267,6 +260,8 @@ rb_str_dup(str)
|
|||
else {
|
||||
str2 = rb_str_new3(rb_str_new4(str));
|
||||
}
|
||||
if (FL_TEST(str, FL_EXIVAR))
|
||||
rb_copy_generic_ivar(str2, str);
|
||||
OBJ_INFECT(str2, str);
|
||||
RBASIC(str2)->klass = klass;
|
||||
return str2;
|
||||
|
|
|
@ -142,9 +142,6 @@ classname(klass)
|
|||
VALUE path = Qnil;
|
||||
ID classpath = rb_intern("__classpath__");
|
||||
|
||||
while (TYPE(klass) == T_ICLASS || FL_TEST(klass, FL_SINGLETON)) {
|
||||
klass = (VALUE)RCLASS(klass)->super;
|
||||
}
|
||||
if (!klass) klass = rb_cObject;
|
||||
if (!ROBJECT(klass)->iv_tbl)
|
||||
ROBJECT(klass)->iv_tbl = st_init_numtable();
|
||||
|
@ -173,7 +170,7 @@ VALUE
|
|||
rb_mod_name(mod)
|
||||
VALUE mod;
|
||||
{
|
||||
VALUE path = classname(mod);
|
||||
VALUE path = classname(rb_obj_type(mod));
|
||||
|
||||
if (path) return rb_str_dup(path);
|
||||
return rb_str_new(0,0);
|
||||
|
@ -183,7 +180,7 @@ VALUE
|
|||
rb_class_path(klass)
|
||||
VALUE klass;
|
||||
{
|
||||
VALUE path = classname(klass);
|
||||
VALUE path = classname(rb_class_real(klass));
|
||||
|
||||
if (path) return path;
|
||||
else {
|
||||
|
@ -871,7 +868,7 @@ rb_free_generic_ivar(obj)
|
|||
}
|
||||
|
||||
void
|
||||
rb_clone_generic_ivar(clone, obj)
|
||||
rb_copy_generic_ivar(clone, obj)
|
||||
VALUE clone, obj;
|
||||
{
|
||||
st_table *tbl;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.7.1"
|
||||
#define RUBY_RELEASE_DATE "2001-07-12"
|
||||
#define RUBY_RELEASE_DATE "2001-07-15"
|
||||
#define RUBY_VERSION_CODE 171
|
||||
#define RUBY_RELEASE_CODE 20010712
|
||||
#define RUBY_RELEASE_CODE 20010715
|
||||
|
|
Loading…
Reference in a new issue