void welcome() { char* welcome_msg = "Hello! Welcome to SOS, Sean's Operating System.\n"; screen_puts(welcome_msg); screen_puts("This is a hex number:"); screen_putx(256); screen_putc('\n'); }
static void display(editor_t *editor, bool ansi) { int line = 0, lines = screen_lines() - 1; for (vector_size_t i = editor->window_top; i < editor->allow_edit_end && line < lines; ++i, ++line) { text_line_t *tl = editor_line(editor, i); if (editor->redraw || tl->redraw) { screen_move_clear(line); if (ansi) { screen_puts(tl->buf, tl->size); } else { bool marked = i >= editor->mark_begin && i < editor->mark_end; if (marked) screen_puts("\033[7m", 4); const char *last = tl->buf, *end = tl->buf + tl->size; for (const char *ptr = tl->buf; ptr < end; ++ptr) { if (*ptr == '\033') { if (ptr > last) screen_puts(last, ptr - last); screen_puts("\033[33m*", 0); if (marked) screen_puts("\033[37m", 0); else screen_puts("\033[m", 0); last = ptr + 1; } } if (end > last) { size_t size = end - last - contains_newline(tl); if (size) screen_puts(last, size); } if (marked) screen_puts("\033[m", 3); } tl->redraw = false; } } if (editor->redraw) { for (; line < lines; ++line) { screen_move_clear(line); screen_puts("\033[33m~\033[m", 0); } } show_status_line(editor); screen_move(editor->current_line - editor->window_top, editor->screen_pos); editor->redraw = false; return; }
static void _print_string(const char *ptr, size_t width, bool utf8, bool left_adjust) { if (!ptr) ptr = nullstr; size_t padding = 0; if (width) { size_t w = screen_display_width(ptr, utf8); if (w < width) padding = width - w; } if (padding && !left_adjust) tui_repeat_char(' ', padding); if (utf8) { screen_puts(ptr, 0); } else { convert(CONVERT_G2U, ptr, CONVERT_ALL, NULL, 0, screen_put_gbk_helper, NULL); } if (padding && left_adjust) tui_repeat_char(' ', padding); }
static void prvDisplayAssertion( const char * pcFile, unsigned long ulLine ) { /* Remove compiler warning about unused parameter. */ ( void ) pcFile; ( void ) ulLine; screen_puts( "prvDisplayAssertion()\n" ); }
static void timer_callback(registers_t regs) { tick++; char* t = "Time tick: " ; screen_puts(t); screen_putd(tick); screen_putc('\n'); // short* vram = (short *)0xb8000; // char* msg = "yo!"; // vram[tick] = msg[0] | '[' << 8; }
/* move cursor and puts */ void screen_pos_puts(const char *text, int new_x, int new_y) { int old_x = _l_scr_px; int old_y = _l_scr_py; _l_scr_px = new_x; _l_scr_py = new_y; screen_puts(text); _l_scr_px = old_x; _l_scr_py = old_y; }
static void _put_string(const char *ptr, const char *end, bool utf8) { if (ptr && end && end > ptr) { size_t size = end - ptr; if (utf8) { screen_puts(ptr, size); } else { convert(CONVERT_G2U, ptr, size, NULL, 0, screen_put_gbk_helper, NULL); } } }
static void prvLoopTask( void *pvParameters ) { TickType_t xNextWakeTime; xNextWakeTime = xTaskGetTickCount(); /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; while(1) { vTaskDelayUntil( &xNextWakeTime, pdMS_TO_TICKS( 1000 ) ); screen_puts( "\n1 second\n" ); } }
/* See http://www.FreeRTOS.org/RTOS_Intel_Quark_Galileo_GCC.html for usage instructions. */ int main( void ) { /* Optionally wait for a debugger to connect. */ prvLoopToWaitForDebugConnection(); /* Init the UART, GPIO, etc. */ prvSetupHardware(); /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top of this file. */ #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 ) { screen_puts( "Running main_blinky().\n" ); main_blinky(); } #else { screen_puts( "Running main_full().\n" ); main_full(); } #endif return 0; }
static void prvQueueReceiveTask( void *pvParameters ) { uint32_t ulReceivedValue; const uint32_t ulExpectedValue = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; for( ;; ) { /* Wait until something arrives in the queue - this task will block indefinitely provided INCLUDE_vTaskSuspend is set to 1 in FreeRTOSConfig.h. */ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY ); /* To get here something must have been received from the queue, but is it the expected value? If it is, print a message. */ if( ulReceivedValue == ulExpectedValue ) { screen_puts( "Receive " ); ulReceivedValue = 0U; } } }
static void prvQueueSendTask( void *pvParameters ) { TickType_t xNextWakeTime; const uint32_t ulValueToSend = 100UL; /* Remove compiler warning about unused parameter. */ ( void ) pvParameters; /* Initialise xNextWakeTime - this only needs to be done once. */ xNextWakeTime = xTaskGetTickCount(); for( ;; ) { /* Place this task in the blocked state until it is time to run again. */ vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS ); screen_puts( "Send " ); /* Send to the queue - causing the queue receive task to unblock and write to the COM port. 0 is used as the block time so the sending operation will not block - it shouldn't need to block as the queue should always be empty at this point in the code. */ xQueueSend( xQueue, &ulValueToSend, 0U ); } }
static void do_intro_line(int row, char_u *mesg, int add_version, int attr) { char_u vers[20]; int col; char_u *p; int l; int clen; #ifdef MODIFIED_BY # define MODBY_LEN 150 char_u modby[MODBY_LEN]; if (*mesg == ' ') { vim_strncpy(modby, (char_u *)_("Modified by "), MODBY_LEN - 1); l = STRLEN(modby); vim_strncpy(modby + l, (char_u *)MODIFIED_BY, MODBY_LEN - l - 1); mesg = modby; } #endif // ifdef MODIFIED_BY // Center the message horizontally. col = vim_strsize(mesg); if (add_version) { STRCPY(vers, mediumVersion); if (highest_patch()) { // Check for 9.9x or 9.9xx, alpha/beta version if (isalpha((int)vers[3])) { int len = (isalpha((int)vers[4])) ? 5 : 4; sprintf((char *)vers + len, ".%d%s", highest_patch(), mediumVersion + len); } else { sprintf((char *)vers + 3, ".%d", highest_patch()); } } col += (int)STRLEN(vers); } col = (Columns - col) / 2; if (col < 0) { col = 0; } // Split up in parts to highlight <> items differently. for (p = mesg; *p != NUL; p += l) { clen = 0; for (l = 0; p[l] != NUL && (l == 0 || (p[l] != '<' && p[l - 1] != '>')); ++l) { if (has_mbyte) { clen += ptr2cells(p + l); l += (*mb_ptr2len)(p + l) - 1; } else { clen += byte2cells(p[l]); } } screen_puts_len(p, l, row, col, *p == '<' ? hl_attr(HLF_8) : attr); col += clen; } // Add the version number to the version line. if (add_version) { screen_puts(vers, row, col, 0); } }
void console_puts(const char *text) { screen_puts(text); }
static void prvClearAssertionLine( void ) { screen_puts( "prvClearAssertionLine()\n" ); }
void screen_putc(int c) { char ch = c; screen_puts(&ch, 1); }
static int screen_put_gbk_helper(const char *buf, size_t len, void *arg) { screen_puts(buf, len); return 0; }
static int _tui_input(int line, int col, const char *prompt, char *buf, int len, int echo, int clear, bool utf8) { extern int RMSG; extern int msg_num; if (clear) buf[0] = '\0'; buf[len - 1] = '\0'; int real_x = prompt ? screen_display_width(prompt, utf8) : 0; int cur, clen; cur = clen = strlen(buf); bool inited = screen_inited(), prompted = false; while (1) { if (inited || !prompted) { screen_move(line, col); clrtoeol(); if (prompt) { if (utf8) screen_printf("%s", prompt); else prints("%s", prompt); } prompted = true; } if (inited) { if (echo) prints("%s", buf); else tui_repeat_char('*', clen); screen_move(line, real_x + cur); } if (RMSG) screen_flush(); int ch = terminal_getchar(); if (RMSG && msg_num == 0) { if (ch == Ctrl('Z') || ch == KEY_UP) { buf[0] = Ctrl('Z'); clen = 1; break; } if (ch == Ctrl('A') || ch == KEY_DOWN) { buf[0] = Ctrl('A'); clen = 1; break; } } if (ch == '\n' || ch == '\r') break; if (!inited) { if (ch == '\x7f' || ch == Ctrl('H')) { int dec = remove_character(buf, &cur, clen, true); if (dec) { clen -= dec; screen_puts("\x8 \x8", 3); } } else if (isprint2(ch) && clen < len - 1) { buf[cur] = ch; buf[++cur] = '\0'; ++clen; screen_putc(echo ? ch : '*'); } continue; } if (ch == '\x7f' || ch == Ctrl('H')) { clen -= remove_character(buf, &cur, clen, true); } else if (ch == KEY_DEL) { clen -= remove_character(buf, &cur, clen, false); } else if (ch == KEY_LEFT) { if (cur > 0) --cur; } else if (ch == KEY_RIGHT) { if (cur < clen) ++cur; } else if (ch == Ctrl('E') || ch == KEY_END) { cur = clen; } else if (ch == Ctrl('A') || ch == KEY_HOME) { cur = 0; } else if (isprint2(ch) && clen < len - 1) { if (buf[cur] != '\0') memmove(buf + cur + 1, buf + cur, clen - cur); buf[cur++] = ch; buf[++clen] = '\0'; } } screen_putc('\n'); screen_flush(); return clen; }