Function report |
Source Code:arch\x86\boot\printf.c |
Create Date:2022-07-28 07:26:58 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:vsprintf
Proto:int vsprintf(char *buf, const char *fmt, va_list args)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
char * | buf | |
const char * | fmt | |
va_list | args |
129 | If fmt != '%' Then |
135 | flags = 0 |
136 | repeat : |
137 | ++fmt |
139 | Case fmt == '-' |
140 | flags |= left justified |
141 | Go to repeat |
142 | Case fmt == '+' |
145 | Case fmt == ' ' |
146 | flags |= space if plus |
147 | Go to repeat |
148 | Case fmt == '#' |
151 | Case fmt == '0' |
152 | flags |= pad with zero |
153 | Go to repeat |
157 | field_width = -1 |
160 | Else if fmt == '*' Then |
161 | ++fmt |
163 | field_width = va_arg(args, int) |
164 | If field_width < 0 Then |
165 | field_width = -field_width |
166 | flags |= left justified |
171 | precision = -1 |
172 | If fmt == '.' Then |
173 | ++fmt |
176 | Else if fmt == '*' Then |
186 | qualifier = -1 |
193 | base = 10 |
196 | Case fmt == 'c' |
197 | If Not (flags & left justified ) Then When --field_width > 0 cycle |
199 | str++ = ' ' |
201 | When --field_width > 0 cycle |
202 | str++ = ' ' |
203 | Continue |
205 | Case fmt == 's' |
209 | If Not (flags & left justified ) Then When len < field_width-- cycle |
211 | str++ = ' ' |
214 | When len < field_width-- cycle |
215 | str++ = ' ' |
216 | Continue |
218 | Case fmt == 'p' |
219 | If field_width == -1 Then |
220 | field_width = 2 * size of * |
221 | flags |= pad with zero |
226 | Continue |
228 | Case fmt == 'n' |
238 | Case fmt == '%' |
239 | str++ = '%' |
240 | Continue |
243 | Case fmt == 'o' |
244 | base = 8 |
245 | Break |
247 | Case fmt == 'x' |
248 | flags |= Must be 32 == 0x20 |
249 | Case fmt == 'X' |
250 | base = 16 |
251 | Break |
253 | Case fmt == 'd' |
254 | Case fmt == 'i' |
255 | flags |= unsigned/signed long |
256 | Case fmt == 'u' |
257 | Break |
259 | Default |
269 | Else if qualifier == 'h' Then |
273 | Else if flags & unsigned/signed long Then num = va_arg(args, int) |
279 | str = '\0' |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |