Subversion Repositories HelenOS

Rev

Rev 2131 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2131 Rev 2307
Line 38... Line 38...
38
#include <unistd.h>
38
#include <unistd.h>
39
#include <stdio.h>
39
#include <stdio.h>
40
#include <io/printf_core.h>
40
#include <io/printf_core.h>
41
#include <ctype.h>
41
#include <ctype.h>
42
#include <string.h>
42
#include <string.h>
43
/* For serialization */
-
 
44
#include <async.h>
-
 
45
 
43
 
46
#define __PRINTF_FLAG_PREFIX        0x00000001  /**< show prefixes 0x or 0*/
44
#define __PRINTF_FLAG_PREFIX        0x00000001  /**< show prefixes 0x or 0*/
47
#define __PRINTF_FLAG_SIGNED        0x00000002  /**< signed / unsigned number */
45
#define __PRINTF_FLAG_SIGNED        0x00000002  /**< signed / unsigned number */
48
#define __PRINTF_FLAG_ZEROPADDED    0x00000004  /**< print leading zeroes */
46
#define __PRINTF_FLAG_ZEROPADDED    0x00000004  /**< print leading zeroes */
49
#define __PRINTF_FLAG_LEFTALIGNED   0x00000010  /**< align to left */
47
#define __PRINTF_FLAG_LEFTALIGNED   0x00000010  /**< align to left */
Line 90... Line 88...
90
 */
88
 */
91
static int printf_putstr(const char * str, struct printf_spec *ps)
89
static int printf_putstr(const char * str, struct printf_spec *ps)
92
{
90
{
93
    size_t count;
91
    size_t count;
94
   
92
   
95
    if (str == NULL) {
93
    if (str == NULL)
96
        return printf_putnchars("(NULL)", 6, ps);
94
        return printf_putnchars("(NULL)", 6, ps);
97
    }
-
 
98
 
95
 
99
    for (count = 0; str[count] != 0; count++);
96
    for (count = 0; str[count] != 0; count++);
100
 
97
 
101
    if (ps->write((void *) str, count, ps->data) == count) {
98
    if (ps->write((void *) str, count, ps->data) == count)
102
        return 0;
99
        return 0;
103
    }
-
 
104
   
100
   
105
    return EOF;
101
    return EOF;
106
}
102
}
107
 
103
 
108
/** Print one character to output
104
/** Print one character to output
Line 445... Line 441...
445
    uint64_t number; /* argument value */
441
    uint64_t number; /* argument value */
446
    size_t  size; /* byte size of integer parameter */
442
    size_t  size; /* byte size of integer parameter */
447
    int width, precision;
443
    int width, precision;
448
    uint64_t flags;
444
    uint64_t flags;
449
   
445
   
450
    /* Don't let other threads interfere */
-
 
451
    async_serialize_start();
-
 
452
 
-
 
453
    counter = 0;
446
    counter = 0;
454
   
447
   
455
    while ((c = fmt[i])) {
448
    while ((c = fmt[i])) {
456
        /* control character */
449
        /* control character */
457
        if (c == '%' ) {
450
        if (c == '%' ) {
Line 679... Line 672...
679
            goto minus_out;
672
            goto minus_out;
680
        }
673
        }
681
        counter += retval;
674
        counter += retval;
682
    }
675
    }
683
   
676
   
684
    async_serialize_end();
-
 
685
    return counter;
677
    return counter;
686
minus_out:
678
minus_out:
687
    async_serialize_end();
-
 
688
    return -counter;
679
    return -counter;
689
}
680
}
690
 
681
 
691
/** @}
682
/** @}
692
 */
683
 */