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); } }
void console_putc(unsigned int ch, char c) { if (__putc) __putc(putc_ctx, c); else putc_ll(c); }
/** * 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 ); } }
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); }
void __putc(uint8_t chr) { if (chr == '\n') __putc('\r'); while (!(inw(0xf0002004) & 0x400)); outb(chr, 0xf0002080); while (!(inw(0xf0002004) & 0x400)); }
/**************************************************************************** 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; }
/**************************************************************************** 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; }
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); } }
/* Write the character C on stdout. */ int putchar (int c) { return __putc (c, stdout); }
int fputc(int c, FILE *fp) { return __putc(c, fp); }
void __puts(u8 *s) { while (*s != 0) { __putc(*s++); } }