ScreenWrite (screen, str, flags, cur_fg_bg, length)  TScreen *screen; Char *str; register unsigned flags; register unsigned cur_fg_bg; register int length;
ScreenWrite ( TScreen *screen, Char *str, register unsigned flags, register unsigned cur_fg_bg, register int length)
ScreenWrite (screen, str, flags, cur_fg_bg, length)/* * Writes str into buf at screen's current row and column.  Characters are set * to match flags. */TScreen *screen;Char *str;register unsigned flags;register unsigned cur_fg_bg;register int length;		/* length of string */{#if OPT_ISO_COLORS	register Char *fb = 0;#endif#if OPT_DEC_CHRSET  	register Char *cb = 0;#endif	register Char *attrs;	register int avail  = screen->max_col - screen->cur_col + 1;	register Char *col;	register int wrappedbit;	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_ISO_COLORS(screen,{		fb = SCRN_BUF_COLOR(screen, screen->cur_row) + screen->cur_col;	})	if_OPT_DEC_CHRSET({		cb = SCRN_BUF_CSETS(screen, screen->cur_row) + screen->cur_col;	})	wrappedbit = ScrnTstWrapped(screen, screen->cur_row);	/* write blanks if we're writing invisible text */	if (flags & INVISIBLE) {		memset(col, ' ', length);	} else {		memcpy(col, str, length);	}	flags &= ATTRIBUTES;	flags |= CHARDRAWN;	memset( attrs, flags,  length);	if_OPT_ISO_COLORS(screen,{		memset( fb,   cur_fg_bg, length);	})	if_OPT_DEC_CHRSET({		memset( cb,   curXtermChrSet(screen->cur_row), length);	})	if (wrappedbit)	    ScrnSetWrapped(screen, screen->cur_row);	else	    ScrnClrWrapped(screen, screen->cur_row);	if_OPT_XMC_GLITCH(screen,{		Resolve_XMC(screen);	})}