Function report |
Source Code:lib\vsprintf.c |
Create Date:2022-07-28 06:12:23 |
| Last Modify:2022-05-21 09:47:42 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Helper function to decode printf style format
Proto:static __attribute__((__noinline__)) int format_decode(const char *fmt, struct printf_spec *spec)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| const char * | fmt | |
| struct printf_spec * | spec |
| 2288 | If format_type enum == FORMAT_TYPE_WIDTH Then |
| 2289 | If width of output field < 0 Then |
| 2291 | flags to number() |= left justified |
| 2294 | Go to precision |
| 2298 | If format_type enum == FORMAT_TYPE_PRECISION Then |
| 2299 | If # of digits/chars < 0 Then # of digits/chars = 0 |
| 2303 | Go to qualifier |
| 2310 | If fmt == '%' Then Break |
| 2319 | flags to number() = 0 |
| 2321 | When 1 cycle |
| 2322 | bool found = true |
| 2324 | ++fmt |
| 2327 | Case fmt == '-' |
| 2327 | flags to number() |= left justified |
| 2327 | Break |
| 2328 | Case fmt == '+' |
| 2328 | flags to number() |= show plus |
| 2328 | Break |
| 2329 | Case fmt == ' ' |
| 2329 | flags to number() |= space if plus |
| 2329 | Break |
| 2330 | Case fmt == '#' |
| 2330 | Break |
| 2331 | Case fmt == '0' |
| 2331 | Break |
| 2332 | Default |
| 2332 | found = false |
| 2335 | If Not found Then Break |
| 2340 | width of output field = -1 |
| 2344 | Else if fmt == '*' Then |
| 2350 | precision : |
| 2352 | # of digits/chars = -1 |
| 2353 | If fmt == '.' Then |
| 2354 | ++fmt |
| 2357 | If # of digits/chars < 0 Then # of digits/chars = 0 |
| 2359 | Else if fmt == '*' Then |
| 2366 | qualifier : |
| 2368 | qualifier = 0 |
| 2369 | If fmt == 'h' || Fast implementation of tolower() for internal usage. Do not use in your* code. == 'l' || fmt == 'z' || fmt == 't' Then |
| 2372 | If Value for the false possibility is greater at compile time(qualifier == * fmt) Then |
| 2384 | number base, 8, 10 or 16 only = 10 |
| 2386 | Case fmt == 'c' |
| 2387 | format_type enum = FORMAT_TYPE_CHAR |
| 2390 | Case fmt == 's' |
| 2391 | format_type enum = FORMAT_TYPE_STR |
| 2394 | Case fmt == 'p' |
| 2395 | format_type enum = FORMAT_TYPE_PTR |
| 2398 | Case fmt == '%' |
| 2403 | Case fmt == 'o' |
| 2404 | number base, 8, 10 or 16 only = 8 |
| 2405 | Break |
| 2407 | Case fmt == 'x' |
| 2411 | Case fmt == 'X' |
| 2412 | number base, 8, 10 or 16 only = 16 |
| 2413 | Break |
| 2415 | Case fmt == 'd' |
| 2416 | Case fmt == 'i' |
| 2418 | Case fmt == 'u' |
| 2419 | Break |
| 2421 | Case fmt == 'n' |
| 2429 | Default |
| 2435 | If qualifier == 'L' Then format_type enum = FORMAT_TYPE_LONG_LONG |
| 2437 | Else if qualifier == 'l' Then |
| 2440 | Else if qualifier == 'z' Then |
| 2442 | Else if qualifier == 't' Then |
| 2444 | Else if qualifier == 'H' Then |
| 2447 | Else if qualifier == 'h' Then |
| 2450 | Else |
| Name | Describe |
|---|---|
| vsnprintf | vsnprintf - Format a string and place it in a buffer*@buf: The buffer to place the result into*@size: The size of the buffer, including the trailing null space*@fmt: The format string to use*@args: Arguments for the format string* This function generally |
| 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 |