]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/test.priv.h
ncurses 6.0 - patch 20170930
[ncurses.git] / test / test.priv.h
index a30ae551b06775f69ed3291d9a4806e4dcff3976..a7cc109cf9f8b2561f8d35ed1ca5d0136bd8458c 100644 (file)
@@ -29,7 +29,7 @@
 /****************************************************************************
  *  Author: Thomas E. Dickey                    1996-on                     *
  ****************************************************************************/
-/* $Id: test.priv.h,v 1.140 2017/03/06 09:43:51 tom Exp $ */
+/* $Id: test.priv.h,v 1.158 2017/09/30 17:58:37 tom Exp $ */
 
 #ifndef __TEST_PRIV_H
 #define __TEST_PRIV_H 1
 #ifndef HAVE_BSD_STRING_H
 #define HAVE_BSD_STRING_H 0
 #endif
+
 #ifndef HAVE_CURSES_VERSION
 #define HAVE_CURSES_VERSION 0
 #endif
 
+#ifndef HAVE_CURSCR
+#define HAVE_CURSCR 0
+#endif
+
 #ifndef HAVE_CHGAT
 #define HAVE_CHGAT 0
 #endif
 
+#ifndef HAVE_COLOR_CONTENT
+#define HAVE_COLOR_CONTENT 0
+#endif
+
+#ifndef HAVE_COPYWIN
+#define HAVE_COPYWIN 0
+#endif
+
 #ifndef HAVE_COLOR_SET
 #define HAVE_COLOR_SET 0
 #endif
 
+#ifndef HAVE_DELSCREEN
+#define HAVE_DELSCREEN 0
+#endif
+
+#ifndef HAVE_DUPWIN
+#define HAVE_DUPWIN 0
+#endif
+
 #ifndef HAVE_FILTER
 #define HAVE_FILTER 0
 #endif
 #define HAVE_GETWIN 0
 #endif
 
+#ifndef HAVE_HALFDELAY
+#define HAVE_HALFDELAY 0
+#endif
+
+#ifndef HAVE_INIT_EXTENDED_COLOR
+#define HAVE_INIT_EXTENDED_COLOR 0
+#endif
+
 #ifndef HAVE_LIBFORM
 #define HAVE_LIBFORM 0
 #endif
 #define HAVE_MENU_H 0
 #endif
 
+#ifndef HAVE_MVDERWIN
+#define HAVE_MVDERWIN 0
+#endif
+
 #ifndef HAVE_MVVLINE
 #define HAVE_MVVLINE 0
 #endif
 
+#ifndef HAVE_MVWIN
+#define HAVE_MVWIN 0
+#endif
+
 #ifndef HAVE_MVWVLINE
 #define HAVE_MVWVLINE 0
 #endif
 #define HAVE_NC_ALLOC_H 0
 #endif
 
+#ifndef HAVE_NEWPAD
+#define HAVE_NEWPAD 0
+#endif
+
 #ifndef HAVE_PANEL_H
 #define HAVE_PANEL_H 0
 #endif
 #define HAVE_SLK_INIT 0
 #endif
 
+#ifndef HAVE_STDINT_H
+#define HAVE_STDINT_H 0
+#endif
+
 #ifndef HAVE_SYS_IOCTL_H
 #define HAVE_SYS_IOCTL_H 0
 #endif
 #define HAVE_SYS_SELECT_H 0
 #endif
 
+#ifndef HAVE_TDESTROY
+#define HAVE_TDESTROY 0
+#endif
+
 #ifndef HAVE_TERMATTRS
 #define HAVE_TERMATTRS 0
 #endif
 #define HAVE_TIGETSTR 0
 #endif
 
+#ifndef HAVE_TPUTS_SP
+#define HAVE_TPUTS_SP 0
+#endif
+
+#ifndef HAVE_TSEARCH
+#define HAVE_TSEARCH 0
+#endif
+
 #ifndef HAVE_TYPEAHEAD
 #define HAVE_TYPEAHEAD 0
 #endif
 #define HAVE_VID_PUTS 0
 #endif
 
+#ifndef HAVE_WINSDELLN
+#define HAVE_WINSDELLN 0
+#endif
+
 #ifndef HAVE_WRESIZE
 #define HAVE_WRESIZE 0
 #endif
 
+#ifndef HAVE__TRACEF
+#define HAVE__TRACEF 0
+#endif
+
 #ifndef NCURSES_EXT_FUNCS
 #define NCURSES_EXT_FUNCS 0
 #endif
@@ -540,6 +605,14 @@ extern int optind;
 #define        WACS_STERLING   &(CURSES_WACS_ARRAY['}'])
 #endif
 
+#ifndef OK
+#define OK (0)
+#endif
+
+#ifndef ERR
+#define ERR (-1)
+#endif
+
 #undef CTRL
 #define CTRL(x)        ((x) & 0x1f)
 
@@ -550,6 +623,9 @@ extern int optind;
 #define KEY_MIN 256            /* not defined in Solaris 8 */
 #endif
 
+#define HELP_KEY_1     '?'
+#define HELP_KEY_2     KEY_F(1)
+
 /* from nc_string.h, to make this stand alone */
 #if HAVE_BSD_STRING_H
 #include <bsd/string.h>
@@ -607,7 +683,15 @@ extern char *numnames[], *numcodes[], *numfnames[];
 extern char *strnames[], *strcodes[], *strfnames[];
 #endif
 
-#ifdef DECL_CURSES_DATA_TTYTYPE
+#ifndef HAVE_CURSES_DATA_TTYTYPE
+#define HAVE_CURSES_DATA_TTYTYPE 0
+#endif
+
+#ifndef DECL_CURSES_DATA_TTYTYPE
+#define DECL_CURSES_DATA_TTYTYPE 0
+#endif
+
+#if !HAVE_CURSES_DATA_TTYTYPE || DECL_CURSES_DATA_TTYTYPE
 #define ttytype termname()
 #endif
 
@@ -651,18 +735,18 @@ extern char *strnames[], *strcodes[], *strfnames[];
  * These usually are implemented as macros, but may be functions.
  */
 #if !defined(getcurx) && !HAVE_GETCURX
-#define getcurx(win)            ((win)?(win)->_curx:ERR)
-#define getcury(win)            ((win)?(win)->_cury:ERR)
+#define getcurx(win)            ((win) ? ((int)(win)->_curx) : ERR)
+#define getcury(win)            ((win) ? ((int)(win)->_cury) : ERR)
 #endif
 
 #if !defined(getbegx) && !HAVE_GETBEGX
-#define getbegx(win)            ((win)?(win)->_begx:ERR)
-#define getbegy(win)            ((win)?(win)->_begy:ERR)
+#define getbegx(win)            ((win) ? ((int)(win)->_begx) : ERR)
+#define getbegy(win)            ((win) ? ((int)(win)->_begy) : ERR)
 #endif
 
 #if !defined(getmaxx) && !HAVE_GETMAXX
-#define getmaxx(win)            ((win)?((win)->_maxx + 1):ERR)
-#define getmaxy(win)            ((win)?((win)->_maxy + 1):ERR)
+#define getmaxx(win)            ((win) ? ((int)(win)->_maxx + 1) : ERR)
+#define getmaxy(win)            ((win) ? ((int)(win)->_maxy + 1) : ERR)
 #endif
 
 /*
@@ -716,6 +800,15 @@ extern char *strnames[], *strcodes[], *strfnames[];
 #define NCURSES_XNAMES 0
 #endif
 
+/*
+ * ncurses restores the cursor in endwin().  Other libraries may not.
+ */
+#ifdef NCURSES_VERSION
+#define exit_curses() endwin()
+#else
+#define exit_curses() do { endwin(); curs_set(1); } while (0)
+#endif
+
 /* ncurses implements tparm() with varargs, X/Open with a fixed-parameter list
  * (which is incompatible with legacy usage, doesn't solve any problems).
  */
@@ -805,12 +898,18 @@ extern char *strnames[], *strcodes[], *strfnames[];
 
 #define VT_ACSC "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"
 
-#define CATCHALL(handler) { \
+#define CATCHALL(handler) do { \
                int nsig; \
                for (nsig = SIGHUP; nsig < SIGTERM; ++nsig) \
                    if (nsig != SIGKILL) \
                        signal(nsig, handler); \
-           }
+           } while(0)
+
+#ifdef NCURSES_VERSION
+#define InitAndCatch(init,handler) do { CATCHALL(handler); init; } while (0)
+#else
+#define InitAndCatch(init,handler) do { init; CATCHALL(handler); } while (0)
+#endif
 
 /*
  * Workaround for clean(er) compile with Solaris's legacy curses.
@@ -895,35 +994,47 @@ extern char *tgoto(char *, int, int);     /* available, but not prototyped */
 #define WANT_USE_SCREEN() extern void _nc_want_use_screen(void)
 #endif
 
-#ifdef TRACE
+#if defined(TRACE) && HAVE__TRACEF
 #define Trace(p) _tracef p
 #define USE_TRACE 1
+#define START_TRACE() \
+       if ((_nc_tracing & TRACE_MAXIMUM) == 0) { \
+           int t = _nc_getenv_num("NCURSES_TRACE"); \
+           if (t >= 0) \
+               trace((unsigned) t); \
+       }
+extern unsigned _nc_tracing;
+extern int _nc_getenv_num(const char *);
 #else
+#undef TRACE
 #define Trace(p)               /* nothing */
 #define USE_TRACE 0
+#define START_TRACE()          /* nothing */
 #endif
 
 #define Trace2(p)              /* nothing */
 
-#define MvAddCh         (void) mvaddch
-#define MvWAddCh        (void) mvwaddch
-#define MvAddStr        (void) mvaddstr
-#define MvWAddStr       (void) mvwaddstr
-#define MvWAddChStr     (void) mvwaddchstr
-#define MvPrintw        (void) mvprintw
-#define MvWPrintw       (void) mvwprintw
-#define MvHLine         (void) mvhline
-#define MvWHLine        (void) mvwhline
-#define MvVLine         (void) mvvline
-#define MvWVLine        (void) mvwvline
+#define AddCh(c)               (void) addch((chtype)(c))
+#define WAddCh(w,c)            (void) waddch((w),(chtype)(c))
+#define MvAddCh(y,x,c)         (void) mvaddch((y),(x),(chtype)(c))
+#define MvWAddCh(w,y,x,c)      (void) mvwaddch((w),(y),(x),(chtype)(c))
+#define MvAddStr(y,x,s)                (void) mvaddstr((y),(x),(s))
+#define MvWAddStr(w,y,x,s)     (void) mvwaddstr((w),(y),(x),(s))
+#define MvWAddChStr(w,y,x,s)   (void) mvwaddchstr((w),(y),(x),(s))
+#define MvPrintw               (void) mvprintw
+#define MvWPrintw              (void) mvwprintw
+#define MvHLine                        (void) mvhline
+#define MvWHLine               (void) mvwhline
+#define MvVLine                        (void) mvvline
+#define MvWVLine               (void) mvwvline
 
 /*
  * The macro likely uses unsigned values, while X/Open prototype uses int.
  */
 #if defined(wattrset) || defined(PDCURSES)
-#define AttrArg(p,a)    (attr_t) ((attr_t)(p) | (attr_t)(a))
+#define AttrArg(p,a)    (chtype) ((chtype)(p) | (chtype)(a))
 #else
-#define AttrArg(p,a)    (int) ((attr_t)(p) | (attr_t)(a))
+#define AttrArg(p,a)    (int) ((chtype)(p) | (chtype)(a))
 #endif
 
 /*