* ext/curses/curses.c ({curses,window}_clrtoeol): added. suggested
by Reyn Vlietstra. * ext/curses/curses.c: chtype in curses is not `char', rahter `long'. [ruby-Bugs:2298] * ext/curses/view.rb: String =~ String is deprecated. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ca3d6e72bf
commit
fb46cf1d7a
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
Sat Aug 27 20:13:31 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
|
* ext/curses/curses.c ({curses,window}_clrtoeol): added. suggested
|
||||||
|
by Reyn Vlietstra.
|
||||||
|
|
||||||
|
* ext/curses/curses.c: chtype in curses is not `char', rahter `long'.
|
||||||
|
[ruby-Bugs:2298]
|
||||||
|
|
||||||
|
* ext/curses/view.rb: String =~ String is deprecated.
|
||||||
|
|
||||||
Thu Aug 25 15:48:58 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
Thu Aug 25 15:48:58 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||||
|
|
||||||
* ext/win32ole/win32ole.c: supress warnings. (win32)
|
* ext/win32ole/win32ole.c: supress warnings. (win32)
|
||||||
|
@ -54,6 +54,9 @@
|
|||||||
# define USE_MOUSE 1
|
# define USE_MOUSE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define NUM2CH NUM2LONG
|
||||||
|
#define CH2FIX LONG2FIX
|
||||||
|
|
||||||
static VALUE mCurses;
|
static VALUE mCurses;
|
||||||
static VALUE mKey;
|
static VALUE mKey;
|
||||||
static VALUE cWindow;
|
static VALUE cWindow;
|
||||||
@ -183,6 +186,15 @@ curses_clear(obj)
|
|||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* def clrtoeol */
|
||||||
|
static VALUE
|
||||||
|
curses_clrtoeol()
|
||||||
|
{
|
||||||
|
curses_stdscr();
|
||||||
|
clrtoeol();
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
/* def refresh */
|
/* def refresh */
|
||||||
static VALUE
|
static VALUE
|
||||||
curses_refresh(obj)
|
curses_refresh(obj)
|
||||||
@ -362,7 +374,7 @@ curses_inch(obj)
|
|||||||
VALUE obj;
|
VALUE obj;
|
||||||
{
|
{
|
||||||
curses_stdscr();
|
curses_stdscr();
|
||||||
return CHR2FIX(inch());
|
return CH2FIX(inch());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def addch(ch) */
|
/* def addch(ch) */
|
||||||
@ -372,7 +384,7 @@ curses_addch(obj, ch)
|
|||||||
VALUE ch;
|
VALUE ch;
|
||||||
{
|
{
|
||||||
curses_stdscr();
|
curses_stdscr();
|
||||||
addch(NUM2CHR(ch));
|
addch(NUM2CH(ch));
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +395,7 @@ curses_insch(obj, ch)
|
|||||||
VALUE ch;
|
VALUE ch;
|
||||||
{
|
{
|
||||||
curses_stdscr();
|
curses_stdscr();
|
||||||
insch(NUM2CHR(ch));
|
insch(NUM2CH(ch));
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -547,7 +559,7 @@ static VALUE
|
|||||||
curses_bkgdset(VALUE obj, VALUE ch)
|
curses_bkgdset(VALUE obj, VALUE ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_BKGDSET
|
#ifdef HAVE_BKGDSET
|
||||||
bkgdset(NUM2CHR(ch));
|
bkgdset(NUM2CH(ch));
|
||||||
#endif
|
#endif
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -556,7 +568,7 @@ static VALUE
|
|||||||
curses_bkgd(VALUE obj, VALUE ch)
|
curses_bkgd(VALUE obj, VALUE ch)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_BKGD
|
#ifdef HAVE_BKGD
|
||||||
return (bkgd(NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
|
return (bkgd(NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
|
||||||
#else
|
#else
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
#endif
|
#endif
|
||||||
@ -829,6 +841,19 @@ window_clear(obj)
|
|||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* def clrtoeol */
|
||||||
|
static VALUE
|
||||||
|
window_clrtoeol(obj)
|
||||||
|
VALUE obj;
|
||||||
|
{
|
||||||
|
struct windata *winp;
|
||||||
|
|
||||||
|
GetWINDOW(obj, winp);
|
||||||
|
wclrtoeol(winp->window);
|
||||||
|
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
/* def refresh */
|
/* def refresh */
|
||||||
static VALUE
|
static VALUE
|
||||||
window_refresh(obj)
|
window_refresh(obj)
|
||||||
@ -1002,13 +1027,13 @@ window_box(argc, argv, self)
|
|||||||
rb_scan_args(argc, argv, "21", &vert, &hor, &corn);
|
rb_scan_args(argc, argv, "21", &vert, &hor, &corn);
|
||||||
|
|
||||||
GetWINDOW(self, winp);
|
GetWINDOW(self, winp);
|
||||||
box(winp->window, NUM2CHR(vert), NUM2CHR(hor));
|
box(winp->window, NUM2CH(vert), NUM2CH(hor));
|
||||||
|
|
||||||
if (!NIL_P(corn)) {
|
if (!NIL_P(corn)) {
|
||||||
int cur_x, cur_y, x, y;
|
int cur_x, cur_y, x, y;
|
||||||
char c;
|
chtype c;
|
||||||
|
|
||||||
c = NUM2CHR(corn);
|
c = NUM2CH(corn);
|
||||||
getyx(winp->window, cur_y, cur_x);
|
getyx(winp->window, cur_y, cur_x);
|
||||||
x = NUM2INT(window_maxx(self)) - 1;
|
x = NUM2INT(window_maxx(self)) - 1;
|
||||||
y = NUM2INT(window_maxy(self)) - 1;
|
y = NUM2INT(window_maxy(self)) - 1;
|
||||||
@ -1058,7 +1083,7 @@ window_inch(obj)
|
|||||||
struct windata *winp;
|
struct windata *winp;
|
||||||
|
|
||||||
GetWINDOW(obj, winp);
|
GetWINDOW(obj, winp);
|
||||||
return CHR2FIX(winch(winp->window));
|
return CH2FIX(winch(winp->window));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* def addch(ch) */
|
/* def addch(ch) */
|
||||||
@ -1070,7 +1095,7 @@ window_addch(obj, ch)
|
|||||||
struct windata *winp;
|
struct windata *winp;
|
||||||
|
|
||||||
GetWINDOW(obj, winp);
|
GetWINDOW(obj, winp);
|
||||||
waddch(winp->window, NUM2CHR(ch));
|
waddch(winp->window, NUM2CH(ch));
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -1084,7 +1109,7 @@ window_insch(obj, ch)
|
|||||||
struct windata *winp;
|
struct windata *winp;
|
||||||
|
|
||||||
GetWINDOW(obj, winp);
|
GetWINDOW(obj, winp);
|
||||||
winsch(winp->window, NUM2CHR(ch));
|
winsch(winp->window, NUM2CH(ch));
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -1313,7 +1338,7 @@ window_bkgdset(VALUE obj, VALUE ch)
|
|||||||
struct windata *winp;
|
struct windata *winp;
|
||||||
|
|
||||||
GetWINDOW(obj,winp);
|
GetWINDOW(obj,winp);
|
||||||
wbkgdset(winp->window, NUM2CHR(ch));
|
wbkgdset(winp->window, NUM2CH(ch));
|
||||||
#endif
|
#endif
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -1325,7 +1350,7 @@ window_bkgd(VALUE obj, VALUE ch)
|
|||||||
struct windata *winp;
|
struct windata *winp;
|
||||||
|
|
||||||
GetWINDOW(obj,winp);
|
GetWINDOW(obj,winp);
|
||||||
return (wbkgd(winp->window, NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
|
return (wbkgd(winp->window, NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
|
||||||
#else
|
#else
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
#endif
|
#endif
|
||||||
@ -1335,11 +1360,11 @@ static VALUE
|
|||||||
window_getbkgd(VALUE obj)
|
window_getbkgd(VALUE obj)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_WGETBKGD
|
#ifdef HAVE_WGETBKGD
|
||||||
char c;
|
chtype c;
|
||||||
struct windata *winp;
|
struct windata *winp;
|
||||||
|
|
||||||
GetWINDOW(obj,winp);
|
GetWINDOW(obj,winp);
|
||||||
return (c = getbkgd(winp->window) != ERR) ? CHR2FIX(c) : Qnil;
|
return (c = getbkgd(winp->window) != ERR) ? CH2FIX(c) : Qnil;
|
||||||
#else
|
#else
|
||||||
return Qnil;
|
return Qnil;
|
||||||
#endif
|
#endif
|
||||||
@ -1439,6 +1464,7 @@ Init_curses()
|
|||||||
rb_define_module_function(mCurses, "refresh", curses_refresh, 0);
|
rb_define_module_function(mCurses, "refresh", curses_refresh, 0);
|
||||||
rb_define_module_function(mCurses, "doupdate", curses_doupdate, 0);
|
rb_define_module_function(mCurses, "doupdate", curses_doupdate, 0);
|
||||||
rb_define_module_function(mCurses, "clear", curses_clear, 0);
|
rb_define_module_function(mCurses, "clear", curses_clear, 0);
|
||||||
|
rb_define_module_function(mCurses, "clrtoeol", curses_clrtoeol, 0);
|
||||||
rb_define_module_function(mCurses, "echo", curses_echo, 0);
|
rb_define_module_function(mCurses, "echo", curses_echo, 0);
|
||||||
rb_define_module_function(mCurses, "noecho", curses_noecho, 0);
|
rb_define_module_function(mCurses, "noecho", curses_noecho, 0);
|
||||||
rb_define_module_function(mCurses, "raw", curses_raw, 0);
|
rb_define_module_function(mCurses, "raw", curses_raw, 0);
|
||||||
@ -1506,6 +1532,7 @@ Init_curses()
|
|||||||
rb_define_method(cWindow, "subwin", window_subwin, 4);
|
rb_define_method(cWindow, "subwin", window_subwin, 4);
|
||||||
rb_define_method(cWindow, "close", window_close, 0);
|
rb_define_method(cWindow, "close", window_close, 0);
|
||||||
rb_define_method(cWindow, "clear", window_clear, 0);
|
rb_define_method(cWindow, "clear", window_clear, 0);
|
||||||
|
rb_define_method(cWindow, "clrtoeol", window_clrtoeol, 0);
|
||||||
rb_define_method(cWindow, "refresh", window_refresh, 0);
|
rb_define_method(cWindow, "refresh", window_refresh, 0);
|
||||||
rb_define_method(cWindow, "noutrefresh", window_noutrefresh, 0);
|
rb_define_method(cWindow, "noutrefresh", window_noutrefresh, 0);
|
||||||
rb_define_method(cWindow, "box", window_box, -1);
|
rb_define_method(cWindow, "box", window_box, -1);
|
||||||
|
@ -49,7 +49,7 @@ while TRUE
|
|||||||
n = 0
|
n = 0
|
||||||
while TRUE
|
while TRUE
|
||||||
c = getch.chr
|
c = getch.chr
|
||||||
if c =~ "[0-9]" then
|
if c =~ /[0-9]/
|
||||||
n = 10 * n + c.to_i
|
n = 10 * n + c.to_i
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user