summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-15 03:01:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-08-15 03:01:52 +0000
commit625c1361e368f6f13f303de0310e6625d7b5296b (patch)
treee119ce31630c3186aa666ed4973f7fd22f4fc9a0 /ext
parentbefd57c7ea203d37531798dda95eaf488ef74dee (diff)
* 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
Diffstat (limited to 'ext')
-rw-r--r--ext/curses/curses.c45
-rw-r--r--ext/curses/extconf.rb4
2 files changed, 35 insertions, 14 deletions
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
index 52c8ab1e7f..e1080f1bd8 100644
--- a/ext/curses/curses.c
+++ b/ext/curses/curses.c
@@ -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
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
index 94d1e2e549..46fcc8f471 100644
--- a/ext/curses/extconf.rb
+++ b/ext/curses/extconf.rb
@@ -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