This source file includes following definitions.
- PRINTF_FETCHARGS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #ifndef PRINTF_FETCHARGS
24 # include <config.h>
25 #endif
26
27
28 #ifndef PRINTF_FETCHARGS
29 # include "printf-args.h"
30 #endif
31
32 #ifdef STATIC
33 STATIC
34 #endif
35 int
36 PRINTF_FETCHARGS (va_list args, arguments *a)
37 {
38 size_t i;
39 argument *ap;
40
41 for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++)
42 switch (ap->type)
43 {
44 case TYPE_SCHAR:
45 ap->a.a_schar = va_arg (args, int);
46 break;
47 case TYPE_UCHAR:
48 ap->a.a_uchar = va_arg (args, int);
49 break;
50 case TYPE_SHORT:
51 ap->a.a_short = va_arg (args, int);
52 break;
53 case TYPE_USHORT:
54 ap->a.a_ushort = va_arg (args, int);
55 break;
56 case TYPE_INT:
57 ap->a.a_int = va_arg (args, int);
58 break;
59 case TYPE_UINT:
60 ap->a.a_uint = va_arg (args, unsigned int);
61 break;
62 case TYPE_LONGINT:
63 ap->a.a_longint = va_arg (args, long int);
64 break;
65 case TYPE_ULONGINT:
66 ap->a.a_ulongint = va_arg (args, unsigned long int);
67 break;
68 case TYPE_LONGLONGINT:
69 ap->a.a_longlongint = va_arg (args, long long int);
70 break;
71 case TYPE_ULONGLONGINT:
72 ap->a.a_ulonglongint = va_arg (args, unsigned long long int);
73 break;
74 case TYPE_DOUBLE:
75 ap->a.a_double = va_arg (args, double);
76 break;
77 case TYPE_LONGDOUBLE:
78 ap->a.a_longdouble = va_arg (args, long double);
79 break;
80 case TYPE_CHAR:
81 ap->a.a_char = va_arg (args, int);
82 break;
83 #if HAVE_WINT_T
84 case TYPE_WIDE_CHAR:
85
86
87
88 ap->a.a_wide_char =
89 (sizeof (wint_t) < sizeof (int)
90 ? (wint_t) va_arg (args, int)
91 : va_arg (args, wint_t));
92 break;
93 #endif
94 case TYPE_STRING:
95 ap->a.a_string = va_arg (args, const char *);
96
97
98
99 if (ap->a.a_string == NULL)
100 ap->a.a_string = "(NULL)";
101 break;
102 #if HAVE_WCHAR_T
103 case TYPE_WIDE_STRING:
104 ap->a.a_wide_string = va_arg (args, const wchar_t *);
105
106
107
108 if (ap->a.a_wide_string == NULL)
109 {
110 static const wchar_t wide_null_string[] =
111 {
112 (wchar_t)'(',
113 (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L',
114 (wchar_t)')',
115 (wchar_t)0
116 };
117 ap->a.a_wide_string = wide_null_string;
118 }
119 break;
120 #endif
121 case TYPE_POINTER:
122 ap->a.a_pointer = va_arg (args, void *);
123 break;
124 case TYPE_COUNT_SCHAR_POINTER:
125 ap->a.a_count_schar_pointer = va_arg (args, signed char *);
126 break;
127 case TYPE_COUNT_SHORT_POINTER:
128 ap->a.a_count_short_pointer = va_arg (args, short *);
129 break;
130 case TYPE_COUNT_INT_POINTER:
131 ap->a.a_count_int_pointer = va_arg (args, int *);
132 break;
133 case TYPE_COUNT_LONGINT_POINTER:
134 ap->a.a_count_longint_pointer = va_arg (args, long int *);
135 break;
136 case TYPE_COUNT_LONGLONGINT_POINTER:
137 ap->a.a_count_longlongint_pointer = va_arg (args, long long int *);
138 break;
139 #if ENABLE_UNISTDIO
140
141 case TYPE_U8_STRING:
142 ap->a.a_u8_string = va_arg (args, const uint8_t *);
143
144
145
146 if (ap->a.a_u8_string == NULL)
147 {
148 static const uint8_t u8_null_string[] =
149 { '(', 'N', 'U', 'L', 'L', ')', 0 };
150 ap->a.a_u8_string = u8_null_string;
151 }
152 break;
153 case TYPE_U16_STRING:
154 ap->a.a_u16_string = va_arg (args, const uint16_t *);
155
156
157
158 if (ap->a.a_u16_string == NULL)
159 {
160 static const uint16_t u16_null_string[] =
161 { '(', 'N', 'U', 'L', 'L', ')', 0 };
162 ap->a.a_u16_string = u16_null_string;
163 }
164 break;
165 case TYPE_U32_STRING:
166 ap->a.a_u32_string = va_arg (args, const uint32_t *);
167
168
169
170 if (ap->a.a_u32_string == NULL)
171 {
172 static const uint32_t u32_null_string[] =
173 { '(', 'N', 'U', 'L', 'L', ')', 0 };
174 ap->a.a_u32_string = u32_null_string;
175 }
176 break;
177 #endif
178 default:
179
180 return -1;
181 }
182 return 0;
183 }