summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog42
-rw-r--r--array.c11
-rw-r--r--configure.in77
-rw-r--r--dir.c13
-rw-r--r--ext/extmk.rb.in2
-rw-r--r--gc.c1
-rw-r--r--io.c7
-rw-r--r--lib/tk.rb3
-rw-r--r--range.c6
-rw-r--r--regex.c18
-rw-r--r--string.c18
-rw-r--r--time.c17
-rw-r--r--version.h4
13 files changed, 145 insertions, 74 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ad1fb2..cf89296 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,45 @@
+Tue Nov 18 13:59:59 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * version 1.0-971118
+
+Tue Nov 18 10:13:08 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * regex.c (re_compile_pattern): insert initialize code for jump_n,
+ before entering loops.
+
+Sat Nov 15 00:11:36 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * io.c (io_s_popen): "rb" detection
+
+Wed Nov 12 13:44:47 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * time.c: remove coerce from Time class.
+
+Wed Nov 2 16:00:00 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (str_sub_s): "".sub! "", "" => "\000"
+
+Thu Oct 30 16:54:01 1997 WATANABE Hirofumi <watanabe@ase.ptg.sony.co.jp>
+
+ * string.c (str_chop_bang): "".chop caused SEGV.
+
+ * string.c (str_chomp_bang): method to chop out last newline.
+
+Mon Oct 27 13:49:13 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ext/extmk.rb.in: library may have pathname contains `.'
+
+ * eval.c (rb_rescue): should not protect SystemError.
+
+Thu Oct 23 11:17:44 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * range.c (range_eqq): fixnum check for last needed too.
+
+Wed Oct 22 12:52:30 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c (ary_join): call ary_join() recursively for the 1st
+ array element.
+
Tue Oct 21 13:31:29 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
* version 1.0-971021
diff --git a/array.c b/array.c
index c1ad998..28ea06f 100644
--- a/array.c
+++ b/array.c
@@ -589,10 +589,17 @@ ary_join(ary, sep)
VALUE result, tmp;
if (ary->len == 0) return str_new(0, 0);
- if (TYPE(ary->ptr[0]) == T_STRING)
+ switch (TYPE(ary->ptr[0])) {
+ case T_STRING:
result = str_dup(ary->ptr[0]);
- else
+ break;
+ case T_ARRAY:
+ result = ary_join(ary->ptr[0], sep);
+ break;
+ default:
result = obj_as_string(ary->ptr[0]);
+ break;
+ }
for (i=1; i<ary->len; i++) {
tmp = ary->ptr[i];
diff --git a/configure.in b/configure.in
index 9a59f42..567e58c 100644
--- a/configure.in
+++ b/configure.in
@@ -98,6 +98,11 @@ AC_STRUCT_ST_BLOCKS
LIBOBJS="$save_LIBOBJS"
AC_STRUCT_ST_RDEV
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(void*)
+
dnl Checks for library functions.
AC_TYPE_GETGROUPS
AC_TYPE_SIGNAL
@@ -271,45 +276,47 @@ if test "$with_dln_a_out" != yes; then
esac
else
case "$host_os" in
- hpux*) CCDLFLAGS='+z';;
- solaris*|irix*) CCDLFLAGS='-K pic' ;;
- sunos*) CCDLFLAGS='-pic' ;;
- esix*|uxpds*) CCDLFLAGS='-Kpic' ;;
- *) CCDLFLAGS='' ;;
+ hpux*) CCDLFLAGS='+z';;
+ solaris*|irix*) CCDLFLAGS='-K pic' ;;
+ sunos*) CCDLFLAGS='-pic' ;;
+ esix*|uxpds*) CCDLFLAGS='-Kpic' ;;
+ *) CCDLFLAGS='' ;;
esac
fi
case "$host_os" in
- hpux*) DLDFLAGS="-E"
- LDSHARED='ld -b'
- LDFLAGS="-Wl,-E"
- rb_cv_dlopen=yes;;
- solaris*) LDSHARED='ld -G'
- rb_cv_dlopen=yes;;
- sunos*) LDSHARED='ld -assert nodefinitions'
- rb_cv_dlopen=yes;;
- sysv4*) LDSHARED='ld -G'
- rb_cv_dlopen=yes;;
- esix*|uxpds*) LDSHARED="ld -G"
- rb_cv_dlopen=yes ;;
- linux*) LDSHARED="gcc -shared"
- rb_cv_dlopen=yes ;;
- freebsd*) LDSHARED="ld -Bshareable"
- rb_cv_dlopen=yes ;;
- netbsd*) LDSHARED="ld -Bshareable"
- rb_cv_dlopen=yes ;;
- openbsd*) LDSHARED="ld -Bshareable"
- rb_cv_dlopen=yes ;;
- nextstep*) LDSHARED='cc -r'
- LDFLAGS="-u libsys_s"
- DLDFLAGS="$ARCH_FLAG"
- rb_cv_dlopen=yes ;;
- aix*) LDSHARED='../../miniruby ../aix_ld.rb $(TARGET)'
- rb_cv_dlopen=yes ;;
- human*) DLDFLAGS=''
- LDSHARED=''
- LDFLAGS='' ;;
- *) LDSHARED='ld' ;;
+ hpux*) DLDFLAGS="-E"
+ LDSHARED='ld -b'
+ LDFLAGS="-Wl,-E"
+ rb_cv_dlopen=yes;;
+ solaris*) LDSHARED='ld -G'
+ rb_cv_dlopen=yes;;
+ sunos*) LDSHARED='ld -assert nodefinitions'
+ rb_cv_dlopen=yes;;
+ irix*) LDSHARED='ld -ignore_unresolved'
+ rb_cv_dlopen=yes;;
+ sysv4*) LDSHARED='ld -G'
+ rb_cv_dlopen=yes;;
+ esix*|uxpds*) LDSHARED="ld -G"
+ rb_cv_dlopen=yes ;;
+ linux*) LDSHARED="gcc -shared"
+ rb_cv_dlopen=yes ;;
+ freebsd*) LDSHARED="ld -Bshareable"
+ rb_cv_dlopen=yes ;;
+ netbsd*) LDSHARED="ld -Bshareable"
+ rb_cv_dlopen=yes ;;
+ openbsd*) LDSHARED="ld -Bshareable"
+ rb_cv_dlopen=yes ;;
+ nextstep*) LDSHARED='cc -r'
+ LDFLAGS="-u libsys_s"
+ DLDFLAGS="$ARCH_FLAG"
+ rb_cv_dlopen=yes ;;
+ aix*) LDSHARED='../../miniruby ../aix_ld.rb $(TARGET)'
+ rb_cv_dlopen=yes ;;
+ human*) DLDFLAGS=''
+ LDSHARED=''
+ LDFLAGS='' ;;
+ *) LDSHARED='ld' ;;
esac
AC_MSG_RESULT($rb_cv_dlopen)
fi
diff --git a/dir.c b/dir.c
index a099d5e..ca2ca21 100644
--- a/dir.c
+++ b/dir.c
@@ -307,8 +307,17 @@ push_braces(ary, s)
p = s;
lbrace = rbrace = 0;
while (*p) {
- if (*p == '{' && !lbrace) lbrace = p;
- if (*p == '}' && lbrace) rbrace = p;
+ if (*p == '{') {
+ lbrace = p;
+ break;
+ }
+ p++;
+ }
+ while (*p) {
+ if (*p == '}' && lbrace) {
+ rbrace = p;
+ break;
+ }
p++;
}
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in
index c6405aa..16f8708 100644
--- a/ext/extmk.rb.in
+++ b/ext/extmk.rb.in
@@ -243,7 +243,7 @@ libdir = @libdir@/ruby/@arch@
mfile.printf $objs.join(" ")
mfile.printf "\n"
- dots = if "@INSTALL@" =~ /^\// then "" else "#{$topdir}/ext" end
+ dots = if "@INSTALL@" =~ /^\// then "" else "#{$topdir}/ext/" end
mfile.printf "\
TARGET = %s.%s
diff --git a/gc.c b/gc.c
index f69f474..f356477 100644
--- a/gc.c
+++ b/gc.c
@@ -655,7 +655,6 @@ obj_free(obj)
case T_DATA:
if (obj->as.data.dfree && DATA_PTR(obj))
(*obj->as.data.dfree)(DATA_PTR(obj));
- if (DATA_PTR(obj)) free(DATA_PTR(obj));
break;
case T_MATCH:
re_free_registers(obj->as.match.regs);
diff --git a/io.c b/io.c
index b836469..f6c0f89 100644
--- a/io.c
+++ b/io.c
@@ -1023,7 +1023,7 @@ io_s_popen(argc, argv, self)
}
else {
Check_Type(pmode, T_STRING);
- if (RSTRING(pmode)->len == 0 || RSTRING(pmode)->len > 2)
+ if (RSTRING(pmode)->len == 0 || RSTRING(pmode)->len > 3)
ArgError("illegal access mode");
mode = RSTRING(pmode)->ptr;
}
@@ -1058,7 +1058,7 @@ f_open(argc, argv, self)
}
else {
Check_Type(pmode, T_STRING);
- if (RSTRING(pmode)->len == 0 || RSTRING(pmode)->len > 2)
+ if (RSTRING(pmode)->len == 0 || RSTRING(pmode)->len > 3)
ArgError("illegal access mode");
mode = RSTRING(pmode)->ptr;
}
@@ -1246,9 +1246,6 @@ io_print(argc, argv, out)
case T_ARRAY:
ary_print_on(argv[i], out);
break;
- case T_HASH:
- break;
- case T_STRING:
default:
io_write(out, argv[i]);
break;
diff --git a/lib/tk.rb b/lib/tk.rb
index 48a3940..5b25821 100644
--- a/lib/tk.rb
+++ b/lib/tk.rb
@@ -707,6 +707,9 @@ class TkListbox<TkTextWin
tk_call 'listbox', path
end
+ def curselection
+ tk_send 'curselection'
+ end
def nearest(y)
tk_send 'nearest', y
end
diff --git a/range.c b/range.c
index 697fc98..98509f4 100644
--- a/range.c
+++ b/range.c
@@ -57,15 +57,15 @@ range_eqq(rng, obj)
first = rb_iv_get(rng, "first");
last = rb_iv_get(rng, "last");
- if (FIXNUM_P(first) && FIXNUM_P(obj)) {
+ if (FIXNUM_P(first) && FIXNUM_P(obj) && FIXNUM_P(last)) {
if (FIX2INT(first) <= FIX2INT(obj) && FIX2INT(obj) <= FIX2INT(last)) {
return TRUE;
}
return FALSE;
}
else {
- if (rb_funcall(first, rb_intern("<="), 1, obj) &&
- rb_funcall(last, rb_intern(">="), 1, obj)) {
+ if (RTEST(rb_funcall(first, rb_intern("<="), 1, obj)) &&
+ RTEST(rb_funcall(last, rb_intern(">="), 1, obj))) {
return TRUE;
}
return FALSE;
diff --git a/regex.c b/regex.c
index da7f2c6..686695c 100644
--- a/regex.c
+++ b/regex.c
@@ -1203,6 +1203,11 @@ re_compile_pattern(pattern, size, bufp)
b, lower_bound);
b += 5; /* Just increment for the succeed_n here. */
+ /* When hit this when matching, set the succeed_n's n. */
+ GET_BUFFER_SPACE(5);
+ insert_op_2(set_number_at, laststart, b, 5, lower_bound);
+ b += 5;
+
/* More than one repetition is allowed, so put in at
the end of the buffer a backward jump from b to the
succeed_n we put in above. By the time we've gotten
@@ -1211,19 +1216,18 @@ re_compile_pattern(pattern, size, bufp)
if (upper_bound > 1)
{
- store_jump_n(b, jump_n, laststart, upper_bound - 1);
+ GET_BUFFER_SPACE(15);
+ store_jump_n(b, jump_n, laststart+5, upper_bound - 1);
b += 5;
/* When hit this when matching, reset the
preceding jump_n's n to upper_bound - 1. */
+ insert_op_2(set_number_at, laststart, b, b - laststart, upper_bound - 1);
+ b += 5;
+
BUFPUSH(set_number_at);
- GET_BUFFER_SPACE(2);
STORE_NUMBER_AND_INCR(b, -5);
STORE_NUMBER_AND_INCR(b, upper_bound - 1);
}
- /* When hit this when matching, set the succeed_n's n. */
- GET_BUFFER_SPACE(5);
- insert_op_2(set_number_at, laststart, b, 5, lower_bound);
- b += 5;
}
pending_exact = 0;
beg_interval = 0;
@@ -2006,7 +2010,7 @@ struct register_info
if (regstart[last_used_reg] != (unsigned char *)(-1L)) \
break; \
\
- if (stacke - stackp < NUM_FAILURE_ITEMS) \
+ if (stacke - stackp <= NUM_FAILURE_ITEMS) \
{ \
unsigned char **stackx; \
unsigned int len = stacke - stackb; \
diff --git a/string.c b/string.c
index 91bb1da..a9f3fc5 100644
--- a/string.c
+++ b/string.c
@@ -812,7 +812,7 @@ str_sub_s(str, pat, val, once)
* Always consume at least one character of the input string
* in order to prevent infinite loops.
*/
- str_cat(result, str->ptr+END(0), 1);
+ if (str->len) str_cat(result, str->ptr+END(0), 1);
offset = END(0)+1;
}
else {
@@ -898,7 +898,7 @@ str_sub_iter_s(str, pat, once)
val = rb_yield(reg_nth_match(0, backref_get()));
val = obj_as_string(val);
str_cat(result, RSTRING(val)->ptr, RSTRING(val)->len);
- if (null) {
+ if (null && str->len) {
str_cat(result, str->ptr+offset-1, 1);
}
@@ -1551,7 +1551,7 @@ tr_setup_table(str, table)
{
struct tr tr;
int i, cflag = 0;
- char c;
+ int c;
tr.p = str->ptr; tr.pend = tr.p + str->len;
tr.gen = tr.now = tr.max = 0;
@@ -1914,13 +1914,15 @@ str_chop_bang(str)
{
str_modify(str);
- str->len--;
- if (str->ptr[str->len] == '\n') {
- if (str->len > 0 && str->ptr[str->len-1] == '\r') {
- str->len--;
+ if (str->len > 0) {
+ str->len--;
+ if (str->ptr[str->len] == '\n') {
+ if (str->len > 0 && str->ptr[str->len-1] == '\r') {
+ str->len--;
+ }
}
+ str->ptr[str->len] = '\0';
}
- str->ptr[str->len] = '\0';
return (VALUE)str;
}
diff --git a/time.c b/time.c
index 51e2a0f..c5147a4 100644
--- a/time.c
+++ b/time.c
@@ -215,10 +215,11 @@ time_arg(argc, argv, args)
}
static VALUE
-time_gm_or_local(argc, argv, gm_or_local)
+time_gm_or_local(argc, argv, gm_or_local, class)
int argc;
VALUE *argv;
int gm_or_local;
+ VALUE class;
{
int args[6];
struct timeval tv;
@@ -253,28 +254,28 @@ time_gm_or_local(argc, argv, gm_or_local)
guess += (args[4] - tm->tm_min) * 60;
guess += args[5] - tm->tm_sec;
- return time_new_internal(cTime, guess, 0);
+ return time_new_internal(class, guess, 0);
error:
ArgError("gmtime error");
}
static VALUE
-time_s_timegm(argc, argv, obj)
+time_s_timegm(argc, argv, class)
int argc;
VALUE *argv;
- VALUE obj;
+ VALUE class;
{
- return time_gm_or_local(argc, argv, 1);
+ return time_gm_or_local(argc, argv, 1, class);
}
static VALUE
-time_s_timelocal(argc, argv, obj)
+time_s_timelocal(argc, argv, class)
int argc;
VALUE *argv;
- VALUE obj;
+ VALUE class;
{
- return time_gm_or_local(argc, argv, 0);
+ return time_gm_or_local(argc, argv, 0, class);
}
static VALUE
diff --git a/version.h b/version.h
index f098bf8..3f0a1ff 100644
--- a/version.h
+++ b/version.h
@@ -1,2 +1,2 @@
-#define RUBY_VERSION "1.0-971021"
-#define VERSION_DATE "97/10/21"
+#define RUBY_VERSION "1.0-971118"
+#define VERSION_DATE "97/11/18"