diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | config.sub | 3 | ||||
-rw-r--r-- | configure.in | 12 | ||||
-rw-r--r-- | error.c | 2 | ||||
-rw-r--r-- | io.c | 4 | ||||
-rw-r--r-- | numeric.c | 1 | ||||
-rw-r--r-- | range.c | 43 |
7 files changed, 36 insertions, 33 deletions
@@ -1,3 +1,7 @@ +Thu May 2 08:01:56 2002 Chris Thomas <kenshin@apple.com> + + * error.c: use HAVE_DECL_SYS_NERR instead of platform names. + Tue Apr 30 09:23:05 2002 Yukihiro Matsumoto <matz@ruby-lang.org> * numeric.c (num_step): better iteration condition for float diff --git a/config.sub b/config.sub index a2d8b0d596..914903cfed 100644 --- a/config.sub +++ b/config.sub @@ -157,6 +157,9 @@ case $os in os=-vxworks basic_machine=$1 ;; + -hiuxmpp) + os=-hiuxmpp + ;; -hiux*) os=-hiuxwe2 ;; diff --git a/configure.in b/configure.in index d97df02523..0785fef1bb 100644 --- a/configure.in +++ b/configure.in @@ -109,6 +109,13 @@ cygwin*|mingw*) ;; esac +# by TOYODA Eizi <toyoda@npd.kishou.go.jp> +case "$target_os" in +hiuxmpp*) + AC_DEFINE(__HIUX_MPP__) + ;; +esac + AC_PROG_LN_S AC_PROG_MAKE_SET @@ -179,8 +186,10 @@ NORETURN(void exit(int x));], done]) AC_DEFINE_UNQUOTED([NORETURN(x)], $rb_cv_noreturn) +dnl Check whether we need to define sys_nerr locally +AC_CHECK_DECLS([sys_nerr]) -dnl wheather link libc_r or not +dnl whether link libc_r or not AC_ARG_WITH(libc_r, [ --with-libc_r link libc_r if possible (FreeBSD only)], [ case $withval in @@ -712,6 +721,7 @@ if test "$with_dln_a_out" != yes; then cygwin*|mingw*) : ${LDSHARED="${CC} -shared -s"} LDFLAGS='-Wl,--stack,0x02000000' rb_cv_dlopen=yes ;; + hiuxmpp) LDSHARED='ld -r' ;; *) LDSHARED='ld' ;; esac AC_MSG_RESULT($rb_cv_dlopen) @@ -513,7 +513,7 @@ static const syserr_index_entry syserr_index[]= { static VALUE *syserr_list; #endif -#if !defined(NT) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(sys_nerr) +#if !HAVE_DECL_SYS_NERR extern int sys_nerr; #endif @@ -73,8 +73,8 @@ struct timeval { #include <sys/stat.h> -/* EMX has sys/parm.h, but.. */ -#if defined(HAVE_SYS_PARAM_H) && !defined(__EMX__) +/* EMX has sys/param.h, but.. */ +#if defined(HAVE_SYS_PARAM_H) && !(defined(__EMX__) || defined(__HIUX_MPP__)) # include <sys/param.h> #else # define NOFILE 64 @@ -788,7 +788,6 @@ num_step(argc, argv, from) while (i <= end) { rb_yield(INT2FIX(i)); i += diff; - printf("<<%g>>\n", i - end); } } else { @@ -265,26 +265,17 @@ range_step(argc, argv, range) } if (FIXNUM_P(b) && FIXNUM_P(e)) { /* fixnums are special */ - long beg = FIX2LONG(b), end = FIX2LONG(e), s = NUM2LONG(step); + long beg, end = FIX2LONG(e), s = NUM2LONG(step); long i; if (s <= 0) { rb_raise(rb_eArgError, "step can't be <= 0"); } - if ((end - beg) < 0) { - if (!EXCL(range)) end -= 1; - for (i=beg; i>end; i-=s) { - rb_yield(LONG2NUM(i)); - } - } - else { - if (!EXCL(range)) end += 1; - for (i=beg; i<end; i+=s) { - rb_yield(INT2NUM(i)); - } + if (!EXCL(range)) end += 1; + for (i=FIX2LONG(b); i<end; i+=s) { + rb_yield(INT2NUM(i)); } } else if (rb_obj_is_kind_of(b, rb_cNumeric)) { - VALUE diff; b = rb_Integer(b); e = rb_Integer(e); step = rb_Integer(step); @@ -292,20 +283,10 @@ range_step(argc, argv, range) if (RTEST(rb_funcall(step, rb_intern("<="), 1, INT2FIX(0)))) { rb_raise(rb_eArgError, "step can't be <= 0"); } - diff = rb_funcall(e, '-', 1, b); - if (RTEST(rb_funcall(diff, '<', 1, INT2FIX(0)))) { - if (!EXCL(range)) e = rb_funcall(e, '-', 1, INT2FIX(1)); - while (RTEST(rb_funcall(b, '>', 1, e))) { - rb_yield(b); - b = rb_funcall(b, '-', 1, step); - } - } - else { - if (!EXCL(range)) e = rb_funcall(e, '+', 1, INT2FIX(1)); - while (RTEST(rb_funcall(b, '<', 1, e))) { - rb_yield(b); - b = rb_funcall(b, '+', 1, step); - } + if (!EXCL(range)) e = rb_funcall(e, '+', 1, INT2FIX(1)); + while (RTEST(rb_funcall(b, '<', 1, e))) { + rb_yield(b); + b = rb_funcall(b, '+', 1, step); } } else if (TYPE(b) == T_STRING) { @@ -314,14 +295,20 @@ range_step(argc, argv, range) args[0] = b; args[1] = e; args[2] = range; iter[0] = 1; iter[1] = NUM2LONG(step); + if (iter[1] <= 0) { + rb_raise(rb_eArgError, "step can't be <= 0"); + } rb_iterate((VALUE(*)_((VALUE)))r_step_str, (VALUE)args, r_step_str_i, (VALUE)iter); } else { /* generic each */ VALUE v = b; - long lim = NUM2INT(step); + long lim = NUM2LONG(step); long i; + if (lim <= 0) { + rb_raise(rb_eArgError, "step can't be <= 0"); + } if (EXCL(range)) { while (r_lt(v, e)) { if (r_eq(v, e)) break; |