mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* configure.in (HUGE_ST_INO): check whether struct stat.st_ino
is larger than long. [ruby-dev:21194] http://www.geocities.co.jp/SiliconValley-PaloAlto/1409/ruby/beos.html * error.c (syserr_eqq): errno might exceed Fixnum limit. * error.c (Init_Exception): moved base initialization from init_syserr(). * inits.c (rb_call_inits): postpone initializing errnos until Bignum is available. * ext/curses/curses.c (_XOPEN_SOURCE_EXTENDED): needed to let keyname() and so on be declared. * ext/curses/curses.c (curses_resizeterm, window_resize): arguments conflicted with macros in term.h. * ext/curses/curses.c (Curses module methods): ensure initialized. [ruby-dev:21191] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
befd57c7ea
commit
625c1361e3
7 changed files with 91 additions and 27 deletions
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
Fri Aug 15 12:01:43 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* configure.in (HUGE_ST_INO): check whether struct stat.st_ino
|
||||
is larger than long. [ruby-dev:21194]
|
||||
http://www.geocities.co.jp/SiliconValley-PaloAlto/1409/ruby/beos.html
|
||||
|
||||
* error.c (syserr_eqq): errno might exceed Fixnum limit.
|
||||
|
||||
* error.c (Init_Exception): moved base initialization from
|
||||
init_syserr().
|
||||
|
||||
* inits.c (rb_call_inits): postpone initializing errnos until
|
||||
Bignum is available.
|
||||
|
||||
Fri Aug 15 12:01:43 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/curses/curses.c (_XOPEN_SOURCE_EXTENDED): needed to let
|
||||
keyname() and so on be declared.
|
||||
|
||||
* ext/curses/curses.c (curses_resizeterm, window_resize):
|
||||
arguments conflicted with macros in term.h.
|
||||
|
||||
* ext/curses/curses.c (Curses module methods): ensure
|
||||
initialized. [ruby-dev:21191]
|
||||
|
||||
Fri Aug 15 02:08:53 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* gc.c (id2ref): recycle check should be done by klass == 0.
|
||||
|
|
12
configure.in
12
configure.in
|
@ -624,6 +624,18 @@ if test "$rb_cv_need_io_flush_before_seek" = yes; then
|
|||
AC_DEFINE(NEED_IO_FLUSH_BEFORE_SEEK, 1)
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([whether st_ino is huge], rb_cv_huge_st_ino,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([
|
||||
#include <sys/stat.h>
|
||||
struct stat test_stat;
|
||||
], [sizeof(test_stat.st_ino)>sizeof(long)])],
|
||||
rb_cv_huge_st_ino=yes,
|
||||
rb_cv_huge_st_ino=no)
|
||||
])
|
||||
if test $rb_cv_huge_st_ino = yes; then
|
||||
AC_DEFINE(HUGE_ST_INO)
|
||||
fi
|
||||
|
||||
case "$target_cpu" in
|
||||
m68*|i?86|sparc) rb_cv_stack_grow_dir=-1;;
|
||||
esac
|
||||
|
|
24
error.c
24
error.c
|
@ -607,7 +607,7 @@ static VALUE
|
|||
syserr_eqq(self, exc)
|
||||
VALUE self, exc;
|
||||
{
|
||||
VALUE num;
|
||||
VALUE num, e;
|
||||
|
||||
if (!rb_obj_is_kind_of(exc, rb_eSystemCallError)) return Qfalse;
|
||||
if (self == rb_eSystemCallError) return Qtrue;
|
||||
|
@ -621,7 +621,8 @@ syserr_eqq(self, exc)
|
|||
}
|
||||
num = rb_const_get(klass, rb_intern("Errno"));
|
||||
}
|
||||
if (rb_const_get(self, rb_intern("Errno")) == num)
|
||||
e = rb_const_get(self, rb_intern("Errno"));
|
||||
if (FIXNUM_P(num) ? num == e : rb_equal(num, e))
|
||||
return Qtrue;
|
||||
return Qfalse;
|
||||
}
|
||||
|
@ -671,7 +672,13 @@ Init_Exception()
|
|||
rb_eSecurityError = rb_define_class("SecurityError", rb_eStandardError);
|
||||
rb_eNoMemError = rb_define_class("NoMemoryError", rb_eException);
|
||||
|
||||
init_syserr();
|
||||
syserr_tbl = st_init_numtable();
|
||||
rb_eSystemCallError = rb_define_class("SystemCallError", rb_eStandardError);
|
||||
rb_define_method(rb_eSystemCallError, "initialize", syserr_initialize, -1);
|
||||
rb_define_method(rb_eSystemCallError, "errno", syserr_errno, 0);
|
||||
rb_define_singleton_method(rb_eSystemCallError, "===", syserr_eqq, 1);
|
||||
|
||||
rb_mErrno = rb_define_module("Errno");
|
||||
|
||||
rb_define_global_function("warn", rb_warn_m, 1);
|
||||
}
|
||||
|
@ -805,16 +812,9 @@ rb_check_frozen(obj)
|
|||
if (OBJ_FROZEN(obj)) rb_error_frozen(rb_obj_classname(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
init_syserr()
|
||||
void
|
||||
Init_syserr()
|
||||
{
|
||||
syserr_tbl = st_init_numtable();
|
||||
rb_eSystemCallError = rb_define_class("SystemCallError", rb_eStandardError);
|
||||
rb_define_method(rb_eSystemCallError, "initialize", syserr_initialize, -1);
|
||||
rb_define_method(rb_eSystemCallError, "errno", syserr_errno, 0);
|
||||
rb_define_singleton_method(rb_eSystemCallError, "===", syserr_eqq, 1);
|
||||
|
||||
rb_mErrno = rb_define_module("Errno");
|
||||
#ifdef EPERM
|
||||
set_syserr(EPERM, "EPERM");
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
|
||||
#include "ruby.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include "rubyio.h"
|
||||
|
||||
#define _XOPEN_SOURCE_EXTENDED 1
|
||||
#if defined(HAVE_NCURSES_H)
|
||||
# include <ncurses.h>
|
||||
#elif defined(HAVE_NCURSES_CURSES_H)
|
||||
|
@ -24,19 +28,21 @@
|
|||
# include <curses_colr/curses.h>
|
||||
#else
|
||||
# include <curses.h>
|
||||
# if (defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)) && !defined(_maxx)
|
||||
# if defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)
|
||||
# if !defined(_maxx)
|
||||
# define _maxx maxx
|
||||
# endif
|
||||
# if (defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)) && !defined(_maxy)
|
||||
# if !defined(_maxy)
|
||||
# define _maxy maxy
|
||||
# endif
|
||||
# if (defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)) && !defined(_begx)
|
||||
# if !defined(_begx)
|
||||
# define _begx begx
|
||||
# endif
|
||||
# if (defined(__bsdi__) || defined(__NetBSD__) || defined(__APPLE__)) && !defined(_begy)
|
||||
# if !defined(_begy)
|
||||
# define _begy begy
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INIT_COLOR
|
||||
# define USE_COLOR 1
|
||||
|
@ -47,9 +53,6 @@
|
|||
# define USE_MOUSE 1
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "rubyio.h"
|
||||
|
||||
static VALUE mCurses;
|
||||
static VALUE mKey;
|
||||
static VALUE cWindow;
|
||||
|
@ -174,6 +177,7 @@ static VALUE
|
|||
curses_clear(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
wclear(stdscr);
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -183,6 +187,7 @@ static VALUE
|
|||
curses_refresh(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
refresh();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -192,6 +197,7 @@ static VALUE
|
|||
curses_doupdate(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
#ifdef HAVE_DOUPDATE
|
||||
doupdate();
|
||||
#else
|
||||
|
@ -205,6 +211,7 @@ static VALUE
|
|||
curses_echo(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
echo();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -214,6 +221,7 @@ static VALUE
|
|||
curses_noecho(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
noecho();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -223,6 +231,7 @@ static VALUE
|
|||
curses_raw(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
raw();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -232,6 +241,7 @@ static VALUE
|
|||
curses_noraw(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
noraw();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -241,6 +251,7 @@ static VALUE
|
|||
curses_cbreak(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
cbreak();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -250,6 +261,7 @@ static VALUE
|
|||
curses_nocbreak(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
nocbreak();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -259,6 +271,7 @@ static VALUE
|
|||
curses_nl(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
nl();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -268,6 +281,7 @@ static VALUE
|
|||
curses_nonl(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
nonl();
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -278,6 +292,7 @@ curses_beep(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifdef HAVE_BEEP
|
||||
curses_stdscr();
|
||||
beep();
|
||||
#endif
|
||||
return Qnil;
|
||||
|
@ -289,6 +304,7 @@ curses_flash(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
#ifdef HAVE_FLASH
|
||||
curses_stdscr();
|
||||
flash();
|
||||
#endif
|
||||
return Qnil;
|
||||
|
@ -301,6 +317,7 @@ curses_ungetch(obj, ch)
|
|||
VALUE ch;
|
||||
{
|
||||
#ifdef HAVE_UNGETCH
|
||||
curses_stdscr();
|
||||
ungetch(NUM2INT(ch));
|
||||
#else
|
||||
rb_notimplement();
|
||||
|
@ -315,6 +332,7 @@ curses_setpos(obj, y, x)
|
|||
VALUE y;
|
||||
VALUE x;
|
||||
{
|
||||
curses_stdscr();
|
||||
move(NUM2INT(y), NUM2INT(x));
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -342,6 +360,7 @@ static VALUE
|
|||
curses_inch(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
return CHR2FIX(inch());
|
||||
}
|
||||
|
||||
|
@ -351,6 +370,7 @@ curses_addch(obj, ch)
|
|||
VALUE obj;
|
||||
VALUE ch;
|
||||
{
|
||||
curses_stdscr();
|
||||
addch(NUM2CHR(ch));
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -361,6 +381,7 @@ curses_insch(obj, ch)
|
|||
VALUE obj;
|
||||
VALUE ch;
|
||||
{
|
||||
curses_stdscr();
|
||||
insch(NUM2CHR(ch));
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -371,6 +392,7 @@ curses_addstr(obj, str)
|
|||
VALUE obj;
|
||||
VALUE str;
|
||||
{
|
||||
curses_stdscr();
|
||||
if (!NIL_P(str)) {
|
||||
addstr(STR2CSTR(str));
|
||||
}
|
||||
|
@ -383,6 +405,7 @@ curses_getch(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
rb_read_check(stdin);
|
||||
curses_stdscr();
|
||||
return UINT2NUM(getch());
|
||||
}
|
||||
|
||||
|
@ -510,10 +533,10 @@ curses_bkgd(VALUE obj, VALUE ch)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
curses_resizeterm(VALUE obj, VALUE lines, VALUE columns)
|
||||
curses_resizeterm(VALUE obj, VALUE lin, VALUE col)
|
||||
{
|
||||
#if defined(HAVE_RESIZETERM)
|
||||
return (resizeterm(NUM2INT(lines),NUM2INT(columns)) == OK) ? Qtrue : Qfalse;
|
||||
return (resizeterm(NUM2INT(lin),NUM2INT(col)) == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qnil;
|
||||
#endif
|
||||
|
@ -1199,13 +1222,13 @@ window_getbkgd(VALUE obj)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
window_resize(VALUE obj, VALUE lines, VALUE columns)
|
||||
window_resize(VALUE obj, VALUE lin, VALUE col)
|
||||
{
|
||||
#if defined(HAVE_WRESIZE)
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
return wresize(winp->window, NUM2INT(lines), NUM2INT(columns)) == OK ? Qtrue : Qfalse;
|
||||
return wresize(winp->window, NUM2INT(lin), NUM2INT(col)) == OK ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qnil;
|
||||
#endif
|
||||
|
|
|
@ -13,10 +13,8 @@ elsif have_header("ncurses/curses.h") and have_library("ncurses", "initscr")
|
|||
make=true
|
||||
elsif have_header("curses_colr/curses.h") and have_library("cur_colr", "initscr")
|
||||
make=true
|
||||
else
|
||||
if have_header("curses.h") and have_library("curses", "initscr")
|
||||
elsif have_header("curses.h") and have_library("curses", "initscr")
|
||||
make=true
|
||||
end
|
||||
end
|
||||
|
||||
if make
|
||||
|
|
6
file.c
6
file.c
|
@ -161,7 +161,11 @@ static VALUE
|
|||
rb_stat_ino(self)
|
||||
VALUE self;
|
||||
{
|
||||
#ifdef HUGE_ST_INO
|
||||
return ULL2NUM(get_stat(self)->st_ino);
|
||||
#else
|
||||
return ULONG2NUM(get_stat(self)->st_ino);
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -171,7 +175,7 @@ rb_stat_mode(self)
|
|||
#ifdef __BORLANDC__
|
||||
return UINT2NUM((unsigned short)(get_stat(self)->st_mode));
|
||||
#else
|
||||
return UINT2NUM(get_stat(self)->st_mode);
|
||||
return UINT2NUM(get_stat(self)->st_mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
2
inits.c
2
inits.c
|
@ -18,6 +18,7 @@ void Init_Comparable _((void));
|
|||
void Init_Dir _((void));
|
||||
void Init_Enumerable _((void));
|
||||
void Init_Exception _((void));
|
||||
void Init_syserr _((void));
|
||||
void Init_eval _((void));
|
||||
void Init_load _((void));
|
||||
void Init_Proc _((void));
|
||||
|
@ -59,6 +60,7 @@ rb_call_inits()
|
|||
Init_Thread();
|
||||
Init_Numeric();
|
||||
Init_Bignum();
|
||||
Init_syserr();
|
||||
Init_Array();
|
||||
Init_Hash();
|
||||
Init_Struct();
|
||||
|
|
Loading…
Reference in a new issue