mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/curses/extconf.rb: check the size of chtype.
* ext/curses/curses.c (NUM2CH, CH2NUM): use proper macros for the size of chtype. [ruby-core:56090] [Bug #8659] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0e2f521057
commit
2328b4b29a
3 changed files with 32 additions and 5 deletions
|
@ -1,3 +1,12 @@
|
|||
Sat Sep 28 00:19:41 2013 Shugo Maeda <shugo@ruby-lang.org>
|
||||
|
||||
* ext/curses/extconf.rb: check the size of chtype.
|
||||
|
||||
* ext/curses/curses.c (NUM2CH, CH2NUM): use proper macros for
|
||||
the size of chtype.
|
||||
|
||||
[ruby-core:56090] [Bug #8659]
|
||||
|
||||
Fri Sep 27 18:33:23 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c: add two GC tuning environment variables.
|
||||
|
|
|
@ -58,8 +58,18 @@
|
|||
# define USE_MOUSE 1
|
||||
#endif
|
||||
|
||||
#define NUM2CH NUM2CHR
|
||||
#define CH2FIX CHR2FIX
|
||||
#if CHTYPE_IS_ULONG
|
||||
# define NUM2CH NUM2ULONG
|
||||
# define CH2NUM ULONG2NUM
|
||||
#else
|
||||
# if CHTYPE_IS_UINT
|
||||
# define NUM2CH NUM2UINT
|
||||
# define CH2NUM UINT2NUM
|
||||
# else
|
||||
# define NUM2CH NUM2CHR
|
||||
# define CH2NUM CHR2FIX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
static VALUE mCurses;
|
||||
static VALUE mKey;
|
||||
|
@ -581,7 +591,7 @@ static VALUE
|
|||
curses_inch(VALUE obj)
|
||||
{
|
||||
curses_stdscr();
|
||||
return CH2FIX(inch());
|
||||
return CH2NUM(inch());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1865,7 +1875,7 @@ window_inch(VALUE obj)
|
|||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj, winp);
|
||||
return CH2FIX(winch(winp->window));
|
||||
return CH2NUM(winch(winp->window));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2360,7 +2370,7 @@ window_getbkgd(VALUE obj)
|
|||
struct windata *winp;
|
||||
|
||||
GetWINDOW(obj,winp);
|
||||
return (c = getbkgd(winp->window) != ERR) ? CH2FIX(c) : Qnil;
|
||||
return (c = getbkgd(winp->window) != ERR) ? CH2NUM(c) : Qnil;
|
||||
#else
|
||||
return Qnil;
|
||||
#endif
|
||||
|
|
|
@ -129,5 +129,13 @@ if header_library
|
|||
warn "unexpeted value for --with-curses-version: #{with_curses_version}"
|
||||
end
|
||||
|
||||
for type in ["long", "int"]
|
||||
if try_static_assert("sizeof(chtype) == sizeof(unsigned #{type})",
|
||||
%w[stdio.h stdlib.h]+curses)
|
||||
$defs << "-DCHTYPE_IS_U#{type.upcase}"
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
create_makefile("curses")
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue