xref: /freebsd/contrib/ncurses/include/nc_tparm.h (revision 21817992b3314c908ab50f0bb88d2ee750b9c4ac)
14a1a9510SRong-En Fan /****************************************************************************
2*21817992SBaptiste Daroussin  * Copyright 2018-2020,2023 Thomas E. Dickey                                *
3e1865124SBaptiste Daroussin  * Copyright 2006-2012,2017 Free Software Foundation, Inc.                  *
44a1a9510SRong-En Fan  *                                                                          *
54a1a9510SRong-En Fan  * Permission is hereby granted, free of charge, to any person obtaining a  *
64a1a9510SRong-En Fan  * copy of this software and associated documentation files (the            *
74a1a9510SRong-En Fan  * "Software"), to deal in the Software without restriction, including      *
84a1a9510SRong-En Fan  * without limitation the rights to use, copy, modify, merge, publish,      *
94a1a9510SRong-En Fan  * distribute, distribute with modifications, sublicense, and/or sell       *
104a1a9510SRong-En Fan  * copies of the Software, and to permit persons to whom the Software is    *
114a1a9510SRong-En Fan  * furnished to do so, subject to the following conditions:                 *
124a1a9510SRong-En Fan  *                                                                          *
134a1a9510SRong-En Fan  * The above copyright notice and this permission notice shall be included  *
144a1a9510SRong-En Fan  * in all copies or substantial portions of the Software.                   *
154a1a9510SRong-En Fan  *                                                                          *
164a1a9510SRong-En Fan  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
174a1a9510SRong-En Fan  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
184a1a9510SRong-En Fan  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
194a1a9510SRong-En Fan  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
204a1a9510SRong-En Fan  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
214a1a9510SRong-En Fan  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
224a1a9510SRong-En Fan  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
234a1a9510SRong-En Fan  *                                                                          *
244a1a9510SRong-En Fan  * Except as contained in this notice, the name(s) of the above copyright   *
254a1a9510SRong-En Fan  * holders shall not be used in advertising or otherwise to promote the     *
264a1a9510SRong-En Fan  * sale, use or other dealings in this Software without prior written       *
274a1a9510SRong-En Fan  * authorization.                                                           *
284a1a9510SRong-En Fan  ****************************************************************************/
294a1a9510SRong-En Fan 
304a1a9510SRong-En Fan /****************************************************************************
314a1a9510SRong-En Fan  *  Author: Thomas E. Dickey                        2006                    *
324a1a9510SRong-En Fan  ****************************************************************************/
334a1a9510SRong-En Fan 
34*21817992SBaptiste Daroussin /* $Id: nc_tparm.h,v 1.12 2023/04/16 17:57:28 tom Exp $ */
3506bfebdeSXin LI 
3606bfebdeSXin LI #ifndef NC_TPARM_included
3706bfebdeSXin LI #define NC_TPARM_included 1
384a1a9510SRong-En Fan 
39aae38d10SBaptiste Daroussin #include <ncurses_cfg.h>
40aae38d10SBaptiste Daroussin #include <curses.h>
41aae38d10SBaptiste Daroussin 
424a1a9510SRong-En Fan /*
434a1a9510SRong-En Fan  * Cast parameters past the formatting-string for tparm() to match the
444a1a9510SRong-En Fan  * assumption of the varargs code.
454a1a9510SRong-En Fan  */
4606bfebdeSXin LI #ifndef TPARM_ARG
4773f0a83dSXin LI #ifdef NCURSES_TPARM_ARG
4873f0a83dSXin LI #define TPARM_ARG NCURSES_TPARM_ARG
4973f0a83dSXin LI #else
504a1a9510SRong-En Fan #define TPARM_ARG long
5106bfebdeSXin LI #endif
5273f0a83dSXin LI #endif /* TPARAM_ARG */
5306bfebdeSXin LI 
544a1a9510SRong-En Fan #define TPARM_N(n) (TPARM_ARG)(n)
554a1a9510SRong-En Fan 
564a1a9510SRong-En Fan #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))
574a1a9510SRong-En Fan 
584a1a9510SRong-En Fan #if NCURSES_TPARM_VARARGS
594a1a9510SRong-En Fan #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))
604a1a9510SRong-En Fan #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))
614a1a9510SRong-En Fan #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))
624a1a9510SRong-En Fan #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))
634a1a9510SRong-En Fan #define TPARM_4(a,b,c,d,e) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d),TPARM_N(e))
644a1a9510SRong-En Fan #define TPARM_3(a,b,c,d) tparm(a,TPARM_N(b),TPARM_N(c),TPARM_N(d))
654a1a9510SRong-En Fan #define TPARM_2(a,b,c) tparm(a,TPARM_N(b),TPARM_N(c))
664a1a9510SRong-En Fan #define TPARM_1(a,b) tparm(a,TPARM_N(b))
674a1a9510SRong-En Fan #define TPARM_0(a) tparm(a)
684a1a9510SRong-En Fan #else
694a1a9510SRong-En Fan #define TPARM_8(a,b,c,d,e,f,g,h,i) TPARM_9(a,b,c,d,e,f,g,h,i,0)
704a1a9510SRong-En Fan #define TPARM_7(a,b,c,d,e,f,g,h) TPARM_8(a,b,c,d,e,f,g,h,0)
714a1a9510SRong-En Fan #define TPARM_6(a,b,c,d,e,f,g) TPARM_7(a,b,c,d,e,f,g,0)
724a1a9510SRong-En Fan #define TPARM_5(a,b,c,d,e,f) TPARM_6(a,b,c,d,e,f,0)
734a1a9510SRong-En Fan #define TPARM_4(a,b,c,d,e) TPARM_5(a,b,c,d,e,0)
744a1a9510SRong-En Fan #define TPARM_3(a,b,c,d) TPARM_4(a,b,c,d,0)
754a1a9510SRong-En Fan #define TPARM_2(a,b,c) TPARM_3(a,b,c,0)
764a1a9510SRong-En Fan #define TPARM_1(a,b) TPARM_2(a,b,0)
774a1a9510SRong-En Fan #define TPARM_0(a) TPARM_1(a,0)
784a1a9510SRong-En Fan #endif
7906bfebdeSXin LI 
807a656419SBaptiste Daroussin #ifdef NCURSES_INTERNALS
81*21817992SBaptiste Daroussin #define TIPARM_0(s) _nc_tiparm(0,s)
827a656419SBaptiste Daroussin #define TIPARM_1(s,a) _nc_tiparm(1,s,a)
837a656419SBaptiste Daroussin #define TIPARM_2(s,a,b) _nc_tiparm(2,s,a,b)
847a656419SBaptiste Daroussin #define TIPARM_3(s,a,b,c) _nc_tiparm(3,s,a,b,c)
857a656419SBaptiste Daroussin #define TIPARM_4(s,a,b,c,d) _nc_tiparm(4,s,a,b,c,d)
867a656419SBaptiste Daroussin #define TIPARM_5(s,a,b,c,d,e) _nc_tiparm(5,s,a,b,c,d,e)
877a656419SBaptiste Daroussin #define TIPARM_6(s,a,b,c,d,e,f) _nc_tiparm(6,s,a,b,c,d,e,f)
887a656419SBaptiste Daroussin #define TIPARM_7(s,a,b,c,d,e,f,g) _nc_tiparm(7,s,a,b,c,d,e,f,g)
897a656419SBaptiste Daroussin #define TIPARM_8(s,a,b,c,d,e,f,g,h) _nc_tiparm(8,s,a,b,c,d,e,f,g,h)
907a656419SBaptiste Daroussin #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)
917a656419SBaptiste Daroussin #endif
927a656419SBaptiste Daroussin 
9306bfebdeSXin LI #endif /* NC_TPARM_included */
94