mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
3 changed files with 53 additions and 16 deletions
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>
|
||||
|
||||
* ext/win32ole/win32ole.c: supress warnings. (win32)
|
||||
|
|
|
@ -54,6 +54,9 @@
|
|||
# define USE_MOUSE 1
|
||||
#endif
|
||||
|
||||
#define NUM2CH NUM2LONG
|
||||
#define CH2FIX LONG2FIX
|
||||
|
||||
static VALUE mCurses;
|
||||
static VALUE mKey;
|
||||
static VALUE cWindow;
|
||||
|
@ -183,6 +186,15 @@ curses_clear(obj)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
/* def clrtoeol */
|
||||
static VALUE
|
||||
curses_clrtoeol()
|
||||
{
|
||||
curses_stdscr();
|
||||
clrtoeol();
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/* def refresh */
|
||||
static VALUE
|
||||
curses_refresh(obj)
|
||||
|
@ -362,7 +374,7 @@ curses_inch(obj)
|
|||
VALUE obj;
|
||||
{
|
||||
curses_stdscr();
|
||||
return CHR2FIX(inch());
|
||||
return CH2FIX(inch());
|
||||
}
|
||||
|
||||
/* def addch(ch) */
|
||||
|
@ -372,7 +384,7 @@ curses_addch(obj, ch)
|
|||
VALUE ch;
|
||||
{
|
||||
curses_stdscr();
|
||||
addch(NUM2CHR(ch));
|
||||
addch(NUM2CH(ch));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -383,7 +395,7 @@ curses_insch(obj, ch)
|
|||
VALUE ch;
|
||||
{
|
||||
curses_stdscr();
|
||||
insch(NUM2CHR(ch));
|
||||
insch(NUM2CH(ch));
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
|
@ -547,7 +559,7 @@ static VALUE
|
|||
curses_bkgdset(VALUE obj, VALUE ch)
|
||||
{
|
||||
#ifdef HAVE_BKGDSET
|
||||
bkgdset(NUM2CHR(ch));
|
||||
bkgdset(NUM2CH(ch));
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -556,7 +568,7 @@ static VALUE
|
|||
curses_bkgd(VALUE obj, VALUE ch)
|
||||
{
|
||||
#ifdef HAVE_BKGD
|
||||
return (bkgd(NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
|
||||
return (bkgd(NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
|
@ -829,6 +841,19 @@ window_clear(obj)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
/* def clrtoeol */
|
||||
static VALUE
|
||||
window_clrtoeol(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj, winp);
|
||||
wclrtoeol(winp->window);
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
||||
/* def refresh */
|
||||
static VALUE
|
||||
window_refresh(obj)
|
||||
|
@ -1002,13 +1027,13 @@ window_box(argc, argv, self)
|
|||
rb_scan_args(argc, argv, "21", &vert, &hor, &corn);
|
||||
|
||||
GetWINDOW(self, winp);
|
||||
box(winp->window, NUM2CHR(vert), NUM2CHR(hor));
|
||||
box(winp->window, NUM2CH(vert), NUM2CH(hor));
|
||||
|
||||
if (!NIL_P(corn)) {
|
||||
int cur_x, cur_y, x, y;
|
||||
char c;
|
||||
chtype c;
|
||||
|
||||
c = NUM2CHR(corn);
|
||||
c = NUM2CH(corn);
|
||||
getyx(winp->window, cur_y, cur_x);
|
||||
x = NUM2INT(window_maxx(self)) - 1;
|
||||
y = NUM2INT(window_maxy(self)) - 1;
|
||||
|
@ -1058,7 +1083,7 @@ window_inch(obj)
|
|||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj, winp);
|
||||
return CHR2FIX(winch(winp->window));
|
||||
return CH2FIX(winch(winp->window));
|
||||
}
|
||||
|
||||
/* def addch(ch) */
|
||||
|
@ -1070,7 +1095,7 @@ window_addch(obj, ch)
|
|||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj, winp);
|
||||
waddch(winp->window, NUM2CHR(ch));
|
||||
waddch(winp->window, NUM2CH(ch));
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -1084,7 +1109,7 @@ window_insch(obj, ch)
|
|||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj, winp);
|
||||
winsch(winp->window, NUM2CHR(ch));
|
||||
winsch(winp->window, NUM2CH(ch));
|
||||
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -1313,7 +1338,7 @@ window_bkgdset(VALUE obj, VALUE ch)
|
|||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
wbkgdset(winp->window, NUM2CHR(ch));
|
||||
wbkgdset(winp->window, NUM2CH(ch));
|
||||
#endif
|
||||
return Qnil;
|
||||
}
|
||||
|
@ -1325,7 +1350,7 @@ window_bkgd(VALUE obj, VALUE ch)
|
|||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
return (wbkgd(winp->window, NUM2CHR(ch)) == OK) ? Qtrue : Qfalse;
|
||||
return (wbkgd(winp->window, NUM2CH(ch)) == OK) ? Qtrue : Qfalse;
|
||||
#else
|
||||
return Qfalse;
|
||||
#endif
|
||||
|
@ -1335,11 +1360,11 @@ static VALUE
|
|||
window_getbkgd(VALUE obj)
|
||||
{
|
||||
#ifdef HAVE_WGETBKGD
|
||||
char c;
|
||||
chtype c;
|
||||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
return (c = getbkgd(winp->window) != ERR) ? CHR2FIX(c) : Qnil;
|
||||
return (c = getbkgd(winp->window) != ERR) ? CH2FIX(c) : Qnil;
|
||||
#else
|
||||
return Qnil;
|
||||
#endif
|
||||
|
@ -1439,6 +1464,7 @@ Init_curses()
|
|||
rb_define_module_function(mCurses, "refresh", curses_refresh, 0);
|
||||
rb_define_module_function(mCurses, "doupdate", curses_doupdate, 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, "noecho", curses_noecho, 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, "close", window_close, 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, "noutrefresh", window_noutrefresh, 0);
|
||||
rb_define_method(cWindow, "box", window_box, -1);
|
||||
|
|
|
@ -49,7 +49,7 @@ while TRUE
|
|||
n = 0
|
||||
while TRUE
|
||||
c = getch.chr
|
||||
if c =~ "[0-9]" then
|
||||
if c =~ /[0-9]/
|
||||
n = 10 * n + c.to_i
|
||||
else
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue