aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/https/lgl/printf-parse.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/https/lgl/printf-parse.h')
-rw-r--r--src/daemon/https/lgl/printf-parse.h176
1 files changed, 0 insertions, 176 deletions
diff --git a/src/daemon/https/lgl/printf-parse.h b/src/daemon/https/lgl/printf-parse.h
deleted file mode 100644
index 2493d481..00000000
--- a/src/daemon/https/lgl/printf-parse.h
+++ /dev/null
@@ -1,176 +0,0 @@
1/* Parse printf format string.
2 Copyright (C) 1999, 2002-2003, 2005, 2007 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1, 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
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License along
15 with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17
18#ifndef _PRINTF_PARSE_H
19#define _PRINTF_PARSE_H
20
21/* This file can be parametrized with the following macros:
22 ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
23 STATIC Set to 'static' to declare the function static. */
24
25#include "printf-args.h"
26
27/* Flags */
28#define FLAG_GROUP 1 /* ' flag */
29#define FLAG_LEFT 2 /* - flag */
30#define FLAG_SHOWSIGN 4 /* + flag */
31#define FLAG_SPACE 8 /* space flag */
32#define FLAG_ALT 16 /* # flag */
33#define FLAG_ZERO 32
34
35/* arg_index value indicating that no argument is consumed. */
36#define ARG_NONE (~(size_t)0)
37
38/* xxx_directive: A parsed directive.
39 xxx_directives: A parsed format string. */
40
41/* A parsed directive. */
42typedef struct
43{
44 const char *dir_start;
45 const char *dir_end;
46 int flags;
47 const char *width_start;
48 const char *width_end;
49 size_t width_arg_index;
50 const char *precision_start;
51 const char *precision_end;
52 size_t precision_arg_index;
53 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 */
54 size_t arg_index;
55}
56char_directive;
57
58/* A parsed format string. */
59typedef struct
60{
61 size_t count;
62 char_directive *dir;
63 size_t max_width_length;
64 size_t max_precision_length;
65}
66char_directives;
67
68#if ENABLE_UNISTDIO
69
70/* A parsed directive. */
71typedef struct
72{
73 const uint8_t *dir_start;
74 const uint8_t *dir_end;
75 int flags;
76 const uint8_t *width_start;
77 const uint8_t *width_end;
78 size_t width_arg_index;
79 const uint8_t *precision_start;
80 const uint8_t *precision_end;
81 size_t precision_arg_index;
82 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 */
83 size_t arg_index;
84}
85u8_directive;
86
87/* A parsed format string. */
88typedef struct
89{
90 size_t count;
91 u8_directive *dir;
92 size_t max_width_length;
93 size_t max_precision_length;
94}
95u8_directives;
96
97/* A parsed directive. */
98typedef struct
99{
100 const uint16_t *dir_start;
101 const uint16_t *dir_end;
102 int flags;
103 const uint16_t *width_start;
104 const uint16_t *width_end;
105 size_t width_arg_index;
106 const uint16_t *precision_start;
107 const uint16_t *precision_end;
108 size_t precision_arg_index;
109 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 */
110 size_t arg_index;
111}
112u16_directive;
113
114/* A parsed format string. */
115typedef struct
116{
117 size_t count;
118 u16_directive *dir;
119 size_t max_width_length;
120 size_t max_precision_length;
121}
122u16_directives;
123
124/* A parsed directive. */
125typedef struct
126{
127 const uint32_t *dir_start;
128 const uint32_t *dir_end;
129 int flags;
130 const uint32_t *width_start;
131 const uint32_t *width_end;
132 size_t width_arg_index;
133 const uint32_t *precision_start;
134 const uint32_t *precision_end;
135 size_t precision_arg_index;
136 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 */
137 size_t arg_index;
138}
139u32_directive;
140
141/* A parsed format string. */
142typedef struct
143{
144 size_t count;
145 u32_directive *dir;
146 size_t max_width_length;
147 size_t max_precision_length;
148}
149u32_directives;
150
151#endif
152
153
154/* Parses the format string. Fills in the number N of directives, and fills
155 in directives[0], ..., directives[N-1], and sets directives[N].dir_start
156 to the end of the format string. Also fills in the arg_type fields of the
157 arguments and the needed count of arguments. */
158#if ENABLE_UNISTDIO
159extern int
160ulc_printf_parse (const char *format, char_directives * d, arguments * a);
161extern int
162u8_printf_parse (const uint8_t * format, u8_directives * d, arguments * a);
163extern int
164u16_printf_parse (const uint16_t * format, u16_directives * d, arguments * a);
165extern int
166u32_printf_parse (const uint32_t * format, u32_directives * d, arguments * a);
167#else
168# ifdef STATIC
169STATIC
170# else
171extern
172# endif
173int printf_parse (const char *format, char_directives * d, arguments * a);
174#endif
175
176#endif /* _PRINTF_PARSE_H */