]> git.cworth.org Git - tar/blob - lib/printf-args.h
Imported Upstream version 1.20
[tar] / lib / printf-args.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Decomposed printf argument list.
4    Copyright (C) 1999, 2002-2003, 2006-2007 Free Software Foundation, Inc.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License along
17    with this program; if not, write to the Free Software Foundation,
18    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
19
20 #ifndef _PRINTF_ARGS_H
21 #define _PRINTF_ARGS_H
22
23 /* This file can be parametrized with the following macros:
24      ENABLE_UNISTDIO    Set to 1 to enable the unistdio extensions.
25      PRINTF_FETCHARGS   Name of the function to be declared.
26      STATIC             Set to 'static' to declare the function static.  */
27
28 /* Default parameters.  */
29 #ifndef PRINTF_FETCHARGS
30 # define PRINTF_FETCHARGS printf_fetchargs
31 #endif
32
33 /* Get size_t.  */
34 #include <stddef.h>
35
36 /* Get wchar_t.  */
37 #if HAVE_WCHAR_T
38 # include <stddef.h>
39 #endif
40
41 /* Get wint_t.  */
42 #if HAVE_WINT_T
43 # include <wchar.h>
44 #endif
45
46 /* Get va_list.  */
47 #include <stdarg.h>
48
49
50 /* Argument types */
51 typedef enum
52 {
53   TYPE_NONE,
54   TYPE_SCHAR,
55   TYPE_UCHAR,
56   TYPE_SHORT,
57   TYPE_USHORT,
58   TYPE_INT,
59   TYPE_UINT,
60   TYPE_LONGINT,
61   TYPE_ULONGINT,
62 #if HAVE_LONG_LONG_INT
63   TYPE_LONGLONGINT,
64   TYPE_ULONGLONGINT,
65 #endif
66   TYPE_DOUBLE,
67   TYPE_LONGDOUBLE,
68   TYPE_CHAR,
69 #if HAVE_WINT_T
70   TYPE_WIDE_CHAR,
71 #endif
72   TYPE_STRING,
73 #if HAVE_WCHAR_T
74   TYPE_WIDE_STRING,
75 #endif
76   TYPE_POINTER,
77   TYPE_COUNT_SCHAR_POINTER,
78   TYPE_COUNT_SHORT_POINTER,
79   TYPE_COUNT_INT_POINTER,
80   TYPE_COUNT_LONGINT_POINTER
81 #if HAVE_LONG_LONG_INT
82 , TYPE_COUNT_LONGLONGINT_POINTER
83 #endif
84 #if ENABLE_UNISTDIO
85   /* The unistdio extensions.  */
86 , TYPE_U8_STRING
87 , TYPE_U16_STRING
88 , TYPE_U32_STRING
89 #endif
90 } arg_type;
91
92 /* Polymorphic argument */
93 typedef struct
94 {
95   arg_type type;
96   union
97   {
98     signed char                 a_schar;
99     unsigned char               a_uchar;
100     short                       a_short;
101     unsigned short              a_ushort;
102     int                         a_int;
103     unsigned int                a_uint;
104     long int                    a_longint;
105     unsigned long int           a_ulongint;
106 #if HAVE_LONG_LONG_INT
107     long long int               a_longlongint;
108     unsigned long long int      a_ulonglongint;
109 #endif
110     float                       a_float;
111     double                      a_double;
112     long double                 a_longdouble;
113     int                         a_char;
114 #if HAVE_WINT_T
115     wint_t                      a_wide_char;
116 #endif
117     const char*                 a_string;
118 #if HAVE_WCHAR_T
119     const wchar_t*              a_wide_string;
120 #endif
121     void*                       a_pointer;
122     signed char *               a_count_schar_pointer;
123     short *                     a_count_short_pointer;
124     int *                       a_count_int_pointer;
125     long int *                  a_count_longint_pointer;
126 #if HAVE_LONG_LONG_INT
127     long long int *             a_count_longlongint_pointer;
128 #endif
129 #if ENABLE_UNISTDIO
130     /* The unistdio extensions.  */
131     const uint8_t *             a_u8_string;
132     const uint16_t *            a_u16_string;
133     const uint32_t *            a_u32_string;
134 #endif
135   }
136   a;
137 }
138 argument;
139
140 typedef struct
141 {
142   size_t count;
143   argument *arg;
144 }
145 arguments;
146
147
148 /* Fetch the arguments, putting them into a. */
149 #ifdef STATIC
150 STATIC
151 #else
152 extern
153 #endif
154 int PRINTF_FETCHARGS (va_list args, arguments *a);
155
156 #endif /* _PRINTF_ARGS_H */