Changeset da32cea in mainline


Ignore:
Timestamp:
2006-04-17T14:28:56Z (19 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1c7da86
Parents:
523fad8
Message:

Update comments in printf.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libc/generic/io/print.c

    r523fad8 rda32cea  
    296296
    297297
    298 
    299298/** General formatted text print
    300299 *
    301  * Print text formatted according the fmt parameter
     300 * Print string formatted according the fmt parameter
    302301 * and variant arguments. Each formatting directive
    303  * begins with \% (percentage) character and one of the
    304  * following character:
    305  *
    306  * \%    Prints the percentage character.
    307  *
    308  * s    The next variant argument is treated as char*
    309  *      and printed as a NULL terminated string.
    310  *
    311  * c    The next variant argument is treated as a single char.
    312  *
    313  * p    The next variant argument is treated as a maximum
    314  *      bit-width integer with respect to architecture
    315  *      and printed in full hexadecimal width.
    316  *
    317  * P    As with 'p', but '0x' is prefixed.
    318  *
    319  * q    The next variant argument is treated as a 64b integer
    320  *      and printed in full hexadecimal width.
    321  *
    322  * Q    As with 'q', but '0x' is prefixed.
    323  *
    324  * l    The next variant argument is treated as a 32b integer
    325  *      and printed in full hexadecimal width.
    326  *
    327  * L    As with 'l', but '0x' is prefixed.
    328  *
    329  * w    The next variant argument is treated as a 16b integer
    330  *      and printed in full hexadecimal width.
    331  *
    332  * W    As with 'w', but '0x' is prefixed.
    333  *
    334  * b    The next variant argument is treated as a 8b integer
    335  *      and printed in full hexadecimal width.
    336  *
    337  * B    As with 'b', but '0x' is prefixed.
    338  *
    339  * d    The next variant argument is treated as integer
    340  *      and printed in standard decimal format (only significant
    341  *      digits).
    342  *
    343  * x    The next variant argument is treated as integer
    344  *      and printed in standard hexadecimal format (only significant
    345  *      digits).
    346  *
    347  * X    As with 'x', but '0x' is prefixed.
    348  *
     302 * must have the following form:
     303 * % [ flags ] [ width ] [ .precision ] [ type ] conversion
     304 *
     305 * FLAGS:
     306 * #    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.
     307 * -    Align to left.
     308 * +    Print positive sign just as negative.
     309 *   (space)    If printed number is positive and '+' flag is not set, print space in place of sign.
     310 * 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.
     311 *
     312 * WIDTH:
     313 * Specify minimal width of printed argument. If it is bigger, width is ignored.
     314 * If width is specified with a '*' character instead of number, width is taken from parameter list.
     315 * Int parameter expected before parameter for processed conversion specification.
     316 * If this value is negative it is taken its absolute value and the '-' flag is set.
     317 *
     318 * PRECISION:
     319 * Value precision. For numbers it specifies minimum valid numbers.
     320 * Smaller numbers are printed with leading zeroes. Bigger numbers are not affected.
     321 * Strings with more than precision characters are cutted of.
     322 * Just as width could be '*' used instead a number.
     323 * A int value is then expected in parameters. When both width and precision are specified using '*',
     324 * first parameter is used for width and second one for precision.
     325 *
     326 * TYPE:
     327 * hh   signed or unsigned char
     328 * h    signed or usigned short
     329 *      signed or usigned int (default value)
     330 * l    signed or usigned long int
     331 * ll   signed or usigned long long int
     332 * z    size_t type
     333 *
     334 *
     335 * CONVERSIONS:
     336 *
     337 * %    Print percentage character.
     338 *
     339 * c    Print single character.
     340 *
     341 * s    Print zero terminated string. If a NULL value is passed as value, "(NULL)" is printed instead.
     342 *
     343 * P, p Print value of a pointer. Void * value is expected and it is printed in hexadecimal notation with prefix
     344 * ( as with %#X or %#x for 32bit or %#X / %#x for 64bit long pointers)
     345 *
     346 * b    Print value as unsigned binary number.  Prefix is not printed by default. (Nonstandard extension.)
     347 *
     348 * o    Print value as unsigned octal number. Prefix is not printed by default.
     349 *
     350 * d,i  Print signed decimal number. There is no difference between d and i conversion.
     351 *
     352 * u    Print unsigned decimal number.
     353 *
     354 * X, x Print hexadecimal number with upper- or lower-case. Prefix is not printed by default.
     355 *
    349356 * All other characters from fmt except the formatting directives
    350357 * are printed in verbatim.
    351358 *
    352359 * @param fmt Formatting NULL terminated string.
     360 * @return count of printed characters or negative value on fail.
    353361 */
    354362int printf(const char *fmt, ...)
Note: See TracChangeset for help on using the changeset viewer.