From: Thomas E. Dickey Date: Sun, 1 Jul 2007 00:42:27 +0000 (+0000) Subject: ncurses 5.6 - patch 20070630 X-Git-Tag: v5.7~62 X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=commitdiff_plain;h=eb312e0bb90463a33aa8a53f825b32dc189af023;hp=574a94bc3d70682bde48f7f10d3c12a58e581e27 ncurses 5.6 - patch 20070630 + add "widec" row to _tracedump() output to help diagnose remaining problems with multi-column characters. + partial fix for refresh of window on top of multi-column characters which are partly overwritten (report by Sadrul H Chowdhury). + ignore A_CHARTEXT bits in vidattr() and vid_attr(), in case multi-column extension bits are passed there. + add setlocale() call to demo_panels.c, needed for wide-characters. + add some output flags to _nc_trace_ttymode to help diagnose a bug report by Larry Virden, i.e., ONLCR, OCRNL, ONOCR and ONLRET, --- diff --git a/MANIFEST b/MANIFEST index 3e3ec427..917600ff 100644 --- a/MANIFEST +++ b/MANIFEST @@ -999,6 +999,8 @@ ./test/savescreen.c ./test/tclock.c ./test/test.priv.h +./test/test_getstr.c +./test/test_instr.c ./test/testaddch.c ./test/testcurs.c ./test/testscanw.c diff --git a/NEWS b/NEWS index 6f597740..4c925c76 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.1138 2007/06/23 21:28:00 tom Exp $ +-- $Id: NEWS,v 1.1140 2007/06/30 23:37:37 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,17 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20070630 + + add "widec" row to _tracedump() output to help diagnose remaining + problems with multi-column characters. + + partial fix for refresh of window on top of multi-column characters + which are partly overwritten (report by Sadrul H Chowdhury). + + ignore A_CHARTEXT bits in vidattr() and vid_attr(), in case + multi-column extension bits are passed there. + + add setlocale() call to demo_panels.c, needed for wide-characters. + + add some output flags to _nc_trace_ttymode to help diagnose a bug + report by Larry Virden, i.e., ONLCR, OCRNL, ONOCR and ONLRET, + 20070623 + add test/demo_panels.c + implement opaque version of setsyx() and getsyx(). diff --git a/dist.mk b/dist.mk index 77237019..39d65ea2 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.598 2007/06/23 15:16:37 tom Exp $ +# $Id: dist.mk,v 1.599 2007/06/30 16:01:18 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 NCURSES_MINOR = 6 -NCURSES_PATCH = 20070623 +NCURSES_PATCH = 20070630 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/base/lib_refresh.c b/ncurses/base/lib_refresh.c index 27649df0..a16dc8e6 100644 --- a/ncurses/base/lib_refresh.c +++ b/ncurses/base/lib_refresh.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,7 +41,7 @@ #include -MODULE_ID("$Id: lib_refresh.c,v 1.34 2006/05/27 19:21:19 tom Exp $") +MODULE_ID("$Id: lib_refresh.c,v 1.37 2007/06/30 23:35:43 tom Exp $") NCURSES_EXPORT(int) wrefresh(WINDOW *win) @@ -74,10 +74,10 @@ NCURSES_EXPORT(int) wnoutrefresh(WINDOW *win) { NCURSES_SIZE_T limit_x; - NCURSES_SIZE_T i, j; + NCURSES_SIZE_T src_row, src_col; NCURSES_SIZE_T begx; NCURSES_SIZE_T begy; - NCURSES_SIZE_T m, n; + NCURSES_SIZE_T dst_row, dst_col; #if USE_SCROLL_HINTS bool wide; #endif @@ -132,17 +132,17 @@ wnoutrefresh(WINDOW *win) * so we'll force the issue. */ - /* limit(n) */ + /* limit(dst_col) */ limit_x = win->_maxx; - /* limit(j) */ + /* limit(src_col) */ if (limit_x > newscr->_maxx - begx) limit_x = newscr->_maxx - begx; - for (i = 0, m = begy + win->_yoffset; - i <= win->_maxy && m <= newscr->_maxy; - i++, m++) { - register struct ldat *nline = &newscr->_line[m]; - register struct ldat *oline = &win->_line[i]; + for (src_row = 0, dst_row = begy + win->_yoffset; + src_row <= win->_maxy && dst_row <= newscr->_maxy; + src_row++, dst_row++) { + register struct ldat *nline = &newscr->_line[dst_row]; + register struct ldat *oline = &win->_line[src_row]; if (oline->firstchar != _NOCHANGE) { int last = oline->lastchar; @@ -150,10 +150,70 @@ wnoutrefresh(WINDOW *win) if (last > limit_x) last = limit_x; - for (j = oline->firstchar, n = j + begx; j <= last; j++, n++) { - if (!CharEq(oline->text[j], nline->text[n])) { - nline->text[n] = oline->text[j]; - CHANGED_CELL(nline, n); + src_col = oline->firstchar; + dst_col = src_col + begx; + + if_WIDEC({ + static cchar_t blank = BLANK; + int last_col = begx + ((last < win->_maxx) + ? last + : win->_maxx); + int fix_left = dst_col; + int fix_right = last_col; + register int j; + + /* + * Check for boundary cases where we may overwrite part of a + * multi-column character. For those, wipe the remainder of + * the character to blanks. + */ + j = dst_col; + if (isWidecExt(nline->text[j])) { + /* + * On the left, we only care about multi-column characters + * that extend into the changed region. + */ + fix_left = 1 + j - WidecExt(nline->text[j]); + if (fix_left < 0) + fix_left = 0; /* only if cell is corrupt */ + } + + j = last_col; + if (WidecExt(nline->text[j]) != 0) { + /* + * On the right, any multi-column character is a problem, + * unless it happens to be contained in the change, and + * ending at the right boundary of the change. The + * computation for 'fix_left' accounts for the left-side of + * this character. Find the end of the character. + */ + fix_right = ++j; + while (j <= newscr->_maxx && isWidecExt(nline->text[j])) { + fix_right = j++; + } + } + + /* + * The analysis is simpler if we do the clearing afterwards. + * Do that now. + */ + for (j = fix_left; j < dst_col; ++j) { + nline->text[j] = blank; + CHANGED_CELL(nline, j); + } + for (j = last_col + 1; j <= fix_right; ++j) { + nline->text[j] = blank; + CHANGED_CELL(nline, j); + } + }); + + /* + * Copy the changed text. + */ + for (; src_col <= last; src_col++, dst_col++) { + if (!CharEq(oline->text[src_col], nline->text[dst_col])) { + nline->text[dst_col] = oline->text[src_col]; + CHANGED_CELL(nline, dst_col); } } @@ -162,13 +222,14 @@ wnoutrefresh(WINDOW *win) if (wide) { int oind = oline->oldindex; - nline->oldindex = (oind == _NEWINDEX) ? _NEWINDEX : begy + oind - + win->_yoffset; + nline->oldindex = ((oind == _NEWINDEX) + ? _NEWINDEX + : (begy + oind + win->_yoffset)); } #endif /* USE_SCROLL_HINTS */ oline->firstchar = oline->lastchar = _NOCHANGE; - if_USE_SCROLL_HINTS(oline->oldindex = i); + if_USE_SCROLL_HINTS(oline->oldindex = src_row); } if (win->_clear) { diff --git a/ncurses/base/lib_window.c b/ncurses/base/lib_window.c index bb20f4fa..530b08e5 100644 --- a/ncurses/base/lib_window.c +++ b/ncurses/base/lib_window.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,7 +39,7 @@ #include -MODULE_ID("$Id: lib_window.c,v 1.22 2006/05/27 19:21:19 tom Exp $") +MODULE_ID("$Id: lib_window.c,v 1.23 2007/06/30 23:36:11 tom Exp $") NCURSES_EXPORT(void) _nc_synchook(WINDOW *win) @@ -149,7 +149,7 @@ wsyncdown(WINDOW *win) /* left and right character in child coordinates */ int left = pp->_line[win->_pary + y].firstchar - win->_parx; int right = pp->_line[win->_pary + y].lastchar - win->_parx; - /* The change maybe outside the childs range */ + /* The change may be outside the child's range */ if (left < 0) left = 0; if (right > win->_maxx) diff --git a/ncurses/trace/lib_tracebits.c b/ncurses/trace/lib_tracebits.c index d9defd0c..de2394c3 100644 --- a/ncurses/trace/lib_tracebits.c +++ b/ncurses/trace/lib_tracebits.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,7 +35,7 @@ #include #include /* cur_term */ -MODULE_ID("$Id: lib_tracebits.c,v 1.13 2006/12/10 01:33:00 tom Exp $") +MODULE_ID("$Id: lib_tracebits.c,v 1.15 2007/06/30 16:14:20 tom Exp $") #if SVR4_TERMIO && !defined(_POSIX_SOURCE) #define _POSIX_SOURCE @@ -53,10 +53,27 @@ MODULE_ID("$Id: lib_tracebits.c,v 1.13 2006/12/10 01:33:00 tom Exp $") #ifndef TOSTOP #define TOSTOP 0 #endif + #ifndef IEXTEN #define IEXTEN 0 #endif +#ifndef ONLCR +#define ONLCR 0 +#endif + +#ifndef OCRNL +#define OCRNL 0 +#endif + +#ifndef ONOCR +#define ONOCR 0 +#endif + +#ifndef ONLRET +#define ONLRET 0 +#endif + #ifdef TRACE typedef struct { @@ -108,8 +125,12 @@ _nc_trace_ttymode(TTY * tty) { {OPOST, "OPOST"}, {OFLAGS_TABS, "XTABS"}, + {ONLCR, "ONLCR"}, + {OCRNL, "OCRNL"}, + {ONOCR, "ONOCR"}, + {ONLRET, "ONLRET"}, {0, NULL} -#define ALLOUT (OPOST) +#define ALLOUT (OPOST|OFLAGS_TABS|ONLCR|OCRNL|ONOCR|ONLRET) }, cflags[] = { {CLOCAL, "CLOCAL"}, diff --git a/ncurses/trace/lib_tracedmp.c b/ncurses/trace/lib_tracedmp.c index 53623136..d56d1a5d 100644 --- a/ncurses/trace/lib_tracedmp.c +++ b/ncurses/trace/lib_tracedmp.c @@ -39,7 +39,7 @@ #include #include -MODULE_ID("$Id: lib_tracedmp.c,v 1.28 2007/04/21 21:10:54 tom Exp $") +MODULE_ID("$Id: lib_tracedmp.c,v 1.29 2007/06/30 23:01:19 tom Exp $") #ifdef TRACE @@ -100,6 +100,30 @@ _tracedump(const char *name, WINDOW *win) (long) win->_line[n].lastchar, ep); + /* if there are multi-column characters on the line, print them now */ + if_WIDEC({ + bool multicolumn = FALSE; + for (j = 0; j < width; ++j) + if (WidecExt(win->_line[n].text[j]) != 0) { + multicolumn = TRUE; + break; + } + if (multicolumn) { + ep = my_buffer; + for (j = 0; j < width; ++j) { + int test = WidecExt(win->_line[n].text[j]); + if (test) { + ep[j] = test + '0'; + } else { + ep[j] = ' '; + } + } + ep[j] = '\0'; + _tracef("%*s[%2d]%*s='%s'", (int) strlen(name), + "widec", n, 8, " ", my_buffer); + } + }); + /* dump A_COLOR part, will screw up if there are more than 96 */ havecolors = FALSE; for (j = 0; j < width; ++j) diff --git a/ncurses/tty/hardscroll.c b/ncurses/tty/hardscroll.c index e2147217..0b227a10 100644 --- a/ncurses/tty/hardscroll.c +++ b/ncurses/tty/hardscroll.c @@ -145,7 +145,7 @@ AUTHOR #include -MODULE_ID("$Id: hardscroll.c,v 1.39 2007/04/28 20:14:08 tom Exp $") +MODULE_ID("$Id: hardscroll.c,v 1.40 2007/06/30 21:11:01 tom Exp $") #if defined(SCROLLDEBUG) || defined(HASHDEBUG) @@ -186,7 +186,7 @@ _nc_scroll_optimize(void) int i; int start, end, shift; - TR(TRACE_ICALLS, ("_nc_scroll_optimize() begins")); + TR(TRACE_ICALLS, (T_CALLED("_nc_scroll_optimize"))); #if !defined(SCROLLDEBUG) && !defined(HASHDEBUG) #if USE_HASHMAP @@ -256,6 +256,7 @@ _nc_scroll_optimize(void) } #endif /* !defined(SCROLLDEBUG) && !defined(HASHDEBUG) */ } + TR(TRACE_ICALLS, (T_RETURN(""))); } #if defined(TRACE) || defined(SCROLLDEBUG) || defined(HASHDEBUG) diff --git a/ncurses/tty/lib_vidattr.c b/ncurses/tty/lib_vidattr.c index 4bee100a..ac2a74f0 100644 --- a/ncurses/tty/lib_vidattr.c +++ b/ncurses/tty/lib_vidattr.c @@ -65,7 +65,7 @@ #include #include -MODULE_ID("$Id: lib_vidattr.c,v 1.48 2007/04/21 23:25:38 tom Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.49 2007/06/30 21:58:04 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -102,6 +102,7 @@ vidputs(chtype newmode, int (*outc) (int)) #define fix_pair0 FALSE #endif + newmode &= A_ATTRIBUTES; T((T_CALLED("vidputs(%s)"), _traceattr(newmode))); /* this allows us to go on whether or not newterm() has been called */ diff --git a/ncurses/tty/tty_update.c b/ncurses/tty/tty_update.c index 57222f15..15510ce4 100644 --- a/ncurses/tty/tty_update.c +++ b/ncurses/tty/tty_update.c @@ -74,7 +74,7 @@ #include #include -MODULE_ID("$Id: tty_update.c,v 1.239 2007/04/19 20:57:49 tom Exp $") +MODULE_ID("$Id: tty_update.c,v 1.240 2007/06/30 21:07:51 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -836,7 +836,6 @@ doupdate(void) nonempty = 0; if (curscr->_clear || newscr->_clear) { /* force refresh ? */ - TR(TRACE_UPDATE, ("clearing and updating from scratch")); ClrUpdate(); curscr->_clear = FALSE; /* reset flag */ newscr->_clear = FALSE; /* reset flag */ @@ -967,7 +966,7 @@ ClrUpdate(void) NCURSES_CH_T blank = ClrBlank(stdscr); int nonempty = min(screen_lines, newscr->_maxy + 1); - TR(TRACE_UPDATE, ("ClrUpdate() called")); + TR(TRACE_UPDATE, (T_CALLED("ClrUpdate"))); ClearScreen(blank); @@ -977,6 +976,8 @@ ClrUpdate(void) for (i = 0; i < nonempty; i++) TransformLine(i); + + TR(TRACE_UPDATE, (T_RETURN(""))); } /* diff --git a/ncurses/widechar/lib_vid_attr.c b/ncurses/widechar/lib_vid_attr.c index 2ba16b5c..1dc679e6 100644 --- a/ncurses/widechar/lib_vid_attr.c +++ b/ncurses/widechar/lib_vid_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002-2005,2006 Free Software Foundation, Inc. * + * Copyright (c) 2002-2006,2007 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,7 +33,7 @@ #include #include -MODULE_ID("$Id: lib_vid_attr.c,v 1.4 2006/11/26 00:26:00 tom Exp $") +MODULE_ID("$Id: lib_vid_attr.c,v 1.5 2007/06/30 22:03:02 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -72,6 +72,7 @@ vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) #define fix_pair0 FALSE #endif + newmode &= A_ATTRIBUTES; T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair)); /* this allows us to go on whether or not newterm() has been called */ diff --git a/test/chgat.c b/test/chgat.c index 06a27d73..ef9ab676 100644 --- a/test/chgat.c +++ b/test/chgat.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: chgat.c,v 1.6 2007/01/06 23:28:46 tom Exp $ + * $Id: chgat.c,v 1.7 2007/06/30 17:52:17 tom Exp $ * * test-driver for chgat/wchgat/mvchgat/mvwchgat */ @@ -47,7 +47,8 @@ typedef struct { unsigned c; unsigned v; - int pair, attr; + int pair; + unsigned attr; int count; int ch; const char *c_msg; @@ -94,11 +95,11 @@ color_params(unsigned state, int *pair) } static const char * -video_params(unsigned state, int *attr) +video_params(unsigned state, unsigned *attr) { /* *INDENT-OFF* */ static struct { - int attr; + unsigned attr; const char *msg; } table[] = { { A_NORMAL, "normal" }, diff --git a/test/demo_panels.c b/test/demo_panels.c index 0ac70407..8d5bac2b 100755 --- a/test/demo_panels.c +++ b/test/demo_panels.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_panels.c,v 1.16 2007/06/23 21:24:23 tom Exp $ + * $Id: demo_panels.c,v 1.22 2007/06/30 21:38:08 tom Exp $ * * Demonstrate a variety of functions from the panel library. */ @@ -40,7 +40,8 @@ typedef void (*InitPanel) (void); typedef void (*FillPanel) (PANEL *); -static bool use_colors; +static bool use_colors = FALSE; +static bool unboxed = FALSE; static FILE *log_in; static FILE *log_out; @@ -197,7 +198,7 @@ mkpanel(short color, int rows, int cols, int tly, int tlx) init_pair(color, fg, bg); wbkgdset(win, (chtype) (COLOR_PAIR(color) | ' ')); - } else { + } else if (!unboxed) { wbkgdset(win, A_BOLD | ' '); } } @@ -207,7 +208,7 @@ mkpanel(short color, int rows, int cols, int tly, int tlx) } static void -remove_panel(PANEL ** pans, int which) +my_remove_panel(PANEL ** pans, int which) { if (pans[which] != 0) { PANEL *pan = pans[which]; @@ -226,7 +227,7 @@ remove_panel(PANEL ** pans, int which) #define ABS(a) ((a) < 0 ? -(a) : (a)) static void -create_panel(PANEL ** pans, int which, FillPanel myFill) +my_create_panel(PANEL ** pans, int which, FillPanel myFill) { PANEL *pan = 0; int code; @@ -238,7 +239,7 @@ create_panel(PANEL ** pans, int which, FillPanel myFill) init_pair(pair, fg, bg); /* remove the old panel, if any */ - remove_panel(pans, which); + my_remove_panel(pans, which); /* get the position of one corner */ wmove(stdscr, getmaxy(stdscr) / 2, getmaxx(stdscr) / 2); @@ -272,53 +273,58 @@ create_panel(PANEL ** pans, int which, FillPanel myFill) static void my_move_panel(PANEL ** pans, int which) { - int code; - int y0, x0; - int y1, x1; - WINDOW *win = panel_window(pans[which]); - char also[80]; + if (pans[which] != 0) { + int code; + int y0, x0; + int y1, x1; + WINDOW *win = panel_window(pans[which]); + char also[80]; - getbegyx(win, y0, x0); - sprintf(also, " (start %d,%d)", y0, x0); - wmove(stdscr, y0, x0); - while ((code = get_position("Move panel", also, which, &x1, &y1)) == 0) { - ; - } - if (code > 0) { - move_panel(pans[which], y1, x1); + getbegyx(win, y0, x0); + sprintf(also, " (start %d,%d)", y0, x0); + wmove(stdscr, y0, x0); + while ((code = get_position("Move panel", also, which, &x1, &y1)) == 0) { + ; + } + if (code > 0) { + move_panel(pans[which], y1, x1); + } } } static void -resize_panel(PANEL ** pans, int which, FillPanel myFill) +my_resize_panel(PANEL ** pans, int which, FillPanel myFill) { - int code; - int y0, x0; - int y1, x1; - WINDOW *win = panel_window(pans[which]); - char also[80]; + if (pans[which] != 0) { + int code; + int y0, x0; + int y1, x1; + WINDOW *win = panel_window(pans[which]); + char also[80]; - getbegyx(win, y0, x0); - sprintf(also, " (start %d,%d)", y0, x0); - wmove(stdscr, y0, x0); - while ((code = get_position("Resize panel", also, which, &x1, &y1)) == 0) { - ; - } - if (code > 0) { - WINDOW *next = newwin(ABS(y1 - y0) + 1, - ABS(x1 - x0) + 1, - MIN(y0, y1), - MIN(x0, x1)); - if (next != 0) { - keypad(next, TRUE); - if (use_colors) { - wbkgdset(next, (chtype) (COLOR_PAIR(which) | ' ')); - } else { - wbkgdset(next, A_BOLD | ' '); + getbegyx(win, y0, x0); + sprintf(also, " (start %d,%d)", y0, x0); + wmove(stdscr, y0, x0); + while ((code = get_position("Resize panel", + also, which, &x1, &y1)) == 0) { + ; + } + if (code > 0) { + WINDOW *next = newwin(ABS(y1 - y0) + 1, + ABS(x1 - x0) + 1, + MIN(y0, y1), + MIN(x0, x1)); + if (next != 0) { + keypad(next, TRUE); + if (use_colors) { + wbkgdset(next, (chtype) (COLOR_PAIR(which) | ' ')); + } else if (!unboxed) { + wbkgdset(next, A_BOLD | ' '); + } + replace_panel(pans[which], next); + myFill(pans[which]); + delwin(win); } - replace_panel(pans[which], next); - myFill(pans[which]); - delwin(win); } } } @@ -353,6 +359,21 @@ fill_panel(PANEL * pan) } } +static void +fill_unboxed(PANEL * pan) +{ + WINDOW *win = panel_window(pan); + int num = ((const char *) panel_userptr(pan))[1]; + int y, x; + + for (y = 0; y < getmaxy(win); y++) { + for (x = 0; x < getmaxx(win); x++) { + wmove(win, y, x); + waddch(win, UChar(num)); + } + } +} + #if USE_WIDEC_SUPPORT static void make_fullwidth_digit(cchar_t *target, int digit) @@ -491,6 +512,22 @@ show_panels(PANEL * px[MAX_PANELS + 1]) } } +#define wrapper(func) \ +static int my_##func(PANEL *pan) \ +{ \ + int code = ERR; \ + if (pan != 0) { \ + code = func(pan); \ + } \ + return code; \ +} +/* *INDENT-OFF* */ +wrapper(bottom_panel) +wrapper(hide_panel) +wrapper(show_panel) +wrapper(top_panel) +/* *INDENT-ON* */ + static void do_panel(PANEL * px[MAX_PANELS + 1], NCURSES_CONST char *cmd, @@ -506,28 +543,28 @@ do_panel(PANEL * px[MAX_PANELS + 1], saywhat(cmd); switch (*cmd) { case 'b': - bottom_panel(px[which]); + my_bottom_panel(px[which]); break; case 'c': - create_panel(px, which, myFill); + my_create_panel(px, which, myFill); break; case 'd': - remove_panel(px, which); + my_remove_panel(px, which); break; case 'h': - hide_panel(px[which]); + my_hide_panel(px[which]); break; case 'm': my_move_panel(px, which); break; case 'r': - resize_panel(px, which, myFill); + my_resize_panel(px, which, myFill); break; case 's': - show_panel(px[which]); + my_show_panel(px[which]); break; case 't': - top_panel(px[which]); + my_top_panel(px[which]); break; } } @@ -579,6 +616,8 @@ get_command(PANEL * px[MAX_PANELS + 1], char *buffer, int limit) if (ch == ERR || ch == QUIT || ch == ESCAPE) { buffer[0] = '\0'; break; + } else if (ch == CTRL('L')) { + wrefresh(curscr); } else if (ch == '\n' || ch == KEY_ENTER) { break; } else if (ch == '?') { @@ -651,7 +690,7 @@ demo_panels(InitPanel myInit, FillPanel myFill) } #if NO_LEAKS for (itmp = 1; itmp <= MAX_PANELS; ++itmp) { - remove_panel(px, itmp); + my_remove_panel(px, itmp); } #endif } @@ -670,6 +709,7 @@ usage(void) #if USE_WIDEC_SUPPORT ," -w use wide-characters in panels and background" #endif + ," -x do not enclose panels in boxes" }; size_t n; for (n = 0; n < SIZEOF(tbl); n++) @@ -685,7 +725,9 @@ main(int argc, char *argv[]) InitPanel myInit = init_panel; FillPanel myFill = fill_panel; - while ((c = getopt(argc, argv, "i:o:mw")) != EOF) { + setlocale(LC_ALL, ""); + + while ((c = getopt(argc, argv, "i:o:mwx")) != EOF) { switch (c) { case 'i': log_in = fopen(optarg, "r"); @@ -702,10 +744,15 @@ main(int argc, char *argv[]) myFill = fill_wide_panel; break; #endif + case 'x': + unboxed = TRUE; + break; default: usage(); } } + if (unboxed) + myFill = fill_unboxed; initscr(); cbreak(); diff --git a/test/echochar.c b/test/echochar.c index 9f2d11c5..e3011388 100644 --- a/test/echochar.c +++ b/test/echochar.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006 Free Software Foundation, Inc. * + * Copyright (c) 2006,2007 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: echochar.c,v 1.3 2006/12/03 00:14:29 tom Exp $ + * $Id: echochar.c,v 1.4 2007/06/30 17:54:56 tom Exp $ * * Demonstrate the echochar function (compare to dots.c). * Thomas Dickey - 2006/11/4 @@ -107,7 +107,7 @@ main( if (use_colors) { start_color(); if (COLOR_PAIRS > 0) { - my_pairs = calloc(COLOR_PAIRS, sizeof(*my_pairs)); + my_pairs = calloc((unsigned) COLOR_PAIRS, sizeof(*my_pairs)); } use_colors = (my_pairs != 0); } @@ -146,10 +146,10 @@ main( } } if (opt_r) { - addch(p); + addch(UChar(p)); refresh(); } else { - echochar(p); + echochar(UChar(p)); } ++total_chars; } diff --git a/test/inch_wide.c b/test/inch_wide.c index 069e8738..01826c45 100644 --- a/test/inch_wide.c +++ b/test/inch_wide.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: inch_wide.c,v 1.4 2007/06/09 21:25:54 tom Exp $ + * $Id: inch_wide.c,v 1.5 2007/06/30 17:50:44 tom Exp $ */ /* int in_wch(cchar_t *wcval); @@ -99,7 +99,7 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) if ((fp = fopen(argv[level], "r")) != 0) { while ((j = fgetc(fp)) != EOF) { - if (waddch(txtwin, j) != OK) { + if (waddch(txtwin, UChar(j)) != OK) { break; } } diff --git a/test/inchs.c b/test/inchs.c index 38747a2f..93cd4c22 100644 --- a/test/inchs.c +++ b/test/inchs.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: inchs.c,v 1.6 2007/06/09 21:25:06 tom Exp $ + * $Id: inchs.c,v 1.7 2007/06/30 17:50:44 tom Exp $ */ /* chtype inch(void); @@ -96,7 +96,7 @@ test_inchs(int level, char **argv, WINDOW *chrwin, WINDOW *strwin) if ((fp = fopen(argv[level], "r")) != 0) { while ((j = fgetc(fp)) != EOF) { - if (waddch(txtwin, j) != OK) { + if (waddch(txtwin, UChar(j)) != OK) { break; } } diff --git a/test/redraw.c b/test/redraw.c index ce98259c..82e63783 100644 --- a/test/redraw.c +++ b/test/redraw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2006 Free Software Foundation, Inc. * + * Copyright (c) 2006,2007 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: redraw.c,v 1.3 2006/11/04 23:20:27 tom Exp $ + * $Id: redraw.c,v 1.4 2007/06/30 17:55:06 tom Exp $ * * Demonstrate the redrawwin() and wredrawln() functions. * Thomas Dickey - 2006/11/4 @@ -148,7 +148,7 @@ test_redraw(WINDOW *win) if (ch > KEY_MIN) { waddstr(win, keyname(ch)); } else { - waddstr(win, unctrl(ch)); + waddstr(win, unctrl(UChar(ch))); } break; } diff --git a/test/test.priv.h b/test/test.priv.h index 0ab41507..4f472d33 100644 --- a/test/test.priv.h +++ b/test/test.priv.h @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: test.priv.h,v 1.67 2007/06/23 15:46:17 tom Exp $ */ +/* $Id: test.priv.h,v 1.68 2007/06/30 17:53:09 tom Exp $ */ #ifndef __TEST_PRIV_H #define __TEST_PRIV_H 1 @@ -309,7 +309,7 @@ extern int optind; #ifndef HAVE_TYPE_ATTR_T #if !USE_WIDEC_SUPPORT -#define attr_t long +#define attr_t chtype #endif #endif diff --git a/test/test_getstr.c b/test/test_getstr.c new file mode 100644 index 00000000..0435897e --- /dev/null +++ b/test/test_getstr.c @@ -0,0 +1,23 @@ +/* + * $Id: test_getstr.c,v 1.1 2007/06/30 16:51:28 tom Exp $ + * + * Demonstrate the getstr functions from the curses library. + + int getstr(char *str); + int getnstr(char *str, int n); + int wgetstr(WINDOW *win, char *str); + int wgetnstr(WINDOW *win, char *str, int n); + int mvgetstr(int y, int x, char *str); + int mvwgetstr(WINDOW *win, int y, int x, char *str); + int mvgetnstr(int y, int x, char *str, int n); + int mvwgetnstr(WINDOW *, int y, int x, char *str, int n); + */ + +#include + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + printf("Not implemented - test-driver for curses getstr() functions\n"); + return EXIT_SUCCESS; +} diff --git a/test/test_instr.c b/test/test_instr.c new file mode 100644 index 00000000..e0066932 --- /dev/null +++ b/test/test_instr.c @@ -0,0 +1,23 @@ +/* + * $Id: test_instr.c,v 1.1 2007/06/30 16:51:44 tom Exp $ + * + * Demonstrate the instr functions from the curses library. + + int instr(char *str); + int innstr(char *str, int n); + int winstr(WINDOW *win, char *str); + int winnstr(WINDOW *win, char *str, int n); + int mvinstr(int y, int x, char *str); + int mvinnstr(int y, int x, char *str, int n); + int mvwinstr(WINDOW *win, int y, int x, char *str); + int mvwinnstr(WINDOW *win, int y, int x, char *str, int n); + */ + +#include + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + printf("Not implemented - test-driver for curses instr() functions\n"); + return EXIT_SUCCESS; +} diff --git a/test/view.c b/test/view.c index 05e7d481..c76aded9 100644 --- a/test/view.c +++ b/test/view.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc. * + * Copyright (c) 1998-2006,2007 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -50,7 +50,7 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.64 2006/05/20 15:37:03 tom Exp $ + * $Id: view.c,v 1.65 2007/06/30 16:40:04 tom Exp $ */ #include @@ -374,7 +374,7 @@ main(int argc, char *argv[]) lptr++; else break; - wscrl(stdscr, lptr - olptr); + scrl(lptr - olptr); break; case KEY_UP: @@ -385,7 +385,7 @@ main(int argc, char *argv[]) lptr--; else break; - wscrl(stdscr, lptr - olptr); + scrl(lptr - olptr); break; case 'h':