ext/curses/curses: more whitespace

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
marcandre 2009-10-08 17:47:51 +00:00
parent c7a8fb0afe
commit d13255aa40

View file

@ -489,9 +489,9 @@ curses_keyname(obj, c)
curses_stdscr(); curses_stdscr();
name = keyname(NUM2INT(c)); name = keyname(NUM2INT(c));
if (name) { if (name) {
return rb_str_new2(name); return rb_str_new2(name);
} else { } else {
return Qnil; return Qnil;
} }
#else #else
return Qnil; return Qnil;
@ -625,7 +625,7 @@ curses_init_color(VALUE obj, VALUE color, VALUE r, VALUE g, VALUE b)
/* may have to raise exception on ERR */ /* may have to raise exception on ERR */
curses_stdscr(); curses_stdscr();
return (init_color(NUM2INT(color),NUM2INT(r), return (init_color(NUM2INT(color),NUM2INT(r),
NUM2INT(g),NUM2INT(b)) == OK) ? Qtrue : Qfalse; NUM2INT(g),NUM2INT(b)) == OK) ? Qtrue : Qfalse;
} }
static VALUE static VALUE
@ -698,7 +698,7 @@ static void
curses_mousedata_free(struct mousedata *mdata) curses_mousedata_free(struct mousedata *mdata)
{ {
if (mdata->mevent) if (mdata->mevent)
free(mdata->mevent); free(mdata->mevent);
} }
static VALUE static VALUE
@ -709,7 +709,7 @@ curses_getmouse(VALUE obj)
curses_stdscr(); curses_stdscr();
val = Data_Make_Struct(cMouseEvent,struct mousedata, val = Data_Make_Struct(cMouseEvent,struct mousedata,
0,curses_mousedata_free,mdata); 0,curses_mousedata_free,mdata);
mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT)); mdata->mevent = (MEVENT*)xmalloc(sizeof(MEVENT));
return (getmouse(mdata->mevent) == OK) ? val : Qnil; return (getmouse(mdata->mevent) == OK) ? val : Qnil;
} }
@ -1063,22 +1063,22 @@ window_box(argc, argv, self)
box(winp->window, NUM2CH(vert), NUM2CH(hor)); box(winp->window, NUM2CH(vert), NUM2CH(hor));
if (!NIL_P(corn)) { if (!NIL_P(corn)) {
int cur_x, cur_y, x, y; int cur_x, cur_y, x, y;
chtype c; chtype c;
c = NUM2CH(corn); c = NUM2CH(corn);
getyx(winp->window, cur_y, cur_x); getyx(winp->window, cur_y, cur_x);
x = NUM2INT(window_maxx(self)) - 1; x = NUM2INT(window_maxx(self)) - 1;
y = NUM2INT(window_maxy(self)) - 1; y = NUM2INT(window_maxy(self)) - 1;
wmove(winp->window, 0, 0); wmove(winp->window, 0, 0);
waddch(winp->window, c); waddch(winp->window, c);
wmove(winp->window, y, 0); wmove(winp->window, y, 0);
waddch(winp->window, c); waddch(winp->window, c);
wmove(winp->window, y, x); wmove(winp->window, y, x);
waddch(winp->window, c); waddch(winp->window, c);
wmove(winp->window, 0, x); wmove(winp->window, 0, x);
waddch(winp->window, c); waddch(winp->window, c);
wmove(winp->window, cur_y, cur_x); wmove(winp->window, cur_y, cur_x);
} }
return Qnil; return Qnil;
@ -1430,7 +1430,7 @@ window_keypad(VALUE obj, VALUE val)
#else #else
/* may have to raise exception on ERR */ /* may have to raise exception on ERR */
return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ? return (keypad(winp->window,RTEST(val) ? TRUE : FALSE)) == OK ?
Qtrue : Qfalse; Qtrue : Qfalse;
#endif #endif
#else #else
rb_notimplement(); rb_notimplement();
@ -1778,14 +1778,14 @@ Init_curses()
#ifdef KEY_F #ifdef KEY_F
/* KEY_F(n) : 0 <= n <= 63 */ /* KEY_F(n) : 0 <= n <= 63 */
{ {
int i; int i;
char c[8]; char c[8];
for( i=0; i<64; i++ ){ for( i=0; i<64; i++ ){
sprintf(c, "KEY_F%d", i); sprintf(c, "KEY_F%d", i);
rb_define_const(mCurses, c, INT2NUM(KEY_F(i))); rb_define_const(mCurses, c, INT2NUM(KEY_F(i)));
sprintf(c, "F%d", i); sprintf(c, "F%d", i);
rb_define_const(mKey, c, INT2NUM(KEY_F(i))); rb_define_const(mKey, c, INT2NUM(KEY_F(i)));
} }
} }
#endif #endif
#ifdef KEY_DL #ifdef KEY_DL
@ -2121,12 +2121,12 @@ Init_curses()
rb_define_const(mKey, "MAX", INT2NUM(KEY_MAX)); rb_define_const(mKey, "MAX", INT2NUM(KEY_MAX));
#endif #endif
{ {
int c; int c;
char name[] = "KEY_CTRL_x"; char name[] = "KEY_CTRL_x";
for( c = 'A'; c <= 'Z'; c++ ){ for( c = 'A'; c <= 'Z'; c++ ){
sprintf(name, "KEY_CTRL_%c", c); sprintf(name, "KEY_CTRL_%c", c);
rb_define_const(mCurses, name, INT2FIX(c - 'A' + 1)); rb_define_const(mCurses, name, INT2FIX(c - 'A' + 1));
} }
} }
#undef rb_curses_define_const #undef rb_curses_define_const