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 Free Software Foundation, Inc.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
20 #ifndef _PRINTF_PARSE_H
21 #define _PRINTF_PARSE_H
23 /* This file can be parametrized with the following macros:
24 ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
25 STATIC Set to 'static' to declare the function static. */
27 #include "printf-args.h"
31 #define FLAG_GROUP 1 /* ' flag */
32 #define FLAG_LEFT 2 /* - flag */
33 #define FLAG_SHOWSIGN 4 /* + flag */
34 #define FLAG_SPACE 8 /* space flag */
35 #define FLAG_ALT 16 /* # flag */
38 /* arg_index value indicating that no argument is consumed. */
39 #define ARG_NONE (~(size_t)0)
41 /* xxx_directive: A parsed directive.
42 xxx_directives: A parsed format string. */
44 /* A parsed directive. */
47 const char* dir_start;
50 const char* width_start;
51 const char* width_end;
52 size_t width_arg_index;
53 const char* precision_start;
54 const char* precision_end;
55 size_t precision_arg_index;
56 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 */
61 /* A parsed format string. */
66 size_t max_width_length;
67 size_t max_precision_length;
73 /* A parsed directive. */
76 const uint8_t* dir_start;
77 const uint8_t* dir_end;
79 const uint8_t* width_start;
80 const uint8_t* width_end;
81 size_t width_arg_index;
82 const uint8_t* precision_start;
83 const uint8_t* precision_end;
84 size_t precision_arg_index;
85 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 */
90 /* A parsed format string. */
95 size_t max_width_length;
96 size_t max_precision_length;
100 /* A parsed directive. */
103 const uint16_t* dir_start;
104 const uint16_t* dir_end;
106 const uint16_t* width_start;
107 const uint16_t* width_end;
108 size_t width_arg_index;
109 const uint16_t* precision_start;
110 const uint16_t* precision_end;
111 size_t precision_arg_index;
112 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 */
117 /* A parsed format string. */
122 size_t max_width_length;
123 size_t max_precision_length;
127 /* A parsed directive. */
130 const uint32_t* dir_start;
131 const uint32_t* dir_end;
133 const uint32_t* width_start;
134 const uint32_t* width_end;
135 size_t width_arg_index;
136 const uint32_t* precision_start;
137 const uint32_t* precision_end;
138 size_t precision_arg_index;
139 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 */
144 /* A parsed format string. */
149 size_t max_width_length;
150 size_t max_precision_length;
157 /* Parses the format string. Fills in the number N of directives, and fills
158 in directives[0], ..., directives[N-1], and sets directives[N].dir_start
159 to the end of the format string. Also fills in the arg_type fields of the
160 arguments and the needed count of arguments. */
163 ulc_printf_parse (const char *format, char_directives *d, arguments *a);
165 u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
167 u16_printf_parse (const uint16_t *format, u16_directives *d,
170 u32_printf_parse (const uint32_t *format, u32_directives *d,
178 int printf_parse (const char *format, char_directives *d, arguments *a);
181 #endif /* _PRINTF_PARSE_H */