[#1611] set_trace_func/Array#fetch error — "Nathaniel Talbott" <nathaniel@...>

I've reduced the error I reported in ruby-talk:84013 to the following code:

17 messages 2003/10/11

Re: PATCH: Revive NextStep, OpenStep, Rhapsody ports

From: Eric Sunshine <sunshine@...>
Date: 2003-10-10 16:45:12 UTC
List: ruby-core #1608
On Sat, 11 Oct 2003 01:11:35 +0900, Yukihiro Matsumoto wrote:
> In message "Re: PATCH: Revive NextStep, OpenStep, Rhapsody ports"
> on 03/10/10, Eric Sunshine <sunshine@sunshineco.com> writes:
> |I can re-submit the patch without the fixes for those three methods in the
> |curses module, if you like. Would this be more acceptable?
> Or explain those modifies.  I'm waiting for confirmation anyway.

I consulted several `man' pages and found that the existing curses extension  
was returning values inconsistent with the `man' page documentation.  Below  
is a summary.

The bkgd() and wbkgd() functions are documented as returning OK (a boolean  
value), but the existing curses extension returns a numeric value from these  
functions.  I changed the return value of these functions to boolean to be  
consistent with the documentation.  Here is an excerpt from a manual page:

RETURN VALUE
       The  routines  bkgd  and wbkgd return the integer OK.  The
       SVr4.0 manual says "or a non-negative integer  if  immedok
       is set", but this appears to be an error.

Here are some URLs from various vendors which document the return values  
from these two functions:

http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/bkgd.3x.html
http://docs.hp.com/cgi-bin/doc3k/B3643090008.12947/56
http://www.mkssoftware.com/docs/man3/curs_bkgd.3.asp


The getbkgd() function is documented in a number of places as returning a  
numeric result unless there is an error, in which case ERR is returned.  Here  
is an excerpt from a manual page:

RETURN VALUE
       Upon successful completion, getbkgd() returns the
       specified window's background character and
       rendition. Otherwise, it returns (chtype)ERR.

Here are som URLs from various vendors which document the return value from  
this function:

http://www.opengroup.org/onlinepubs/7908799/xcurses/bkgd.html
http://docs.sun.com/db/doc/816-3323/6m9k40tdl?a=view
http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V40G_HTML/MAN/MAN3/0092____.HTM

The existing Ruby curses extension always returns a numeric result, even if  
getbkgd() returns ERR.  I changed it so that the Ruby function returns nil if  
ERR is returned from the getbkgd() curses function in order to be consistent  
with the curses_curs_set() function in curses.c.  The curs_set() function  
also returns a numeric result unless an error occurs, in which case it  
returns ERR.  The Ruby curses_curs_set() cover function converts the ERR to  
Ruby nil upon return.  It seems to me that these two curses functions, which  
have similar return values (numeric or ERR), should be treated similarly by  
the Ruby code.

-- ES

In This Thread

Prev Next