xref: /openbsd/lib/libcurses/build.priv.h (revision c7ef0cfc)
1*c7ef0cfcSnicm /****************************************************************************
2*c7ef0cfcSnicm  * Copyright 2019,2020 Thomas E. Dickey                                     *
3*c7ef0cfcSnicm  * Copyright 2010,2012 Free Software Foundation, Inc.                       *
4*c7ef0cfcSnicm  *                                                                          *
5*c7ef0cfcSnicm  * Permission is hereby granted, free of charge, to any person obtaining a  *
6*c7ef0cfcSnicm  * copy of this software and associated documentation files (the            *
7*c7ef0cfcSnicm  * "Software"), to deal in the Software without restriction, including      *
8*c7ef0cfcSnicm  * without limitation the rights to use, copy, modify, merge, publish,      *
9*c7ef0cfcSnicm  * distribute, distribute with modifications, sublicense, and/or sell       *
10*c7ef0cfcSnicm  * copies of the Software, and to permit persons to whom the Software is    *
11*c7ef0cfcSnicm  * furnished to do so, subject to the following conditions:                 *
12*c7ef0cfcSnicm  *                                                                          *
13*c7ef0cfcSnicm  * The above copyright notice and this permission notice shall be included  *
14*c7ef0cfcSnicm  * in all copies or substantial portions of the Software.                   *
15*c7ef0cfcSnicm  *                                                                          *
16*c7ef0cfcSnicm  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17*c7ef0cfcSnicm  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18*c7ef0cfcSnicm  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19*c7ef0cfcSnicm  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20*c7ef0cfcSnicm  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21*c7ef0cfcSnicm  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22*c7ef0cfcSnicm  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23*c7ef0cfcSnicm  *                                                                          *
24*c7ef0cfcSnicm  * Except as contained in this notice, the name(s) of the above copyright   *
25*c7ef0cfcSnicm  * holders shall not be used in advertising or otherwise to promote the     *
26*c7ef0cfcSnicm  * sale, use or other dealings in this Software without prior written       *
27*c7ef0cfcSnicm  * authorization.                                                           *
28*c7ef0cfcSnicm  ****************************************************************************/
29*c7ef0cfcSnicm 
30*c7ef0cfcSnicm /****************************************************************************
31*c7ef0cfcSnicm  *  Author: Thomas E. Dickey                        2010                    *
32*c7ef0cfcSnicm  ****************************************************************************/
33*c7ef0cfcSnicm 
34*c7ef0cfcSnicm /*
35*c7ef0cfcSnicm  * $Id: build.priv.h,v 1.1 2023/10/17 09:52:08 nicm Exp $
36*c7ef0cfcSnicm  *
37*c7ef0cfcSnicm  *	build.priv.h
38*c7ef0cfcSnicm  *
39*c7ef0cfcSnicm  *	This is a reduced version of curses.priv.h, for build-time utilities.
40*c7ef0cfcSnicm  *	Because it has fewer dependencies, this simplifies cross-compiling.
41*c7ef0cfcSnicm  *
42*c7ef0cfcSnicm  */
43*c7ef0cfcSnicm 
44*c7ef0cfcSnicm #ifndef CURSES_PRIV_H
45*c7ef0cfcSnicm #define CURSES_PRIV_H 1
46*c7ef0cfcSnicm 
47*c7ef0cfcSnicm #include <ncurses_dll.h>
48*c7ef0cfcSnicm 
49*c7ef0cfcSnicm #ifdef __cplusplus
50*c7ef0cfcSnicm extern "C" {
51*c7ef0cfcSnicm #endif
52*c7ef0cfcSnicm 
53*c7ef0cfcSnicm #include <ncurses_cfg.h>
54*c7ef0cfcSnicm 
55*c7ef0cfcSnicm #if USE_RCS_IDS
56*c7ef0cfcSnicm #define MODULE_ID(id) static const char Ident[] = id;
57*c7ef0cfcSnicm #else
58*c7ef0cfcSnicm #define MODULE_ID(id)		/*nothing */
59*c7ef0cfcSnicm #endif
60*c7ef0cfcSnicm 
61*c7ef0cfcSnicm #include <stdlib.h>
62*c7ef0cfcSnicm #include <string.h>
63*c7ef0cfcSnicm #include <sys/types.h>
64*c7ef0cfcSnicm 
65*c7ef0cfcSnicm #include <assert.h>
66*c7ef0cfcSnicm #include <stdio.h>
67*c7ef0cfcSnicm 
68*c7ef0cfcSnicm #include <errno.h>
69*c7ef0cfcSnicm 
70*c7ef0cfcSnicm #include <curses.h>		/* we'll use -Ipath directive to get the right one! */
71*c7ef0cfcSnicm 
72*c7ef0cfcSnicm /* usually in <unistd.h> */
73*c7ef0cfcSnicm #ifndef EXIT_SUCCESS
74*c7ef0cfcSnicm #define EXIT_SUCCESS 0
75*c7ef0cfcSnicm #endif
76*c7ef0cfcSnicm 
77*c7ef0cfcSnicm #ifndef EXIT_FAILURE
78*c7ef0cfcSnicm #define EXIT_FAILURE 1
79*c7ef0cfcSnicm #endif
80*c7ef0cfcSnicm 
81*c7ef0cfcSnicm #define FreeAndNull(p)   do { free(p); p = 0; } while (0)
82*c7ef0cfcSnicm #define UChar(c)         ((unsigned char)(c))
83*c7ef0cfcSnicm #define SIZEOF(v)        (sizeof(v) / sizeof(v[0]))
84*c7ef0cfcSnicm 
85*c7ef0cfcSnicm #include <nc_alloc.h>
86*c7ef0cfcSnicm #include <nc_string.h>
87*c7ef0cfcSnicm 
88*c7ef0cfcSnicm /* declare these, to avoid needing term.h */
89*c7ef0cfcSnicm #if BROKEN_LINKER || USE_REENTRANT
90*c7ef0cfcSnicm #define NCURSES_ARRAY(name) \
91*c7ef0cfcSnicm 	NCURSES_WRAPPED_VAR(NCURSES_CONST char * const *, name)
92*c7ef0cfcSnicm 
93*c7ef0cfcSnicm     NCURSES_ARRAY(boolnames);
94*c7ef0cfcSnicm     NCURSES_ARRAY(boolfnames);
95*c7ef0cfcSnicm     NCURSES_ARRAY(numnames);
96*c7ef0cfcSnicm     NCURSES_ARRAY(numfnames);
97*c7ef0cfcSnicm     NCURSES_ARRAY(strnames);
98*c7ef0cfcSnicm     NCURSES_ARRAY(strfnames);
99*c7ef0cfcSnicm #endif
100*c7ef0cfcSnicm 
101*c7ef0cfcSnicm #if NO_LEAKS
102*c7ef0cfcSnicm     NCURSES_EXPORT(void) _nc_names_leaks(void);
103*c7ef0cfcSnicm #endif
104*c7ef0cfcSnicm 
105*c7ef0cfcSnicm #ifdef __cplusplus
106*c7ef0cfcSnicm }
107*c7ef0cfcSnicm #endif
108*c7ef0cfcSnicm #endif				/* CURSES_PRIV_H */
109