ruby-changes:13492
From: marcandre <ko1@a...>
Date: Fri, 9 Oct 2009 02:47:25 +0900 (JST)
Subject: [ruby-changes:13492] Ruby:r25268 (ruby_1_8): ext/curses/curses.c: fix whitespace
marcandre 2009-10-09 02:47:15 +0900 (Fri, 09 Oct 2009) New Revision: 25268 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25268 Log: ext/curses/curses.c: fix whitespace Modified files: branches/ruby_1_8/ext/curses/curses.c Index: ruby_1_8/ext/curses/curses.c =================================================================== --- ruby_1_8/ext/curses/curses.c (revision 25267) +++ ruby_1_8/ext/curses/curses.c (revision 25268) @@ -476,16 +476,16 @@ VALUE c; { #ifdef HAVE_KEYNAME - const char *name; + const char *name; - name = keyname(NUM2INT(c)); - if (name) { + name = keyname(NUM2INT(c)); + if (name) { return rb_str_new2(name); - } else { + } else { return Qnil; - } + } #else - return Qnil; + return Qnil; #endif } @@ -505,72 +505,72 @@ curses_curs_set(VALUE obj, VALUE visibility) { #ifdef HAVE_CURS_SET - int n; - return (n = curs_set(NUM2INT(visibility)) != ERR) ? INT2FIX(n) : Qnil; + int n; + return (n = curs_set(NUM2INT(visibility)) != ERR) ? INT2FIX(n) : Qnil; #else - return Qnil; + return Qnil; #endif } static VALUE curses_scrl(VALUE obj, VALUE n) { - /* may have to raise exception on ERR */ + /* may have to raise exception on ERR */ #ifdef HAVE_SCRL - return (scrl(NUM2INT(n)) == OK) ? Qtrue : Qfalse; + return (scrl(NUM2INT(n)) == OK) ? Qtrue : Qfalse; #else - return Qfalse; + return Qfalse; #endif } static VALUE curses_setscrreg(VALUE obj, VALUE top, VALUE bottom) { - /* may have to raise exception on ERR */ + /* may have to raise exception on ERR */ #ifdef HAVE_SETSCRREG - return (setscrreg(NUM2INT(top), NUM2INT(bottom)) == OK) ? Qtrue : Qfalse; + return (setscrreg(NUM2INT(top), NUM2INT(bottom)) == OK) ? Qtrue : Qfalse; #else - return Qfalse; + return Qfalse; #endif } static VALUE curses_attroff(VALUE obj, VALUE attrs) { - return window_attroff(rb_stdscr,attrs); - /* return INT2FIX(attroff(NUM2INT(attrs))); */ + return window_attroff(rb_stdscr,attrs); + /* return INT2FIX(attroff(NUM2INT(attrs))); */ } static VALUE curses_attron(VALUE obj, VALUE attrs) { - return window_attron(rb_stdscr,attrs); - /* return INT2FIX(attroff(NUM2INT(attrs))); */ + return window_attron(rb_stdscr,attrs); + /* return INT2FIX(attroff(NUM2INT(attrs))); */ } static VALUE curses_attrset(VALUE obj, VALUE attrs) { - return window_attrset(rb_stdscr,attrs); - /* return INT2FIX(attroff(NUM2INT(attrs))); */ + return window_attrset(rb_stdscr,attrs); + /* return INT2FIX(attroff(NUM2INT(attrs))); */ } static VALUE curses_bkgdset(VALUE obj, VALUE ch) { #ifdef HAVE_BKGDSET - bkgdset(NUM2CH(ch)); + bkgdset(NUM2CH(ch)); #endif - return Qnil; + return Qnil; } static VALUE curses_bkgd(VALUE obj, VALUE ch) { #ifdef HAVE_BKGD - return (bkgd(NUM2CH(ch)) == OK) ? Qtrue : Qfalse; + return (bkgd(NUM2CH(ch)) == OK) ? Qtrue : Qfalse; #else - return Qfalse; + return Qfalse; #endif } @@ -578,9 +578,9 @@ curses_resizeterm(VALUE obj, VALUE lin, VALUE col) { #if defined(HAVE_RESIZETERM) - return (resizeterm(NUM2INT(lin),NUM2INT(col)) == OK) ? Qtrue : Qfalse; + return (resizeterm(NUM2INT(lin),NUM2INT(col)) == OK) ? Qtrue : Qfalse; #else - return Qnil; + return Qnil; #endif } @@ -588,77 +588,77 @@ static VALUE curses_start_color(VALUE obj) { - /* may have to raise exception on ERR */ - return (start_color() == OK) ? Qtrue : Qfalse; + /* may have to raise exception on ERR */ + return (start_color() == OK) ? Qtrue : Qfalse; } static VALUE curses_init_pair(VALUE obj, VALUE pair, VALUE f, VALUE b) { - /* may have to raise exception on ERR */ - return (init_pair(NUM2INT(pair),NUM2INT(f),NUM2INT(b)) == OK) ? Qtrue : Qfalse; + /* may have to raise exception on ERR */ + return (init_pair(NUM2INT(pair),NUM2INT(f),NUM2INT(b)) == OK) ? Qtrue : Qfalse; } static VALUE curses_init_color(VALUE obj, VALUE color, VALUE r, VALUE g, VALUE b) { - /* may have to raise exception on ERR */ - return (init_color(NUM2INT(color),NUM2INT(r), + /* may have to raise exception on ERR */ + return (init_color(NUM2INT(color),NUM2INT(r), NUM2INT(g),NUM2INT(b)) == OK) ? Qtrue : Qfalse; } static VALUE curses_has_colors(VALUE obj) { - return has_colors() ? Qtrue : Qfalse; + return has_colors() ? Qtrue : Qfalse; } static VALUE curses_can_change_color(VALUE obj) { - return can_change_color() ? Qtrue : Qfalse; + return can_change_color() ? Qtrue : Qfalse; } static VALUE curses_color_content(VALUE obj, VALUE color) { - short r,g,b; + short r,g,b; - color_content(NUM2INT(color),&r,&g,&b); - return rb_ary_new3(3,INT2FIX(r),INT2FIX(g),INT2FIX(b)); + color_content(NUM2INT(color),&r,&g,&b); + return rb_ary_new3(3,INT2FIX(r),INT2FIX(g),INT2FIX(b)); } static VALUE curses_pair_content(VALUE obj, VALUE pair) { - short f,b; + short f,b; - pair_content(NUM2INT(pair),&f,&b); - return rb_ary_new3(2,INT2FIX(f),INT2FIX(b)); + pair_content(NUM2INT(pair),&f,&b); + return rb_ary_new3(2,INT2FIX(f),INT2FIX(b)); } static VALUE curses_color_pair(VALUE obj, VALUE attrs) { - return INT2FIX(COLOR_PAIR(NUM2INT(attrs))); + return INT2FIX(COLOR_PAIR(NUM2INT(attrs))); } static VALUE curses_pair_number(VALUE obj, VALUE attrs) { - return INT2FIX(PAIR_NUMBER(NUM2INT(attrs))); + return INT2FIX(PAIR_NUMBER(NUM2INT(attrs))); } #endif /* USE_COLOR */ #ifdef USE_MOUSE struct mousedata { - MEVENT *mevent; + MEVENT *mevent; }; static void no_mevent() { - rb_raise(rb_eRuntimeError, "no such mouse event"); + rb_raise(rb_eRuntimeError, "no such mouse event"); } #define GetMOUSE(obj, data) do {\ @@ -671,49 +671,49 @@ static void curses_mousedata_free(struct mousedata *mdata) { - if (mdata->mevent) + if (mdata->mevent) free(mdata->mevent); } static VALUE curses_getmouse(VALUE obj) { - struct mousedata *mdata; - VALUE val; + struct mousedata *mdata; + VALUE val; - val = Data_Make_Struct(cMouseEvent,struct mousedata, + val = Data_Make_Struct(cMouseEvent,struct mousedata, 0,curses_mousedata_free,mdata); - mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT)); - return (getmouse(mdata->mevent) == OK) ? val : Qnil; + mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT)); + return (getmouse(mdata->mevent) == OK) ? val : Qnil; } static VALUE curses_ungetmouse(VALUE obj, VALUE mevent) { - struct mousedata *mdata; + struct mousedata *mdata; - GetMOUSE(mevent,mdata); - return (ungetmouse(mdata->mevent) == OK) ? Qtrue : Qfalse; + GetMOUSE(mevent,mdata); + return (ungetmouse(mdata->mevent) == OK) ? Qtrue : Qfalse; } static VALUE curses_mouseinterval(VALUE obj, VALUE interval) { - return mouseinterval(NUM2INT(interval)) ? Qtrue : Qfalse; + return mouseinterval(NUM2INT(interval)) ? Qtrue : Qfalse; } static VALUE curses_mousemask(VALUE obj, VALUE mask) { - return INT2NUM(mousemask(NUM2UINT(mask),NULL)); + return INT2NUM(mousemask(NUM2UINT(mask),NULL)); } #define DEFINE_MOUSE_GET_MEMBER(func_name,mem) \ static VALUE func_name (VALUE mouse) \ { \ - struct mousedata *mdata; \ - GetMOUSE(mouse, mdata); \ - return (UINT2NUM(mdata->mevent -> mem)); \ + struct mousedata *mdata; \ + GetMOUSE(mouse, mdata); \ + return (UINT2NUM(mdata->mevent -> mem)); \ } DEFINE_MOUSE_GET_MEMBER(curs_mouse_id, id) @@ -728,8 +728,8 @@ curses_timeout(VALUE obj, VALUE delay) { #ifdef HAVE_TIMEOUT - timeout(NUM2INT(delay)); - return Qnil; + timeout(NUM2INT(delay)); + return Qnil; #else rb_notimplement(); #endif @@ -739,7 +739,7 @@ curses_def_prog_mode(VALUE obj) { #ifdef HAVE_DEF_PROG_MODE - return def_prog_mode() == OK ? Qtrue : Qfalse; + return def_prog_mode() == OK ? Qtrue : Qfalse; #else rb_notimplement(); #endif @@ -749,7 +749,7 @@ curses_reset_prog_mode(VALUE obj) { #ifdef HAVE_RESET_PROG_MODE - return reset_prog_mode() == OK ? Qtrue : Qfalse; + return reset_prog_mode() == OK ? Qtrue : Qfalse; #else rb_notimplement(); #endif @@ -1212,36 +1212,36 @@ static VALUE window_scrollok(VALUE obj, VALUE bf) { - struct windata *winp; + struct windata *winp; - GetWINDOW(obj, winp); - scrollok(winp->window, RTEST(bf) ? TRUE : FALSE); - return Qnil; + GetWINDOW(obj, winp); + scrollok(winp->window, RTEST(bf) ? TRUE : FALSE); + return Qnil; } static VALUE window_idlok(VALUE obj, VALUE bf) { - struct windata *winp; + struct windata *winp; - GetWINDOW(obj, winp); - idlok(winp->window, RTEST(bf) ? TRUE : FALSE); - return Qnil; + GetWINDOW(obj, winp); + idlok(winp->window, RTEST(bf) ? TRUE : FALSE); + return Qnil; } static VALUE window_setscrreg(VALUE obj, VALUE top, VALUE bottom) { #ifdef HAVE_WSETSCRREG - struct windata *winp; - int res; + struct windata *winp; + int res; - GetWINDOW(obj, winp); - res = wsetscrreg(winp->window, NUM2INT(top), NUM2INT(bottom)); - /* may have to raise exception on ERR */ - return (res == OK) ? Qtrue : Qfalse; + GetWINDOW(obj, winp); + res = wsetscrreg(winp->window, NUM2INT(top), NUM2INT(bottom)); + /* may have to raise exception on ERR */ + return (res == OK) ? Qtrue : Qfalse; #else - return Qfalse; + return Qfalse; #endif } @@ -1249,36 +1249,36 @@ static VALUE window_color_set(VALUE obj, VALUE col) { - struct windata *winp; - int res; + struct windata *winp; + int res; - GetWINDOW(obj, winp); - res = wcolor_set(winp->window, NUM2INT(col), NULL); - return (res == OK) ? Qtrue : Qfalse; + GetWINDOW(obj, winp); + res = wcolor_set(winp->window, NUM2INT(col), NULL); + return (res == OK) ? Qtrue : Qfalse; } #endif /* USE_COLOR */ static VALUE window_scroll(VALUE obj) { - struct windata *winp; + struct windata *winp; - GetWINDOW(obj, winp); - /* may have to raise exception on ERR */ - return (scroll(winp->window) == OK) ? Qtrue : Qfalse; + GetWINDOW(obj, winp); + /* may have to raise exception on ERR */ + return (scroll(winp->window) == OK) ? Qtrue : Qfalse; } static VALUE window_scrl(VALUE obj, VALUE n) { #ifdef HAVE_WSCRL - struct windata *winp; + struct windata *winp; - GetWINDOW(obj, winp); - /* may have to raise exception on ERR */ - return (wscrl(winp->window,NUM2INT(n)) == OK) ? Qtrue : Qfalse; + GetWINDOW(obj, winp); + /* may have to raise exception on ERR */ + return (wscrl(winp->window,NUM2INT(n)) == OK) ? Qtrue : Qfalse; #else - return Qfalse; + return Qfalse; #endif } @@ -1286,12 +1286,12 @@ window_attroff(VALUE obj, VALUE attrs) { #ifdef HAVE_WATTROFF - struct windata *winp; + struct windata *winp; - GetWINDOW(obj,winp); - return INT2FIX(wattroff(winp->window,NUM2INT(attrs))); + GetWINDOW(obj,winp); + return INT2FIX(wattroff(winp->window,NUM2INT(attrs))); #else - return Qtrue; + return Qtrue; #endif } @@ -1299,21 +1299,21 @@ window_attron(VALUE obj, VALUE attrs) { #ifdef HAVE_WATTRON - struct windata *winp; - VALUE val; + struct windata *winp; + VALUE val; - GetWINDOW(obj,winp); - val = INT2FIX(wattron(winp->window,NUM2INT(attrs))); - if( rb_block_given_p() ){ + GetWINDOW(obj,winp); + val = INT2FIX(wattron(winp->window,NUM2INT(attrs))); + if( rb_block_given_p() ){ rb_yield(val); wattroff(winp->window,NUM2INT(attrs)); return val; - } - else{ + } + else{ return val; - } + } #else - return Qtrue; + return Qtrue; #endif } @@ -1321,12 +1321,12 @@ window_attrset(VALUE obj, VALUE attrs) { #ifdef HAVE_WATTRSET - struct windata *winp; + struct windata *winp; - GetWINDOW(obj,winp); - return INT2FIX(wattrset(winp->window,NUM2INT(attrs))); + GetWINDOW(obj,winp); + return INT2FIX(wattrset(winp->window,NUM2INT(attrs))); #else - return Qtrue; + return Qtrue; #endif } @@ -1334,24 +1334,24 @@ window_bkgdset(VALUE obj, VALUE ch) { #ifdef HAVE_WBKGDSET - struct windata *winp; + struct windata *winp; - GetWINDOW(obj,winp); - wbkgdset(winp->window, NUM2CH(ch)); + GetWINDOW(obj,winp); + wbkgdset(winp->window, NUM2CH(ch)); #endif - return Qnil; + return Qnil; } static VALUE window_bkgd(VALUE obj, VALUE ch) { #ifdef HAVE_WBKGD - struct windata *winp; + struct windata *winp; - GetWINDOW(obj,winp); - return (wbkgd(winp->window, NUM2CH(ch)) == OK) ? Qtrue : Qfalse; + GetWINDOW(obj,winp); + return (wbkgd(winp->window, NUM2CH(ch)) == OK) ? Qtrue : Qfalse; #else - return Qfalse; + return Qfalse; #endif } @@ -1359,13 +1359,13 @@ window_getbkgd(VALUE obj) { #ifdef HAVE_WGETBKGD - chtype c; - struct windata *winp; + chtype c; + struct windata *winp; - GetWINDOW(obj,winp); - return (c = getbkgd(winp->window) != ERR) ? CH2FIX(c) : Qnil; + GetWINDOW(obj,winp); + return (c = getbkgd(winp->window) != ERR) ? CH2FIX(c) : Qnil; #else - return Qnil; + return Qnil; #endif } @@ -1373,12 +1373,12 @@ window_resize(VALUE obj, VALUE lin, VALUE col) { #if defined(HAVE_WRESIZE) - struct windata *winp; + struct windata *winp; - GetWINDOW(obj,winp); - return wresize(winp->window, NUM2INT(lin), NUM2INT(col)) == OK ? Qtrue : Qfalse; + GetWINDOW(obj,winp); + return wresize(winp->window, NUM2INT(lin), NUM2INT(col)) == OK ? Qtrue : Qfalse; #else - return Qnil; + return Qnil; #endif } @@ -1387,16 +1387,16 @@ window_keypad(VALUE obj, VALUE val) { #ifdef HAVE_KEYPAD - struct windata *winp; + struct windata *winp; - GetWINDOW(obj,winp); - /* keypad() of NetBSD's libcurses returns no value */ + GetWINDOW(obj,winp); + /* keypad() of NetBSD's libcurses returns no value */ #if defined(__NetBSD__) && !defined(NCURSES_VERSION) - keypad(winp->window,(RTEST(val) ? TRUE : FALSE)); - return Qnil; + keypad(winp->window,(RTEST(val) ? TRUE : FALSE)); + return Qnil; #else - /* may have to raise exception on ERR */ - return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ? + /* may have to raise exception on ERR */ + return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ? Qtrue : Qfalse; #endif #else @@ -1408,15 +1408,15 @@ window_nodelay(VALUE obj, VALUE val) { #ifdef HAVE_NODELAY - struct windata *winp; - GetWINDOW(obj,winp); + struct windata *winp; + GetWINDOW(obj,winp); - /* nodelay() of NetBSD's libcurses returns no value */ + /* nodelay() of NetBSD's libcurses returns no value */ #if defined(__NetBSD__) && !defined(NCURSES_VERSION) - nodelay(winp->window, RTEST(val) ? TRUE : FALSE); - return Qnil; + nodelay(winp->window, RTEST(val) ? TRUE : FALSE); + return Qnil; #else - return nodelay(winp->window,RTEST(val) ? TRUE : FALSE) == OK ? Qtrue : Qfalse; + return nodelay(winp->window,RTEST(val) ? TRUE : FALSE) == OK ? Qtrue : Qfalse; #endif #else rb_notimplement(); @@ -1427,11 +1427,11 @@ window_timeout(VALUE obj, VALUE delay) { #ifdef HAVE_WTIMEOUT - struct windata *winp; - GetWINDOW(obj,winp); + struct windata *winp; + GetWINDOW(obj,winp); - wtimeout(winp->window,NUM2INT(delay)); - return Qnil; + wtimeout(winp->window,NUM2INT(delay)); + return Qnil; #else rb_notimplement(); #endif -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/