Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _PRINTF_PARSE_H
00022 #define _PRINTF_PARSE_H
00023
00024
00025
00026
00027
00028 #if HAVE_FEATURES_H
00029 # include <features.h>
00030 #endif
00031
00032 #include "printf-args.h"
00033
00034
00035
00036 #define FLAG_GROUP 1
00037 #define FLAG_LEFT 2
00038 #define FLAG_SHOWSIGN 4
00039 #define FLAG_SPACE 8
00040 #define FLAG_ALT 16
00041 #define FLAG_ZERO 32
00042 #if __GLIBC__ >= 2 && !defined __UCLIBC__
00043 # define FLAG_LOCALIZED 64
00044 #endif
00045
00046
00047 #define ARG_NONE (~(size_t)0)
00048
00049
00050
00051
00052
00053 #define N_DIRECT_ALLOC_DIRECTIVES 7
00054
00055
00056 typedef struct
00057 {
00058 const char* dir_start;
00059 const char* dir_end;
00060 int flags;
00061 const char* width_start;
00062 const char* width_end;
00063 size_t width_arg_index;
00064 const char* precision_start;
00065 const char* precision_end;
00066 size_t precision_arg_index;
00067 char conversion;
00068 size_t arg_index;
00069 }
00070 char_directive;
00071
00072
00073 typedef struct
00074 {
00075 size_t count;
00076 char_directive *dir;
00077 size_t max_width_length;
00078 size_t max_precision_length;
00079 char_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
00080 }
00081 char_directives;
00082
00083 #if ENABLE_UNISTDIO
00084
00085
00086 typedef struct
00087 {
00088 const uint8_t* dir_start;
00089 const uint8_t* dir_end;
00090 int flags;
00091 const uint8_t* width_start;
00092 const uint8_t* width_end;
00093 size_t width_arg_index;
00094 const uint8_t* precision_start;
00095 const uint8_t* precision_end;
00096 size_t precision_arg_index;
00097 uint8_t conversion;
00098 size_t arg_index;
00099 }
00100 u8_directive;
00101
00102
00103 typedef struct
00104 {
00105 size_t count;
00106 u8_directive *dir;
00107 size_t max_width_length;
00108 size_t max_precision_length;
00109 u8_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
00110 }
00111 u8_directives;
00112
00113
00114 typedef struct
00115 {
00116 const uint16_t* dir_start;
00117 const uint16_t* dir_end;
00118 int flags;
00119 const uint16_t* width_start;
00120 const uint16_t* width_end;
00121 size_t width_arg_index;
00122 const uint16_t* precision_start;
00123 const uint16_t* precision_end;
00124 size_t precision_arg_index;
00125 uint16_t conversion;
00126 size_t arg_index;
00127 }
00128 u16_directive;
00129
00130
00131 typedef struct
00132 {
00133 size_t count;
00134 u16_directive *dir;
00135 size_t max_width_length;
00136 size_t max_precision_length;
00137 u16_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
00138 }
00139 u16_directives;
00140
00141
00142 typedef struct
00143 {
00144 const uint32_t* dir_start;
00145 const uint32_t* dir_end;
00146 int flags;
00147 const uint32_t* width_start;
00148 const uint32_t* width_end;
00149 size_t width_arg_index;
00150 const uint32_t* precision_start;
00151 const uint32_t* precision_end;
00152 size_t precision_arg_index;
00153 uint32_t conversion;
00154 size_t arg_index;
00155 }
00156 u32_directive;
00157
00158
00159 typedef struct
00160 {
00161 size_t count;
00162 u32_directive *dir;
00163 size_t max_width_length;
00164 size_t max_precision_length;
00165 u32_directive direct_alloc_dir[N_DIRECT_ALLOC_DIRECTIVES];
00166 }
00167 u32_directives;
00168
00169 #endif
00170
00171
00172
00173
00174
00175
00176 #if ENABLE_UNISTDIO
00177 extern int
00178 ulc_printf_parse (const char *format, char_directives *d, arguments *a);
00179 extern int
00180 u8_printf_parse (const uint8_t *format, u8_directives *d, arguments *a);
00181 extern int
00182 u16_printf_parse (const uint16_t *format, u16_directives *d,
00183 arguments *a);
00184 extern int
00185 u32_printf_parse (const uint32_t *format, u32_directives *d,
00186 arguments *a);
00187 #else
00188 # ifdef STATIC
00189 STATIC
00190 # else
00191 extern
00192 # endif
00193 int printf_parse (const char *format, char_directives *d, arguments *a);
00194 #endif
00195
00196 #endif