43,13 → 43,13 |
|
SPINLOCK_INITIALIZE(printf_lock); /**< vprintf spinlock */ |
|
static int vprintf_write_utf8(const char *str, size_t size, void *data) |
static int vprintf_str_write(const char *str, size_t size, void *data) |
{ |
index_t index = 0; |
index_t chars = 0; |
size_t offset = 0; |
count_t chars = 0; |
|
while (index < size) { |
putchar(chr_decode(str, &index, size)); |
while (offset < size) { |
putchar(str_decode(str, &offset, size)); |
chars++; |
} |
|
56,25 → 56,27 |
return chars; |
} |
|
static int vprintf_write_utf32(const wchar_t *str, size_t size, void *data) |
static int vprintf_wstr_write(const wchar_t *str, size_t size, void *data) |
{ |
index_t index = 0; |
size_t offset = 0; |
count_t chars = 0; |
|
while (index < (size / sizeof(wchar_t))) { |
putchar(str[index]); |
index++; |
while (offset < size) { |
putchar(str[chars]); |
chars++; |
offset += sizeof(wchar_t); |
} |
|
return index; |
return chars; |
} |
|
int puts(const char *str) |
{ |
index_t index = 0; |
index_t chars = 0; |
size_t offset = 0; |
count_t chars = 0; |
wchar_t uc; |
|
while ((uc = chr_decode(str, &index, UTF8_NO_LIMIT)) != 0) { |
while ((uc = str_decode(str, &offset, STR_NO_LIMIT)) != 0) { |
putchar(uc); |
chars++; |
} |
85,8 → 87,8 |
int vprintf(const char *fmt, va_list ap) |
{ |
printf_spec_t ps = { |
vprintf_write_utf8, |
vprintf_write_utf32, |
vprintf_str_write, |
vprintf_wstr_write, |
NULL |
}; |
|