diff options
Diffstat (limited to 'gl/printf-parse.h')
-rw-r--r-- | gl/printf-parse.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gl/printf-parse.h b/gl/printf-parse.h index 0f2b7082..d8474bee 100644 --- a/gl/printf-parse.h +++ b/gl/printf-parse.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Parse printf format string. | 1 | /* Parse printf format string. |
2 | Copyright (C) 1999, 2002-2003, 2005, 2007, 2009-2010 Free Software | 2 | Copyright (C) 1999, 2002-2003, 2005, 2007, 2010-2013 Free Software |
3 | Foundation, Inc. | 3 | Foundation, Inc. |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
@@ -13,8 +13,7 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License along | 15 | You should have received a copy of the GNU General Public License along |
16 | with this program; if not, write to the Free Software Foundation, | 16 | with this program; if not, see <http://www.gnu.org/licenses/>. */ |
17 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | ||
18 | 17 | ||
19 | #ifndef _PRINTF_PARSE_H | 18 | #ifndef _PRINTF_PARSE_H |
20 | #define _PRINTF_PARSE_H | 19 | #define _PRINTF_PARSE_H |
@@ -23,6 +22,10 @@ | |||
23 | ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. | 22 | ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. |
24 | STATIC Set to 'static' to declare the function static. */ | 23 | STATIC Set to 'static' to declare the function static. */ |
25 | 24 | ||
25 | #if HAVE_FEATURES_H | ||
26 | # include <features.h> /* for __GLIBC__, __UCLIBC__ */ | ||
27 | #endif | ||
28 | |||
26 | #include "printf-args.h" | 29 | #include "printf-args.h" |
27 | 30 | ||
28 | 31 | ||
@@ -33,6 +36,9 @@ | |||
33 | #define FLAG_SPACE 8 /* space flag */ | 36 | #define FLAG_SPACE 8 /* space flag */ |
34 | #define FLAG_ALT 16 /* # flag */ | 37 | #define FLAG_ALT 16 /* # flag */ |
35 | #define FLAG_ZERO 32 | 38 | #define FLAG_ZERO 32 |
39 | #if __GLIBC__ >= 2 && !defined __UCLIBC__ | ||
40 | # define FLAG_LOCALIZED 64 /* I flag, uses localized digits */ | ||
41 | #endif | ||
36 | 42 | ||
37 | /* arg_index value indicating that no argument is consumed. */ | 43 | /* arg_index value indicating that no argument is consumed. */ |
38 | #define ARG_NONE (~(size_t)0) | 44 | #define ARG_NONE (~(size_t)0) |
@@ -40,6 +46,9 @@ | |||
40 | /* xxx_directive: A parsed directive. | 46 | /* xxx_directive: A parsed directive. |
41 | xxx_directives: A parsed format string. */ | 47 | xxx_directives: A parsed format string. */ |
42 | 48 | ||
49 | /* Number of directly allocated directives (no malloc() needed). */ | ||
50 | #define N_DIRECT_ALLOC_DIRECTIVES 7 | ||
51 | |||
43 | /* A parsed directive. */ | 52 | /* A parsed directive. */ |
44 | typedef struct | 53 | typedef struct |
45 | { | 54 | { |
@@ -64,6 +73,7 @@ typedef struct | |||
64 | char_directive *dir; | 73 | char_directive *dir; |
65 | size_t max_width_length; | 74 | size_t max_width_length; |
66 | size_t max_precision_length; | 75 | size_t max_precision_length; |
76 | char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; | ||
67 | } | 77 | } |
68 | char_directives; | 78 | char_directives; |
69 | 79 | ||
@@ -93,6 +103,7 @@ typedef struct | |||
93 | u8_directive *dir; | 103 | u8_directive *dir; |
94 | size_t max_width_length; | 104 | size_t max_width_length; |
95 | size_t max_precision_length; | 105 | size_t max_precision_length; |
106 | u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; | ||
96 | } | 107 | } |
97 | u8_directives; | 108 | u8_directives; |
98 | 109 | ||
@@ -120,6 +131,7 @@ typedef struct | |||
120 | u16_directive *dir; | 131 | u16_directive *dir; |
121 | size_t max_width_length; | 132 | size_t max_width_length; |
122 | size_t max_precision_length; | 133 | size_t max_precision_length; |
134 | u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; | ||
123 | } | 135 | } |
124 | u16_directives; | 136 | u16_directives; |
125 | 137 | ||
@@ -147,6 +159,7 @@ typedef struct | |||
147 | u32_directive *dir; | 159 | u32_directive *dir; |
148 | size_t max_width_length; | 160 | size_t max_width_length; |
149 | size_t max_precision_length; | 161 | size_t max_precision_length; |
162 | u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES]; | ||
150 | } | 163 | } |
151 | u32_directives; | 164 | u32_directives; |
152 | 165 | ||