diff --git a/ChangeLog b/ChangeLog index dfe9df0595..3d3e9ee68b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu May 2 08:01:56 2002 Chris Thomas + + * error.c: use HAVE_DECL_SYS_NERR instead of platform names. + Tue Apr 30 09:23:05 2002 Yukihiro Matsumoto * 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 +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) diff --git a/error.c b/error.c index 65f4ec3745..8d95e4a395 100644 --- a/error.c +++ b/error.c @@ -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 diff --git a/io.c b/io.c index 2754988aaa..ba6b695dfa 100644 --- a/io.c +++ b/io.c @@ -73,8 +73,8 @@ struct timeval { #include -/* 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 #else # define NOFILE 64 diff --git a/numeric.c b/numeric.c index 76b59ecd76..5f25df82a7 100644 --- a/numeric.c +++ b/numeric.c @@ -788,7 +788,6 @@ num_step(argc, argv, from) while (i <= end) { rb_yield(INT2FIX(i)); i += diff; - printf("<<%g>>\n", i - end); } } else { diff --git a/range.c b/range.c index 8a92eacec3..81d00f0077 100644 --- a/range.c +++ b/range.c @@ -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', 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;