mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/curses/curses.c (curses_colors): new method added. a patch
from Alexander Beisig in [ruby-core:22331]. * ext/curses/curses.c (curses_color_pairs): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ca292099a6
commit
02316f11d5
3 changed files with 32 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Feb 25 00:15:15 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* ext/curses/curses.c (curses_colors): new method added. a patch
|
||||
from Alexander Beisig in [ruby-core:22331].
|
||||
|
||||
* ext/curses/curses.c (curses_color_pairs): ditto.
|
||||
|
||||
Wed Feb 25 00:05:13 2009 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* class.c (rb_scan_args): Revamp rb_scan_args() to compute the
|
||||
|
|
|
@ -676,6 +676,16 @@ curses_can_change_color(VALUE obj)
|
|||
return can_change_color() ? Qtrue : Qfalse;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
curses_colors(VALUE obj)
|
||||
{
|
||||
#if defined(HAVE_COLORS)
|
||||
return INT2FIX(COLORS);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
curses_color_content(VALUE obj, VALUE color)
|
||||
{
|
||||
|
@ -685,6 +695,17 @@ curses_color_content(VALUE obj, VALUE color)
|
|||
return rb_ary_new3(3,INT2FIX(r),INT2FIX(g),INT2FIX(b));
|
||||
}
|
||||
|
||||
|
||||
static VALUE
|
||||
curses_color_pairs(VALUE obj)
|
||||
{
|
||||
#if defined(HAVE_COLOR_PAIRS)
|
||||
return INT2FIX(COLOR_PAIRS);
|
||||
#else
|
||||
rb_notimplement();
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
curses_pair_content(VALUE obj, VALUE pair)
|
||||
{
|
||||
|
@ -1537,7 +1558,9 @@ Init_curses(void)
|
|||
rb_define_module_function(mCurses, "has_colors?", curses_has_colors, 0);
|
||||
rb_define_module_function(mCurses, "can_change_color?",
|
||||
curses_can_change_color, 0);
|
||||
rb_define_module_function(mCurses, "colors", curses_colors, 0);
|
||||
rb_define_module_function(mCurses, "color_content", curses_color_content, 1);
|
||||
rb_define_module_function(mCurses, "color_pairs", curses_color_pairs, 0);
|
||||
rb_define_module_function(mCurses, "pair_content", curses_pair_content, 1);
|
||||
rb_define_module_function(mCurses, "color_pair", curses_color_pair, 1);
|
||||
rb_define_module_function(mCurses, "pair_number", curses_pair_number, 1);
|
||||
|
|
|
@ -30,5 +30,7 @@ if make
|
|||
end
|
||||
have_var("ESCDELAY", curses)
|
||||
have_var("TABSIZE", curses)
|
||||
have_var("COLORS", curses)
|
||||
have_var("COLOR_PAIRS", curses)
|
||||
create_makefile("curses")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue