1 /****************************************************************************
2 * Copyright (c) 1998-2002,2003 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 <dickey@clark.net> 1996 *
31 ****************************************************************************/
32 /* $Id: test.priv.h,v 1.46 2003/10/19 00:04:24 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_LIBFORM 1
48 #define HAVE_LIBMENU 1
52 #define HAVE_LIBPANEL 1
56 * Fallback definitions to accommodate broken compilers
58 #ifndef HAVE_CURSES_VERSION
59 #define HAVE_CURSES_VERSION 0
67 #define HAVE_LIBFORM 0
71 #define HAVE_LIBMENU 0
75 #define HAVE_LIBPANEL 0
79 #define HAVE_LOCALE_H 0
90 #ifndef HAVE_NC_ALLOC_H
91 #define HAVE_NC_ALLOC_H 0
95 #define HAVE_PANEL_H 0
98 #ifndef HAVE_SLK_COLOR
99 #define HAVE_SLK_COLOR 0
103 #define HAVE_WRESIZE 0
106 #ifndef NCURSES_EXT_FUNCS
107 #define NCURSES_EXT_FUNCS 0
110 #ifndef NCURSES_NOMACROS
111 #define NCURSES_NOMACROS 0
115 #define NEED_PTEM_H 0
120 #include <sys/types.h>
126 #include <signal.h> /* include before curses.h to work around glibc bug */
128 #if defined(HAVE_NCURSESW_NCURSES_H)
129 #include <ncursesw/curses.h>
130 #include <ncursesw/term.h>
131 #elif defined(HAVE_NCURSES_NCURSES_H)
132 #include <ncurses/curses.h>
133 #include <ncurses/term.h>
140 #include <nomacros.h>
146 /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its variables
151 #endif /* HAVE_GETOPT_H */
156 #define setlocale(name,string) /* nothing */
163 #define GCC_NORETURN /* nothing */
166 #define GCC_UNUSED /* nothing */
170 #define getnstr(s,n) getstr(s)
173 #ifndef USE_WIDEC_SUPPORT
174 #if defined(_XOPEN_SOURCE_EXTENDED) && defined(WACS_ULCORNER)
175 #define USE_WIDEC_SUPPORT 1
177 #define USE_WIDEC_SUPPORT 0
181 #if HAVE_PANEL_H && HAVE_LIBPANEL
182 #define USE_LIBPANEL 1
184 #define USE_LIBPANEL 0
187 #if HAVE_MENU_H && HAVE_LIBMENU
188 #define USE_LIBMENU 1
190 #define USE_LIBMENU 0
193 #if HAVE_FORM_H && HAVE_LIBFORM
194 #define USE_LIBFORM 1
196 #define USE_LIBFORM 0
199 #ifndef HAVE_TYPE_ATTR_T
200 #if !USE_WIDEC_SUPPORT
206 #if !USE_WIDEC_SUPPORT
207 #define NCURSES_CH_T chtype
209 #define NCURSES_CH_T cchar_t
217 #define CTRL(x) ((x) & 0x1f)
220 #define QUIT CTRL('Q')
221 #define ESCAPE CTRL('[')
224 #define KEY_MIN 256 /* not defined in Solaris 8 */
228 #define getcurx(win) ((win)?(win)->_curx:ERR)
229 #define getcury(win) ((win)?(win)->_cury:ERR)
233 #define getbegx(win) ((win)?(win)->_begx:ERR)
234 #define getbegy(win) ((win)?(win)->_begy:ERR)
238 #define getmaxx(win) ((win)?((win)->_maxx + 1):ERR)
239 #define getmaxy(win) ((win)?((win)->_maxy + 1):ERR)
242 /* ncurses implements tparm() with varargs, X/Open with a fixed-parameter list
243 * (which is incompatible with legacy usage, doesn't solve any problems).
245 #define tparm3(a,b,c) tparm(a,b,c,0,0,0,0,0,0,0)
246 #define tparm2(a,b) tparm(a,b,0,0,0,0,0,0,0,0)
248 #define UChar(c) ((unsigned char)(c))
250 #define SIZEOF(table) (sizeof(table)/sizeof(table[0]))
252 #if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H
253 #include <nc_alloc.h>
255 #define typeMalloc(type,n) (type *) malloc((n) * sizeof(type))
256 #define typeRealloc(type,n,p) (type *) realloc(p, (n) * sizeof(type))
260 #define ExitProgram(code) exit(code)
264 #define EXIT_SUCCESS 0
267 #define EXIT_FAILURE 1
270 /* Use this to quiet gcc's -Wwrite-strings warnings, but accommodate SVr4
271 * curses which doesn't have const parameters declared (so far) in the places
274 #ifndef NCURSES_CONST
275 #define NCURSES_CONST /* nothing */
278 /* out-of-band values for representing absent capabilities */
279 #define ABSENT_BOOLEAN (-1) /* 255 */
280 #define ABSENT_NUMERIC (-1)
281 #define ABSENT_STRING (char *)0
283 /* out-of-band values for representing cancels */
284 #define CANCELLED_BOOLEAN (char)(-2) /* 254 */
285 #define CANCELLED_NUMERIC (-2)
286 #define CANCELLED_STRING (char *)(-1)
288 #define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */
289 #define VALID_NUMERIC(s) ((s) >= 0)
290 #define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)
292 #define VT_ACSC "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~"
294 #endif /* __TEST_PRIV_H */