1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Parse printf format string.
4 Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 Free Software
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License along
18 with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
21 #ifndef _PRINTF_PARSE_H
22 #define _PRINTF_PARSE_H
24 /* This file can be parametrized with the following macros:
25 ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
26 STATIC Set to 'static' to declare the function static. */
28 #include "printf-args.h"
32 #define FLAG_GROUP 1 /* ' flag */
33 #define FLAG_LEFT 2 /* - flag */
34 #define FLAG_SHOWSIGN 4 /* + flag */
35 #define FLAG_SPACE 8 /* space flag */
36 #define FLAG_ALT 16 /* # flag */
39 /* arg_index value indicating that no argument is consumed. */
40 #define ARG_NONE (~(size_t)0)
42 /* xxx_directive: A parsed directive.
43 xxx_directives: A parsed format string. */
45 /* A parsed directive. */
48 const char* dir_start;
51 const char* width_start;
52 const char* width_end;
53 size_t width_arg_index;
54 const char* precision_start;
55 const char* precision_end;
56 size_t precision_arg_index;
57 char conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
62 /* A parsed format string. */
67 size_t max_width_length;
68 size_t max_precision_length;
74 /* A parsed directive. */
77 const uint8_t* dir_start;
78 const uint8_t* dir_end;
80 const uint8_t* width_start;
81 const uint8_t* width_end;
82 size_t width_arg_index;
83 const uint8_t* precision_start;
84 const uint8_t* precision_end;
85 size_t precision_arg_index;
86 uint8_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
91 /* A parsed format string. */
96 size_t max_width_length;
97 size_t max_precision_length;
101 /* A parsed directive. */
104 const uint16_t* dir_start;
105 const uint16_t* dir_end;
107 const uint16_t* width_start;
108 const uint16_t* width_end;
109 size_t width_arg_index;
110 const uint16_t* precision_start;
111 const uint16_t* precision_end;
112 size_t precision_arg_index;
113 uint16_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
118 /* A parsed format string. */
123 size_t max_width_length;
124 size_t max_precision_length;
128 /* A parsed directive. */
131 const uint32_t* dir_start;
132 const uint32_t* dir_end;
134 const uint32_t* width_start;
135 const uint32_t* width_end;
136 size_t width_arg_index;
137 const uint32_t* precision_start;
138 const uint32_t* precision_end;
139 size_t precision_arg_index;
140 uint32_t conversion; /* d i o u x X f F e E g G a A c s p n U % but not C S */
145 /* A parsed format string. */
150 size_t max_width_length;
151 size_t max_precision_length;
158 /* Parses the format string. Fills in the number N of directives, and fills
159 in directives[0], ..., directives[N-1], and sets directives[N].dir_start
160 to the end of the format string. Also fills in the arg_type fields of the
161 arguments and the needed count of arguments. */
164 ulc_printf_parse (const char *format, char_directives *d, arguments *a);
166 u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
168 u16_printf_parse (const uint16_t *format, u16_directives *d,
171 u32_printf_parse (const uint32_t *format, u32_directives *d,
179 int printf_parse (const char *format, char_directives *d, arguments *a);
182 #endif /* _PRINTF_PARSE_H */