[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / glib / gnulib / printf-args.h
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, see <http://www.gnu.org/licenses/>.  */
16
17 #ifndef _PRINTF_ARGS_H
18 #define _PRINTF_ARGS_H
19
20 /* Get wchar_t.  */
21 #ifdef HAVE_WCHAR_T
22 # include <stddef.h>
23 #endif
24
25 /* Get wint_t.  */
26 #ifdef HAVE_WINT_T
27 # include <wchar.h>
28 #endif
29
30 /* Get va_list.  */
31 #include <stdarg.h>
32
33
34 /* Argument types */
35 typedef enum
36 {
37   TYPE_NONE,
38   TYPE_SCHAR,
39   TYPE_UCHAR,
40   TYPE_SHORT,
41   TYPE_USHORT,
42   TYPE_INT,
43   TYPE_UINT,
44   TYPE_LONGINT,
45   TYPE_ULONGINT,
46 #ifdef HAVE_LONG_LONG
47   TYPE_LONGLONGINT,
48   TYPE_ULONGLONGINT,
49 #endif
50 #ifdef HAVE_INT64_AND_I64
51   TYPE_INT64,
52   TYPE_UINT64,
53 #endif
54   TYPE_DOUBLE,
55 #ifdef HAVE_LONG_DOUBLE
56   TYPE_LONGDOUBLE,
57 #endif
58   TYPE_CHAR,
59 #ifdef HAVE_WINT_T
60   TYPE_WIDE_CHAR,
61 #endif
62   TYPE_STRING,
63 #ifdef HAVE_WCHAR_T
64   TYPE_WIDE_STRING,
65 #endif
66   TYPE_POINTER,
67   TYPE_COUNT_SCHAR_POINTER,
68   TYPE_COUNT_SHORT_POINTER,
69   TYPE_COUNT_INT_POINTER,
70   TYPE_COUNT_LONGINT_POINTER
71 #ifdef HAVE_LONG_LONG
72 , TYPE_COUNT_LONGLONGINT_POINTER
73 #endif
74 } arg_type;
75
76 /* Polymorphic argument */
77 typedef struct
78 {
79   arg_type type;
80   union
81   {
82     signed char                 a_schar;
83     unsigned char               a_uchar;
84     short                       a_short;
85     unsigned short              a_ushort;
86     int                         a_int;
87     unsigned int                a_uint;
88     long int                    a_longint;
89     unsigned long int           a_ulongint;
90 #ifdef HAVE_LONG_LONG
91     long long int               a_longlongint;
92     unsigned long long int      a_ulonglongint;
93 #endif
94 #ifdef HAVE_INT64_AND_I64
95     __int64                     a_int64;
96     unsigned __int64            a_uint64;
97 #endif
98     float                       a_float;
99     double                      a_double;
100 #ifdef HAVE_LONG_DOUBLE
101     long double                 a_longdouble;
102 #endif
103     int                         a_char;
104 #ifdef HAVE_WINT_T
105     wint_t                      a_wide_char;
106 #endif
107     const char*                 a_string;
108 #ifdef HAVE_WCHAR_T
109     const wchar_t*              a_wide_string;
110 #endif
111     void*                       a_pointer;
112     signed char *               a_count_schar_pointer;
113     short *                     a_count_short_pointer;
114     int *                       a_count_int_pointer;
115     long int *                  a_count_longint_pointer;
116 #ifdef HAVE_LONG_LONG
117     long long int *             a_count_longlongint_pointer;
118 #endif
119   }
120   a;
121 }
122 argument;
123
124 typedef struct
125 {
126   unsigned int count;
127   argument *arg;
128 }
129 arguments;
130
131
132 /* Fetch the arguments, putting them into a. */
133 #ifdef STATIC
134 STATIC
135 #else
136 extern
137 #endif
138 int printf_fetchargs (va_list args, arguments *a);
139
140 #endif /* _PRINTF_ARGS_H */