void
ARMConsole::print(const TCHAR *fmt, ...)
{
	SETUP_WIDECHAR_BUFFER();

	if (!setupMultibyteBuffer())
		return;

	for (int i = 0; _bufm[i] != '\0' && i < CONSOLE_BUFSIZE; i++) {
		char s = _bufm[i];
		if (s == '\n')
			__putc('\r');
		__putc(s);
	}
}
Exemple #2
0
void console_putc(unsigned int ch, char c)
{
	if (__putc)
		__putc(putc_ctx, c);
	else
		putc_ll(c);
}
Exemple #3
0
/**
 * Print a character to stdout (if string is null)
 * otherwise, put the character at the end of the provided string.
 */
static void __print_char( _print_ctx_t* ctx, char c )
{
	if( ctx ) {
		if( c == '\r' || c == '\n' ) {
			if( ctx->_max_len > 1 ) {
				*(ctx->_ptr)='\r';
				ctx->_max_len--;
				ctx->_ptr++;
				*(ctx->_ptr)='\n';
				ctx->_max_len--;
				ctx->_ptr++;
			} else {
				*(ctx->_ptr)='\n';
				ctx->_max_len--;
				ctx->_ptr++;
			}
		} else {
			if( ctx->_max_len ) {
				*(ctx->_ptr)=c;
				ctx->_max_len--;
				ctx->_ptr++;
			}
		}
	} else {
		__putc( (uint8_t)c );
	}
}
Exemple #4
0
W
getc (FILE *port)
{
  W ch;

  ch = readchar (port->device, dev_recv);
  __putc (ch, stdout);
  return (ch);
}
//
// write -- write bytes to the serial port. Ignore fd, since
//          stdout and stderr are the same. Since we have no filesystem,
//          open will only return an error.
//
static int
sys_write(int fd, char *buf, int nbytes)
{
#define WBUFSIZE  256
    int  tosend;

    tosend = nbytes;

    while (tosend > 0) {
        if (*buf == '\n')
            __putc('\r');
        __putc(*buf++);
        tosend--;
    }
    __flush();

    return (nbytes);
}
Exemple #6
0
void __putc(uint8_t chr)
{
	if (chr == '\n')
		__putc('\r');

	while (!(inw(0xf0002004) & 0x400));
	outb(chr, 0xf0002080);
	while (!(inw(0xf0002004) & 0x400));
}
Exemple #7
0
/****************************************************************************
REMARKS:
VxD implementation of the ANSI C fputs function.
****************************************************************************/
int	fputs(
	const char *s,
	FILE *f)
{
	int r = 0;
	int c;

	while ((c = *s++) != 0)
		r = __putc(c, f);
	return r;
}
Exemple #8
0
/****************************************************************************
REMARKS:
Write a single character from to input buffer, including translation of the
character in text transation modes.
****************************************************************************/
static int __putc(int c,FILE *f)
{
	int count = 1;
	if (f->text && c == '\n') {
		__putc('\r',f);
		count = 2;
		}
	if (f->curp == f->endp)
		fflush(f);
	*f->curp++ = c;
	return count;
}
Exemple #9
0
static void vga_putc(int c)
{
    bool new_row = false;

    switch ( c ) {
        case '\n':
            cursor_y++;
            cursor_x = 0;
            new_row = true;
            break;
        case '\r':
            cursor_x = 0;
            break;
        case '\t':
            cursor_x += 4;
            break;
        default:
            __putc(cursor_x, cursor_y, c);
            cursor_x++;
            break;
    }

    if ( cursor_x >= MAX_COLS ) {
        cursor_x %= MAX_COLS;
        cursor_y++;
        new_row = true;
    }

    if ( new_row ) {
        num_lines++;
        if ( cursor_y >= MAX_LINES ) {
            scroll_screen();
            cursor_y--;
        }

        /* (optionally) pause after every screenful */
        if ( (num_lines % (MAX_LINES - 1)) == 0 && g_vga_delay > 0 )
            delay(g_vga_delay * 1000);
    }
}
Exemple #10
0
/* Write the character C on stdout.  */
int
putchar (int c)
{
  return __putc (c, stdout);
}
Exemple #11
0
int fputc(int c, FILE *fp)
{
 return __putc(c, fp);
}
Exemple #12
0
void __puts(u8 *s) {
	while (*s != 0) {
		__putc(*s++);
	}
}