xref: /openbsd-src/gnu/usr.bin/texinfo/intl/printf-args.h (revision a1acfa9b69ad64eb720639240c8438f11107dc85)
1*a1acfa9bSespie /* Decomposed printf argument list.
2*a1acfa9bSespie    Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
3*a1acfa9bSespie 
4*a1acfa9bSespie    This program is free software; you can redistribute it and/or modify it
5*a1acfa9bSespie    under the terms of the GNU Library General Public License as published
6*a1acfa9bSespie    by the Free Software Foundation; either version 2, or (at your option)
7*a1acfa9bSespie    any later version.
8*a1acfa9bSespie 
9*a1acfa9bSespie    This program is distributed in the hope that it will be useful,
10*a1acfa9bSespie    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*a1acfa9bSespie    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12*a1acfa9bSespie    Library General Public License for more details.
13*a1acfa9bSespie 
14*a1acfa9bSespie    You should have received a copy of the GNU Library General Public
15*a1acfa9bSespie    License along with this program; if not, write to the Free Software
16*a1acfa9bSespie    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17*a1acfa9bSespie    USA.  */
18*a1acfa9bSespie 
19*a1acfa9bSespie #ifndef _PRINTF_ARGS_H
20*a1acfa9bSespie #define _PRINTF_ARGS_H
21*a1acfa9bSespie 
22*a1acfa9bSespie /* Get size_t.  */
23*a1acfa9bSespie #include <stddef.h>
24*a1acfa9bSespie 
25*a1acfa9bSespie /* Get wchar_t.  */
26*a1acfa9bSespie #ifdef HAVE_WCHAR_T
27*a1acfa9bSespie # include <stddef.h>
28*a1acfa9bSespie #endif
29*a1acfa9bSespie 
30*a1acfa9bSespie /* Get wint_t.  */
31*a1acfa9bSespie #ifdef HAVE_WINT_T
32*a1acfa9bSespie # include <wchar.h>
33*a1acfa9bSespie #endif
34*a1acfa9bSespie 
35*a1acfa9bSespie /* Get va_list.  */
36*a1acfa9bSespie #include <stdarg.h>
37*a1acfa9bSespie 
38*a1acfa9bSespie 
39*a1acfa9bSespie /* Argument types */
40*a1acfa9bSespie typedef enum
41*a1acfa9bSespie {
42*a1acfa9bSespie   TYPE_NONE,
43*a1acfa9bSespie   TYPE_SCHAR,
44*a1acfa9bSespie   TYPE_UCHAR,
45*a1acfa9bSespie   TYPE_SHORT,
46*a1acfa9bSespie   TYPE_USHORT,
47*a1acfa9bSespie   TYPE_INT,
48*a1acfa9bSespie   TYPE_UINT,
49*a1acfa9bSespie   TYPE_LONGINT,
50*a1acfa9bSespie   TYPE_ULONGINT,
51*a1acfa9bSespie #ifdef HAVE_LONG_LONG
52*a1acfa9bSespie   TYPE_LONGLONGINT,
53*a1acfa9bSespie   TYPE_ULONGLONGINT,
54*a1acfa9bSespie #endif
55*a1acfa9bSespie   TYPE_DOUBLE,
56*a1acfa9bSespie #ifdef HAVE_LONG_DOUBLE
57*a1acfa9bSespie   TYPE_LONGDOUBLE,
58*a1acfa9bSespie #endif
59*a1acfa9bSespie   TYPE_CHAR,
60*a1acfa9bSespie #ifdef HAVE_WINT_T
61*a1acfa9bSespie   TYPE_WIDE_CHAR,
62*a1acfa9bSespie #endif
63*a1acfa9bSespie   TYPE_STRING,
64*a1acfa9bSespie #ifdef HAVE_WCHAR_T
65*a1acfa9bSespie   TYPE_WIDE_STRING,
66*a1acfa9bSespie #endif
67*a1acfa9bSespie   TYPE_POINTER,
68*a1acfa9bSespie   TYPE_COUNT_SCHAR_POINTER,
69*a1acfa9bSespie   TYPE_COUNT_SHORT_POINTER,
70*a1acfa9bSespie   TYPE_COUNT_INT_POINTER,
71*a1acfa9bSespie   TYPE_COUNT_LONGINT_POINTER
72*a1acfa9bSespie #ifdef HAVE_LONG_LONG
73*a1acfa9bSespie , TYPE_COUNT_LONGLONGINT_POINTER
74*a1acfa9bSespie #endif
75*a1acfa9bSespie } arg_type;
76*a1acfa9bSespie 
77*a1acfa9bSespie /* Polymorphic argument */
78*a1acfa9bSespie typedef struct
79*a1acfa9bSespie {
80*a1acfa9bSespie   arg_type type;
81*a1acfa9bSespie   union
82*a1acfa9bSespie   {
83*a1acfa9bSespie     signed char			a_schar;
84*a1acfa9bSespie     unsigned char		a_uchar;
85*a1acfa9bSespie     short			a_short;
86*a1acfa9bSespie     unsigned short		a_ushort;
87*a1acfa9bSespie     int				a_int;
88*a1acfa9bSespie     unsigned int		a_uint;
89*a1acfa9bSespie     long int			a_longint;
90*a1acfa9bSespie     unsigned long int		a_ulongint;
91*a1acfa9bSespie #ifdef HAVE_LONG_LONG
92*a1acfa9bSespie     long long int		a_longlongint;
93*a1acfa9bSespie     unsigned long long int	a_ulonglongint;
94*a1acfa9bSespie #endif
95*a1acfa9bSespie     float			a_float;
96*a1acfa9bSespie     double			a_double;
97*a1acfa9bSespie #ifdef HAVE_LONG_DOUBLE
98*a1acfa9bSespie     long double			a_longdouble;
99*a1acfa9bSespie #endif
100*a1acfa9bSespie     int				a_char;
101*a1acfa9bSespie #ifdef HAVE_WINT_T
102*a1acfa9bSespie     wint_t			a_wide_char;
103*a1acfa9bSespie #endif
104*a1acfa9bSespie     const char*			a_string;
105*a1acfa9bSespie #ifdef HAVE_WCHAR_T
106*a1acfa9bSespie     const wchar_t*		a_wide_string;
107*a1acfa9bSespie #endif
108*a1acfa9bSespie     void*			a_pointer;
109*a1acfa9bSespie     signed char *		a_count_schar_pointer;
110*a1acfa9bSespie     short *			a_count_short_pointer;
111*a1acfa9bSespie     int *			a_count_int_pointer;
112*a1acfa9bSespie     long int *			a_count_longint_pointer;
113*a1acfa9bSespie #ifdef HAVE_LONG_LONG
114*a1acfa9bSespie     long long int *		a_count_longlongint_pointer;
115*a1acfa9bSespie #endif
116*a1acfa9bSespie   }
117*a1acfa9bSespie   a;
118*a1acfa9bSespie }
119*a1acfa9bSespie argument;
120*a1acfa9bSespie 
121*a1acfa9bSespie typedef struct
122*a1acfa9bSespie {
123*a1acfa9bSespie   size_t count;
124*a1acfa9bSespie   argument *arg;
125*a1acfa9bSespie }
126*a1acfa9bSespie arguments;
127*a1acfa9bSespie 
128*a1acfa9bSespie 
129*a1acfa9bSespie /* Fetch the arguments, putting them into a. */
130*a1acfa9bSespie #ifdef STATIC
131*a1acfa9bSespie STATIC
132*a1acfa9bSespie #else
133*a1acfa9bSespie extern
134*a1acfa9bSespie #endif
135*a1acfa9bSespie int printf_fetchargs (va_list args, arguments *a);
136*a1acfa9bSespie 
137*a1acfa9bSespie #endif /* _PRINTF_ARGS_H */
138