1 /****************************************************************************
2 * Copyright (c) 1998-2014,2016 Free Software Foundation, Inc. *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
27 ****************************************************************************/
29 /****************************************************************************
30 * Author: Thomas E. Dickey 1996-on *
31 ****************************************************************************/
32 /* $Id: test.priv.h,v 1.138 2016/09/10 23:42:33 tom Exp $ */
35 #define __TEST_PRIV_H 1
37 #include <ncurses_cfg.h>
40 * Fix ifdef's that look for the form/menu/panel libraries, if we are building
41 * with wide-character ncurses.
44 #define HAVE_LIBFORMW 1
45 #define HAVE_LIBFORM 1
49 #define HAVE_LIBMENUW 1
50 #define HAVE_LIBMENU 1
54 #define HAVE_LIBPANELW 1
55 #define HAVE_LIBPANEL 1
59 * Fallback definitions to accommodate broken compilers.
61 #ifndef HAVE_ASSUME_DEFAULT_COLORS
62 #define HAVE_ASSUME_DEFAULT_COLORS 0
65 #ifndef HAVE_BSD_STRING_H
66 #define HAVE_BSD_STRING_H 0
68 #ifndef HAVE_CURSES_VERSION
69 #define HAVE_CURSES_VERSION 0
76 #ifndef HAVE_COLOR_SET
77 #define HAVE_COLOR_SET 0
89 #define HAVE_GETBEGX 0
93 #define HAVE_GETCURX 0
97 #define HAVE_GETMAXX 0
100 #ifndef HAVE_GETOPT_H
101 #define HAVE_GETOPT_H 0
105 #define HAVE_GETPARX 0
109 #define HAVE_GETWIN 0
113 #define HAVE_LIBFORM 0
117 #define HAVE_LIBMENU 0
120 #ifndef HAVE_LIBPANEL
121 #define HAVE_LIBPANEL 0
124 #ifndef HAVE_LANGINFO_CODESET
125 #define HAVE_LANGINFO_CODESET 0
128 #ifndef HAVE_LOCALE_H
129 #define HAVE_LOCALE_H 0
133 #define HAVE_MATH_H 0
137 #define HAVE_MENU_H 0
141 #define HAVE_MVVLINE 0
144 #ifndef HAVE_MVWVLINE
145 #define HAVE_MVWVLINE 0
152 #ifndef HAVE_NC_ALLOC_H
153 #define HAVE_NC_ALLOC_H 0
157 #define HAVE_PANEL_H 0
161 #define HAVE_PUTWIN 0
164 #ifndef HAVE_RESIZE_TERM
165 #define HAVE_RESIZE_TERM 0
168 #ifndef HAVE_RESTARTTERM
169 #define HAVE_RESTARTTERM 0
172 #ifndef HAVE_RIPOFFLINE
173 #define HAVE_RIPOFFLINE 0
176 #ifndef HAVE_SCR_DUMP
177 #define HAVE_SCR_DUMP 0
180 #ifndef HAVE_SETUPTERM
181 #define HAVE_SETUPTERM 0
184 #ifndef HAVE_SLK_COLOR
185 #define HAVE_SLK_COLOR 0
188 #ifndef HAVE_SLK_INIT
189 #define HAVE_SLK_INIT 0
192 #ifndef HAVE_SYS_IOCTL_H
193 #define HAVE_SYS_IOCTL_H 0
196 #ifndef HAVE_SYS_SELECT_H
197 #define HAVE_SYS_SELECT_H 0
200 #ifndef HAVE_TERMATTRS
201 #define HAVE_TERMATTRS 0
204 #ifndef HAVE_TERMIOS_H
205 #define HAVE_TERMIOS_H 0
208 #ifndef HAVE_TERMNAME
209 #define HAVE_TERMNAME 0
212 #ifndef HAVE_TERM_ENTRY_H
213 #define HAVE_TERM_ENTRY_H 0
217 #define HAVE_TGETENT 0
220 #ifndef HAVE_TIGETNUM
221 #define HAVE_TIGETNUM 0
224 #ifndef HAVE_TIGETSTR
225 #define HAVE_TIGETSTR 0
228 #ifndef HAVE_TYPEAHEAD
229 #define HAVE_TYPEAHEAD 0
233 #define HAVE_WINSSTR 0
236 #ifndef HAVE_USE_DEFAULT_COLORS
237 #define HAVE_USE_DEFAULT_COLORS 0
241 #define HAVE_USE_ENV 0
244 #ifndef HAVE_USE_EXTENDED_NAMES
245 #define HAVE_USE_EXTENDED_NAMES 0
248 #ifndef HAVE_USE_SCREEN
249 #define HAVE_USE_SCREEN 0
252 #ifndef HAVE_USE_WINDOW
253 #define HAVE_USE_WINDOW 0
257 #define HAVE_VIDPUTS 0
260 #ifndef HAVE_VID_PUTS
261 #define HAVE_VID_PUTS 0
265 #define HAVE_WRESIZE 0
268 #ifndef NCURSES_EXT_FUNCS
269 #define NCURSES_EXT_FUNCS 0
273 #define NEED_PTEM_H 0
277 #define NEED_WCHAR_H 0
285 * Workaround for HPUX
287 #if defined(__hpux) && !defined(NCURSES_VERSION)
288 #define _ACS_COMPAT_CODE /* needed for acs_map vs __acs_map */
294 #include <sys/types.h>
301 #include <signal.h> /* include before curses.h to work around glibc bug */
305 #ifdef HAVE_LIBUTF8_H
310 #if defined(HAVE_XCURSES)
312 #elif defined(HAVE_NCURSESW_NCURSES_H)
313 #include <ncursesw/curses.h>
314 #elif defined(HAVE_NCURSES_NCURSES_H)
315 #include <ncurses/curses.h>
320 #if defined(HAVE_XCURSES) || defined(PDCURSES)
321 /* no other headers */
322 #undef HAVE_SETUPTERM /* nonfunctional */
323 #define HAVE_SETUPTERM 0
324 #undef HAVE_TGETENT /* nonfunctional */
325 #define HAVE_TGETENT 0
326 #undef HAVE_TIGETSTR /* nonfunctional */
327 #define HAVE_TIGETSTR 0
328 #elif defined(HAVE_NCURSESW_TERM_H)
329 #include <ncursesw/term.h>
330 #elif defined(HAVE_NCURSES_TERM_H)
331 #include <ncurses/term.h>
332 #elif defined(HAVE_TERM_H)
337 * Not all curses.h implementations include unctrl.h,
339 #if defined(HAVE_NCURSESW_UNCTRL_H)
340 #include <ncursesw/unctrl.h>
341 #elif defined(HAVE_NCURSES_UNCTRL_H)
342 #include <ncurses/unctrl.h>
343 #elif defined(HAVE_UNCTRL_H)
349 #elif !defined(HAVE_GETOPT_HEADER)
350 /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its variables
355 #endif /* HAVE_GETOPT_H */
360 #define setlocale(name,string) /* nothing */
367 #define GCC_NORETURN /* nothing */
369 #ifndef GCC_PRINTFLIKE
370 #define GCC_PRINTFLIKE(a,b) /* nothing */
373 #define GCC_UNUSED /* nothing */
377 #define getnstr(s,n) getstr(s)
382 #define USE_SOFTKEYS 1
384 #define USE_SOFTKEYS 0
389 #define slk_init() /* nothing */
390 #define slk_restore() /* nothing */
391 #define slk_clear() /* nothing */
394 #ifndef HAVE_WSYNCDOWN
395 #define wsyncdown(win) /* nothing */
398 #ifndef USE_WIDEC_SUPPORT
399 #if (defined(_XOPEN_SOURCE_EXTENDED) \
400 || (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE - 0 >= 500)) \
401 || (defined(NCURSES_WIDECHAR) && (NCURSES_WIDECHAR - 0 < 1))) \
402 && defined(WACS_ULCORNER)
403 #define USE_WIDEC_SUPPORT 1
405 #define USE_WIDEC_SUPPORT 0
409 #if HAVE_PANEL_H && HAVE_LIBPANEL
410 #define USE_LIBPANEL 1
412 #define USE_LIBPANEL 0
415 #if HAVE_MENU_H && HAVE_LIBMENU
416 #define USE_LIBMENU 1
418 #define USE_LIBMENU 0
421 #if HAVE_FORM_H && HAVE_LIBFORM
422 #define USE_LIBFORM 1
424 #define USE_LIBFORM 0
427 /* workaround, to build against NetBSD's variant of the form library */
428 #ifdef HAVE_NETBSD_FORM_H
429 #define form_getyx(form, y, x) y = current_field(form)->cursor_ypos, x = current_field(form)->cursor_xpos
431 #define form_getyx(form, y, x) y = (form)->currow, x = (form)->curcol
434 /* workaround, to build against NetBSD's variant of the form library */
435 #ifdef HAVE_NETBSD_MENU_H
436 #define menu_itemwidth(menu) (menu)->max_item_width
438 #define menu_itemwidth(menu) (menu)->itemlen
441 #ifndef HAVE_TYPE_ATTR_T
442 #if !USE_WIDEC_SUPPORT && !defined(attr_t)
443 #define attr_t chtype
448 #if !USE_WIDEC_SUPPORT
449 #define NCURSES_CH_T chtype
451 #define NCURSES_CH_T cchar_t
454 #ifndef NCURSES_COLOR_T
455 #define NCURSES_COLOR_T short
458 #ifndef NCURSES_PAIRS_T
459 #define NCURSES_PAIRS_T short
462 #ifndef NCURSES_OPAQUE
463 #define NCURSES_OPAQUE 0
470 #if defined(NCURSES_VERSION) && defined(CURSES_WACS_ARRAY) && !defined(CURSES_WACS_SYMBOLS)
471 #define CURSES_WACS_SYMBOLS
474 #if defined(CURSES_WACS_ARRAY) && !defined(CURSES_WACS_SYMBOLS)
475 /* NetBSD 5.1 defines these incorrectly */
509 #define WACS_RARROW &(CURSES_WACS_ARRAY['+'])
510 #define WACS_LARROW &(CURSES_WACS_ARRAY[','])
511 #define WACS_UARROW &(CURSES_WACS_ARRAY['-'])
512 #define WACS_DARROW &(CURSES_WACS_ARRAY['.'])
513 #define WACS_BLOCK &(CURSES_WACS_ARRAY['0'])
514 #define WACS_DIAMOND &(CURSES_WACS_ARRAY['`'])
515 #define WACS_CKBOARD &(CURSES_WACS_ARRAY['a'])
516 #define WACS_DEGREE &(CURSES_WACS_ARRAY['f'])
517 #define WACS_PLMINUS &(CURSES_WACS_ARRAY['g'])
518 #define WACS_BOARD &(CURSES_WACS_ARRAY['h'])
519 #define WACS_LANTERN &(CURSES_WACS_ARRAY['i'])
520 #define WACS_LRCORNER &(CURSES_WACS_ARRAY['j'])
521 #define WACS_URCORNER &(CURSES_WACS_ARRAY['k'])
522 #define WACS_ULCORNER &(CURSES_WACS_ARRAY['l'])
523 #define WACS_LLCORNER &(CURSES_WACS_ARRAY['m'])
524 #define WACS_PLUS &(CURSES_WACS_ARRAY['n'])
525 #define WACS_HLINE &(CURSES_WACS_ARRAY['q'])
526 #define WACS_S1 &(CURSES_WACS_ARRAY['o'])
527 #define WACS_S9 &(CURSES_WACS_ARRAY['s'])
528 #define WACS_LTEE &(CURSES_WACS_ARRAY['t'])
529 #define WACS_RTEE &(CURSES_WACS_ARRAY['u'])
530 #define WACS_BTEE &(CURSES_WACS_ARRAY['v'])
531 #define WACS_TTEE &(CURSES_WACS_ARRAY['w'])
532 #define WACS_VLINE &(CURSES_WACS_ARRAY['x'])
533 #define WACS_BULLET &(CURSES_WACS_ARRAY['~'])
534 #define WACS_S3 &(CURSES_WACS_ARRAY['p'])
535 #define WACS_S7 &(CURSES_WACS_ARRAY['r'])
536 #define WACS_LEQUAL &(CURSES_WACS_ARRAY['y'])
537 #define WACS_GEQUAL &(CURSES_WACS_ARRAY['z'])
538 #define WACS_PI &(CURSES_WACS_ARRAY['{'])
539 #define WACS_NEQUAL &(CURSES_WACS_ARRAY['|'])
540 #define WACS_STERLING &(CURSES_WACS_ARRAY['}'])
544 #define CTRL(x) ((x) & 0x1f)
546 #define QUIT CTRL('Q')
547 #define ESCAPE CTRL('[')
550 #define KEY_MIN 256 /* not defined in Solaris 8 */
553 /* from nc_string.h, to make this stand alone */
554 #if HAVE_BSD_STRING_H
555 #include <bsd/string.h>
559 #define NCURSES_VOID /* nothing */
561 #define NCURSES_VOID (void)
565 #define HAVE_STRLCAT 0
569 #define HAVE_STRLCPY 0
572 #ifndef HAVE_SNPRINTF
573 #define HAVE_SNPRINTF 0
576 #ifndef USE_STRING_HACKS
577 #define USE_STRING_HACKS 0
580 #if USE_STRING_HACKS && HAVE_STRLCAT
581 #define _nc_STRCAT(d,s,n) NCURSES_VOID strlcat((d),(s),NCURSES_CAST(size_t,n))
582 #define _nc_STRNCAT(d,s,m,n) NCURSES_VOID strlcat((d),(s),NCURSES_CAST(size_t,m))
584 #define _nc_STRCAT(d,s,n) NCURSES_VOID strcat((d),(s))
585 #define _nc_STRNCAT(d,s,m,n) NCURSES_VOID strncat((d),(s),(n))
588 #if USE_STRING_HACKS && HAVE_STRLCPY
589 #define _nc_STRCPY(d,s,n) NCURSES_VOID strlcpy((d),(s),NCURSES_CAST(size_t,n))
590 #define _nc_STRNCPY(d,s,n) NCURSES_VOID strlcpy((d),(s),NCURSES_CAST(size_t,n))
592 #define _nc_STRCPY(d,s,n) NCURSES_VOID strcpy((d),(s))
593 #define _nc_STRNCPY(d,s,n) NCURSES_VOID strncpy((d),(s),(n))
596 #if USE_STRING_HACKS && HAVE_SNPRINTF
597 #define _nc_SPRINTF NCURSES_VOID snprintf
598 #define _nc_SLIMIT(n) NCURSES_CAST(size_t,n),
600 #define _nc_SPRINTF NCURSES_VOID sprintf
601 #define _nc_SLIMIT(n) /* nothing */
604 #ifdef DECL_CURSES_DATA_BOOLNAMES
605 extern char *boolnames[], *boolcodes[], *boolfnames[];
606 extern char *numnames[], *numcodes[], *numfnames[];
607 extern char *strnames[], *strcodes[], *strfnames[];
610 #ifdef DECL_CURSES_DATA_TTYTYPE
611 #define ttytype termname()
614 #define colored_chtype(ch, attr, pair) \
615 ((chtype) (ch) | (chtype) (attr) | (chtype) COLOR_PAIR(pair))
618 * Workaround for HPUX
620 #if defined(__hpux) && !defined(NCURSES_VERSION)
621 #define getbegx(w) __getbegx(w)
622 #define getbegy(w) __getbegy(w)
623 #define getcurx(w) __getcurx(w)
624 #define getcury(w) __getcury(w)
625 #define getmaxx(w) __getmaxx(w)
626 #define getmaxy(w) __getmaxy(w)
627 #define getparx(w) __getparx(w)
628 #define getpary(w) __getpary(w)
632 * Workaround in case getcchar() returns a positive value when the source
633 * string produces only a L'\0'.
635 #define TEST_CCHAR(s, count, then_stmt, else_stmt) \
636 if ((count = getcchar(s, NULL, NULL, NULL, NULL)) > 0) { \
637 wchar_t test_wch[CCHARW_MAX + 2]; \
639 NCURSES_PAIRS_T test_pair; \
641 if (getcchar( s, test_wch, &test_attrs, &test_pair, NULL) == OK \
642 && test_wch[0] != L'\0') { \
651 * These usually are implemented as macros, but may be functions.
653 #if !defined(getcurx) && !HAVE_GETCURX
654 #define getcurx(win) ((win)?(win)->_curx:ERR)
655 #define getcury(win) ((win)?(win)->_cury:ERR)
658 #if !defined(getbegx) && !HAVE_GETBEGX
659 #define getbegx(win) ((win)?(win)->_begx:ERR)
660 #define getbegy(win) ((win)?(win)->_begy:ERR)
663 #if !defined(getmaxx) && !HAVE_GETMAXX
664 #define getmaxx(win) ((win)?((win)->_maxx + 1):ERR)
665 #define getmaxy(win) ((win)?((win)->_maxy + 1):ERR)
670 #define __m_getparx(w) ((w)->_parent == (WINDOW *) 0 ? -1 \
671 : (w)->_begx - (w)->_parent->_begx)
673 #if !defined(getparx) && !HAVE_GETPARX
675 #define getparx(win) __m_getparx(win)
676 #define getpary(win) __m_getpary(win)
678 #define getparx(win) ((win)?((win)->_parx + 1):ERR)
679 #define getpary(win) ((win)?((win)->_pary + 1):ERR)
683 #if !defined(mvwvline) && !HAVE_MVWVLINE
684 #define mvwvline(w,y,x,ch,n) (move(y,x) == ERR ? ERR : wvline(w,ch,n))
685 #define mvwhline(w,y,x,ch,n) (move(y,x) == ERR ? ERR : whline(w,ch,n))
688 #if !defined(mvvline) && !HAVE_MVVLINE
689 #define mvvline(y,x,ch,n) (move(y,x) == ERR ? ERR : vline(ch,n))
690 #define mvhline(y,x,ch,n) (move(y,x) == ERR ? ERR : hline(ch,n))
694 * Try to accommodate curses implementations that have no terminfo support.
697 #define TIGETNUM(ti,tc) tigetnum(ti)
699 #define TIGETNUM(ti,tc) tgetnum(tc)
703 #define TIGETSTR(ti,tc) tigetstr(ti)
705 #define TIGETSTR(ti,tc) tgetstr(tc,&area_pointer)
709 * So far (2013 - more than ten years), only ncurses implements
710 * use_extended_names().
712 #if defined(NCURSES_XNAMES)
713 #elif defined(NCURSES_VERSION) && defined(HAVE_TERM_ENTRY_H) && HAVE_TERM_ENTRY_H
714 #define NCURSES_XNAMES 1
716 #define NCURSES_XNAMES 0
719 /* ncurses implements tparm() with varargs, X/Open with a fixed-parameter list
720 * (which is incompatible with legacy usage, doesn't solve any problems).
722 #define tparm3(a,b,c) tparm(a,b,c,0,0,0,0,0,0,0)
723 #define tparm2(a,b) tparm(a,b,0,0,0,0,0,0,0,0)
725 #define UChar(c) ((unsigned char)(c))
727 #define SIZEOF(table) (sizeof(table)/sizeof(table[0]))
729 #if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H
730 #include <nc_alloc.h>
731 #if HAVE_NC_FREEALL && defined(USE_TINFO)
733 #define ExitProgram(code) _nc_free_tinfo(code)
736 #define typeMalloc(type,n) (type *) malloc((size_t)(n) * sizeof(type))
737 #define typeCalloc(type,elts) (type *) calloc((size_t)(elts), sizeof(type))
738 #define typeRealloc(type,n,p) (type *) realloc(p, (size_t)(n) * sizeof(type))
742 #define ExitProgram(code) exit(code)
746 #define EXIT_SUCCESS 0
749 #define EXIT_FAILURE 1
752 #if defined(__MINGW32__) || defined(USE_WIN32CON_DRIVER)
754 #if defined(PDCURSES)
757 # error WINVER must at least be 0x0501
760 # define WINVER 0x0501
763 #include <sys/time.h> /* for struct timeval */
765 #define sleep(n) Sleep((n) * 1000)
768 #define getlogin() "username"
770 #elif defined(HAVE_NCURSESW_NCURSES_H)
771 #include <ncursesw/nc_mingw.h>
772 #elif defined(HAVE_NCURSES_NCURSES_H)
773 #include <ncurses/nc_mingw.h>
775 #include <nc_mingw.h>
778 /* conflicts in test/firstlast.c */
784 /* Use this to quiet gcc's -Wwrite-strings warnings, but accommodate SVr4
785 * curses which doesn't have const parameters declared (so far) in the places
788 #ifndef NCURSES_CONST
789 #define NCURSES_CONST /* nothing */
792 /* out-of-band values for representing absent capabilities */
793 #define ABSENT_BOOLEAN ((signed char)-1) /* 255 */
794 #define ABSENT_NUMERIC (-1)
795 #define ABSENT_STRING (char *)0
797 /* out-of-band values for representing cancels */
798 #define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */
799 #define CANCELLED_NUMERIC (-2)
800 #define CANCELLED_STRING (char *)(-1)
802 #define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */
803 #define VALID_NUMERIC(s) ((s) >= 0)
804 #define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)
806 #define VT_ACSC "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"
808 #define CATCHALL(handler) { \
810 for (nsig = SIGHUP; nsig < SIGTERM; ++nsig) \
811 if (nsig != SIGKILL) \
812 signal(nsig, handler); \
816 * Workaround for clean(er) compile with Solaris's legacy curses.
817 * The same would be needed for HPUX 10.20
820 #define TPUTS_ARG int
823 #if defined(sun) && !defined(_XOPEN_CURSES) && !defined(NCURSES_VERSION_PATCH)
825 #define TPUTS_ARG char
826 extern char *tgoto(char *, int, int); /* available, but not prototyped */
830 #define TPUTS_PROTO(func,value) int func(TPUTS_ARG value)
834 #define TPUTS_RETURN(value) return value
838 * Workarounds for Solaris's X/Open curses
840 #if !defined(KEY_MIN) && defined(__KEY_MIN)
841 #define KEY_MIN __KEY_MIN
843 #if !defined(KEY_MAX) && defined(__KEY_MIN)
844 #define KEY_MAX __KEY_MAX
848 * Workaround to build with Sun's default SVr4 curses.
850 #ifdef NCURSES_VERSION
851 #ifndef HAVE_VW_PRINTW
852 #define HAVE_VW_PRINTW 1
857 * ncurses provides arrays of capability names; X/Open discarded these SVr4
858 * features. Some implementations continue to provide them (see the test
861 #ifdef NCURSES_VERSION
862 #ifndef HAVE_CURSES_DATA_BOOLNAMES
863 #define HAVE_CURSES_DATA_BOOLNAMES 1
868 * ncurses uses const in some places where X/Open does (or did) not allow.
870 #ifdef NCURSES_VERSION
871 #define CONST_MENUS const
873 #define CONST_MENUS /* nothing */
877 * Simplify setting up demo of threading with these macros.
881 #define USING_WINDOW(w,func) use_window(w, (NCURSES_WINDOW_CB) func, w)
882 #define USING_WINDOW2(w,func,data) use_window(w, (NCURSES_WINDOW_CB) func, data)
883 #define WANT_USE_WINDOW() extern void _nc_want_use_window(void)
885 #define USING_WINDOW(w,func) func(w)
886 #define USING_WINDOW2(w,func,data) func(w,data)
887 #define WANT_USE_WINDOW() extern void _nc_want_use_window(void)
891 #define USING_SCREEN(s,func,data) use_screen(s, (NCURSES_SCREEN_CB) func, data)
892 #define WANT_USE_SCREEN() extern void _nc_want_use_screen(void)
894 #define USING_SCREEN(s,func,data) func(data)
895 #define WANT_USE_SCREEN() extern void _nc_want_use_screen(void)
899 #define Trace(p) _tracef p
902 #define Trace(p) /* nothing */
906 #define Trace2(p) /* nothing */
908 #define MvAddCh (void) mvaddch
909 #define MvWAddCh (void) mvwaddch
910 #define MvAddStr (void) mvaddstr
911 #define MvWAddStr (void) mvwaddstr
912 #define MvWAddChStr (void) mvwaddchstr
913 #define MvPrintw (void) mvprintw
914 #define MvWPrintw (void) mvwprintw
915 #define MvHLine (void) mvhline
916 #define MvWHLine (void) mvwhline
917 #define MvVLine (void) mvvline
918 #define MvWVLine (void) mvwvline
921 * The macro likely uses unsigned values, while X/Open prototype uses int.
923 #if defined(wattrset) || defined(PDCURSES)
924 #define AttrArg(p,a) (attr_t) ((attr_t)(p) | (attr_t)(a))
926 #define AttrArg(p,a) (int) ((attr_t)(p) | (attr_t)(a))
930 * Workaround for defective implementation of gcc attribute warn_unused_result
932 #if defined(__GNUC__) && defined(_FORTIFY_SOURCE)
933 #define IGNORE_RC(func) errno = func
935 #define IGNORE_RC(func) (void) func
936 #endif /* gcc workarounds */
938 #define init_mb(state) memset(&state, 0, sizeof(state))
940 #endif /* __TEST_PRIV_H */