xref: /freebsd/contrib/ncurses/include/nc_tparm.h (revision faf25f48d601ae39f5752602f3020e2e92605625)
1 /****************************************************************************
2  * Copyright 2018,2020 Thomas E. Dickey                                     *
3  * Copyright 2006-2012,2017 Free Software Foundation, Inc.                  *
4  *                                                                          *
5  * Permission is hereby granted, free of charge, to any person obtaining a  *
6  * copy of this software and associated documentation files (the            *
7  * "Software"), to deal in the Software without restriction, including      *
8  * without limitation the rights to use, copy, modify, merge, publish,      *
9  * distribute, distribute with modifications, sublicense, and/or sell       *
10  * copies of the Software, and to permit persons to whom the Software is    *
11  * furnished to do so, subject to the following conditions:                 *
12  *                                                                          *
13  * The above copyright notice and this permission notice shall be included  *
14  * in all copies or substantial portions of the Software.                   *
15  *                                                                          *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
19  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
21  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
23  *                                                                          *
24  * Except as contained in this notice, the name(s) of the above copyright   *
25  * holders shall not be used in advertising or otherwise to promote the     *
26  * sale, use or other dealings in this Software without prior written       *
27  * authorization.                                                           *
28  ****************************************************************************/
29 
30 /****************************************************************************
31  *  Author: Thomas E. Dickey                        2006                    *
32  ****************************************************************************/
33 
34 /* $Id: nc_tparm.h,v 1.11 2020/05/27 23:33:31 tom Exp $ */
35 
36 #ifndef NC_TPARM_included
37 #define NC_TPARM_included 1
38 
39 #include <ncurses_cfg.h>
40 #include <curses.h>
41 
42 /*
43  * Cast parameters past the formatting-string for tparm() to match the
44  * assumption of the varargs code.
45  */
46 #ifndef TPARM_ARG
47 #ifdef NCURSES_TPARM_ARG
48 #define TPARM_ARG NCURSES_TPARM_ARG
49 #else
50 #define TPARM_ARG long
51 #endif
52 #endif /* TPARAM_ARG */
53 
54 #define TPARM_N(n) (TPARM_ARG)(n)
55 
56 #define TPARM_9(a,b,c,d,e,f,g,h,i,j) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i),TPARM_N(j))
57 
58 #if NCURSES_TPARM_VARARGS
59 #define TPARM_8(a,b,c,d,e,f,g,h,i) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h),TPARM_N(i))
60 #define TPARM_7(a,b,c,d,e,f,g,h) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g),TPARM_N(h))
61 #define TPARM_6(a,b,c,d,e,f,g) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f),TPARM_N(g))
62 #define TPARM_5(a,b,c,d,e,f) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e),TPARM_N(f))
63 #define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e))
64 #define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d))
65 #define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c))
66 #define TPARM_1(a,b) tparm(a,TPARM_N(b))
67 #define TPARM_0(a) tparm(a)
68 #else
69 #define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0)
70 #define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0)
71 #define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0)
72 #define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0)
73 #define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0)
74 #define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
75 #define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
76 #define TPARM_1(a,b) TPARM_2(a,b,0)
77 #define TPARM_0(a) TPARM_1(a,0)
78 #endif
79 
80 #ifdef NCURSES_INTERNALS
81 #define TIPARM_1(s,a) _nc_tiparm(1,s,a)
82 #define TIPARM_2(s,a,b) _nc_tiparm(2,s,a,b)
83 #define TIPARM_3(s,a,b,c) _nc_tiparm(3,s,a,b,c)
84 #define TIPARM_4(s,a,b,c,d) _nc_tiparm(4,s,a,b,c,d)
85 #define TIPARM_5(s,a,b,c,d,e) _nc_tiparm(5,s,a,b,c,d,e)
86 #define TIPARM_6(s,a,b,c,d,e,f) _nc_tiparm(6,s,a,b,c,d,e,f)
87 #define TIPARM_7(s,a,b,c,d,e,f,g) _nc_tiparm(7,s,a,b,c,d,e,f,g)
88 #define TIPARM_8(s,a,b,c,d,e,f,g,h) _nc_tiparm(8,s,a,b,c,d,e,f,g,h)
89 #define TIPARM_9(s,a,b,c,d,e,f,g,h,i) _nc_tiparm(9,s,a,b,c,d,e,f,g,h,i)
90 #endif
91 
92 #endif /* NC_TPARM_included */
93