ruby-changes:11012
From: matz <ko1@a...>
Date: Wed, 25 Feb 2009 00:20:38 +0900 (JST)
Subject: [ruby-changes:11012] Ruby:r22602 (trunk): * ext/curses/curses.c (curses_colors): new method added. a patch
matz 2009-02-25 00:19:17 +0900 (Wed, 25 Feb 2009) New Revision: 22602 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22602 Log: * 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. Modified files: trunk/ChangeLog trunk/ext/curses/curses.c trunk/ext/curses/extconf.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 22601) +++ ChangeLog (revision 22602) @@ -1,3 +1,10 @@ +Wed Feb 25 00:15:15 2009 Yukihiro Matsumoto <matz@r...> + + * 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@i...> * class.c (rb_scan_args): Revamp rb_scan_args() to compute the Index: ext/curses/curses.c =================================================================== --- ext/curses/curses.c (revision 22601) +++ ext/curses/curses.c (revision 22602) @@ -677,6 +677,16 @@ } 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) { short r,g,b; @@ -685,7 +695,18 @@ 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) { short f,b; @@ -1537,7 +1558,9 @@ 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); Index: ext/curses/extconf.rb =================================================================== --- ext/curses/extconf.rb (revision 22601) +++ ext/curses/extconf.rb (revision 22602) @@ -30,5 +30,7 @@ end have_var("ESCDELAY", curses) have_var("TABSIZE", curses) + have_var("COLORS", curses) + have_var("COLOR_PAIRS", curses) create_makefile("curses") end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/