]> ncurses.scripts.mit.edu Git - ncurses.git/blob - test/test.priv.h
ncurses 5.3
[ncurses.git] / test / test.priv.h
1 /****************************************************************************
2  * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc.              *
3  *                                                                          *
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:                 *
11  *                                                                          *
12  * The above copyright notice and this permission notice shall be included  *
13  * in all copies or substantial portions of the Software.                   *
14  *                                                                          *
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.                               *
22  *                                                                          *
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       *
26  * authorization.                                                           *
27  ****************************************************************************/
28
29 /****************************************************************************
30  *  Author: Thomas E. Dickey <dickey@clark.net> 1996                        *
31  ****************************************************************************/
32 /* $Id: test.priv.h,v 1.35 2002/06/29 23:36:12 tom Exp $ */
33
34 #if HAVE_CONFIG_H
35 #include <ncurses_cfg.h>
36 #else
37 #define HAVE_CURSES_VERSION 0
38 #define HAVE_RESIZETERM 0
39 #define HAVE_USE_DEFAULT_COLORS 0
40 #define HAVE_WRESIZE 0
41 #endif
42
43 #ifndef HAVE_CURSES_VERSION
44 #define HAVE_CURSES_VERSION 0
45 #endif
46
47 #ifndef HAVE_FORM_H
48 #define HAVE_FORM_H 0
49 #endif
50
51 #ifndef HAVE_LIBFORM
52 #define HAVE_LIBFORM 0
53 #endif
54
55 #ifndef HAVE_LIBMENU
56 #define HAVE_LIBMENU 0
57 #endif
58
59 #ifndef HAVE_LIBPANEL
60 #define HAVE_LIBPANEL 0
61 #endif
62
63 #ifndef HAVE_LOCALE_H
64 #define HAVE_LOCALE_H 0
65 #endif
66
67 #ifndef HAVE_MENU_H
68 #define HAVE_MENU_H 0
69 #endif
70
71 #ifndef HAVE_NAPMS
72 #define HAVE_NAPMS 1
73 #endif
74
75 #ifndef HAVE_NC_ALLOC_H
76 #define HAVE_NC_ALLOC_H 0
77 #endif
78
79 #ifndef HAVE_PANEL_H
80 #define HAVE_PANEL_H 0
81 #endif
82
83 #ifndef HAVE_WRESIZE
84 #define HAVE_WRESIZE 0
85 #endif
86
87 #ifndef NCURSES_NOMACROS
88 #define NCURSES_NOMACROS 0
89 #endif
90
91 #ifndef NEED_PTEM_H
92 #define NEED_PTEM_H 0
93 #endif
94
95 #include <stdlib.h>
96 #include <string.h>
97 #include <sys/types.h>
98
99 #if HAVE_UNISTD_H
100 #include <unistd.h>
101 #endif
102
103 #include <signal.h>     /* include before curses.h to work around glibc bug */
104
105 #include <curses.h>
106 #include <term.h>
107
108 #if NCURSES_NOMACROS
109 #include <nomacros.h>
110 #endif
111
112 #if HAVE_GETOPT_H
113 #include <getopt.h>
114 #else
115 /* 'getopt()' may be prototyped in <stdlib.h>, but declaring its variables
116  * doesn't hurt.
117  */
118 extern char *optarg;
119 extern int optind;
120 #endif /* HAVE_GETOPT_H */
121
122 #if HAVE_LOCALE_H
123 #include <locale.h>
124 #else
125 #define setlocale(name,string) /* nothing */
126 #endif
127
128 #ifndef GCC_NORETURN
129 #define GCC_NORETURN /* nothing */
130 #endif
131 #ifndef GCC_UNUSED
132 #define GCC_UNUSED /* nothing */
133 #endif
134
135 #ifndef HAVE_GETNSTR
136 #define getnstr(s,n) getstr(s)
137 #endif
138
139 #ifndef USE_WIDEC_SUPPORT
140 #if defined(_XOPEN_SOURCE_EXTENDED) && defined(WACS_ULCORNER)
141 #define USE_WIDEC_SUPPORT 1
142 #else
143 #define USE_WIDEC_SUPPORT 0
144 #endif
145 #endif
146
147 #ifndef HAVE_TYPE_ATTR_T
148 #if !USE_WIDEC_SUPPORT
149 #define attr_t long
150 #endif
151 #endif
152
153 #ifndef NCURSES_CH_T
154 #if !USE_WIDEC_SUPPORT
155 #define NCURSES_CH_T chtype
156 #else
157 #define NCURSES_CH_T cchar_t
158 #endif
159 #endif
160
161 #ifndef CCHARW_MAX
162 #define CCHARW_MAX 5
163 #endif
164
165 #ifndef KEY_MIN
166 #define KEY_MIN 256     /* not defined in Solaris 8 */
167 #endif
168
169 #ifndef getcurx
170 #define getcurx(win)            ((win)?(win)->_curx:ERR)
171 #define getcury(win)            ((win)?(win)->_cury:ERR)
172 #endif
173
174 #ifndef getbegx
175 #define getbegx(win)            ((win)?(win)->_begx:ERR)
176 #define getbegy(win)            ((win)?(win)->_begy:ERR)
177 #endif
178
179 #ifndef getmaxx
180 #define getmaxx(win)            ((win)?((win)->_maxx + 1):ERR)
181 #define getmaxy(win)            ((win)?((win)->_maxy + 1):ERR)
182 #endif
183
184 /* ncurses implements tparm() with varargs, X/Open with a fixed-parameter list
185  * (which is incompatible with legacy usage, doesn't solve any problems).
186  */
187 #define tparm3(a,b,c) tparm(a,b,c,0,0,0,0,0,0,0)
188 #define tparm2(a,b)   tparm(a,b,0,0,0,0,0,0,0,0)
189
190 #define UChar(c)    ((unsigned char)(c))
191
192 #define SIZEOF(table)   (sizeof(table)/sizeof(table[0]))
193
194 #if defined(NCURSES_VERSION) && HAVE_NC_ALLOC_H
195 #include <nc_alloc.h>
196 #else
197 #define typeMalloc(type,n) (type *) malloc((n) * sizeof(type))
198 #define typeRealloc(type,n,p) (type *) realloc(p, (n) * sizeof(type))
199 #endif
200
201 #ifndef ExitProgram
202 #define ExitProgram(code) exit(code)
203 #endif
204
205 #ifndef EXIT_SUCCESS
206 #define EXIT_SUCCESS 0
207 #endif
208 #ifndef EXIT_FAILURE
209 #define EXIT_FAILURE 1
210 #endif
211
212 /* Use this to quiet gcc's -Wwrite-strings warnings, but accommodate SVr4
213  * curses which doesn't have const parameters declared (so far) in the places
214  * that XSI shows.
215  */
216 #ifndef NCURSES_CONST
217 #define NCURSES_CONST /* nothing */
218 #endif