summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog24
-rw-r--r--configure1
-rw-r--r--eval.c3
-rw-r--r--ext/md5/md5init.c1
-rw-r--r--file.c11
-rw-r--r--hash.c4
-rw-r--r--io.c61
-rw-r--r--parse.y2
-rw-r--r--process.c3
-rw-r--r--re.c4
-rw-r--r--string.c4
-rw-r--r--version.h8
12 files changed, 82 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b53a40d97..fa0339fd4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,29 @@
+Sun Jul 23 12:55:04 2000 Dave Thomas <Dave@Thomases.com>
+
+ * string.c (rb_str_rindex): Support negative end position.
+
+Fri Jul 21 17:35:01 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * process.c (proc_getpriority): getpriority(2) may return valid
+ negative number. use errno to detect error.
+
+Sat Jul 15 01:32:34 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (Init_eval): should prohibit `include' and
+ `module_function' for class Class. The latter was very
+ dangerous.
+
Fri Jul 14 12:49:50 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * io.c (argf_eof): need to check stdin, when next_p == -1.
+
+ * io.c (read_all): use io_fread() instead of fread(3).
+
+ * io.c (io_reopen): should clearerr FILE if fd < 3.
+
+ * re.c (rb_reg_match_m): the result is exported, so it should be
+ declared as busy.
+
* eval.c (rb_eval): should preserve errinfo even if return, break,
etc. is called in rescue clause.
diff --git a/configure b/configure
index 726207a187..f0e92c67a9 100644
--- a/configure
+++ b/configure
@@ -515,6 +515,7 @@ else
> $cache_file
fi
+echo $CC
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
diff --git a/eval.c b/eval.c
index 53cd2dd21b..cf693da1a3 100644
--- a/eval.c
+++ b/eval.c
@@ -5394,6 +5394,9 @@ Init_eval()
rb_define_method(rb_cModule, "module_eval", rb_mod_module_eval, -1);
rb_define_method(rb_cModule, "class_eval", rb_mod_module_eval, -1);
+ rb_undef_method(rb_cClass, "include");
+ rb_undef_method(rb_cClass, "module_function");
+
rb_define_private_method(rb_cModule, "remove_method", rb_mod_remove_method, 1);
rb_define_private_method(rb_cModule, "undef_method", rb_mod_undef_method, 1);
rb_define_private_method(rb_cModule, "alias_method", rb_mod_alias_method, 2);
diff --git a/ext/md5/md5init.c b/ext/md5/md5init.c
index 7d17835a93..eeee5e358f 100644
--- a/ext/md5/md5init.c
+++ b/ext/md5/md5init.c
@@ -106,6 +106,7 @@ Init_md5()
cMD5 = rb_define_class("MD5", rb_cObject);
rb_define_singleton_method(cMD5, "new", md5_new, -1);
+ rb_define_singleton_method(cMD5, "md5", md5_new, -1);
rb_define_method(cMD5, "update", md5_update, 1);
rb_define_method(cMD5, "digest", md5_digest, 0);
diff --git a/file.c b/file.c
index e966479252..8333e8d7df 100644
--- a/file.c
+++ b/file.c
@@ -58,10 +58,13 @@ char *strrchr _((const char*,const char));
#include <sys/stat.h>
#ifdef USE_CWGUSI
- #include "macruby_missing.h"
- extern int fileno(FILE *stream);
- extern int utimes();
- char* strdup(char*);
+#include "macruby_missing.h"
+extern int fileno(FILE *stream);
+extern int utimes();
+#endif
+
+#ifndef strdup
+char *strdup();
#endif
#ifdef __EMX__
diff --git a/hash.c b/hash.c
index cc456a79b9..20865bcec3 100644
--- a/hash.c
+++ b/hash.c
@@ -22,8 +22,8 @@
char *strchr _((char*,char));
#endif
-#ifdef USE_CWGUSI
-char* strdup(const char*);
+#ifndef strdup
+char *strdup();
#endif
#define HASH_FREEZE FL_USER1
diff --git a/io.c b/io.c
index 88314ba455..5056459846 100644
--- a/io.c
+++ b/io.c
@@ -382,6 +382,32 @@ rb_io_to_io(io)
/* reading functions */
+static size_t
+io_fread(ptr, len, f)
+ char *ptr;
+ size_t len;
+ FILE *f;
+{
+ size_t n = len;
+ int c;
+
+ while (n--) {
+ if (!READ_DATA_PENDING(f)) {
+ rb_thread_wait_fd(fileno(f));
+ }
+ TRAP_BEG;
+ c = getc(f);
+ TRAP_END;
+ if (c == EOF) {
+ *ptr = '\0';
+ break;
+ }
+ *ptr++ = c;
+ }
+
+ return len - n - 1;
+}
+
#ifndef S_ISREG
# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
#endif
@@ -421,11 +447,9 @@ read_all(port)
}
}
str = rb_str_new(0, siz);
+ READ_CHECK(fptr->f);
for (;;) {
- READ_CHECK(fptr->f);
- TRAP_BEG;
- n = fread(RSTRING(str)->ptr+bytes, 1, siz-bytes, fptr->f);
- TRAP_END;
+ n = io_fread(RSTRING(str)->ptr+bytes, siz-bytes, fptr->f);
if (n == 0 && bytes == 0) {
if (feof(fptr->f)) return Qnil;
rb_sys_fail(fptr->path);
@@ -442,32 +466,6 @@ read_all(port)
return str;
}
-static size_t
-io_fread(ptr, len, f)
- char *ptr;
- size_t len;
- FILE *f;
-{
- size_t n = len;
- int c;
-
- while (n--) {
- if (!READ_DATA_PENDING(f)) {
- rb_thread_wait_fd(fileno(f));
- }
- TRAP_BEG;
- c = getc(f);
- TRAP_END;
- if (c == EOF) {
- *ptr = '\0';
- break;
- }
- *ptr++ = c;
- }
-
- return len - n - 1;
-}
-
static VALUE
io_read(argc, argv, io)
int argc;
@@ -1727,6 +1725,7 @@ rb_io_reopen(io, nfile)
mode = rb_io_mode_string(fptr);
fd = fileno(fptr->f);
if (fd < 3) {
+ clearerr(fptr->f);
/* need to keep stdio */
if (dup2(fileno(orig->f), fd) < 0)
rb_sys_fail(orig->path);
@@ -3087,8 +3086,6 @@ argf_eof()
{
if (init_p == 0 && !next_argv())
return Qtrue;
- if (next_p == -1)
- return Qtrue;
if (TYPE(current_file) != T_FILE) {
return argf_forward();
}
diff --git a/parse.y b/parse.y
index a852d7f485..9d2579eb41 100644
--- a/parse.y
+++ b/parse.y
@@ -2093,6 +2093,8 @@ tokadd_escape()
int numlen;
scan_hex(lex_p, 2, &numlen);
+ tokadd('\\');
+ tokadd('x');
while (numlen--)
tokadd(nextc());
}
diff --git a/process.c b/process.c
index 7d79a1d5c2..d3eba5ea2f 100644
--- a/process.c
+++ b/process.c
@@ -864,8 +864,9 @@ proc_getpriority(obj, which, who)
iwhich = NUM2INT(which);
iwho = NUM2INT(who);
+ errno = 0;
prio = getpriority(iwhich, iwho);
- if (prio < 0) rb_sys_fail(0);
+ if (errno) rb_sys_fail(0);
return INT2FIX(prio);
#else
rb_notimplement();
diff --git a/re.c b/re.c
index 2ab4c56ec8..8ed90080f2 100644
--- a/re.c
+++ b/re.c
@@ -907,7 +907,9 @@ rb_reg_match_method(re, str)
VALUE result = rb_reg_match(re, str);
if (NIL_P(result)) return Qnil;
- return rb_backref_get();
+ result = rb_backref_get();
+ rb_match_busy(result, Qtrue);
+ return result;
}
static VALUE
diff --git a/string.c b/string.c
index 102b9f0b61..54ac253376 100644
--- a/string.c
+++ b/string.c
@@ -632,6 +632,10 @@ rb_str_rindex(argc, argv, str)
if (rb_scan_args(argc, argv, "11", &sub, &position) == 2) {
pos = NUM2INT(position);
+ if (pos < 0) {
+ pos += RSTRING(str)->len;
+ if (pos < 0) return Qnil;
+ }
if (pos > RSTRING(str)->len) pos = RSTRING(str)->len;
}
else {
diff --git a/version.h b/version.h
index 1b3a6e3099..ae878ce6ac 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
-#define RUBY_VERSION "1.4.5"
-#define RUBY_RELEASE_DATE "2000-06-26"
-#define RUBY_VERSION_CODE 145
-#define RUBY_RELEASE_CODE 20000626
+#define RUBY_VERSION "1.4.6"
+#define RUBY_RELEASE_DATE "2000-07-21"
+#define RUBY_VERSION_CODE 146
+#define RUBY_RELEASE_CODE 20000721