Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
-$Id: ncurses.c,v 1.412 2014/07/27 00:24:00 tom Exp $
+$Id: ncurses.c,v 1.416 2014/08/16 23:30:20 tom Exp $
***************************************************************************/
static wchar_t
fullwidth_digit(int ch)
{
- return (ch + 0xff10 - '0');
+ return (wchar_t) (ch + 0xff10 - '0');
}
static void
{
int ch;
while ((ch = *source++) != 0) {
- *target++ = ch;
+ *target++ = (wchar_t) ch;
}
*target = 0;
}
(void) waddch(win, ch | attr);
}
} else {
- (void) wattrset(win, (int) attr);
+ (void) wattrset(win, AttrArg(attr, 0));
(void) waddstr(win, attr_test_string);
(void) wattroff(win, (int) attr);
}
beep();
} else {
extras |= (chtype) COLOR_PAIR(pair);
+ normal &= ~A_COLOR;
}
}
}
for (j = 0; j < my_size; ++j) {
bool arrow = (j == k);
row = show_attr(my_wins[j], row, n, arrow,
+ normal |
extras |
my_list[j].attr |
my_list[k].attr,
#define FULL_HI 0xff5e
#define HALF_LO 0x20
-#define isFullWidth(ch) ((ch) >= FULL_LO && (ch) <= FULL_HI)
-#define ToNormalWidth(ch) (((ch) - FULL_LO) + HALF_LO)
-#define ToFullWidth(ch) (((ch) - HALF_LO) + FULL_LO)
+#define isFullWidth(ch) ((int)(ch) >= FULL_LO && (int)(ch) <= FULL_HI)
+#define ToNormalWidth(ch) (wchar_t) (((int)(ch) - FULL_LO) + HALF_LO)
+#define ToFullWidth(ch) (wchar_t) (((int)(ch) - HALF_LO) + FULL_LO)
/*
* Returns an ASCII code in [32..126]
static wchar_t
normal_wchar(int ch)
{
- wchar_t result = ch;
+ wchar_t result = (wchar_t) ch;
if (isFullWidth(ch))
result = ToNormalWidth(ch);
return result;
static wchar_t
target_wchar(int ch)
{
- wchar_t result = ch;
+ wchar_t result = (wchar_t) ch;
if (use_fullwidth) {
if (!isFullWidth(ch))
result = ToFullWidth(ch);
wide_init_attr_string(void)
{
use_fullwidth = FALSE;
- wide_attr_test_string[0] = default_attr_string();
+ wide_attr_test_string[0] = (wchar_t) default_attr_string();
wide_adjust_attr_string(0);
}
NCURSES_COLOR_T bg = InxToBG(i);
init_pair(pair, fg, bg);
- attron((attr_t) COLOR_PAIR(pair));
+ attron(COLOR_PAIR(pair));
if (opt_acsc)
- attron((attr_t) A_ALTCHARSET);
+ attron(A_ALTCHARSET);
if (opt_bold)
- attron((attr_t) A_BOLD);
+ attron(A_BOLD);
if (opt_revs)
- attron((attr_t) A_REVERSE);
+ attron(A_REVERSE);
if (opt_nums) {
sprintf(numbered, "{%02X}", (int) i);
init_pair(pair, InxToFG(i), InxToBG(i));
(void) color_set(pair, NULL);
if (opt_acsc)
- attr_on((attr_t) A_ALTCHARSET, NULL);
+ attr_on(A_ALTCHARSET, NULL);
if (opt_bold)
- attr_on((attr_t) A_BOLD, NULL);
+ attr_on(A_BOLD, NULL);
if (opt_revs)
- attr_on((attr_t) A_REVERSE, NULL);
+ attr_on(A_REVERSE, NULL);
if (opt_nums) {
sprintf(numbered, "{%02X}", i);
(i == current ? '>' : ' '),
(i < (int) SIZEOF(the_color_names)
? the_color_names[i] : numeric));
- (void) attrset((attr_t) COLOR_PAIR(i));
+ (void) attrset(AttrArg(COLOR_PAIR(i), 0));
addstr(" ");
(void) attrset(A_NORMAL);
MvPrintw(0, 20, "Display of Character Codes %#x to %#x", first, last);
attroff(A_BOLD);
- for (code = first; (int) code <= last; code++) {
+ for (code = (wchar_t) first; (int) code <= last; code++) {
int row = (2 + ((int) code - first) / per_line);
int col = 5 * ((int) code % per_line);
int count;
MvPrintw(0, 20, "Display of Character Codes %d to %d", first, last);
attroff(A_BOLD);
- for (code = first; (int) code <= last; code++) {
+ for (code = (wchar_t) first; (int) code <= last; code++) {
int row = 2 + ((code - first) % 16);
int col = ((code - first) / 16) * COLS / 2;
wchar_t codes[10];
break;
case 2:
init_pair(cpair, COLOR_BLUE, COLOR_WHITE);
- (void) wattrset(win, (int) ((chtype) COLOR_PAIR(cpair) | A_NORMAL));
+ (void) wattrset(win, AttrArg(COLOR_PAIR(cpair), A_NORMAL));
break;
case 3:
init_pair(cpair, COLOR_WHITE, COLOR_BLUE);
- (void) wattrset(win, (int) ((chtype) COLOR_PAIR(cpair) | A_BOLD));
+ (void) wattrset(win, AttrArg(COLOR_PAIR(cpair), A_BOLD));
break;
}
}