summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-07 08:37:59 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-03-07 08:37:59 +0000
commit4d215cd9d3e0c4ea8ba802aa87773d6578c45a15 (patch)
tree0726d5ac3dbee381503921a9a6016c6dea786115
parent73d2362580ad40c267419a31cc1fd1bf550760c8 (diff)
2000-03-07
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog22
-rw-r--r--bignum.c4
-rw-r--r--class.c5
-rw-r--r--configure76
-rw-r--r--configure.in16
-rw-r--r--dir.c9
-rw-r--r--dln.c6
-rw-r--r--error.c24
-rw-r--r--eval.c8
-rw-r--r--ext/dbm/dbm.c3
-rw-r--r--ext/gdbm/gdbm.c3
-rw-r--r--ext/sdbm/init.c3
-rw-r--r--ext/socket/socket.c7
-rw-r--r--file.c31
-rw-r--r--gc.c5
-rw-r--r--hash.c4
-rw-r--r--io.c60
-rw-r--r--lib/e2mmap.rb34
-rw-r--r--lib/matrix.rb2
-rw-r--r--marshal.c8
-rw-r--r--numeric.c10
-rw-r--r--object.c47
-rw-r--r--parse.y2
-rw-r--r--process.c32
-rw-r--r--range.c2
-rw-r--r--re.c1
-rw-r--r--ruby.c7
-rw-r--r--ruby.h19
-rw-r--r--signal.c19
-rw-r--r--sprintf.c4
-rw-r--r--st.c4
-rw-r--r--string.c2
-rw-r--r--struct.c4
-rw-r--r--time.c9
-rw-r--r--util.c6
-rw-r--r--version.h8
36 files changed, 190 insertions, 316 deletions
diff --git a/ChangeLog b/ChangeLog
index 9aa1d4478c..d47395fec0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
+Tue Mar 7 01:44:27 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * io.c (set_stdin): simplified procedure, allows $stdin = DATA;
+ experimental.
+
+ * io.c (set_outfile): ditto.
+
+ * re.c (Init_Regexp): new method Regexp#last_match added; it's a
+ replacement for $~.
+
+ * configure.in (DEFAULT_KCODE): KCODE_NONE should be the default.
+
+ * dir.c (dir_s_rmdir): should return 0 on success.
+
+ * signal.c: remove CWGUSI support.
+
Mon Mar 6 12:28:37 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * marshal.c (w_symbol): support symbol object.
+
+ * util.c: make symbol as separated class.
+
+ * error.c (Init_Exception): new exception RangeError.
+
* ext/socket/socket.c (ip_addrsetup): should check length of hostname.
* ext/socket/socket.c (ip_addrsetup): check newline at the end of
diff --git a/bignum.c b/bignum.c
index ecc5953681..7d1a513cd9 100644
--- a/bignum.c
+++ b/bignum.c
@@ -404,7 +404,7 @@ big2ulong(x, type)
USHORT *ds;
if (len > sizeof(long)/sizeof(USHORT))
- rb_raise(rb_eArgError, "bignum too big to convert into `%s'", type);
+ rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
ds = BDIGITS(x);
num = 0;
while (len--) {
@@ -430,7 +430,7 @@ rb_big2long(x)
unsigned long num = big2ulong(x, "int");
if ((long)num < 0) {
- rb_raise(rb_eArgError, "bignum too big to convert into `int'");
+ rb_raise(rb_eRangeError, "bignum too big to convert into `int'");
}
if (!RBIGNUM(x)->sign) return -(long)num;
return num;
diff --git a/class.c b/class.c
index 5dcdcf6c0f..4048305491 100644
--- a/class.c
+++ b/class.c
@@ -15,10 +15,6 @@
#include "st.h"
#include <ctype.h>
-#ifdef USE_CWGUSI
-#include <stdio.h>
-#endif
-
extern st_table *rb_class_tbl;
VALUE
@@ -511,6 +507,7 @@ rb_singleton_class(obj)
VALUE obj;
{
VALUE klass;
+
if (rb_special_const_p(obj)) {
rb_raise(rb_eTypeError, "can't define singleton");
}
diff --git a/configure b/configure
index af51fc3c6e..e07ada1a71 100644
--- a/configure
+++ b/configure
@@ -2820,7 +2820,7 @@ else
#include "confdefs.h"
#include <alloca.h>
int main() {
-char *p = alloca(2 * sizeof(int));
+void *p = alloca(2 * sizeof(int));
; return 0; }
EOF
if { (eval echo configure:2827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
@@ -4205,35 +4205,24 @@ EOF
fi
+DEFAULT_KCODE="KCODE_NONE"
# Check whether --with-default-kcode or --without-default-kcode was given.
if test "${with_default_kcode+set}" = set; then
withval="$with_default_kcode"
case $withval in
- 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";;
+ utf8) DEFAULT_KCODE="KCODE_UTF8";;
+ euc) DEFAULT_KCODE="KCODE_EUC";;
+ sjis) DEFAULT_KCODE="KCODE_SJIS";;
+ none) DEFAULT_KCODE="KCODE_NONE";;
*) echo "configure: warning: $withval is not valid kcode; ignored" 1>&2;;
esac
fi
+cat >> confdefs.h <<EOF
+#define DEFAULT_KCODE $DEFAULT_KCODE
+EOF
+
# Check whether --with-dln-a-out or --without-dln-a-out was given.
if test "${with_dln_a_out+set}" = set; then
@@ -4250,7 +4239,7 @@ fi
echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6
-echo "configure:4254: checking whether ELF binaries are produced" >&5
+echo "configure:4243: 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
@@ -4258,7 +4247,7 @@ else
rb_cv_binary_elf=yes
else
cat > conftest.$ac_ext <<EOF
-#line 4262 "configure"
+#line 4251 "configure"
#include "confdefs.h"
/* Test for whether ELF binaries are produced */
@@ -4278,7 +4267,7 @@ main() {
}
EOF
-if { (eval echo configure:4282: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4271: \"$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
@@ -4326,7 +4315,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:4330: checking whether OS depend dynamic link works" >&5
+echo "configure:4319: checking whether OS depend dynamic link works" >&5
if test "$GCC" = yes; then
case "$target_os" in
nextstep*) ;;
@@ -4445,12 +4434,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:4449: checking whether matz's dln works" >&5
+echo "configure:4438: 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 4454 "configure"
+#line 4443 "configure"
#include "confdefs.h"
#define USE_DLN_A_OUT
@@ -4460,7 +4449,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:4464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
rb_cv_dln_a_out=yes
else
@@ -4567,7 +4556,7 @@ fi
case "$target_os" in
human*)
echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6
-echo "configure:4571: checking for _harderr in -lsignal" >&5
+echo "configure:4560: 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
@@ -4575,7 +4564,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsignal $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4579 "configure"
+#line 4568 "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
@@ -4586,7 +4575,7 @@ int main() {
_harderr()
; return 0; }
EOF
-if { (eval echo configure:4590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4579: \"$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
@@ -4614,7 +4603,7 @@ else
fi
echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6
-echo "configure:4618: checking for hmemset in -lhmem" >&5
+echo "configure:4607: 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
@@ -4622,7 +4611,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lhmem $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4626 "configure"
+#line 4615 "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
@@ -4633,7 +4622,7 @@ int main() {
hmemset()
; return 0; }
EOF
-if { (eval echo configure:4637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4626: \"$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
@@ -4663,12 +4652,12 @@ fi
for ac_func in select gettimeofday
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4667: checking for $ac_func" >&5
+echo "configure:4656: 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 4672 "configure"
+#line 4661 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4691,7 +4680,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4684: \"$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
@@ -4716,7 +4705,7 @@ fi
done
echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6
-echo "configure:4720: checking whether PD libc _dtos18 fail to convert big number" >&5
+echo "configure:4709: 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
@@ -4724,7 +4713,7 @@ else
rb_cv_missing__dtos18=no
else
cat > conftest.$ac_ext <<EOF
-#line 4728 "configure"
+#line 4717 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4736,7 +4725,7 @@ main ()
}
EOF
-if { (eval echo configure:4740: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4729: \"$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
@@ -4758,7 +4747,7 @@ EOF
fi
echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6
-echo "configure:4762: checking whether PD libc fconvert fail to round" >&5
+echo "configure:4751: 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
@@ -4766,7 +4755,7 @@ else
rb_cv_missing_fconvert=no
else
cat > conftest.$ac_ext <<EOF
-#line 4770 "configure"
+#line 4759 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4779,7 +4768,7 @@ main ()
}
EOF
-if { (eval echo configure:4783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4772: \"$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
@@ -5213,7 +5202,6 @@ s%@EXEEXT@%$EXEEXT%g
s%@OBJEXT@%$OBJEXT%g
s%@LIBOBJS@%$LIBOBJS%g
s%@ALLOCA@%$ALLOCA%g
-s%@DEFAULT_KCODE@%$DEFAULT_KCODE%g
s%@XLDFLAGS@%$XLDFLAGS%g
s%@DLDFLAGS@%$DLDFLAGS%g
s%@STATIC@%$STATIC%g
diff --git a/configure.in b/configure.in
index 7eae4b2f8d..e5779545eb 100644
--- a/configure.in
+++ b/configure.in
@@ -323,20 +323,18 @@ else
fi
dnl default value for $KANJI
-AC_SUBST(DEFAULT_KCODE)
+DEFAULT_KCODE="KCODE_NONE"
+
AC_ARG_WITH(default-kcode,
[--with-default-kcode=CODE specify default value for \$KCODE (utf8|euc|sjis|none)],
[case $withval in
- utf8) AC_DEFINE(DEFAULT_KCODE, KCODE_UTF8)
- DEFAULT_KCODE="KCODE_UTF8";;
- euc) AC_DEFINE(DEFAULT_KCODE, KCODE_EUC)
- DEFAULT_KCODE="KCODE_EUC";;
- sjis) AC_DEFINE(DEFAULT_KCODE, KCODE_SJIS)
- DEFAULT_KCODE="KCODE_SJIS";;
- none) AC_DEFINE(DEFAULT_KCODE, KCODE_NONE)
- DEFAULT_KCODE="KCODE_NONE";;
+ utf8) DEFAULT_KCODE="KCODE_UTF8";;
+ euc) DEFAULT_KCODE="KCODE_EUC";;
+ sjis) DEFAULT_KCODE="KCODE_SJIS";;
+ none) DEFAULT_KCODE="KCODE_NONE";;
*) AC_MSG_WARN($withval is not valid kcode; ignored);;
esac])
+AC_DEFINE_UNQUOTED(DEFAULT_KCODE, $DEFAULT_KCODE)
dnl wheather use dln_a_out ot not
AC_ARG_WITH(dln-a-out,
diff --git a/dir.c b/dir.c
index a5409a304d..9c64dd35e9 100644
--- a/dir.c
+++ b/dir.c
@@ -48,9 +48,6 @@
#endif
#include <errno.h>
-#ifdef USE_CWGUSI
-# include <sys/errno.h>
-#endif
#ifndef HAVE_STDLIB_H
char *getenv();
@@ -430,7 +427,7 @@ static VALUE
dir_s_chroot(dir, path)
VALUE dir, path;
{
-#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__) && !defined(USE_CWGUSI) && !defined(__BEOS__) && !defined(__EMX__) && !defined(riscos)
+#if !defined(DJGPP) && !defined(NT) && !defined(__human68k__) && !defined(__BEOS__) && !defined(__EMX__) && !defined(riscos)
rb_secure(2);
Check_SafeStr(path);
@@ -462,7 +459,7 @@ dir_s_mkdir(argc, argv, obj)
Check_SafeStr(path);
rb_secure(2);
-#if !defined(NT) && !defined(USE_CWGUSI)
+#if !defined(NT)
if (mkdir(RSTRING(path)->ptr, mode) == -1)
rb_sys_fail(RSTRING(path)->ptr);
#else
@@ -482,7 +479,7 @@ dir_s_rmdir(obj, dir)
if (rmdir(RSTRING(dir)->ptr) < 0)
rb_sys_fail(RSTRING(dir)->ptr);
- return Qtrue;
+ return INT2FIX(0);
}
/* Return nonzero if S has any special globbing chars in it. */
diff --git a/dln.c b/dln.c
index 10ea423643..789493db4f 100644
--- a/dln.c
+++ b/dln.c
@@ -37,11 +37,7 @@ void *xrealloc();
#endif
#include <stdio.h>
-#ifndef NT
-# ifndef USE_CWGUSI
-# include <sys/file.h>
-# endif
-#else
+#ifdef NT
#include "missing/file.h"
#endif
#include <sys/types.h>
diff --git a/error.c b/error.c
index 75b57ffb0e..ecfc7185fe 100644
--- a/error.c
+++ b/error.c
@@ -21,11 +21,6 @@
#define va_init_list(a,b) va_start(a)
#endif
-#ifdef USE_CWGUSI
-#include <sys/errno.h>
-int sys_nerr = 256;
-#endif
-
#if defined __CYGWIN__
# include <cygwin/version.h>
# if (CYGWIN_VERSION_API_MAJOR > 0) || (CYGWIN_VERSION_API_MINOR >= 8)
@@ -185,8 +180,10 @@ static struct types {
T_STRUCT, "Struct",
T_BIGNUM, "Bignum",
T_FILE, "File",
- T_TRUE, "TRUE",
- T_FALSE, "FALSE",
+ T_TRUE, "true",
+ T_FALSE, "false",
+ T_UNDEF, "Symbol", /* :symbol */
+ T_UNDEF, "undef", /* internal use: #undef */
T_DATA, "Data", /* internal use: wrapped C pointers */
T_MATCH, "Match", /* data of $~ */
T_VARMAP, "Varmap", /* internal use: dynamic variables */
@@ -242,6 +239,7 @@ VALUE rb_eRuntimeError;
VALUE rb_eTypeError;
VALUE rb_eArgError;
VALUE rb_eIndexError;
+VALUE rb_eRangeError;
VALUE rb_eSecurityError;
VALUE rb_eNotImpError;
VALUE rb_eNoMemError;
@@ -538,6 +536,7 @@ Init_Exception()
rb_eTypeError = rb_define_class("TypeError", rb_eStandardError);
rb_eArgError = rb_define_class("ArgumentError", rb_eStandardError);
rb_eIndexError = rb_define_class("IndexError", rb_eStandardError);
+ rb_eRangeError = rb_define_class("RangeError", rb_eStandardError);
rb_eScriptError = rb_define_class("ScriptError", rb_eException);
rb_eSyntaxError = rb_define_class("SyntaxError", rb_eScriptError);
@@ -650,17 +649,6 @@ rb_sys_fail(mesg)
ee = set_syserr(n, name);
}
#else
-# ifdef USE_CWGUSI
- if (n < 0) {
- int macoserr_index = sys_nerr - 1;
- if (!syserr_list[macoserr_index]) {
- char name[6];
- sprintf(name, "E%03d", macoserr_index);
- ee = set_syserr(macoserr_index, name);
- }
- }
- else
-#endif /* USE_CWGUSI */
if (n > sys_nerr || !syserr_list[n]) {
char name[6];
diff --git a/eval.c b/eval.c
index 66910fb9c0..579e9a2b7f 100644
--- a/eval.c
+++ b/eval.c
@@ -32,12 +32,6 @@ char *strrchr _((const char*,const char));
#include <net/socket.h>
#endif
-#ifdef USE_CWGUSI
-#include <sys/stat.h>
-#include <sys/errno.h>
-#include <compat.h>
-#endif
-
#ifdef __MACOS__
#include "macruby_private.h"
#endif
@@ -3814,7 +3808,7 @@ rb_undefined(obj, id, argc, argv, call_status)
VALUE *nargv;
nargv = ALLOCA_N(VALUE, argc+1);
- nargv[0] = INT2FIX(id);
+ nargv[0] = ID2SYM(id);
MEMCPY(nargv+1, argv, VALUE, argc);
last_call_status = call_status;
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index c68c5b427e..5377b4b6e3 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -18,9 +18,6 @@
#include <ndbm.h>
#include <fcntl.h>
#include <errno.h>
-#ifdef USE_CWGUSI
-# include <sys/errno.h>
-#endif
VALUE cDBM;
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index b4d8212717..3bf9669543 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -13,9 +13,6 @@
#include <gdbm.h>
#include <fcntl.h>
#include <errno.h>
-#ifdef USE_CWGUSI
-# include <sys/errno.h>
-#endif
VALUE cGDBM;
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index 5ebffcb9fd..b28b8e3ad2 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -15,9 +15,6 @@
#include "sdbm.h"
#include <fcntl.h>
#include <errno.h>
-#ifdef USE_CWGUSI
-# include <sys/errno.h>
-#endif
VALUE cSDBM;
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index ac79d89134..aee13a1a19 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -29,13 +29,6 @@
#include <sys/un.h>
#endif
-#ifdef USE_CWGUSI
-extern int fileno(FILE *stream); /* <unix.mac.h> */
-extern int rb_thread_select(int, fd_set*, fd_set*, fd_set*, struct timeval*); /* thread.c */
-# include <sys/errno.h>
-# include <GUSI.h>
-#endif
-
#if defined(HAVE_FCNTL)
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
diff --git a/file.c b/file.c
index 51c00a5958..1d98d6ebe8 100644
--- a/file.c
+++ b/file.c
@@ -58,13 +58,6 @@ char *strrchr _((const char*,const char));
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef USE_CWGUSI
- #include "macruby_missing.h"
- extern int fileno(FILE *stream);
- extern int utimes();
- char* strdup(char*);
-#endif
-
#ifdef __EMX__
#define lstat stat
#endif
@@ -107,11 +100,7 @@ rb_file_path(obj)
return rb_str_new2(fptr->path);
}
-#ifndef NT
-# ifndef USE_CWGUSI
-# include <sys/file.h>
-# endif
-#else
+#ifdef NT
#include "missing/file.h"
#endif
@@ -343,7 +332,7 @@ static int
group_member(gid)
GETGROUPS_T gid;
{
-#if !defined(NT) && !defined(USE_CWGUSI)
+#if !defined(NT)
if (getgid() == gid || getegid() == gid)
return Qtrue;
@@ -902,7 +891,7 @@ rb_file_chmod(obj, vmode)
mode = NUM2INT(vmode);
GetOpenFile(obj, fptr);
-#if defined(DJGPP) || defined(NT) || defined(USE_CWGUSI) || defined(__BEOS__) || defined(__EMX__)
+#if defined(DJGPP) || defined(NT) || defined(__BEOS__) || defined(__EMX__)
if (!fptr->path) return Qnil;
if (chmod(fptr->path, mode) == -1)
rb_sys_fail(fptr->path);
@@ -962,7 +951,7 @@ rb_file_chown(obj, owner, group)
rb_secure(2);
GetOpenFile(obj, fptr);
-#if defined(DJGPP) || defined(__CYGWIN32__) || defined(NT) || defined(USE_CWGUSI) || defined(__EMX__)
+#if defined(DJGPP) || defined(__CYGWIN32__) || defined(NT) || defined(__EMX__)
if (!fptr->path) return Qnil;
if (chown(fptr->path, NUM2INT(owner), NUM2INT(group)) == -1)
rb_sys_fail(fptr->path);
@@ -1061,16 +1050,12 @@ static VALUE
rb_file_s_link(obj, from, to)
VALUE obj, from, to;
{
-#if defined(USE_CWGUSI)
- rb_notimplement();
-#else
Check_SafeStr(from);
Check_SafeStr(to);
if (link(RSTRING(from)->ptr, RSTRING(to)->ptr) < 0)
rb_sys_fail(RSTRING(from)->ptr);
return INT2FIX(0);
-#endif /* USE_CWGUSI */
}
static VALUE
@@ -1146,9 +1131,6 @@ rb_file_s_umask(argc, argv)
int argc;
VALUE *argv;
{
-#ifdef USE_CWGUSI
- rb_notimplement();
-#else
int omask = 0;
rb_secure(2);
@@ -1163,7 +1145,6 @@ rb_file_s_umask(argc, argv)
rb_raise(rb_eArgError, "wrong # of argument");
}
return INT2FIX(omask);
-#endif /* USE_CWGUSI */
}
#if defined DOSISH
@@ -1495,9 +1476,6 @@ rb_file_flock(obj, operation)
VALUE obj;
VALUE operation;
{
-#ifdef USE_CWGUSI
- rb_notimplement();
-#else
OpenFile *fptr;
rb_secure(2);
@@ -1515,7 +1493,6 @@ rb_file_flock(obj, operation)
rb_sys_fail(fptr->path);
}
return INT2FIX(0);
-#endif /* USE_CWGUSI */
}
#undef flock
diff --git a/gc.c b/gc.c
index 4b337bc281..494e8f2331 100644
--- a/gc.c
+++ b/gc.c
@@ -450,7 +450,6 @@ rb_gc_mark(ptr)
Top:
if (FIXNUM_P(obj)) return; /* fixnum not marked */
if (rb_special_const_p((VALUE)obj)) return; /* special const not marked */
- if ((VALUE)obj == Qundef) return; /* special placeholder */
if (obj->as.basic.flags == 0) return; /* free cell */
if (obj->as.basic.flags & FL_MARK) return; /* already marked */
@@ -1219,10 +1218,10 @@ id2ref(obj, id)
ptr = id ^ FIXNUM_FLAG;
if (!looks_pointerp(ptr)) {
- rb_raise(rb_eIndexError, "0x%x is not id value", ptr);
+ rb_raise(rb_eRangeError, "0x%x is not id value", ptr);
}
if (BUILTIN_TYPE(ptr) == 0) {
- rb_raise(rb_eIndexError, "0x%x is recycled object", ptr);
+ rb_raise(rb_eRangeError, "0x%x is recycled object", ptr);
}
return (VALUE)ptr;
}
diff --git a/hash.c b/hash.c
index b7e7516354..781857aa25 100644
--- a/hash.c
+++ b/hash.c
@@ -19,10 +19,6 @@
char *strchr _((char*,char));
#endif
-#ifdef USE_CWGUSI
-char* strdup(const char*);
-#endif
-
#define HASH_DELETED FL_USER1
static void
diff --git a/io.c b/io.c
index eb580a2383..dcdd1b8476 100644
--- a/io.c
+++ b/io.c
@@ -54,12 +54,6 @@ struct timeval {
#include <unistd.h>
#endif
-#ifdef USE_CWGUSI
- #include <sys/errno.h>
- #include <unix.mac.h>
- #include <compat.h>
-#endif
-
#ifndef strdup
char *strdup();
#endif
@@ -110,8 +104,6 @@ static VALUE lineno;
# define READ_DATA_PENDING(fp) ((fp)->FILE_COUNT > 0)
#elif defined(__BEOS__)
# define ReadDataPending(fp) (fp->_state._eof == 0)
-#elif defined(USE_CWGUSI)
-# define READ_DATA_PENDING(fp) (fp->state.eof == 0)
#else
/* requires systems own version of the ReadDataPending() */
extern int ReadDataPending();
@@ -1109,8 +1101,7 @@ VALUE
rb_io_binmode(io)
VALUE io;
{
-#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__)\
- || defined(__human68k__) || defined(USE_CWGUSI) || defined(__EMX__)
+#if defined(NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__)
OpenFile *fptr;
GetOpenFile(io, fptr);
@@ -1120,17 +1111,10 @@ rb_io_binmode(io)
if (fptr->f2)
fmode(fptr->f2, _IOBIN);
#else
-# ifndef USE_CWGUSI
if (fptr->f && setmode(fileno(fptr->f), O_BINARY) == -1)
rb_sys_fail(fptr->path);
if (fptr->f2 && setmode(fileno(fptr->f2), O_BINARY) == -1)
rb_sys_fail(fptr->path);
-# else /* USE_CWGUSI */
- if (fptr->f)
- fptr->f->mode.binary_io = 1;
- if (fptr->f2)
- fptr->f2->mode.binary_io = 1;
-# endif /* USE_CWGUSI */
#endif
fptr->mode |= FMODE_BINMODE;
@@ -1327,12 +1311,6 @@ rb_file_sysopen_internal(klass, fname, flags, mode)
char *fname;
int flags, mode;
{
-#ifdef USE_CWGUSI
- if (mode != 0666) {
- rb_warn("can't specify file mode on this platform");
- }
- return rb_file_open_internal(klass, fname, rb_io_flags_mode(flags));
-#else
OpenFile *fptr;
int fd;
char *m;
@@ -1347,7 +1325,6 @@ rb_file_sysopen_internal(klass, fname, flags, mode)
fptr->path = strdup(fname);
return (VALUE)port;
-#endif
}
VALUE
@@ -1450,7 +1427,6 @@ static VALUE
pipe_open(pname, mode)
char *pname, *mode;
{
-#ifndef USE_CWGUSI
int modef = rb_io_mode_flags(mode);
OpenFile *fptr;
@@ -1557,10 +1533,6 @@ pipe_open(pname, mode)
}
}
#endif
-#else /* USE_CWGUSI */
- rb_notimplement();
- return Qnil; /* not reached */
-#endif
}
static VALUE
@@ -2135,19 +2107,7 @@ set_stdin(val, id, var)
GetOpenFile(val, fptr);
rb_io_check_readable(fptr);
-
- GetOpenFile(*var, fptr);
- mode = rb_io_mode_string(fptr);
- fd = rb_dup(fileno(fptr->f));
- if (fileno(fptr->f) > 2) {
- fclose(fptr->f);
- }
- fptr->f = rb_fdopen(fd, mode);
-
- GetOpenFile(val, fptr);
dup2(fileno(fptr->f), 0);
- fclose(fptr->f);
- fptr->f = stdin;
*var = val;
}
@@ -2181,22 +2141,8 @@ set_outfile(val, var, orig, stdf)
rb_io_check_writable(fptr);
GetOpenFile(*var, fptr);
- mode = rb_io_mode_string(fptr);
- f = GetWriteFile(fptr);
- fd = rb_dup(fileno(f));
- if (fileno(f) > 2) {
- fclose(fptr->f);
- }
- f = rb_fdopen(fd, mode);
- if (fptr->f2) fptr->f2 = f;
- else fptr->f = f;
-
- GetOpenFile(val, fptr);
f = GetWriteFile(fptr);
dup2(fileno(f), fileno(stdf));
- fclose(f);
- if (fptr->f2) fptr->f2 = stdf;
- else fptr->f = stdf;
*var = val;
}
@@ -2351,7 +2297,7 @@ next_argv()
#endif
}
fw = rb_fopen(fn, "w");
-#if !defined(MSDOS) && !defined(__CYGWIN__) && !(NT) && !defined(__human68k__) && !defined(USE_CWGUSI) && !defined(__BEOS__) && !defined(__EMX__)
+#if !defined(MSDOS) && !defined(__CYGWIN__) && !(NT) && !defined(__human68k__) && !defined(__BEOS__) && !defined(__EMX__)
fstat(fileno(fw), &st2);
fchmod(fileno(fw), st.st_mode);
if (st.st_uid!=st2.st_uid || st.st_gid!=st2.st_gid) {
@@ -2704,7 +2650,7 @@ rb_io_ctl(io, req, arg, io_p)
fd = fileno(fptr->f);
#ifdef HAVE_FCNTL
TRAP_BEG;
-# if defined(USE_CWGUSI) || defined(__CYGWIN__)
+# if defined(__CYGWIN__)
retval = io_p?ioctl(fd, cmd, (void*) narg):fcntl(fd, cmd, narg);
# else
retval = io_p?ioctl(fd, cmd, narg):fcntl(fd, cmd, narg);
diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb
index 2b023601d2..c5f54e06d5 100644
--- a/lib/e2mmap.rb
+++ b/lib/e2mmap.rb
@@ -60,7 +60,7 @@ module Exception2MessageMapper
cl.bind(self) unless cl == E2MM
end
- # 以前との互換性のために残してある.
+ # backward compatibility
def E2MM.extend_to(b)
c = eval("self", b)
c.extend(self)
@@ -81,15 +81,15 @@ module Exception2MessageMapper
end
# Fail(err, *rest)
- # err: 例外
- # rest: メッセージに渡すパラメータ
+ # err: exception
+ # rest: message arguments
#
def Raise(err = nil, *rest)
E2MM.Raise(self, err, *rest)
end
alias Fail Raise
- # 過去の互換性のため
+ # backward compatibility
alias fail! fail
def fail(err = nil, *rest)
begin
@@ -106,17 +106,17 @@ module Exception2MessageMapper
# def_e2message(c, m)
# c: exception
# m: message_form
- # 例外cのメッセージをmとする.
+ # define exception c with message m.
#
def def_e2message(c, m)
E2MM.def_e2message(self, c, m)
end
- # def_exception(c, m)
+ # def_exception(c, m, s)
# n: exception_name
# m: message_form
- # s: 例外スーパークラス(デフォルト: StandardError)
- # 例外名``c''をもつ例外を定義し, そのメッセージをmとする.
+ # s: superclass(default: StandardError)
+ # define exception named ``c'' with message m.
#
def def_exception(n, m, s = StandardError)
E2MM.def_exception(self, n, m, s)
@@ -129,22 +129,22 @@ module Exception2MessageMapper
@MessageMap = {}
# E2MM.def_exception(k, e, m)
- # k: 例外を定義するクラス
+ # k: class to define exception under.
# e: exception
# m: message_form
- # 例外cのメッセージをmとする.
+ # define exception c with message m.
#
def E2MM.def_e2message(k, c, m)
E2MM.instance_eval{@MessageMap[[k, c]] = m}
c
end
- # E2MM.def_exception(k, c, m)
- # k: 例外を定義するクラス
+ # E2MM.def_exception(k, c, m, s)
+ # k: class to define exception under.
# n: exception_name
# m: message_form
- # s: 例外スーパークラス(デフォルト: StandardError)
- # 例外名``c''をもつ例外を定義し, そのメッセージをmとする.
+ # s: superclass(default: StandardError)
+ # define exception named ``c'' with message m.
#
def E2MM.def_exception(k, n, m, s = StandardError)
n = n.id2name if n.kind_of?(Fixnum)
@@ -154,9 +154,9 @@ module Exception2MessageMapper
end
# Fail(klass, err, *rest)
- # klass: 例外の定義されているクラス
- # err: 例外
- # rest: メッセージに渡すパラメータ
+ # klass: class to define exception under.
+ # err: exception
+ # rest: message arguments
#
def E2MM.Raise(klass = E2MM, err = nil, *rest)
if form = e2mm_message(klass, err)
diff --git a/lib/matrix.rb b/lib/matrix.rb
index f31da643ff..80d28148ac 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -18,8 +18,6 @@
# :
# rown]
#
-# column: 列
-# row: 行
#
# module ExceptionForMatrix::
# Exceptions:
diff --git a/marshal.c b/marshal.c
index a2e6a0a40c..3a6d3bd000 100644
--- a/marshal.c
+++ b/marshal.c
@@ -17,7 +17,7 @@ double strtod();
#endif
#define MARSHAL_MAJOR 4
-#define MARSHAL_MINOR 3
+#define MARSHAL_MINOR 4
#define TYPE_NIL '0'
#define TYPE_TRUE 'T'
@@ -253,6 +253,10 @@ w_object(obj, arg, limit)
}
#endif
}
+ else if (SYMBOL_P(obj)) {
+ w_symbol(obj, arg);
+ return;
+ }
else {
int num;
@@ -877,6 +881,8 @@ r_object(arg)
}
return r_regist(m, arg);
}
+ case TYPE_SYMBOL:
+ return ID2SYM(r_symbol(arg));
default:
rb_raise(rb_eArgError, "dump format error(0x%x)", type);
diff --git a/numeric.c b/numeric.c
index a16863f6df..447817c625 100644
--- a/numeric.c
+++ b/numeric.c
@@ -721,7 +721,7 @@ rb_num2long(val)
sprintf(buf, "%-.10g", RFLOAT(val)->value);
if (s = strchr(buf, ' ')) *s = '\0';
- rb_raise(rb_eTypeError, "float %s out of rang of integer", buf);
+ rb_raise(rb_eRangeError, "float %s out of rang of integer", buf);
}
case T_BIGNUM:
@@ -763,7 +763,7 @@ rb_num2int(val)
long num = rb_num2long(val);
if (num < INT_MIN || INT_MAX < num) {
- rb_raise(rb_eArgError, "integer %d too big to convert to `int'", num);
+ rb_raise(rb_eRangeError, "integer %d too big to convert to `int'", num);
}
return (int)num;
}
@@ -775,7 +775,7 @@ rb_fix2int(val)
long num = FIXNUM_P(val)?FIX2LONG(val):rb_num2long(val);
if (num < INT_MIN || INT_MAX < num) {
- rb_raise(rb_eArgError, "integer %d too big to convert to `int'", num);
+ rb_raise(rb_eRangeError, "integer %d too big to convert to `int'", num);
}
return (int)num;
}
@@ -805,7 +805,7 @@ rb_num2fix(val)
v = rb_num2long(val);
if (!FIXABLE(v))
- rb_raise(rb_eTypeError, "integer %d out of range of fixnum", v);
+ rb_raise(rb_eRangeError, "integer %d out of range of fixnum", v);
return INT2FIX(v);
}
@@ -831,7 +831,7 @@ int_chr(num)
long i = NUM2LONG(num);
if (i < 0 || 0xff < i)
- rb_raise(rb_eTypeError, "%d out of char range", i);
+ rb_raise(rb_eRangeError, "%d out of char range", i);
c = i;
return rb_str_new(&c, 1);
}
diff --git a/object.c b/object.c
index d21e0460af..72429641e1 100644
--- a/object.c
+++ b/object.c
@@ -23,6 +23,7 @@ VALUE rb_cData;
VALUE rb_cNilClass;
VALUE rb_cTrueClass;
VALUE rb_cFalseClass;
+VALUE rb_cSymbol;
VALUE rb_f_sprintf();
VALUE rb_obj_alloc();
@@ -477,6 +478,29 @@ rb_obj_alloc(klass)
}
static VALUE
+sym_type(sym)
+ VALUE sym;
+{
+ return rb_cSymbol;
+}
+
+static VALUE
+sym_to_i(sym)
+ VALUE sym;
+{
+ ID id = SYM2ID(sym);
+
+ return INT2FIX(id);
+}
+
+static VALUE
+sym_to_s(sym)
+ VALUE sym;
+{
+ return rb_str_new2(rb_id2name(SYM2ID(sym)));
+}
+
+static VALUE
rb_mod_clone(module)
VALUE module;
{
@@ -644,12 +668,18 @@ rb_to_id(name)
{
ID id;
- if (TYPE(name) == T_STRING) {
+ switch (TYPE(name)) {
+ case T_STRING:
return rb_intern(RSTRING(name)->ptr);
- }
- id = NUM2UINT(name);
- if (!rb_id2name(id)) {
- rb_raise(rb_eArgError, "%d is not a symbol", id);
+ case T_FIXNUM:
+ id = FIX2INT(name);
+ if (!rb_id2name(id)) {
+ rb_raise(rb_eArgError, "%d is not a symbol", id);
+ }
+ break;
+ case T_SYMBOL:
+ id = SYM2ID(name);
+ break;
}
return id;
}
@@ -1069,6 +1099,13 @@ Init_Object()
rb_undef_method(CLASS_OF(rb_cNilClass), "new");
rb_define_global_const("NIL", Qnil);
+ rb_cSymbol = rb_define_class("Symbol", rb_cObject);
+ rb_undef_method(CLASS_OF(rb_cNilClass), "new");
+ rb_define_method(rb_cSymbol, "type", sym_type, 0);
+ rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0);
+ rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0);
+ rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0);
+
rb_define_method(rb_cModule, "===", rb_mod_eqq, 1);
rb_define_method(rb_cModule, "<=>", rb_mod_cmp, 1);
rb_define_method(rb_cModule, "<", rb_mod_lt, 1);
diff --git a/parse.y b/parse.y
index f2cecf0d61..73808532ca 100644
--- a/parse.y
+++ b/parse.y
@@ -1459,7 +1459,7 @@ ensure : none
literal : numeric
| symbol
{
- $$ = INT2FIX($1);
+ $$ = ID2SYM($1);
}
| tREGEXP
diff --git a/process.c b/process.c
index 38c72f5a6a..62ee886aa7 100644
--- a/process.c
+++ b/process.c
@@ -43,11 +43,6 @@ struct timeval rb_time_interval _((VALUE));
#endif
#include "st.h"
-#ifdef USE_CWGUSI
-# include <sys/errno.h>
-# include "macruby_missing.h"
-#endif
-
#ifdef __EMX__
#undef HAVE_GETPGRP
#endif
@@ -220,11 +215,9 @@ security(str)
char *str;
{
if (rb_safe_level() > 0) {
-#ifndef USE_CWGUSI
if (rb_env_path_tainted()) {
rb_raise(rb_eSecurityError, "Insecure PATH - %s", str);
}
-#endif
}
}
@@ -233,7 +226,6 @@ proc_exec_v(argv, prog)
char **argv;
char *prog;
{
-#ifndef USE_CWGUSI
if (prog) {
security(prog);
}
@@ -286,9 +278,6 @@ proc_exec_v(argv, prog)
execv(prog, argv);
after_exec();
return -1;
-#else /* USE_CWGUSI */
- rb_notimplement();
-#endif /* USE_CWGUSI */
}
static int
@@ -319,7 +308,6 @@ int
rb_proc_exec(str)
const char *str;
{
-#ifndef USE_CWGUSI
const char *s = str;
char *ss, *t;
char **argv, **a;
@@ -369,9 +357,6 @@ rb_proc_exec(str)
}
errno = ENOENT;
return -1;
-#else /* USE_CWGUSI */
- rb_notimplement();
-#endif /* USE_CWGUSI */
}
#if defined(__human68k__)
@@ -556,11 +541,8 @@ rb_f_exit_bang(argc, argv, obj)
else {
istatus = -1;
}
-#ifdef USE_CWGUSI
- exit(istatus);
-#else
_exit(istatus);
-#endif
+
return Qnil; /* not reached */
}
@@ -678,9 +660,6 @@ rb_f_system(argc, argv)
rb_last_status = state == -1 ? INT2FIX(127) : INT2FIX(state);
return state == 0 ? Qtrue : Qfalse;
#else
-#if defined(USE_CWGUSI)
- rb_notimplement();
-#else
volatile VALUE prog = 0;
int pid;
int i;
@@ -732,7 +711,6 @@ rb_f_system(argc, argv)
if (rb_last_status == INT2FIX(0)) return Qtrue;
return Qfalse;
-#endif /* USE_CWGUSI */
#endif /* __human68k__ */
#endif /* DJGPP */
#endif /* NT */
@@ -1022,13 +1000,9 @@ VALUE rb_mProcess;
void
Init_process()
{
-#ifndef USE_CWGUSI
rb_define_virtual_variable("$$", get_pid, 0);
-#endif
rb_define_readonly_variable("$?", &rb_last_status);
-#ifndef USE_CWGUSI
rb_define_global_function("exec", rb_f_exec, -1);
-#endif
rb_define_global_function("fork", rb_f_fork, 0);
rb_define_global_function("exit!", rb_f_exit_bang, -1);
rb_define_global_function("system", rb_f_system, -1);
@@ -1053,17 +1027,13 @@ Init_process()
rb_define_singleton_method(rb_mProcess, "fork", rb_f_fork, 0);
#endif
rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, -1);
-#ifndef USE_CWGUSI
rb_define_module_function(rb_mProcess, "kill", rb_f_kill, -1);
-#endif
#ifndef NT
rb_define_module_function(rb_mProcess, "wait", proc_wait, 0);
rb_define_module_function(rb_mProcess, "waitpid", proc_waitpid, 2);
-#ifndef USE_CWGUSI
rb_define_module_function(rb_mProcess, "pid", get_pid, 0);
rb_define_module_function(rb_mProcess, "ppid", get_ppid, 0);
-#endif /* ifndef USE_CWGUSI */
#endif /* ifndef NT */
rb_define_module_function(rb_mProcess, "getpgrp", proc_getpgrp, -1);
diff --git a/range.c b/range.c
index 22787bfb25..bbb24124bf 100644
--- a/range.c
+++ b/range.c
@@ -242,7 +242,7 @@ rb_range_beg_len(range, begp, lenp, len, err)
out_of_range:
if (err) {
- rb_raise(rb_eIndexError, "%d..%s%d out of range",
+ rb_raise(rb_eRangeError, "%d..%s%d out of range",
b, EXCL(range)?".":"", e);
}
return Qnil;
diff --git a/re.c b/re.c
index 72fae4728d..cc435e2efa 100644
--- a/re.c
+++ b/re.c
@@ -1292,6 +1292,7 @@ Init_Regexp()
rb_define_method(rb_cRegexp, "source", rb_reg_source, 0);
rb_define_method(rb_cRegexp, "casefold?", rb_reg_casefold_p, 0);
rb_define_method(rb_cRegexp, "kcode", rb_reg_kcode_m, 0);
+ rb_define_method(rb_cRegexp, "last_match", match_getter, 0);
rb_define_const(rb_cRegexp, "IGNORECASE", INT2FIX(RE_OPTION_IGNORECASE));
rb_define_const(rb_cRegexp, "EXTENDED", INT2FIX(RE_OPTION_EXTENDED));
diff --git a/ruby.c b/ruby.c
index 22bc2b3629..2e813e9dcc 100644
--- a/ruby.c
+++ b/ruby.c
@@ -28,10 +28,6 @@
#include <unistd.h>
#endif
-#ifdef USE_CWGUSI
-#include "macruby_missing.h"
-#endif
-
#ifndef HAVE_STRING_H
char *strchr _((const char*,const char));
char *strrchr _((const char*,const char));
@@ -707,7 +703,6 @@ load_file(fname, script)
while (p < pend && ISSPACE(*p))
p++;
path = p; /* interpreter path */
-#ifndef USE_CWGUSI
while (p < pend && !ISSPACE(*p))
p++;
*p++ = '\0';
@@ -721,7 +716,7 @@ load_file(fname, script)
}
argv[0] = path;
execv(path, argv);
-#endif
+
ruby_sourcefile = fname;
ruby_sourceline = 1;
rb_fatal("Can't exec %s", path);
diff --git a/ruby.h b/ruby.h
index 7dcfac1ea6..a68969e342 100644
--- a/ruby.h
+++ b/ruby.h
@@ -114,7 +114,7 @@ typedef unsigned long ID;
#define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
#define FIXNUM_FLAG 0x01
-#define INT2FIX(i) (VALUE)(((long)(i))<<1 | FIXNUM_FLAG)
+#define INT2FIX(i) ((VALUE)(((long)(i))<<1 | FIXNUM_FLAG))
#define rb_fix_new(v) INT2FIX(v)
VALUE rb_int2inum _((long));
#define INT2NUM(v) rb_int2inum(v)
@@ -130,6 +130,14 @@ VALUE rb_uint2inum _((unsigned long));
#define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
#define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
+#define IMMEDIATE_MASK 0x03
+#define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK)
+
+#define SYMBOL_FLAG 0x0e
+#define SYMBOL_P(x) (((VALUE)(x)&0xff)==SYMBOL_FLAG)
+#define ID2SYM(x) ((VALUE)(((long)(x))<<8|SYMBOL_FLAG))
+#define SYM2ID(x) RSHIFT((long)x,8)
+
/* special contants - i.e. non-zero and non-fixnum constants */
#define Qfalse 0
#define Qtrue 2
@@ -162,7 +170,9 @@ VALUE rb_uint2inum _((unsigned long));
#define T_FALSE 0x21
#define T_DATA 0x22
#define T_MATCH 0x23
+#define T_SYMBOL 0x24
+#define T_UNDEF 0x3c
#define T_VARMAP 0x3d
#define T_SCOPE 0x3e
#define T_NODE 0x3f
@@ -352,7 +362,7 @@ struct RBignum {
#define FL_UMASK (0xff<<FL_USHIFT)
-#define SPECIAL_CONST_P(x) (FIXNUM_P((VALUE)x) || (VALUE)(x) <= Qundef)
+#define SPECIAL_CONST_P(x) (IMMEDIATE_P(x) || !RTEST(x))
#define FL_ABLE(x) (!SPECIAL_CONST_P(x))
#define FL_TEST(x,f) (FL_ABLE(x)?(RBASIC(x)->flags&(f)):0)
@@ -489,6 +499,7 @@ EXTERN VALUE rb_cProc;
EXTERN VALUE rb_cRange;
EXTERN VALUE rb_cRegexp;
EXTERN VALUE rb_cString;
+EXTERN VALUE rb_cSymbol;
EXTERN VALUE rb_cThread;
EXTERN VALUE rb_cTime;
EXTERN VALUE rb_cTrueClass;
@@ -503,6 +514,7 @@ EXTERN VALUE rb_eFatal;
EXTERN VALUE rb_eArgError;
EXTERN VALUE rb_eEOFError;
EXTERN VALUE rb_eIndexError;
+EXTERN VALUE rb_eRangeError;
EXTERN VALUE rb_eIOError;
EXTERN VALUE rb_eLoadError;
EXTERN VALUE rb_eNameError;
@@ -528,6 +540,7 @@ rb_class_of(VALUE obj)
if (obj == Qnil) return rb_cNilClass;
if (obj == Qfalse) return rb_cFalseClass;
if (obj == Qtrue) return rb_cTrueClass;
+ if (SYMBOL_P(obj)) return rb_cSymbol;
return RBASIC(obj)->klass;
}
@@ -539,6 +552,8 @@ rb_type(VALUE obj)
if (obj == Qnil) return T_NIL;
if (obj == Qfalse) return T_FALSE;
if (obj == Qtrue) return T_TRUE;
+ if (obj == Qtrue) return T_UNDEF;
+ if (SYMBOL_P(obj)) return T_SYMBOL;
return BUILTIN_TYPE(obj);
}
diff --git a/signal.c b/signal.c
index f5f8d822d1..ee0c93069a 100644
--- a/signal.c
+++ b/signal.c
@@ -25,11 +25,6 @@
# endif
#endif
-#ifdef USE_CWGUSI
-# undef NSIG
-# define NSIG __signal_max
-#endif
-
static struct signals {
char *signm;
int signo;
@@ -196,9 +191,6 @@ rb_f_kill(argc, argv)
int argc;
VALUE *argv;
{
-#ifdef USE_CWGUSI
- rb_notimplement();
-#else
int negative = 0;
int sig;
int i;
@@ -261,7 +253,6 @@ rb_f_kill(argc, argv)
}
}
return INT2FIX(i-1);
-#endif /* USE_CWGUSI */
}
static VALUE trap_list[NSIG];
@@ -409,7 +400,7 @@ rb_trap_exec()
}
struct trap_arg {
-#if !defined(NT) && !defined(USE_CWGUSI)
+#if !defined(NT)
# ifdef HAVE_SIGPROCMASK
sigset_t mask;
# else
@@ -538,7 +529,7 @@ trap(arg)
trap_list[sig] = command;
/* enable at least specified signal. */
-#if !defined(NT) && !defined(USE_CWGUSI)
+#if !defined(NT)
#ifdef HAVE_SIGPROCMASK
sigdelset(&arg->mask, sig);
#else
@@ -548,7 +539,7 @@ trap(arg)
return old;
}
-#if !defined(NT) && !defined(USE_CWGUSI)
+#if !defined(NT)
static VALUE
trap_ensure(arg)
struct trap_arg *arg;
@@ -567,7 +558,7 @@ trap_ensure(arg)
void
rb_trap_restore_mask()
{
-#if !defined(NT) && !defined(USE_CWGUSI)
+#if !defined(NT)
# ifdef HAVE_SIGPROCMASK
sigprocmask(SIG_SETMASK, &trap_last_mask, NULL);
# else
@@ -596,7 +587,7 @@ rb_f_trap(argc, argv)
arg.cmd = argv[1];
}
-#if !defined(NT) && !defined(USE_CWGUSI)
+#if !defined(NT)
/* disable interrupt */
# ifdef HAVE_SIGPROCMASK
sigfillset(&arg.mask);
diff --git a/sprintf.c b/sprintf.c
index a428e0483e..917fdd953e 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -20,11 +20,7 @@
double strtod();
#endif
-#ifdef USE_CWGUSI
-static void fmt_setup();
-#else
static void fmt_setup _((char*,int,int,int,int));
-#endif
static char*
remove_sign_bits(str, base)
diff --git a/st.c b/st.c
index cd72d26af8..ede02b2169 100644
--- a/st.c
+++ b/st.c
@@ -6,10 +6,6 @@ static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible";
#include <stdio.h>
#include "st.h"
-#ifdef USE_CWGUSI
-#include <stdlib.h>
-#endif
-
#ifdef NT
#include <malloc.h>
#endif
diff --git a/string.c b/string.c
index 27700a3d56..6fcd7d257b 100644
--- a/string.c
+++ b/string.c
@@ -2532,7 +2532,7 @@ rb_str_intern(str)
if (strlen(RSTRING(str)->ptr) != RSTRING(str)->len)
rb_raise(rb_eArgError, "string contains `\\0'");
id = rb_intern(RSTRING(str)->ptr);
- return INT2FIX(id);
+ return ID2SYM(id);
}
static VALUE
diff --git a/struct.c b/struct.c
index d345a19d9a..743a2fd7ef 100644
--- a/struct.c
+++ b/struct.c
@@ -10,10 +10,6 @@
#include "ruby.h"
-#ifdef USE_CWGUSI
-#include <stdio.h>
-#endif
-
VALUE rb_cStruct;
static VALUE struct_alloc _((int, VALUE*, VALUE));
diff --git a/time.c b/time.c
index 346227faa8..a28fe335e1 100644
--- a/time.c
+++ b/time.c
@@ -30,12 +30,6 @@ struct timeval {
#include <sys/times.h>
#endif
-#ifdef USE_CWGUSI
-#define time_t long
-int gettimeofday(struct timeval*, struct timezone*);
-int strcasecmp(char*, char*);
-#endif
-
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -99,10 +93,9 @@ time_new_internal(klass, sec, usec)
VALUE obj;
struct time_object *tobj;
-#ifndef USE_CWGUSI
if (sec < 0 || (sec == 0 && usec < 0))
rb_raise(rb_eArgError, "time must be positive");
-#endif
+
obj = Data_Make_Struct(klass, struct time_object, 0, free, tobj);
tobj->tm_got = 0;
tobj->tv.tv_sec = sec;
diff --git a/util.c b/util.c
index a48b420915..24a2fe4d60 100644
--- a/util.c
+++ b/util.c
@@ -19,10 +19,6 @@
#define RUBY_NO_INLINE
#include "ruby.h"
-#ifdef USE_CWGUSI
-extern char* mktemp(char*);
-#endif
-
VALUE
rb_class_of(obj)
VALUE obj;
@@ -31,6 +27,7 @@ rb_class_of(obj)
if (obj == Qnil) return rb_cNilClass;
if (obj == Qfalse) return rb_cFalseClass;
if (obj == Qtrue) return rb_cTrueClass;
+ if (SYMBOL_P(obj)) return rb_cSymbol;
return RBASIC(obj)->klass;
}
@@ -43,6 +40,7 @@ rb_type(obj)
if (obj == Qnil) return T_NIL;
if (obj == Qfalse) return T_FALSE;
if (obj == Qtrue) return T_TRUE;
+ if (SYMBOL_P(obj)) return T_SYMBOL;
return BUILTIN_TYPE(obj);
}
diff --git a/version.h b/version.h
index e59402222b..74f6787edb 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
-#define RUBY_VERSION "1.5.2"
-#define RUBY_RELEASE_DATE "2000-03-06"
-#define RUBY_VERSION_CODE 152
-#define RUBY_RELEASE_CODE 20000306
+#define RUBY_VERSION "1.5.3"
+#define RUBY_RELEASE_DATE "2000-03-07"
+#define RUBY_VERSION_CODE 153
+#define RUBY_RELEASE_CODE 20000307