Esempio n. 1
0
static
#if !USE_WIDEC_SUPPORT		/* cannot be inline if it is recursive */
NCURSES_INLINE
#endif
int
waddch_literal(WINDOW *win, NCURSES_CH_T ch)
{
    int x;
    int y;
    struct ldat *line;

    x = win->_curx;
    y = win->_cury;

    CHECK_POSITION(win, x, y);

    ch = render_char(win, ch);

    line = win->_line + y;

    CHANGED_CELL(line, x);

    /*
     * Build up multibyte characters until we have a wide-character.
     */
    if_WIDEC({
	if (WINDOW_EXT(win, addch_used) != 0 || !Charable(ch)) {
	    int len = _nc_build_wch(win, CHREF(ch));

	    if (len >= -1) {
		/* handle EILSEQ */
		if (is8bits(CharOf(ch))) {
		    const char *s = unctrl((chtype) CharOf(ch));
		    if (s[1] != 0) {
			return waddstr(win, s);
		    }
		}
		if (len == -1)
		    return waddch(win, ' ');
	    } else {
		return OK;
	    }
	}
    });
Esempio n. 2
0
static
#if !USE_WIDEC_SUPPORT		/* cannot be inline if it is recursive */
NCURSES_INLINE
#endif
int
waddch_literal(WINDOW *win, NCURSES_CH_T ch)
{
    int x;
    int y;
    struct ldat *line;

    x = win->_curx;
    y = win->_cury;

    CHECK_POSITION(win, x, y);

    ch = render_char(win, ch);

    line = win->_line + y;

    CHANGED_CELL(line, x);

    /*
     * Build up multibyte characters until we have a wide-character.
     */
#if NCURSES_SP_FUNCS
#define DeriveSP() SCREEN *sp = _nc_screen_of(win);
#else
#define DeriveSP()		/*nothing */
#endif
    if_WIDEC({
	DeriveSP();
	if (WINDOW_EXT(win, addch_used) != 0 || !Charable(ch)) {
	    int len = _nc_build_wch(win, CHREF(ch));

	    if (len >= -1) {
		attr_t attr = AttrOf(ch);

		/* handle EILSEQ (i.e., when len >= -1) */
		if (len == -1 && is8bits(CharOf(ch))) {
		    int rc = OK;
		    const char *s = NCURSES_SP_NAME(unctrl)
		      (NCURSES_SP_ARGx (chtype) CharOf(ch));

		    if (s[1] != '\0') {
			while (*s != '\0') {
			    rc = waddch(win, UChar(*s) | attr);
			    if (rc != OK)
				break;
			    ++s;
			}
			return rc;
		    }
		}
		if (len == -1)
		    return waddch(win, ' ' | attr);
	    } else {
		return OK;
	    }
	}
    });