xref: /freebsd/contrib/ncurses/include/nc_tparm.h (revision bc3f5ec90bde2f3a5e4021d133c89793d68b8c73)
1 /****************************************************************************
2  * Copyright (c) 2006-2010,2012 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                        2006                    *
31  ****************************************************************************/
32 
33 /* $Id: nc_tparm.h,v 1.6 2012/02/18 21:34:42 tom Exp $ */
34 
35 #ifndef NC_TPARM_included
36 #define NC_TPARM_included 1
37 
38 /*
39  * Cast parameters past the formatting-string for tparm() to match the
40  * assumption of the varargs code.
41  */
42 #ifndef TPARM_ARG
43 #ifdef NCURSES_TPARM_ARG
44 #define TPARM_ARG NCURSES_TPARM_ARG
45 #else
46 #define TPARM_ARG long
47 #endif
48 #endif /* TPARAM_ARG */
49 
50 #define TPARM_N(n) (TPARM_ARG)(n)
51 
52 #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))
53 
54 #if NCURSES_TPARM_VARARGS
55 #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))
56 #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))
57 #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))
58 #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))
59 #define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e))
60 #define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d))
61 #define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c))
62 #define TPARM_1(a,b) tparm(a,TPARM_N(b))
63 #define TPARM_0(a) tparm(a)
64 #else
65 #define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0)
66 #define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0)
67 #define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0)
68 #define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0)
69 #define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0)
70 #define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
71 #define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
72 #define TPARM_1(a,b) TPARM_2(a,b,0)
73 #define TPARM_1(a,b) TPARM_2(a,b,0)
74 #define TPARM_0(a) TPARM_1(a,0)
75 #endif
76 
77 #endif /* NC_TPARM_included */
78