1 /* Decomposed printf argument list.
2 Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2024 Free Software
5 This file is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) any later version.
10 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 #ifndef _PRINTF_ARGS_H
19 #define _PRINTF_ARGS_H
21 /* This file can be parametrized with the following macros:
22 ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
23 PRINTF_FETCHARGS Name of the function to be declared.
24 STATIC Set to 'static' to declare the function static. */
26 /* Default parameters. */
27 #ifndef PRINTF_FETCHARGS
28 # define PRINTF_FETCHARGS printf_fetchargs
44 /* Get intN_t, uintN_t, intN_fast_t, uintN_fast_t. */
65 /* According to ISO C 23 ยง 7.23.6.1, "all exact-width integer types",
66 "all minimum-width integer types", and "all fastest minimum-width integer
67 types" defined in <stdint.h> should be supported. But for portability
68 between platforms, we support only those with N = 8, 16, 32, 64. */
96 TYPE_COUNT_SCHAR_POINTER
,
97 TYPE_COUNT_SHORT_POINTER
,
98 TYPE_COUNT_INT_POINTER
,
99 TYPE_COUNT_LONGINT_POINTER
,
100 TYPE_COUNT_LONGLONGINT_POINTER
,
101 TYPE_COUNT_INT8_T_POINTER
,
102 TYPE_COUNT_INT16_T_POINTER
,
103 TYPE_COUNT_INT32_T_POINTER
,
104 TYPE_COUNT_INT64_T_POINTER
,
105 TYPE_COUNT_INT_FAST8_T_POINTER
,
106 TYPE_COUNT_INT_FAST16_T_POINTER
,
107 TYPE_COUNT_INT_FAST32_T_POINTER
,
108 TYPE_COUNT_INT_FAST64_T_POINTER
110 /* The unistdio extensions. */
117 /* Polymorphic argument */
124 unsigned char a_uchar
;
126 unsigned short a_ushort
;
130 unsigned long int a_ulongint
;
131 long long int a_longlongint
;
132 unsigned long long int a_ulonglongint
;
141 int_fast8_t a_int_fast8_t
;
142 uint_fast8_t a_uint_fast8_t
;
143 int_fast16_t a_int_fast16_t
;
144 uint_fast16_t a_uint_fast16_t
;
145 int_fast32_t a_int_fast32_t
;
146 uint_fast32_t a_uint_fast32_t
;
147 int_fast64_t a_int_fast64_t
;
148 uint_fast64_t a_uint_fast64_t
;
149 float a_float
; /* unused */
151 long double a_longdouble
;
156 const char* a_string
;
158 const wchar_t* a_wide_string
;
161 signed char * a_count_schar_pointer
;
162 short * a_count_short_pointer
;
163 int * a_count_int_pointer
;
164 long int * a_count_longint_pointer
;
165 long long int * a_count_longlongint_pointer
;
166 int8_t * a_count_int8_t_pointer
;
167 int16_t * a_count_int16_t_pointer
;
168 int32_t * a_count_int32_t_pointer
;
169 int64_t * a_count_int64_t_pointer
;
170 int_fast8_t * a_count_int_fast8_t_pointer
;
171 int_fast16_t * a_count_int_fast16_t_pointer
;
172 int_fast32_t * a_count_int_fast32_t_pointer
;
173 int_fast64_t * a_count_int_fast64_t_pointer
;
175 /* The unistdio extensions. */
176 const uint8_t * a_u8_string
;
177 const uint16_t * a_u16_string
;
178 const uint32_t * a_u32_string
;
185 /* Number of directly allocated arguments (no malloc() needed). */
186 #define N_DIRECT_ALLOC_ARGUMENTS 7
192 argument direct_alloc_arg
[N_DIRECT_ALLOC_ARGUMENTS
];
197 /* Fetch the arguments, putting them into a. */
203 int PRINTF_FETCHARGS (va_list args
, arguments
*a
);
205 #endif /* _PRINTF_ARGS_H */