static void textboxDraw(newtComponent c) { int i; struct textbox * tb = c->data; int size; if (tb->sb) { size = tb->numLines - c->height; newtScrollbarSet(tb->sb, tb->topLine, size ? size : 0); tb->sb->ops->draw(tb->sb); } SLsmg_set_color(NEWT_COLORSET_TEXTBOX); for (i = 0; (i + tb->topLine) < tb->numLines && i < c->height; i++) { newtGotorc(c->top + i, c->left); SLsmg_write_string(tb->blankline); newtGotorc(c->top + i, c->left); SLsmg_write_string(tb->lines[i + tb->topLine]); } }
static void cbDraw(newtComponent c) { struct checkbox * cb = c->data; if (!c->isMapped) return; if (cb->flags & NEWT_FLAG_DISABLED) { cb->inactive = NEWT_COLORSET_DISENTRY; cb->active = NEWT_COLORSET_DISENTRY; } else { cb->inactive = COLORSET_CHECKBOX; cb->active = COLORSET_ACTCHECKBOX; } SLsmg_set_color(cb->inactive); newtGotorc(c->top, c->left); switch (cb->type) { case RADIO: SLsmg_write_string("( ) "); break; case CHECK: SLsmg_write_string("[ ] "); break; default: break; } SLsmg_write_string(cb->text); if (cb->hasFocus) SLsmg_set_color(cb->active); newtGotorc(c->top, c->left + 1); SLsmg_write_char(*cb->result); newtGotorc(c->top, c->left + 4); }
int ui__question_window(const char *title, const char *text, const char *exit_msg, int delay_secs) { int x, y; int max_len = 0, nr_lines = 0; const char *t; t = text; while (1) { const char *sep = strchr(t, '\n'); int len; if (sep == NULL) sep = strchr(t, '\0'); len = sep - t; if (max_len < len) max_len = len; ++nr_lines; if (*sep == '\0') break; t = sep + 1; } pthread_mutex_lock(&ui__lock); max_len += 2; nr_lines += 4; y = SLtt_Screen_Rows / 2 - nr_lines / 2, x = SLtt_Screen_Cols / 2 - max_len / 2; SLsmg_set_color(0); SLsmg_draw_box(y, x++, nr_lines, max_len); if (title) { SLsmg_gotorc(y, x + 1); SLsmg_write_string((char *)title); } SLsmg_gotorc(++y, x); nr_lines -= 2; max_len -= 2; SLsmg_write_wrapped_string((unsigned char *)text, y, x, nr_lines, max_len, 1); SLsmg_gotorc(y + nr_lines - 2, x); SLsmg_write_nstring((char *)" ", max_len); SLsmg_gotorc(y + nr_lines - 1, x); SLsmg_write_nstring((char *)exit_msg, max_len); SLsmg_refresh(); pthread_mutex_unlock(&ui__lock); return ui__getch(delay_secs); }
void newtDrawRootText(int col, int row, const char * text) { SLsmg_set_color(NEWT_COLORSET_ROOTTEXT); if (col < 0) { col = SLtt_Screen_Cols + col; } if (row < 0) { row = SLtt_Screen_Rows + row; } SLsmg_gotorc(row, col); SLsmg_write_string((char *)text); }
void printall(int offset) { int n = 0; int i, j; SLsmg_gotorc(0, offset); SLsmg_write_string(" 0 1 2 3 4 5 6 7 8 9 A B C D E F"); for (i = 0; i < 16; i++) { SLsmg_gotorc(i + 1, offset); SLsmg_printf("%x", i); for (j = 0; j < 16; j++) { SLsmg_gotorc(i + 1, (j + 1) * 2 + offset); SLsmg_write_char(n++); } } }
static void buttonDrawText(newtComponent co, int active, int pushed) { struct button * bu = co->data; if (pushed) pushed = 1; if (active) SLsmg_set_color(NEWT_COLORSET_ACTBUTTON); else SLsmg_set_color(NEWT_COLORSET_BUTTON); newtGotorc(co->top + 1 + pushed, co->left + 1 + pushed); SLsmg_write_char(' '); SLsmg_write_string(bu->text); SLsmg_write_char(' '); }
static void do_dialog(char *b) { char *quit = "Quit!"; if (Batch) return; #ifdef FIX_CHAR_WIDTH FIX_CHAR_WIDTH; #endif if (! *b) { if(!SLKeyBoard_Quit) return; b = quit; } if ((b == Error_Buffer) || (b == quit)) { SLsmg_set_color (JERROR_COLOR); touch_screen(); } else SLsmg_set_color (JMESSAGE_COLOR); SLsmg_Newline_Behavior = SLSMG_NEWLINE_PRINTABLE; SLsmg_gotorc (Jed_Num_Screen_Rows - 1, 0); SLsmg_write_string (b); SLsmg_set_color (0); SLsmg_erase_eol (); SLsmg_Newline_Behavior = 0; if ((b == Error_Buffer) || (SLKeyBoard_Quit)) { jed_beep(); flush_input(); } if (*b) { if (MiniBuffer != NULL) { SLsmg_refresh (); (void) input_pending(&Number_Ten); } Mini_Ghost = -1; } else Mini_Ghost = 0; }
static void update_display (void) { unsigned int row, nrows; File_Line_Type *line; /* All well behaved applications should block signals that may affect * the display while performing screen update. */ SLsig_block_signals (); Line_Window.nrows = nrows = SLtt_Screen_Rows - 1; /* Always make the current line equal to the top window line. */ if (Line_Window.top_window_line != NULL) Line_Window.current_line = Line_Window.top_window_line; SLscroll_find_top (&Line_Window); row = 0; line = (File_Line_Type *) Line_Window.top_window_line; SLsmg_normal_video (); while (row < Line_Window.nrows) { SLsmg_gotorc (row, 0); if (line != NULL) { SLsmg_write_string (line->data); line = line->next; } SLsmg_erase_eol (); row++; } SLsmg_gotorc (row, 0); SLsmg_reverse_video (); SLsmg_printf ("%s | UTF-8 = %d", (File_Name == NULL) ? "<stdin>" : File_Name, SLutf8_is_utf8_mode ()); SLsmg_erase_eol (); SLsmg_refresh (); SLsig_unblock_signals (); }
void newtRedrawHelpLine(void) { char * buf; SLsmg_set_color(NEWT_COLORSET_HELPLINE); buf = alloca(SLtt_Screen_Cols + 1); memset(buf, ' ', SLtt_Screen_Cols); buf[SLtt_Screen_Cols] = '\0'; if (currentHelpline) { int len = strlen(*currentHelpline); if (SLtt_Screen_Cols < len) len = SLtt_Screen_Cols; memcpy(buf, *currentHelpline, len); } SLsmg_gotorc(SLtt_Screen_Rows - 1, 0); SLsmg_write_string(buf); }
static void update_top_screen_line (void) { #if JED_HAS_MENUS if (Jed_Menus_Active || (Top_Window_SY > 0)) { jed_redraw_menus (); return; } #else if (Top_Window_SY == 0) return; SLsmg_gotorc (0,0); SLsmg_set_color (JMENU_COLOR); SLsmg_write_string (Top_Screen_Line_Buffer); SLsmg_erase_eol (); JScreen[0].is_modified = 0; #endif }
static void slang_write_utf32(uint32_t ch) { #ifdef HAVE_SLSMG_UTF8_ENABLE char buf[10]; int bytes; #else char ascii; #endif if(ch == CACA_MAGIC_FULLWIDTH) return; #ifdef HAVE_SLSMG_UTF8_ENABLE bytes = caca_utf32_to_utf8(buf, ch); buf[bytes] = '\0'; SLsmg_write_string(buf); #else ascii = caca_utf32_to_ascii(ch); SLsmg_write_char(ascii); if(caca_utf32_is_fullwidth(ch)) SLsmg_write_char(ascii); #endif }
static int cmsg(int type, int verbosity_level, char *fmt, ...) { va_list ap; char p[1000]; if ((type==CMSG_TEXT || type==CMSG_INFO || type==CMSG_WARNING) && ctl.verbosity<verbosity_level) return 0; va_start(ap, fmt); if (!ctl.opened) { vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); } else if (ctl.trace_playing) { switch(type) { /* Pretty pointless to only have one line for messages, but... */ case CMSG_WARNING: case CMSG_ERROR: case CMSG_FATAL: SLsmg_gotorc(2,0); SLsmg_erase_eol(); SLsmg_bold(); vsnprintf(p, sizeof(p), fmt, ap); SLsmg_write_string(p); SLsmg_normal(); _ctl_refresh(); if (type==CMSG_WARNING) sleep(1); /* Don't you just _HATE_ it when programs do this... */ else sleep(2); SLsmg_gotorc(2,0); SLsmg_erase_eol(); _ctl_refresh(); break; } } else { SLsmg_gotorc(msg_row++,0); if(msg_row==SLtt_Screen_Rows){ int i; msg_row=6; for(i=6;i<=SLtt_Screen_Rows;i++){ SLsmg_gotorc(i,0); SLsmg_erase_eol(); } } switch(type) { default: vsnprintf(p, sizeof(p), fmt, ap); SLsmg_write_string(p); _ctl_refresh(); break; case CMSG_WARNING: SLsmg_bold(); vsnprintf(p, sizeof(p), fmt, ap); SLsmg_write_string(p); SLsmg_normal(); _ctl_refresh(); break; case CMSG_ERROR: case CMSG_FATAL: SLsmg_bold(); vsnprintf(p, sizeof(p), fmt, ap); SLsmg_write_string(p); SLsmg_normal(); _ctl_refresh(); if (type==CMSG_FATAL) sleep(2); break; } } va_end(ap); return 0; }
static int update_status_line (int col_flag) { unsigned char star0, star1; char buf[32], *b; int num; if (IN_MINI_WINDOW) return 0; SLsmg_gotorc (JWindow->rows + JWindow->sy, 0); SLsmg_set_color (JSTATUS_COLOR); b = buf; if (JWindow->hscroll_column != 1) *b++ = '<'; else *b++ = '-'; if (CBuf->flags & BUFFER_MODIFIED) star0 = star1 = '*'; else star0 = star1 = '-'; if ((CBuf->flags & READ_ONLY) #if JED_HAS_LINE_ATTRIBUTES || (CLine->flags & JED_LINE_IS_READONLY) #endif ) star0 = star1 = '%'; #if JED_HAS_SUBPROCESSES if (CBuf->subprocess) star1 = 'S'; #endif *b++ = star0; *b++ = star1; if (CBuf->marks != NULL) *b++ = 'm'; else *b++ = '-'; if (CBuf->flags & FILE_MODIFIED) *b++ = 'd'; else *b++ = '-'; if (CBuf->spots != NULL) *b++ = 's'; else *b++ = '-'; if (CBuf->flags & BINARY_FILE) *b++ = 'B'; #ifdef IBMPC_SYSTEM else if ((CBuf->flags & ADD_CR_ON_WRITE_FLAG) == 0) *b++ = 'L'; #else # ifdef __unix__ else if (CBuf->flags & ADD_CR_ON_WRITE_FLAG) *b++ = 'C'; # endif #endif else *b++ = '-'; if (CBuf->flags & UNDO_ENABLED) *b++ = '+'; else *b++ = '-'; SLsmg_write_nchars (buf, (unsigned int) (b - buf)); finish_status (col_flag); if (Defining_Keyboard_Macro) SLsmg_write_string (" [Macro]"); num = Jed_Num_Screen_Cols - SLsmg_get_column (); star1 = '-'; while (num > 0) { SLsmg_write_nchars ((char *) &star1, 1); num--; } SLsmg_set_color (0); Point_Cursor_Flag = 1; return 1; }
static int sl_output(int port, char *buf, int len) { int x,y,z,v,w; char *str, *t1, *t2, *t3; int ret; char ch; /* check for signals */ if (signal_cought != 0) { /* async out signal */ char xxx[5]; xxx[0] = 0; put_int32(signal_cought, xxx+1); driver_output(port, xxx, 5); signal_cought = 0; } switch (*buf++) { case INIT_TTY: { int abort_char, flow_ctl, opost; abort_char = get_int32(buf); buf+=4; flow_ctl = get_int32(buf); buf+= 4; opost = get_int32(buf); buf+= 4; ret = SLang_init_tty (abort_char,flow_ctl, opost); return ret_int(port, ret); } case SET_ABORT_FUNCTION: { SLang_set_abort_signal (NULL); return ret_int(port, 0); } case GETKEY: { unsigned int key; if (SLang_input_pending (0) == 0) { wait_for = GETKEY; driver_select(port, 0, DO_READ, 1); return 0; } x = SLang_getkey (); return ret_int(port, x); } /* read a symbol */ case KP_GETKEY: { if (SLang_input_pending (0) == 0) { wait_for = KP_GETKEY; driver_select(port, 0, DO_READ, 1); return 0; } x = SLkp_getkey (); return ret_int(port, x); } case UNGETKEY: { unsigned char key = (unsigned char) *buf; SLang_ungetkey (key); return 0; } case RESET_TTY: { SLang_reset_tty(); return 0; } case KP_INIT: { return ret_int(port, SLkp_init ()); } case SETVAR: { x = get_int32(buf);buf+= 4; y = get_int32(buf); switch (x) { case esl_baud_rate: SLang_TT_Baud_Rate = y; return 0; case esl_read_fd: return 0; case esl_abort_char: SLang_Abort_Char = y; return 0; case esl_ignore_user_abort: SLang_Ignore_User_Abort=y; return 0; case esl_input_buffer_len : SLang_Input_Buffer_Len=y; return 0; case esl_keyboard_quit: SLKeyBoard_Quit=y; return 0; case esl_last_key_char: SLang_Last_Key_Char=y; return 0; case esl_rl_eof_char: SLang_RL_EOF_Char=y; return 0; case esl_rline_quit: SLang_Rline_Quit=y; return 0; case esl_screen_rows: case esl_screen_cols : return 0; case esl_tab_width: SLsmg_Tab_Width=y; return 0; case esl_newline_behaviour: SLsmg_Newline_Behavior=y; return 0; case esl_error: SLang_Error=y; return 0; case esl_version: return 0; case esl_backspace_moves : SLsmg_Backspace_Moves=y; return 0; case esl_display_eight_bit: SLsmg_Display_Eight_Bit=y; return 0; default: return 0; } } case GETVAR: { x = get_int32(buf); switch (x) { case esl_baud_rate: return ret_int(port, SLang_TT_Baud_Rate); case esl_read_fd: return ret_int(port, SLang_TT_Read_FD); case esl_abort_char: return (ret_int(port, SLang_Abort_Char)); case esl_ignore_user_abort: return ret_int(port, SLang_Ignore_User_Abort); case esl_input_buffer_len : return ret_int(port, SLang_Input_Buffer_Len); case esl_keyboard_quit: return ret_int(port, SLKeyBoard_Quit); case esl_last_key_char: return ret_int(port, SLang_Last_Key_Char); case esl_rl_eof_char: return ret_int(port, SLang_RL_EOF_Char); case esl_rline_quit: return ret_int(port, SLang_Rline_Quit); case esl_screen_rows: return ret_int(port, SLtt_Screen_Rows); case esl_screen_cols : return ret_int(port, SLtt_Screen_Cols); case esl_tab_width: return ret_int(port, SLsmg_Tab_Width); case esl_newline_behaviour: return ret_int(port, SLsmg_Newline_Behavior); case esl_error: return ret_int(port, SLang_Error); case esl_version: return ret_int(port, SLang_Version); case esl_backspace_moves : return ret_int(port, SLsmg_Backspace_Moves); case esl_display_eight_bit: return ret_int(port, SLsmg_Display_Eight_Bit); default: return ret_int(port, -1); } } /*{{{ SLsmg Screen Management Functions */ case SMG_FILL_REGION: { x = get_int32(buf); buf+= 4; y = get_int32(buf); buf+= 4; z = get_int32(buf); buf+= 4; v = get_int32(buf); buf+= 4; ch = *buf; SLsmg_fill_region(x, y,z,v,ch); return 0; } case SMG_SET_CHAR_SET: { x = get_int32(buf); buf+= 4; SLsmg_set_char_set(x); return 0; } case SMG_SUSPEND_SMG: { return ret_int(port, SLsmg_suspend_smg()); } case SMG_RESUME_SMG: { ret_int(port, SLsmg_resume_smg()); } case SMG_ERASE_EOL: { SLsmg_erase_eol(); return 0; } case SMG_GOTORC: { x = get_int32(buf); buf+= 4; y = get_int32(buf); buf+= 4; SLsmg_gotorc(x, y); return 0; } case SMG_ERASE_EOS: { SLsmg_erase_eos(); return 0; } case SMG_REVERSE_VIDEO: { SLsmg_reverse_video(); return 0; } case SMG_SET_COLOR: { x = get_int32(buf); buf+= 4; SLsmg_set_color(x); return 0; } case SMG_NORMAL_VIDEO: { SLsmg_normal_video(); return 0; } case SMG_WRITE_STRING: { SLsmg_write_string(buf); return 0; } case SMG_WRITE_CHAR: { ch = *buf; SLsmg_write_char(ch); return 0; } case SMG_WRITE_WRAPPED_STRING: { t1 = buf; buf += strlen(t1) + 1; x = get_int32(buf); buf+= 4; y = get_int32(buf); buf+= 4; z = get_int32(buf); buf+= 4; v = get_int32(buf); buf+= 4; w = get_int32(buf); buf+= 4; SLsmg_write_wrapped_string(t1, x,y,z,v,w); return 0; } case SMG_CLS: { SLsmg_cls(); return 0; } case SMG_REFRESH: { SLsmg_refresh(); return 0; } case SMG_TOUCH_LINES: { x = get_int32(buf); buf+= 4; y = get_int32(buf); buf+= 4; SLsmg_touch_lines(x, y); return 0; } case SMG_TOUCH_SCREEN: { #if (SLANG_VERSION < 10400 ) return ret_int(port, -1); #else SLsmg_touch_screen(); #endif return 0; } case SMG_INIT_SMG: { return ret_int(port, SLsmg_init_smg()); } case SMG_REINIT_SMG: { #if (SLANG_VERSION < 10400 ) return ret_int(port, -1); #else return ret_int(port, SLsmg_reinit_smg()); #endif } case SMG_RESET_SMG: { SLsmg_reset_smg(); return 0; } case SMG_CHAR_AT: { return ret_int(port, SLsmg_char_at()); } case SMG_SET_SCREEN_START: { int *ip1, *ip2; *ip1 = get_int32(buf); buf+= 4; *ip2 = get_int32(buf); buf+= 4; SLsmg_set_screen_start(ip1, ip2); return ret_int_int(port, *ip1, *ip2); } case SMG_DRAW_HLINE: { x = get_int32(buf); buf+= 4; SLsmg_draw_hline(x); return 0; } case SMG_DRAW_VLINE: { x = get_int32(buf); buf+= 4; SLsmg_draw_vline(x); return 0; } case SMG_DRAW_OBJECT: { x = get_int32(buf); buf+= 4; y = get_int32(buf); buf+= 4; x = get_int32(buf); buf+= 4; SLsmg_draw_object(x, y,z); return 0; } case SMG_DRAW_BOX: { x = get_int32(buf); buf+= 4; y = get_int32(buf); buf+= 4; z = get_int32(buf); buf+= 4; v = get_int32(buf); buf+= 4; SLsmg_draw_box(x, y,z,v); return 0; } case SMG_GET_COLUMN: { return ret_int(port, SLsmg_get_column()); } case SMG_GET_ROW: { return ret_int(port, SLsmg_get_row()); } case SMG_FORWARD: { x = get_int32(buf); buf+= 4; SLsmg_forward(x); return 0; } case SMG_WRITE_COLOR_CHARS: { SLsmg_Char_Type * sl; sl = decode_smg_char_type(&buf); x = get_int32(buf); buf+= 4; SLsmg_write_color_chars(sl, x); return 0; } case SMG_READ_RAW: { x = get_int32(buf); buf+= 4; t1 = malloc((2*x) + 2 + 1); y = SLsmg_read_raw((unsigned short*)t1 +1, x); t1[1] = 1; driver_output(port, t1, y+1); free(t1); return 0; } case SMG_WRITE_RAW: { SLsmg_Char_Type * sl; sl = decode_smg_char_type(&buf); x = get_int32(buf); y = SLsmg_write_raw(sl, x); return ret_int(port, y); } case SMG_SET_COLOR_IN_REGION: { x = get_int32(buf); buf+= 4; y = get_int32(buf); buf+= 4; z = get_int32(buf); buf+= 4; v = get_int32(buf); buf+= 4; w = get_int32(buf); buf+= 4; SLsmg_set_color_in_region(x, y,z,v,w); return 0; } /* all the tt_functions */ case TT_FLUSH_OUTPUT: { ret = SLtt_flush_output(); return ret_int(port, ret); } case TT_SET_SCROLL_REGION: { x = get_int32(buf); buf+=4; y = get_int32(buf); buf+=4; SLtt_set_scroll_region(x, y); return 0; } case TT_RESET_SCROLL_REGION: { SLtt_reset_scroll_region(); return 0; } case TT_REVERSE_VIDEO: { SLtt_reverse_video (get_int32(buf)); return 0; } case TT_BOLD_VIDEO: { SLtt_begin_insert(); return 0; } case TT_BEGIN_INSERT: { SLtt_begin_insert(); return 0; } case TT_END_INSERT: { SLtt_end_insert(); return 0; } case TT_DEL_EOL: { SLtt_del_eol(); return 0; } case TT_GOTO_RC: { x = get_int32(buf); buf+=4; y = get_int32(buf); buf+=4; SLtt_goto_rc (x, y); return 0; } case TT_DELETE_NLINES: { SLtt_delete_nlines(get_int32(buf)); return 0; } case TT_DELETE_CHAR: { SLtt_delete_char(); return 0; } case TT_ERASE_LINE: { SLtt_erase_line(); return 0; } case TT_NORMAL_VIDEO: { SLtt_normal_video(); return 0; } case TT_CLS: { SLtt_cls(); return 0; } case TT_BEEP: { SLtt_beep(); return 0; } case TT_REVERSE_INDEX: { SLtt_reverse_index(get_int32(buf)); return 0; } case TT_SMART_PUTS: { SLsmg_Char_Type *t1 ; SLsmg_Char_Type *t2; t1 = decode_smg_char_type(&buf); t2 = decode_smg_char_type(&buf); x = get_int32(buf); buf+=4; y = get_int32(buf); buf+=4; SLtt_smart_puts(t1, t2,x,y); return 0; } case TT_WRITE_STRING: { SLtt_write_string (buf); return 0; } case TT_PUTCHAR: { SLtt_putchar((char) get_int32(buf)); return 0; } case TT_INIT_VIDEO: { ret = SLtt_init_video (); return ret_int(port, ret); } case TT_RESET_VIDEO: { SLtt_reset_video (); return 0; } case TT_GET_TERMINFO: { SLtt_get_terminfo(); return 0; } case TT_GET_SCREEN_SIZE: { SLtt_get_screen_size (); return 0; } case TT_SET_CURSOR_VISIBILITY: { ret = SLtt_set_cursor_visibility (get_int32(buf)); return ret_int(port, ret); } case TT_SET_MOUSE_MODE: { x = get_int32(buf); buf+=4; y = get_int32(buf); buf+=4; ret = SLtt_set_mouse_mode (x,y); return ret_int(port, ret); } case TT_INITIALIZE: { ret =SLtt_initialize (buf); return ret_int(port, ret); } case TT_ENABLE_CURSOR_KEYS: { SLtt_enable_cursor_keys(); return 0; } case TT_SET_TERM_VTXXX: { return 0; } case TT_SET_COLOR_ESC: { x = get_int32(buf); buf+=4; SLtt_set_color_esc (x, buf); return 0; } case TT_WIDE_WIDTH: { SLtt_narrow_width(); return 0; } case TT_NARROW_WIDTH: { SLtt_narrow_width(); return 0; } case TT_SET_ALT_CHAR_SET: { SLtt_set_alt_char_set (get_int32(buf)); return 0; } case TT_WRITE_TO_STATUS_LINE: { x = get_int32(buf); buf+=4; SLtt_write_to_status_line (buf, x); return 0; } case TT_DISABLE_STATUS_LINE: { SLtt_disable_status_line (); return 0; } case TT_TGETSTR: { str = SLtt_tgetstr (buf); return ret_string(port, str); } case TT_TGETNUM: { x = SLtt_tgetnum (buf); return ret_int(port, x); } case TT_TGETFLAG: { x = SLtt_tgetflag (buf); return ret_int(port, x); } case TT_TIGETENT: { str = SLtt_tigetent (buf); return ret_string(port, str); } case TT_TIGETSTR: { return 0; } case TT_TIGETNUM: { return 0; } case SLTT_GET_COLOR_OBJECT: { x = get_int32(buf); buf+=4; y = SLtt_get_color_object (x); return ret_int(port, y); return 0; } case TT_SET_COLOR_OBJECT: { x = get_int32(buf); buf+=4; y = get_int32(buf); buf+=4; SLtt_set_color_object (x, y); return 0; } case TT_SET_COLOR: { x = get_int32(buf); buf+=4; t1 = buf; t2 = buf + (strlen(t1) + 1); t3 = buf + (strlen(t1) + strlen(t2) + 2); SLtt_set_color (x, t1, t2, t3); return 0; } case TT_SET_MONO: { x = get_int32(buf); buf+=4; t1 = buf; buf += strlen(t1) + 1; y = get_int32(buf); SLtt_set_mono (x, t1, y); return 0; } case TT_ADD_COLOR_ATTRIBUTE: { x = get_int32(buf); buf+=4; y = get_int32(buf); buf+=4; SLtt_add_color_attribute (x, y); return 0; } case TT_SET_COLOR_FGBG: { x = get_int32(buf); buf+=4; y = get_int32(buf); buf+=4; z = get_int32(buf); buf+=4; SLtt_set_color_fgbg (x, y, z); return 0; } case ISATTY: { x = get_int32(buf); buf+=4; return ret_int(port, isatty(x)); } case EFORMAT: { fprintf(stderr, "%s", buf); fflush(stderr); return 0; } case SIGNAL: { x = get_int32(buf); buf+=4; SLsignal(x_to_sig(x), sig_handler); return 0; } case SIGNAL_CHECK: { /* polled */ if (signal_cought != 0) signal_cought = 0; return ret_int(port, signal_cought); } default: return 0; } }
static void display_line_numbers (void) { unsigned int i, imin, imax, linenum; Line *line_start, *line; char buf[32]; unsigned int c; imin = JWindow->sy; imax = imin + JWindow->rows; line = NULL; for (i = imin; i < imax; i++) { if (JScreen[i].line != CLine) continue; line = JScreen[i].line; break; } if (line == NULL) return; /* ??? */ line_start = JScreen[imin].line; linenum = LineNum + CBuf->nup; while (line != line_start) { if (line == NULL) return; /* ??? */ linenum--; line = line->prev; } SLsmg_set_color (JLINENUM_COLOR); c = JWindow->sx; for (i = imin; i < imax; i++) { line_start = JScreen[i].line; if (line_start == NULL) break; while (line != line_start) { if (line == NULL) return; /* ??? */ linenum++; line = line->next; } SLsmg_gotorc (i, c); sprintf (buf, "%*u ", CBuf->line_num_display_size-1, linenum); SLsmg_write_string (buf); line = line->next; linenum++; } if (i < imax) { memset (buf, ' ', CBuf->line_num_display_size); buf[CBuf->line_num_display_size] = 0; while (i < imax) { SLsmg_gotorc (i, c); SLsmg_write_string (buf); i++; } } SLsmg_set_color (0); }
static void finish_status(int col_flag) { char *v, ch; Line *l; int top, rows, narrows; char buf[256]; char *str; v = CBuf->status_line; if (*v == 0) v = Default_Status_Line; while (1) { char *v0 = v; while (1) { ch = *v; if (ch == 0) { SLsmg_write_nchars (v0, (unsigned int) (v-v0)); return; } if (ch == '%') { SLsmg_write_nchars (v0, (unsigned int) (v-v0)); break; } v++; } /* At this point *v == '%' */ v++; ch = *v++; switch (ch) { case 'F': SLsmg_write_string (CBuf->dir); str = CBuf->file; break; case 'S': /* stack depth */ sprintf(buf, "%03d", SLstack_depth()); str = buf; break; case 'a': if (CBuf->flags & ABBREV_MODE) str = " abbrev"; else str = NULL; break; case 'f': str = CBuf->file; break; case 'n': narrows = jed_count_narrows (); if (narrows) { sprintf (buf, " Narrow[%d]", narrows); str = buf; } else str = NULL; break; case 'o': if (CBuf->flags & OVERWRITE_MODE) str = " Ovwrt"; else str = NULL; break; case 'O': if (CBuf->flags & OVERWRITE_MODE) str = " ovr"; else str = " ins"; break; case 'b': str = CBuf->name; break; case 'p': str = buf; if (0 == User_Prefers_Line_Numbers) { top = JWindow->sy; rows = JWindow->rows - 1; l = JScreen[top + rows].line; if (l == CBuf->end) l = NULL; if (JScreen[top].line == CBuf->beg) { if (l == NULL) str = "All"; else str = "Top"; } else if (l == NULL) str = "Bot"; else { sprintf(buf, "%d%%", (int) ((LineNum * 100L) / (long) Max_LineNum)); } } else { if (User_Prefers_Line_Numbers == 1) sprintf(buf, "%u/%u", LineNum, Max_LineNum); else { if (col_flag) (void) calculate_column (); sprintf(buf, "%u/%u,%d", LineNum, Max_LineNum, Absolute_Column); } } break; case 'l': sprintf(buf, "%u", LineNum); str=buf; break; case 'L': sprintf(buf, "%u", Max_LineNum); str=buf; break; case 'v': SLsmg_write_string (Jed_Version_String); if (Jed_UTF8_Mode) str = "U"; else str = NULL; break; case 'm': str = CBuf->mode_string; break; case 't': str = status_get_time(); break; case 'c': if (col_flag) (void) calculate_column (); sprintf(buf, "%d", Absolute_Column); str = buf; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { char fmt[16]; int num = ch - '0'; while (isdigit(*v)) { num = num * 10 + (*v - '0'); v++; } if ((num < 0) || (-1 == SLsnprintf (fmt, sizeof(fmt), "%s%du", ((ch == '0') ? "%0" : "%"), num))) strcpy (fmt, "%u"); str = "*"; switch (*v++) { default: v--; break; case 'c': if (col_flag) (void) calculate_column (); if (-1 != SLsnprintf (buf, sizeof (buf), fmt, (unsigned int)Absolute_Column)) str = buf; break; case 'l': if (-1 != SLsnprintf (buf, sizeof (buf), fmt, LineNum)) str = buf; break; case 'L': if (-1 != SLsnprintf (buf, sizeof (buf), fmt, Max_LineNum)) str = buf; break; } } break; case '%': str = "%"; break; case 0: return; default: str = NULL; } if (str != NULL) SLsmg_write_string (str); } }
int ui__popup_menu(int argc, char * const argv[]) { struct ui_browser menu = { .entries = (void *)argv, .refresh = ui_browser__argv_refresh, .seek = ui_browser__argv_seek, .write = ui_browser__argv_write, .nr_entries = argc, }; return popup_menu__run(&menu); } int ui_browser__input_window(const char *title, const char *text, char *input, const char *exit_msg, int delay_secs) { int x, y, len, key; int max_len = 60, nr_lines = 0; static char buf[50]; const char *t; t = text; while (1) { const char *sep = strchr(t, '\n'); if (sep == NULL) sep = strchr(t, '\0'); len = sep - t; if (max_len < len) max_len = len; ++nr_lines; if (*sep == '\0') break; t = sep + 1; } pthread_mutex_lock(&ui__lock); max_len += 2; nr_lines += 8; y = SLtt_Screen_Rows / 2 - nr_lines / 2; x = SLtt_Screen_Cols / 2 - max_len / 2; SLsmg_set_color(0); SLsmg_draw_box(y, x++, nr_lines, max_len); if (title) { SLsmg_gotorc(y, x + 1); SLsmg_write_string((char *)title); } SLsmg_gotorc(++y, x); nr_lines -= 7; max_len -= 2; SLsmg_write_wrapped_string((unsigned char *)text, y, x, nr_lines, max_len, 1); y += nr_lines; len = 5; while (len--) { SLsmg_gotorc(y + len - 1, x); SLsmg_write_nstring((char *)" ", max_len); } SLsmg_draw_box(y++, x + 1, 3, max_len - 2); SLsmg_gotorc(y + 3, x); SLsmg_write_nstring((char *)exit_msg, max_len); SLsmg_refresh(); pthread_mutex_unlock(&ui__lock); x += 2; len = 0; key = ui__getch(delay_secs); while (key != K_TIMER && key != K_ENTER && key != K_ESC) { pthread_mutex_lock(&ui__lock); if (key == K_BKSPC) { if (len == 0) { pthread_mutex_unlock(&ui__lock); goto next_key; } SLsmg_gotorc(y, x + --len); SLsmg_write_char(' '); } else { buf[len] = key; SLsmg_gotorc(y, x + len++); SLsmg_write_char(key); } SLsmg_refresh(); pthread_mutex_unlock(&ui__lock); /* XXX more graceful overflow handling needed */ if (len == sizeof(buf) - 1) { ui_helpline__push("maximum size of symbol name reached!"); key = K_ENTER; break; } next_key: key = ui__getch(delay_secs); } buf[len] = '\0'; strncpy(input, buf, len+1); return key; }
/** * Open a new window. * @param left. int Size; _not_ including border * @param top: int size, _not_ including border * @param width unsigned int * @param height unsigned int * @param title - title string * @return zero on success */ int newtOpenWindow(int left, int top, unsigned int width, unsigned int height, const char * title) { int j, row, col; int n; int i; newtFlushInput(); if (currentWindow && currentWindow - windowStack + 1 >= sizeof (windowStack) / sizeof (struct Window)) return 1; if (!currentWindow) { currentWindow = windowStack; } else { currentWindow++; } currentWindow->left = left; currentWindow->top = top; currentWindow->width = width; currentWindow->height = height; currentWindow->title = title ? strdup(title) : NULL; currentWindow->buffer = malloc(sizeof(SLsmg_Char_Type) * (width + 5) * (height + 3)); row = top - 1; col = left - 2; /* clip to the current screen bounds - msw */ if (row < 0) row = 0; if (col < 0) col = 0; if (left + width > SLtt_Screen_Cols) width = SLtt_Screen_Cols - left; if (top + height > SLtt_Screen_Rows) height = SLtt_Screen_Rows - top; n = 0; for (j = 0; j < height + 3; j++, row++) { SLsmg_gotorc(row, col); SLsmg_read_raw(currentWindow->buffer + n, currentWindow->width + 5); n += currentWindow->width + 5; } newtTrashScreen(); SLsmg_set_color(NEWT_COLORSET_BORDER); SLsmg_set_char_set(1); SLsmg_draw_box(top - 1, left - 1, height + 2, width + 2); SLsmg_set_char_set(0); if (currentWindow->title) { trim_string (currentWindow->title, width-4); i = wstrlen(currentWindow->title,-1) + 4; i = ((width - i) / 2) + left; SLsmg_gotorc(top - 1, i); SLsmg_set_char_set(1); SLsmg_write_char(SLSMG_RTEE_CHAR); SLsmg_set_char_set(0); SLsmg_write_char(' '); SLsmg_set_color(NEWT_COLORSET_TITLE); SLsmg_write_string((char *)currentWindow->title); SLsmg_set_color(NEWT_COLORSET_BORDER); SLsmg_write_char(' '); SLsmg_set_char_set(1); SLsmg_write_char(SLSMG_LTEE_CHAR); SLsmg_set_char_set(0); } SLsmg_set_color(NEWT_COLORSET_WINDOW); SLsmg_fill_region(top, left, height, width, ' '); SLsmg_set_color(NEWT_COLORSET_SHADOW); SLsmg_fill_region(top + height + 1, left, 1, width + 2, ' '); SLsmg_fill_region(top, left + width + 1, height + 1, 1, ' '); for (i = top; i < (top + height + 1); i++) { SLsmg_gotorc(i, left + width + 1); SLsmg_write_string(" "); } return 0; }
static void display_line (Line *line, int sy, int sx) { unsigned int len; int hscroll_col; int is_mini; Screen_Type *s; #if JED_HAS_LINE_MARKS Mark *line_marks; #endif int num_columns; int color_set; SLsmg_Tab_Width = Buffer_Local.tab; (void) SLsmg_embedded_escape_mode (CBuf->flags & SMG_EMBEDDED_ESCAPE); is_mini = (sy + 1 == Jed_Num_Screen_Rows); SLsmg_gotorc (sy, sx); SLsmg_set_color (0); s = JScreen + sy; s->line = line; s->is_modified = 0; if (line == NULL) { SLsmg_erase_eol (); return; } hscroll_col = JWindow->hscroll_column - 1; if ((line == HScroll_Line) && Wants_HScroll && HScroll) hscroll_col += HScroll; num_columns = JWindow->width; if (hscroll_col || sx #if JED_HAS_DISPLAY_LINE_NUMBERS || (CBuf->line_num_display_size) #endif ) { int tmp = hscroll_col - sx; #if JED_HAS_DISPLAY_LINE_NUMBERS tmp -= CBuf->line_num_display_size; num_columns -= CBuf->line_num_display_size; #endif SLsmg_set_screen_start (NULL, &tmp); sx = 0; } len = line->len; if (is_mini) { SLsmg_Newline_Behavior = SLSMG_NEWLINE_PRINTABLE; SLsmg_write_string ((char *)Mini_Info.prompt); } else { SLsmg_Newline_Behavior = 0; if (len && (line->data[len - 1] == '\n')) len--; } color_set = 0; #if JED_HAS_LINE_ATTRIBUTES if (line->flags & JED_LINE_COLOR_BITS) { SLsmg_set_color (JED_GET_LINE_COLOR(line)); color_set = 1; } #endif #if JED_HAS_LINE_MARKS line_marks = CBuf->user_marks; if (color_set == 0) while (line_marks != NULL) { if ((line_marks->line == line) && (line_marks->flags & JED_LINE_MARK)) { SLsmg_set_color (line_marks->flags & MARK_COLOR_MASK); color_set = 1; break; } line_marks = line_marks->next; } #endif if (len) { if ((color_set == 0) && Mode_Has_Syntax_Highlight && (line != &Eob_Line) #if !defined(IBMPC_SYSTEM) && (*tt_Use_Ansi_Colors && Term_Supports_Color) #endif && Wants_Syntax_Highlight) write_syntax_highlight (sy, line, len); else { if ((is_mini == 0) && Jed_Highlight_WS & HIGHLIGHT_WS_TRAILING) { unsigned char *pmin = line->data; unsigned char *pmax = pmin + len; unsigned char *p = pmax; while (p > pmin) { p--; if ((*p != ' ') && (*p != '\t')) { p++; break; } } SLsmg_write_nchars ((char *)pmin, p - pmin); if (p != pmax) { SLsmg_set_color (JTWS_COLOR); SLsmg_write_nchars ((char *)p, pmax - p); SLsmg_set_color (0); } } else SLsmg_write_nchars ((char *)line->data, len); } } #if JED_HAS_LINE_ATTRIBUTES if ((line->next != NULL) && (line->next->flags & JED_LINE_HIDDEN)) { SLsmg_set_color (JDOTS_COLOR); SLsmg_write_string ("..."); SLsmg_set_color (0); } #endif SLsmg_erase_eol (); if (Jed_Dollar) { char dollar = (char) Jed_Dollar; if (hscroll_col + num_columns <= SLsmg_get_column ()) { SLsmg_gotorc (sy, hscroll_col + num_columns - 1); SLsmg_set_color (JDOLLAR_COLOR); SLsmg_write_nchars (&dollar, 1); } if (hscroll_col) { SLsmg_gotorc (sy, hscroll_col); SLsmg_set_color (JDOLLAR_COLOR); SLsmg_write_nchars (&dollar, 1); } } if ((s->hi0 != NULL) && Wants_Attributes) { int c; len = (int) (s->hi1 - s->hi0); if (len && (s->hi0[len - 1] == '\n')) len--; if (len) { c = jed_compute_effective_length (line->data, s->hi0); if (is_mini) c += Mini_Info.effective_prompt_len; SLsmg_gotorc (sy, c); SLsmg_set_color (JREGION_COLOR); SLsmg_write_nchars ((char *)s->hi0, len); } } /* if (hscroll_col + sx) */ SLsmg_set_screen_start (NULL, NULL); SLsmg_set_color (0); }
int main() { int i, j, k, screenHeight, screenWidth; int input; unsigned int ch; char *boundString; int ch2; char inputBuffer[40]; int terminalIndex, fdMax; fd_set fileDescriptors; struct timespec timeout; //struct tesiObject *to; struct virtualTerminal *vt; for(i = 0; i < 10; i++) virtualTerminals[i] = NULL; fdMax = 0; timeout.tv_sec = 0; timeout.tv_nsec = 50000000; // 10E-9 #ifdef USE_NCURSES ncursesScreen = initscr(); if(ncursesScreen == NULL) { perror("Error initializing nCurses\n"); exit(1); } if(has_colors()) { start_color(); #ifdef DEBUG fprintf(stderr, "max colors: %d\n", COLORS); fprintf(stderr, "max color pairs: %d\n", COLOR_PAIRS); #endif k = 1; for(i = 0; i < COLORS; i++) { for(j = 0; j < COLORS; j++) { vt_colors[i][j] = k; init_pair(k, i, j); k++; } } //init all color pairs /* * black red green yellow blue magenta cyan white * attributes 30-37 * in iterm, black starts at 1 * */ } keypad(ncursesScreen, true); // cause nCurses to package key combos into special, single values nodelay(ncursesScreen, TRUE); // return immediately if no input is waiting raw(); noecho(); // don't echo input refresh(); // clear the main window // Get main window dimensions. This will be used when creating additional virtual terminals getmaxyx(ncursesScreen, screenHeight, screenWidth); #endif inputBuffer[0] = 0; mvwaddstr(ncursesScreen, screenHeight - 1, 0, ":"); mvwaddstr(ncursesScreen, 1, 0, "USING KNOX\n\nCommands\n\t\"create\" - creates a new Virtual Terminal\n\t\"create #\" - create # number of new Virtual Terminals\n\t\"NUMBER\" - sets focus to so numbered terminal\n\t\"NUMBER COMMAND\" - sends COMMAND to numbered terminal followed by newline"); wmove(ncursesScreen, screenHeight - 1, 1); terminalIndex = -1; keepRunning = 1; k = 0; while(keepRunning) { FD_ZERO(&fileDescriptors); for(i = 0; i < 10; i++) { //if(vtGet(i) != NULL && tesi_handleInput(vtGet(i))) { vt = vtGet(i); if(vt && vt->fd != -1) { if(vt->fd > fdMax) fdMax = vt->fd; FD_SET(vt->fd, &fileDescriptors); } } pselect(fdMax + 1, &fileDescriptors, NULL, NULL, &timeout, NULL); j = 0; for(i = 0; i < 10; i++) { //if(vtGet(i) != NULL && tesi_handleInput(vtGet(i))) { vt = vtGet(i); if(vt != NULL && vt->fd != -1 && FD_ISSET(vt->fd, &fileDescriptors)) { VTCore_dispatch(vt->core); #ifdef USE_NCURSES //vt = (struct virtualTerminal*) vtGet(i)->pointer; wnoutrefresh(vt->window); #endif j++; // keep track of the terminals that need updating } } if(j || k) { // if a VT or command window needs updating #ifdef USE_NCURSES // re-move cursor to correct location after updating screens if(terminalIndex > -1) { //to = (struct tesiObject*) vtGet(terminalIndex); //vt = (struct virtualTerminal*) to->pointer; vt = vtGet(terminalIndex); //wmove(vt->window, to->y, to->x); } else { wmove(ncursesScreen, screenHeight - 1, 1 + strlen(inputBuffer)); } doupdate(); } k = 0; ch = wgetch(ncursesScreen); // ? #endif #ifdef USE_SLANG SLsmg_refresh(); if(!SLang_input_pending(1)) // wait 1/10 of a second continue; ch = SLang_getkey(); #endif #ifdef USE_NCURSES #endif switch(ch) { case '`': // tilde pressed, cycle through terms? //case KEY_RIGHT: // tilde pressed, cycle through terms? terminalIndex++; if(terminalIndex == 10 || vtGet(terminalIndex) == NULL) terminalIndex = -1; vtHighlight(terminalIndex); k = 1; // update cursor position break; case ERR: // no input break; default: if(terminalIndex > -1) { // send input to terminal //to = vtGet(terminalIndex); vt = vtGet(terminalIndex); if(vt) { // this should never be null, but check anyway boundString = keybound(ch, 0); if(boundString) { #ifdef DEBUG fprintf(stderr, "key string: %s\n", boundString); #endif write(vt->fd, boundString, strlen(boundString)); free(boundString); } else write(vt->fd, &ch, 1); } } else { // build input buffer #ifdef DEBUG fprintf(stderr, "Keypress: %d\n", ch); #endif if(ch == 10) { // parse buffer when Enter is pressed, returns active terminal index //wclear(ncursesScreen); terminalIndex = processInput(inputBuffer, terminalIndex, screenHeight, screenWidth); vtHighlight(terminalIndex); FD_ZERO(&fileDescriptors); FD_SET(0, &fileDescriptors); #ifdef USE_NCURSES // clear command window mvwaddch(ncursesScreen, screenHeight - 1, 0, ':'); wmove(ncursesScreen, screenHeight - 1, 1); wclrtoeol(ncursesScreen); wmove(ncursesScreen, screenHeight - 1, 1); wnoutrefresh(ncursesScreen); k = 1; #endif inputBuffer[0] = 0; } else { i = strlen(inputBuffer); inputBuffer[ i ] = ch; inputBuffer[ i + 1 ] = 0; #ifdef USE_NCURSES mvwaddstr(ncursesScreen, screenHeight - 1, 1, inputBuffer); #endif #ifdef USE_SLANG SLsmg_gotorc(SLtt_Screen_Rows - 1, 0); SLsmg_write_string(inputBuffer); SLsmg_refresh(); #endif } } break; } } for(i = 0; i < 10; i++) { if(virtualTerminals[i] != NULL) { vtDestroy(i); } } #ifdef USE_NCURSES endwin(); #endif #ifdef USE_SLANG SLsmg_reset_smg(); SLang_reset_tty(); #endif return 0; }
static void smg_write_string (char *s) { if (Smg_Initialized <= 0) return; SLsmg_write_string (s); }
static void slang_print(aa_context * c, __AA_CONST char *text) { SLsmg_write_string(text); }
int main() { int i, j; int keepRunning; int input; unsigned int ch; int ch2; char inputBuffer[40]; int terminalIndex; struct tesiObject *to; for(i = 0; i < 10; i++) tesiObjects[i] = NULL; SLtt_get_terminfo(); SLang_init_tty(-1, 0, 0); SLsmg_init_smg(); SLsmg_refresh(); inputBuffer[0] = 0; terminalIndex = -1; keepRunning = 1; while(keepRunning) { j = 0; for(i = 0; i < 10; i++) { if(tesiObjects[i] != NULL) j += tesi_handleInput(tesiObjects[i]); } if(j) SLsmg_refresh(); if(!SLang_input_pending(1)) // wait 1/10 of a second continue; ch = SLang_getkey(); switch(ch) { case '`': // tilde pressed, cycle through terms? terminalIndex++; if(terminalIndex == 10 || vtGet(terminalIndex) == NULL) terminalIndex = -1; // highlight selected terminal break; case 'Q': keepRunning = 0; break; default: if(terminalIndex > -1) { // send input to terminal to = vtGet(terminalIndex); if(to) // this should never be null, but check anyway write(to->fd_input, &ch, 1); } else { // build input buffer #ifdef DEBUG fprintf(stderr, "Keypress: %d\n", ch); #endif if(ch == 13) { // parse buffer when Enter is pressed // new terminal processInput(inputBuffer); inputBuffer[0] = 0; } else { i = strlen(inputBuffer); inputBuffer[ i ] = ch; inputBuffer[ i + 1 ] = 0; SLsmg_gotorc(SLtt_Screen_Rows - 1, 0); SLsmg_write_string(inputBuffer); SLsmg_refresh(); } } break; } } for(i = 0; i < 10; i++) { if(tesiObjects[i] != NULL) { vtDestroy(i); } } SLsmg_reset_smg(); SLang_reset_tty(); return 0; }
static void most_do_help_text (void) { char **p = help, *sect = NULL; int r; while (*p != NULL) { SLsmg_cls (); r = 0; SLsmg_gotorc (0, 0); if ((sect != NULL) && (**p == ' ')) { most_tt_bold_video (); SLsmg_gotorc (r, 0); SLsmg_write_string (sect); most_tt_normal_video (); SLsmg_write_string (" (continued)"); r += 2; } else sect = NULL; while (r < SLtt_Screen_Rows - 1) { if (*p == NULL) break; if (**p != ' ') { if (((r + 5) > SLtt_Screen_Rows) && (**p != '*')) { sect = NULL; break; } if (sect != NULL) { r++; } if (**p != '*') { sect = *p; most_tt_bold_video (); } else sect = NULL; } SLsmg_gotorc (r, 0); SLsmg_write_string (*p); if ((**p != ' ') && (**p != '*')) { most_tt_normal_video (); r++; } p++; r++; } SLsmg_gotorc (r, 0); most_tt_reverse_video(); SLsmg_write_string("Press any key to continue."); most_tt_normal_video(); SLsmg_refresh (); most_getkey (); } most_redraw_display(); }
void tty_print_string (const char *s) { SLsmg_write_string ((char *) str_term_form (s)); }