1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* error.c: use HAVE_DECL_SYS_NERR instead of platform names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-05-02 07:50:36 +00:00
parent b5a8ba178f
commit 20ed1f8d1a
7 changed files with 36 additions and 33 deletions

View file

@ -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

3
config.sub vendored
View file

@ -157,6 +157,9 @@ case $os in
os=-vxworks
basic_machine=$1
;;
-hiuxmpp)
os=-hiuxmpp
;;
-hiux*)
os=-hiuxwe2
;;

View file

@ -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)

View file

@ -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

4
io.c
View file

@ -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

View file

@ -788,7 +788,6 @@ num_step(argc, argv, from)
while (i <= end) {
rb_yield(INT2FIX(i));
i += diff;
printf("<<%g>>\n", i - end);
}
}
else {

43
range.c
View file

@ -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;