Changeset 50de918 in mainline
- Timestamp:
- 2006-04-17T14:28:35Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 97a7eff
- Parents:
- 280a27e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/debug/print.c
r280a27e r50de918 209 209 * be in range 2 .. 16). 210 210 * @param flags output modifiers 211 * @return number of written characters or EOF 212 * 211 * @return number of written characters or negative value on fail. 213 212 */ 214 213 static int print_number(__u64 num, int width, int precision, int base , __u64 flags) … … 346 345 } 347 346 348 349 350 347 /** General formatted text print 351 348 * 352 * Print textformatted according the fmt parameter349 * Print string formatted according the fmt parameter 353 350 * and variant arguments. Each formatting directive 354 * begins with \% (percentage) character and one of the 355 * following character: 356 * 357 * \% Prints the percentage character. 358 * 359 * s The next variant argument is treated as char* 360 * and printed as a NULL terminated string. 361 * 362 * c The next variant argument is treated as a single char. 363 * 364 * p The next variant argument is treated as a maximum 365 * bit-width integer with respect to architecture 366 * and printed in full hexadecimal width. 367 * 368 * P As with 'p', but '0x' is prefixed. 369 * 370 * q The next variant argument is treated as a 64b integer 371 * and printed in full hexadecimal width. 372 * 373 * Q As with 'q', but '0x' is prefixed. 374 * 375 * l The next variant argument is treated as a 32b integer 376 * and printed in full hexadecimal width. 377 * 378 * L As with 'l', but '0x' is prefixed. 379 * 380 * w The next variant argument is treated as a 16b integer 381 * and printed in full hexadecimal width. 382 * 383 * W As with 'w', but '0x' is prefixed. 384 * 385 * b The next variant argument is treated as a 8b integer 386 * and printed in full hexadecimal width. 387 * 388 * B As with 'b', but '0x' is prefixed. 389 * 390 * d The next variant argument is treated as integer 391 * and printed in standard decimal format (only significant 392 * digits). 393 * 394 * x The next variant argument is treated as integer 395 * and printed in standard hexadecimal format (only significant 396 * digits). 397 * 398 * X As with 'x', but '0x' is prefixed. 399 * 351 * must have the following form: 352 * % [ flags ] [ width ] [ .precision ] [ type ] conversion 353 * 354 * FLAGS: 355 * # Force to print prefix. For conversion %o is prefix 0, for %x and %X are prefixes 0x and 0X and for conversion %b is prefix 0b. 356 * - Align to left. 357 * + Print positive sign just as negative. 358 * (space) If printed number is positive and '+' flag is not set, print space in place of sign. 359 * 0 Print 0 as padding instead of spaces. Zeroes are placed between sign and the rest of number. This flag is ignored if '-' flag is specified. 360 * 361 * WIDTH: 362 * Specify minimal width of printed argument. If it is bigger, width is ignored. 363 * If width is specified with a '*' character instead of number, width is taken from parameter list. 364 * Int parameter expected before parameter for processed conversion specification. 365 * If this value is negative it is taken its absolute value and the '-' flag is set. 366 * 367 * PRECISION: 368 * Value precision. For numbers it specifies minimum valid numbers. 369 * Smaller numbers are printed with leading zeroes. Bigger numbers are not affected. 370 * Strings with more than precision characters are cutted of. 371 * Just as width could be '*' used instead a number. 372 * A int value is then expected in parameters. When both width and precision are specified using '*', 373 * first parameter is used for width and second one for precision. 374 * 375 * TYPE: 376 * hh signed or unsigned char 377 * h signed or usigned short 378 * signed or usigned int (default value) 379 * l signed or usigned long int 380 * ll signed or usigned long long int 381 * z __native (non-standard extension) 382 * 383 * 384 * CONVERSIONS: 385 * 386 * % Print percentage character. 387 * 388 * c Print single character. 389 * 390 * s Print zero terminated string. If a NULL value is passed as value, "(NULL)" is printed instead. 391 * 392 * P, p Print value of a pointer. Void * value is expected and it is printed in hexadecimal notation with prefix 393 * ( as with %#X or %#x for 32bit or %#X / %#x for 64bit long pointers). 394 * 395 * b Print value as unsigned binary number. Prefix is not printed by default. (Nonstandard extension.) 396 * 397 * o Print value as unsigned octal number. Prefix is not printed by default. 398 * 399 * d,i Print signed decimal number. There is no difference between d and i conversion. 400 * 401 * u Print unsigned decimal number. 402 * 403 * X, x Print hexadecimal number with upper- or lower-case. Prefix is not printed by default. 404 * 400 405 * All other characters from fmt except the formatting directives 401 406 * are printed in verbatim. 402 407 * 403 408 * @param fmt Formatting NULL terminated string. 409 * @return count of printed characters or negative value on fail. 404 410 */ 405 411 int printf(const char *fmt, ...)
Note:
See TracChangeset
for help on using the changeset viewer.