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