Subversion Repositories HelenOS

Rev

Rev 4201 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4201 Rev 4296
Line 55... Line 55...
55
 
55
 
56
/** Pointer to first available field in cbuffer. */
56
/** Pointer to first available field in cbuffer. */
57
static char *cbp = cbuffer;
57
static char *cbp = cbuffer;
58
 
58
 
59
static ssize_t cons_write(const char *buf, size_t nbyte);
59
static ssize_t cons_write(const char *buf, size_t nbyte);
60
static void cons_putchar(int c);
60
static void cons_putchar(wchar_t c);
61
 
61
 
62
static void cbuffer_flush(void);
62
static void cbuffer_flush(void);
63
static void cbuffer_drain(void);
63
static void cbuffer_drain(void);
64
static void cbuffer_putc(int c);
64
static inline void cbuffer_putc(int c);
65
 
65
 
66
 
66
 
67
void console_open(bool blocking)
67
void console_open(bool blocking)
68
{
68
{
69
    if (console_phone < 0) {
69
    if (console_phone < 0) {
Line 117... Line 117...
117
 
117
 
118
    cbuffer_flush();
118
    cbuffer_flush();
119
    async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
119
    async_msg_2(cons_phone, CONSOLE_GOTO, row, col);
120
}
120
}
121
 
121
 
122
void console_putchar(int c)
122
void console_putchar(wchar_t c)
123
{
123
{
124
    cbuffer_putc(c);
124
//  cbuffer_putc(c);
-
 
125
    cbuffer_flush();
-
 
126
    cons_putchar(c);
125
}
127
}
126
 
128
 
127
/** Write all data from output buffer to the console. */
129
/** Write all data from output buffer to the console. */
128
static void cbuffer_flush(void)
130
static void cbuffer_flush(void)
129
{
131
{
Line 160... Line 162...
160
    if (c == '\n')
162
    if (c == '\n')
161
        cbuffer_flush();
163
        cbuffer_flush();
162
}
164
}
163
 
165
 
164
/** Write one character to the console via IPC. */
166
/** Write one character to the console via IPC. */
165
static void cons_putchar(int c)
167
static void cons_putchar(wchar_t c)
166
{
168
{
167
    int cons_phone = console_phone_get(true);
169
    int cons_phone = console_phone_get(true);
168
    async_msg_1(cons_phone, CONSOLE_PUTCHAR, c);
170
    async_msg_1(cons_phone, CONSOLE_PUTCHAR, c);
169
}
171
}
170
 
172
 
Line 215... Line 217...
215
void console_putstr(const char *s)
217
void console_putstr(const char *s)
216
{
218
{
217
    size_t len;
219
    size_t len;
218
    ssize_t rc;
220
    ssize_t rc;
219
 
221
 
220
    len = strlen(s);
222
    len = str_size(s);
221
    while (len > 0) {
223
    while (len > 0) {
222
        rc = console_write(s, len);
224
        rc = console_write(s, len);
223
        if (rc < 0)
225
        if (rc < 0)
224
            return; /* Error */
226
            return; /* Error */
225
        s += rc;
227
        s += rc;
Line 234... Line 236...
234
 
236
 
235
    cbuffer_flush();
237
    cbuffer_flush();
236
    async_msg_0(cons_phone, CONSOLE_FLUSH);
238
    async_msg_0(cons_phone, CONSOLE_FLUSH);
237
}
239
}
238
 
240
 
-
 
241
void console_flush_optional(void)
-
 
242
{
-
 
243
    if (console_phone >= 0)
-
 
244
        console_flush();
-
 
245
}
-
 
246
 
239
int console_get_size(int *rows, int *cols)
247
int console_get_size(int *rows, int *cols)
240
{
248
{
241
    int cons_phone = console_phone_get(true);
249
    int cons_phone = console_phone_get(true);
242
    ipcarg_t r, c;
250
    ipcarg_t r, c;
243
    int rc;
251
    int rc;