[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / glib / gnulib / printf-parse.h
1 /* Parse printf format string.
2    Copyright (C) 1999, 2002 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_PARSE_H
18 #define _PRINTF_PARSE_H
19
20 #include "printf-args.h"
21
22 /* Private namespace for gnulib functions */
23 #define printf_parse _g_gnulib_printf_parse
24
25 /* Flags */
26 #define FLAG_GROUP       1      /* ' flag */
27 #define FLAG_LEFT        2      /* - flag */
28 #define FLAG_SHOWSIGN    4      /* + flag */
29 #define FLAG_SPACE       8      /* space flag */
30 #define FLAG_ALT        16      /* # flag */
31 #define FLAG_ZERO       32
32
33 /* A parsed directive.  */
34 typedef struct
35 {
36   const char* dir_start;
37   const char* dir_end;
38   int flags;
39   const char* width_start;
40   const char* width_end;
41   int width_arg_index;
42   const char* precision_start;
43   const char* precision_end;
44   int precision_arg_index;
45   char conversion; /* d i o u x X f e E g G c s p n U % but not C S */
46   int arg_index;
47 }
48 char_directive;
49
50 /* A parsed format string.  */
51 typedef struct
52 {
53   unsigned int count;
54   char_directive *dir;
55   unsigned int max_width_length;
56   unsigned int max_precision_length;
57 }
58 char_directives;
59
60
61 /* Parses the format string.  Fills in the number N of directives, and fills
62    in directives[0], ..., directives[N-1], and sets directives[N].dir_start
63    to the end of the format string.  Also fills in the arg_type fields of the
64    arguments and the needed count of arguments.  */
65 #ifdef STATIC
66 STATIC
67 #else
68 extern
69 #endif
70 int printf_parse (const char *format, char_directives *d, arguments *a);
71
72 #endif /* _PRINTF_PARSE_H */