/* * Writes str into buf at screen's current row and column. Characters are set * to match flags. */ void ScreenWrite(TScreen * screen, PAIRED_CHARS(Char * str, Char * str2), unsigned flags, unsigned cur_fg_bg, int len) /* length of string */ { #if OPT_ISO_COLORS #if OPT_EXT_COLORS Char *fbf = 0; Char *fbb = 0; #else Char *fb = 0; #endif #endif #if OPT_DEC_CHRSET Char *cb = 0; #endif int length = len; /* workaround for compiler bug? */ Char *attrs; int avail = screen->max_col - screen->cur_col + 1; Char *col; int wrappedbit; #if OPT_WIDE_CHARS Char starcol, starcol2; Char *comb1l = 0, *comb1h = 0, *comb2l = 0, *comb2h = 0; #endif #if OPT_WIDE_CHARS int real_width = visual_width(PAIRED_CHARS(str, str2), length); #else int real_width = length; #endif if (length > avail) length = avail; if (length <= 0) return; col = SCRN_BUF_CHARS(screen, screen->cur_row) + screen->cur_col; attrs = SCRN_BUF_ATTRS(screen, screen->cur_row) + screen->cur_col; if_OPT_WIDE_CHARS(screen, { comb1l = SCRN_BUF_COM1L(screen, screen->cur_row) + screen->cur_col; comb1h = SCRN_BUF_COM1H(screen, screen->cur_row) + screen->cur_col; comb2l = SCRN_BUF_COM2L(screen, screen->cur_row) + screen->cur_col; comb2h = SCRN_BUF_COM2H(screen, screen->cur_row) + screen->cur_col; });
/* * Writes str into buf at screen's current row and column. Characters are set * to match flags. */ void ScreenWrite(TScreen * screen, PAIRED_CHARS(Char * str, Char * str2), unsigned flags, unsigned cur_fg_bg, unsigned length) { #if OPT_ISO_COLORS #if OPT_EXT_COLORS Char *fbf = 0; Char *fbb = 0; #else Char *fb = 0; #endif #endif #if OPT_DEC_CHRSET Char *cb = 0; #endif Char *attrs; int avail = MaxCols(screen) - screen->cur_col; Char *chars; int wrappedbit; #if OPT_WIDE_CHARS Char starcol1, starcol2; Char *comb1l = 0, *comb1h = 0, *comb2l = 0, *comb2h = 0; #endif unsigned real_width = visual_width(PAIRED_CHARS(str, str2), length); if (avail <= 0) return; if (length > (unsigned) avail) length = avail; if (length == 0 || real_width == 0) return; chars = SCRN_BUF_CHARS(screen, screen->cur_row) + screen->cur_col; attrs = SCRN_BUF_ATTRS(screen, screen->cur_row) + screen->cur_col; if_OPT_WIDE_CHARS(screen, { comb1l = SCRN_BUF_COM1L(screen, screen->cur_row) + screen->cur_col; comb1h = SCRN_BUF_COM1H(screen, screen->cur_row) + screen->cur_col; comb2l = SCRN_BUF_COM2L(screen, screen->cur_row) + screen->cur_col; comb2h = SCRN_BUF_COM2H(screen, screen->cur_row) + screen->cur_col; });