Exemple #1
0
int
__m_acs_cc(chtype acs, cchar_t *cc)
{
	int i, ch;
	unsigned char *acsc;

	/* Is it a single-byte character? */
	if (UCHAR_MAX < (A_CHARTEXT & acs) || __m_chtype_cc(acs, cc) == ERR)
		return -1;

	if (!(acs & A_ALTCHARSET))
		return 0;
		
	/* Pick the acs mapping string to use. */
	if (acs_chars == (char *) 0) {
		/* Use primary character set. */
		acsc = acs_defaults;
		acs &= ~A_ALTCHARSET;
	} else {
		acsc = (unsigned char *) acs_chars;
	}

	/* Assume that acsc is even in length. */
	for (i = 0; acsc[i] != '\0'; i += 2) {
		if (acsc[i] == (acs & A_CHARTEXT)) {
			(void) __m_chtype_cc(
				(chtype) ((acs & A_ATTRIBUTES) | acsc[i+1]), cc
			);
			break;
		}
	}

	return 0;
}
Exemple #2
0
int
wvline(WINDOW *w, chtype v, int n)
{
	int	code;
	cchar_t	cc;

	(void) __m_chtype_cc(v, &cc);
	code = wvline_set(w, &cc, n);

	return (code);
}
Exemple #3
0
int
vidputs(chtype ch, int (*putout)(int))
{
	int	code;
	cchar_t	cc;

	(void) __m_chtype_cc(ch, &cc);
	code = vid_puts(cc._at, cc._co, NULL, putout);

	return (code);
}
Exemple #4
0
int
vidattr(chtype ch)
{
	int	code;
	cchar_t	cc;

	(void) __m_chtype_cc(ch, &cc);
	code = vid_puts(cc._at, cc._co, NULL, __m_putchar);

	return (code);
}
Exemple #5
0
int
winsch(WINDOW *w, chtype ch)
{
	int	code;
	cchar_t	cc;

	(void) __m_chtype_cc(ch, &cc);
	code = wins_wch(w, &cc);

	return (code);
}
Exemple #6
0
int
waddchnstr(WINDOW *w, const chtype *chs, int n)
{
	cchar_t	cc;
	int	x, y, xnew, ynew;

	if (n < 0 || w->_maxx < (n += w->_curx))
		n = w->_maxx;

	for (x = w->_curx, y = w->_cury; x < n && *chs != 0;
		x = xnew, y = ynew, ++chs) {
		(void) __m_chtype_cc(*chs, &cc);
		if (__m_cc_add_k(w, y, x, &cc, 0, &ynew, &xnew) == ERR)
			break;
	}

	WSYNC(w);

	return (WFLUSH(w));
}
Exemple #7
0
int
waddchnstr(WINDOW *w, const chtype *chs, int n)
{
	cchar_t cc;
	int x, width;

#ifdef M_CURSES_TRACE
	__m_trace("waddchnstr(%p, %p, %d)", w, chs, n);
#endif

	if (n < 0 || w->_maxx < (n += w->_curx))
		n = w->_maxx;

	for (x = w->_curx; x < n && *chs != 0; x += width, ++chs) {
                (void) __m_chtype_cc(*chs, &cc);
		width = __m_cc_replace(w, w->_cury, x, &cc, 0);
        }

	WSYNC(w);

	return __m_return_code("waddchnstr", WFLUSH(w));
}