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