[#11852] continuations in Ruby 1.9? — David Flanagan <david@...>
In a comment on my recent blog post
On 8/6/07, David Flanagan <david@davidflanagan.com> wrote:
[#11860] Is this really what we want? — James Edward Gray II <james@...>
I'm investigating some recent breakage in FasterCSV and have tracking
Hi,
[#11871] ruby-openssl: == incorrect for X509-Subjects — Hadmut Danisch <hadmut@...>
Hi,
[#11876] priorities of newly-created threads — David Flanagan <david@...>
Hi,
Hi,
[#11886] Core dump with simple web scraper when run via cron — Daniel Berger <Daniel.Berger@...>
Hi all,
[#11890] Ruby and Solaris door library — "Hiro Asari" <asari.ruby@...>
Hi, there. This is my first patch against ruby. I think I followed
Hiro Asari wrote:
On 8/13/07, Daniel Berger <djberg96@gmail.com> wrote:
> -----Original Message-----
On 8/15/07, Berger, Daniel <Daniel.Berger@qwest.com> wrote:
[#11893] UDP sockets raise exception on MIPS platform — Brian Candler <B.Candler@...>
I am running ruby-1.8.6 under OpenWrt (*), which is a small MIPS platform
[#11894] IO#seek and whence problem — Bertram Scharpf <lists@...>
[#11899] pack/unpack 64bit Integers — Hadmut Danisch <hadmut@...>
Hi,
On Wed, Aug 15, 2007 at 06:50:01AM +0900, Hadmut Danisch wrote:
On Wed, Aug 15, 2007 at 02:45:20PM +0900, Brian Candler wrote:
On Fri, Aug 17, 2007 at 05:17:09PM +0200, Hadmut Danisch wrote:
Dumb question of the day: are Kernel#proc and Kernel#lambda identical?
> Dumb question of the day: are Kernel#proc and Kernel#lambda identical?
[#11900] missing bison, gperf not detected, do I need ruby to build ruby? — "Gabor Szabo" <szabgab@...>
Hi,
On Wed, 15 Aug 2007, Gabor Szabo wrote:
> > It seems ./configure did not detect the fact that bison was missing from
[#11930] Bug in select? — "Robert Dober" <robert.dober@...>
Hi
[#11945] Smoke testing Ruby — "Gabor Szabo" <szabgab@...>
Hi,
On 8/21/07, Gabor Szabo <szabgab@gmail.com> wrote:
Ruby used to have the Triple-R project based on Rubicon: see
Hugh Sasse wrote:
[#11947] Splatting MatchData bug? — Jos Backus <jos@...>
$ /tmp/ruby-1.9/bin/ruby -v
[#11948] Fibers in Ruby 1.9? — David Flanagan <david@...>
I just noticed that my ruby1.9 build of August 17th includes a Fiber
David Flanagan wrote:
On 8/22/07, Daniel Berger <djberg96@gmail.com> wrote:
On Wed, 22 Aug 2007 20:50:12 +0900, "Francis Cianfrocca" <garbagecat10@gmail.com> wrote:
On 8/22/07, MenTaLguY <mental@rydia.net> wrote:
On Thu, 23 Aug 2007 00:57:01 +0900, "Francis Cianfrocca" <garbagecat10@gmail.com> wrote:
[#11960] coroutines with Fiber::Core — David Flanagan <david@...>
The following code works on Linux with today's snapshot of 1.9:
Hi,
[#11981] Inverse Square Root — "Dave Pederson" <dave.pederson@...>
Hello-
[#11988] String#length not working properly in Ruby 1.9 — "Vincent Isambart" <vincent.isambart@...>
I saw that Matz just merged his M17N implementation in the trunk.
Hi,
On Sat, 25 Aug 2007 10:54:20 +0200, Yukihiro Matsumoto
Hi,
On 8/25/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
Hi,
On 8/25/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
[#12025] how to build ruby on vms — "toni" <toni@...>
Hi,
[#12040] Pragmas in Ruby 1.9 — David Flanagan <david@...>
Hi,
[#12042] Encodings of string literals; explicit codepoint escapes? — David Flanagan <david@...>
This message contains queries that probably only Matz can answer:
Hi,
Yukihiro Matsumoto wrote:
On 8/31/07, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:
[PATCH] Curses - add default_color() routines
I added conditionally compiled functions to ext/curses of Ruby 1.9 to
wrap the curses extensions use_default_colors() and
assume_default_colors(). I have tested this with ncurses 5.5.20060422
on an Ubuntu Linux system i686. Could apply to Ruby 1.8 as well.
Normally, Curses.start_color causes the terminal window default colors
to be white text on black background. Curses.use_default_colors()
assigns the terminal's default foreground and background colors to color
number -1. The default colors are thus not changed which is important
for customized X terminals and those with transparent backgrounds, etc.
See default_colors(3NCURSES) manpage for more details. The
code documentation was shamelessly ripped from the manpage.
Old behavior:
ruby -r curses -e 'include Curses; init_screen; start_color; \
addstr("hello"); stdscr.refresh; sleep(1); close_screen'
New behavior:
ruby -r curses -e 'include Curses; init_screen; start_color; use_default_colors; \
addstr("hello"); stdscr.refresh; sleep(1); close_screen'
ChangeLog:
Thu Aug 2 23:36:12 2007 Patrick Mahoney <pat@polycrystal.org>
* ext/curses/extconf.rb: add checks for use_default_colors() and
assume_default_colors() library functions.
* ext/curses/curses.c (curses_use_default_colors): new method compiled
conditionally if available in the curses library.
* ext/curses/curses.c (curses_assume_default_colors): new method compiled
conditionally if available in the curses library.
Attachments (1)
Index: ext/curses/curses.c
===================================================================
--- ext/curses/curses.c (revision 12869)
+++ ext/curses/curses.c (working copy)
@@ -613,6 +613,45 @@
}
#endif /* USE_COLOR */
+#ifdef HAVE_USE_DEFAULT_COLORS
+/*
+ * Assign terminal's default foreground and background colors to color number
+ * -1. So Curses.init_pair(x,Curses::COLOR_RED,-1) will initialize pair x as
+ * red on default background and init_pair(x,-1,Curses::COLOR_BLUE) will
+ * initialize pair x as default foreground on blue.
+ *
+ * Returns true on success; false on failure.
+ *
+ * This function is not available on all platforms.
+ */
+static VALUE
+curses_use_default_colors(VALUE obj)
+{
+ return (use_default_colors() == OK) ? Qtrue : Qfalse;
+}
+#endif
+
+#ifdef HAVE_ASSUME_DEFAULT_COLORS
+/*
+ * Related to Curses.use_default_colors, tells which colors to paint for color
+ * pair 0. This function recognizes a special color number -1, which denotes
+ * the default terminal color.
+ *
+ * Returns true on success; false on failure.
+ *
+ * The following are equivalent:
+ * Curses.use_default_colors()
+ * Curses.assume_default_colors(-1,-1)
+ *
+ * This function is not available on all platforms.
+ */
+static VALUE
+curses_assume_default_colors(VALUE obj, VALUE fg, VALUE bg)
+{
+ return (assume_default_colors(NUM2INT(fg), NUM2INT(bg)) == OK) ? Qtrue : Qfalse;
+}
+#endif
+
#ifdef USE_MOUSE
struct mousedata {
MEVENT *mevent;
@@ -1432,6 +1471,13 @@
rb_define_module_function(mCurses, "color_pair", curses_color_pair, 1);
rb_define_module_function(mCurses, "pair_number", curses_pair_number, 1);
#endif /* USE_COLOR */
+#ifdef HAVE_USE_DEFAULT_COLORS
+ rb_define_module_function(mCurses, "use_default_colors", curses_use_default_colors, 0);
+#endif
+#ifdef HAVE_ASSUME_DEFAULT_COLORS
+ rb_define_module_function(mCurses, "assume_default_colors", curses_assume_default_colors, 2);
+#endif
+
#ifdef USE_MOUSE
rb_define_module_function(mCurses, "getmouse", curses_getmouse, 0);
rb_define_module_function(mCurses, "ungetmouse", curses_ungetmouse, 1);
Index: ext/curses/extconf.rb
===================================================================
--- ext/curses/extconf.rb (revision 12869)
+++ ext/curses/extconf.rb (working copy)
@@ -19,7 +19,7 @@
end
if make
- for f in %w(beep bkgd bkgdset curs_set deleteln doupdate flash getbkgd getnstr init isendwin keyname keypad resizeterm scrl set setscrreg ungetch wattroff wattron wattrset wbkgd wbkgdset wdeleteln wgetnstr wresize wscrl wsetscrreg def_prog_mode reset_prog_mode timeout wtimeout nodelay init_color wcolor_set)
+ for f in %w(beep bkgd bkgdset curs_set deleteln doupdate flash getbkgd getnstr init isendwin keyname keypad resizeterm scrl set setscrreg ungetch wattroff wattron wattrset wbkgd wbkgdset wdeleteln wgetnstr wresize wscrl wsetscrreg def_prog_mode reset_prog_mode timeout wtimeout nodelay init_color wcolor_set use_default_colors assume_default_colors)
have_func(f)
end
flag = "-D_XOPEN_SOURCE_EXTENDED"