Add.
[shishi.git] / gl / printf-args.h
blob35114a8fad43d9e496c009ad9e09bd60a26ca282
1 /* Decomposed printf argument list.
2 Copyright (C) 1999, 2002-2003 Free Software Foundation, Inc.
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.
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.
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. */
19 #ifndef _PRINTF_ARGS_H
20 #define _PRINTF_ARGS_H
22 /* Get wchar_t. */
23 #ifdef HAVE_WCHAR_T
24 # include <stddef.h>
25 #endif
27 /* Get wint_t. */
28 #ifdef HAVE_WINT_T
29 # include <wchar.h>
30 #endif
32 /* Get va_list. */
33 #include <stdarg.h>
36 /* Argument types */
37 typedef enum
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 TYPE_DOUBLE,
53 #ifdef HAVE_LONG_DOUBLE
54 TYPE_LONGDOUBLE,
55 #endif
56 TYPE_CHAR,
57 #ifdef HAVE_WINT_T
58 TYPE_WIDE_CHAR,
59 #endif
60 TYPE_STRING,
61 #ifdef HAVE_WCHAR_T
62 TYPE_WIDE_STRING,
63 #endif
64 TYPE_POINTER,
65 TYPE_COUNT_SCHAR_POINTER,
66 TYPE_COUNT_SHORT_POINTER,
67 TYPE_COUNT_INT_POINTER,
68 TYPE_COUNT_LONGINT_POINTER
69 #ifdef HAVE_LONG_LONG
70 , TYPE_COUNT_LONGLONGINT_POINTER
71 #endif
72 } arg_type;
74 /* Polymorphic argument */
75 typedef struct
77 arg_type type;
78 union
80 signed char a_schar;
81 unsigned char a_uchar;
82 short a_short;
83 unsigned short a_ushort;
84 int a_int;
85 unsigned int a_uint;
86 long int a_longint;
87 unsigned long int a_ulongint;
88 #ifdef HAVE_LONG_LONG
89 long long int a_longlongint;
90 unsigned long long int a_ulonglongint;
91 #endif
92 float a_float;
93 double a_double;
94 #ifdef HAVE_LONG_DOUBLE
95 long double a_longdouble;
96 #endif
97 int a_char;
98 #ifdef HAVE_WINT_T
99 wint_t a_wide_char;
100 #endif
101 const char* a_string;
102 #ifdef HAVE_WCHAR_T
103 const wchar_t* a_wide_string;
104 #endif
105 void* a_pointer;
106 signed char * a_count_schar_pointer;
107 short * a_count_short_pointer;
108 int * a_count_int_pointer;
109 long int * a_count_longint_pointer;
110 #ifdef HAVE_LONG_LONG
111 long long int * a_count_longlongint_pointer;
112 #endif
116 argument;
118 typedef struct
120 unsigned int count;
121 argument *arg;
123 arguments;
126 /* Fetch the arguments, putting them into a. */
127 #ifdef STATIC
128 STATIC
129 #else
130 extern
131 #endif
132 int printf_fetchargs (va_list args, arguments *a);
134 #endif /* _PRINTF_ARGS_H */