Changeset 17b1b99 in mainline


Ignore:
Timestamp:
2006-04-17T21:09:19Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68091bd
Parents:
73e9b49
Message:

Some formatting and formulation changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/debug/print.c

    r73e9b49 r17b1b99  
    3636#include <arch.h>
    3737
    38 SPINLOCK_INITIALIZE(printflock);                /**< printf spinlock */
    39 
    40 #define __PRINTF_FLAG_PREFIX            0x00000001      /* show prefixes 0x or 0*/
     38SPINLOCK_INITIALIZE(printflock);                        /**< printf spinlock */
     39
     40#define __PRINTF_FLAG_PREFIX            0x00000001      /* show prefixes 0x or 0 */
    4141#define __PRINTF_FLAG_SIGNED            0x00000002      /* signed / unsigned number */
    4242#define __PRINTF_FLAG_ZEROPADDED        0x00000004      /* print leading zeroes */
     
    6363
    6464static char digits_small[] = "0123456789abcdef";        /* Small hexadecimal characters */
    65 static char digits_big[] = "0123456789ABCDEF";  /* Big hexadecimal characters */
     65static char digits_big[] = "0123456789ABCDEF";          /* Big hexadecimal characters */
    6666
    6767static inline int isdigit(int c)
     
    8181}
    8282
    83 /** Print one string without adding \n at end
     83/** Print one string without appending '\n' to the end
     84 *
    8485 * Dont use this function directly - printflock is not locked here
    85  * */
     86 *
     87 */
    8688static int putstr(const char *str)
    8789{
     
    116118
    117119/** Print one formatted character
     120 *
    118121 * @param c character to print
    119122 * @param width
     
    126129       
    127130        if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) {
    128                 while (--width > 0) {   /* one space is consumed by character itself hence predecrement */
    129                         /* FIXME: painful slow */
     131                while (--width > 0) {   /* one space is consumed by character itself hence the predecrement */
     132                        /* FIXME: painfully slow */
    130133                        putchar(' ');   
    131134                        ++counter;
     
    136139        ++counter;
    137140
    138         while (--width > 0) { /* one space is consumed by character itself hence predecrement */
     141        while (--width > 0) { /* one space is consumed by character itself hence the predecrement */
    139142                putchar(' ');
    140143                ++counter;
     
    151154 * @return number of printed characters or EOF
    152155 */
    153                                                
    154156static int print_string(char *s, int width, int precision, __u64 flags)
    155157{
     
    276278
    277279        /* print leading spaces */
    278         if (size > precision) /* We must print whole number not only a part */
     280        if (size > precision) /* We must print the whole number, not only a part */
    279281                precision = size;
    280282
     
    347349/** General formatted text print
    348350 *
    349  * Print string formatted according the fmt parameter
    350  * and variant arguments. Each formatting directive
     351 * Print string formatted according to the fmt parameter
     352 * and variadic arguments. Each formatting directive
    351353 * must have the following form:
    352354 * % [ flags ] [ width ] [ .precision ] [ type ] conversion
    353355 *
    354356 * 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.
     357 * #    Force to print prefix.
     358 *      For conversion %o the prefix is 0, for %x and %X prefixes are 0x and 0X and for conversion %b the prefix is 0b.
    356359 * -    Align to left.
    357360 * +    Print positive sign just as negative.
    358361 *   (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.
     362 * 0    Print 0 as padding instead of spaces. Zeroes are placed between sign and the rest of number.
     363 *      This flag is ignored if '-' flag is specified.
    360364 *
    361365 * WIDTH:
     
    363367 * If width is specified with a '*' character instead of number, width is taken from parameter list.
    364368 * 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.
     369 * If this value is negative its absolute value is taken and the '-' flag is set.
    366370 *
    367371 * PRECISION:
    368372 * Value precision. For numbers it specifies minimum valid numbers.
    369373 * 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 '*',
     374 * Strings with more than precision characters are cut off.
     375 * Just as with width, an '*' can be used used instead of a number.
     376 * An integer value is then expected in parameters. When both width and precision are specified using '*',
    373377 * first parameter is used for width and second one for precision.
    374378 *
     
    674678        return counter;
    675679}
    676 
Note: See TracChangeset for help on using the changeset viewer.