_tracechtype2(int bufnum, chtype ch)
{
    char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);

    if (result != 0) {
	const char *found;
	attr_t attr = ChAttrOf(ch);

	_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
	if ((found = _nc_altcharset_name(attr, ch)) != 0) {
	    (void) _nc_trace_bufcat(bufnum, found);
	    attr &= ~A_ALTCHARSET;
	} else
	    (void) _nc_trace_bufcat(bufnum,
				    _nc_tracechar(CURRENT_SCREEN,
						  (int) ChCharOf(ch)));

	if (attr != A_NORMAL) {
	    (void) _nc_trace_bufcat(bufnum, " | ");
	    (void) _nc_trace_bufcat(bufnum,
				    _traceattr2(bufnum + 20, attr));
	}

	result = _nc_trace_bufcat(bufnum, r_brace);
    }
    return result;
}
Example #2
0
_tracecchar_t2(int bufnum, const cchar_t *ch)
{
    char *result = _nc_trace_buf(bufnum, BUFSIZ);
    attr_t attr;
    const char *found;

    if (result != 0) {
	strcpy(result, l_brace);
	if (ch != 0) {
	    attr = AttrOfD(ch);
	    if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) {
		(void) _nc_trace_bufcat(bufnum, found);
		attr &= ~A_ALTCHARSET;
	    } else if (isWidecExt(CHDEREF(ch))) {
		(void) _nc_trace_bufcat(bufnum, "{NAC}");
		attr &= ~A_CHARTEXT;
	    } else {
		PUTC_DATA;
		int n;

		PUTC_INIT;
		(void) _nc_trace_bufcat(bufnum, "{ ");
		for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
		    PUTC_ch = ch->chars[PUTC_i];
		    if (PUTC_ch == L'\0') {
			if (PUTC_i == 0)
			    result = _nc_trace_bufcat(bufnum, "\\000");
			break;
		    }
		    PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
		    if (PUTC_n <= 0) {
			if (PUTC_ch != L'\0') {
			    /* it could not be a multibyte sequence */
			    (void) _nc_trace_bufcat(bufnum,
						    _nc_tracechar(CURRENT_SCREEN,
								  UChar(ch->chars[PUTC_i])));
			}
			break;
		    }
		    for (n = 0; n < PUTC_n; n++) {
			if (n)
			    (void) _nc_trace_bufcat(bufnum, ", ");
			(void) _nc_trace_bufcat(bufnum,
						_nc_tracechar(CURRENT_SCREEN,
							      UChar(PUTC_buf[n])));
		    }
		}
		(void) _nc_trace_bufcat(bufnum, " }");
	    }
	    if (attr != A_NORMAL) {
		(void) _nc_trace_bufcat(bufnum, " | ");
		(void) _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr));
	    }
	}

	result = _nc_trace_bufcat(bufnum, r_brace);
    }
    return result;
}
Example #3
0
_tracecchar_t2 (int bufnum, const cchar_t *ch)
{
    char *buf = _nc_trace_buf(bufnum, BUFSIZ);
    attr_t attr;
    const char *found;

    strcpy(buf, l_brace);
    if (ch != 0) {
	attr = AttrOfD(ch);
	if ((found = _nc_altcharset_name(attr, CharOfD(ch))) != 0) {
	    (void) _nc_trace_bufcat(bufnum, found);
	    attr &= ~A_ALTCHARSET;
	} else if (isWidecExt(CHDEREF(ch))) {
	    (void) _nc_trace_bufcat(bufnum, "{NAC}");
	    attr &= ~A_CHARTEXT;
	} else {
	    PUTC_DATA;
	    int n;

	    PUTC_INIT;
	    (void) _nc_trace_bufcat(bufnum, "{ ");
	    do {
		PUTC_ch = PUTC_i < CCHARW_MAX ? ch->chars[PUTC_i] : L'\0';
		PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
		if (PUTC_ch == L'\0')
		    --PUTC_n;
		if (PUTC_n <= 0) {
		    if (PUTC_ch != L'\0') {
			/* it could not be a multibyte sequence */
			(void) _nc_trace_bufcat(bufnum, _tracechar(UChar(ch->chars[PUTC_i])));
		    }
		    break;
		}
		for (n = 0; n < PUTC_n; n++) {
		    if (n)
			(void) _nc_trace_bufcat(bufnum, ", ");
		    (void) _nc_trace_bufcat(bufnum, _tracechar(UChar(PUTC_buf[n])));
		}
		++PUTC_i;
	    } while (PUTC_ch != L'\0');
	    (void) _nc_trace_bufcat(bufnum, " }");
	}
	if (attr != A_NORMAL) {
	    (void) _nc_trace_bufcat(bufnum, " | ");
	    (void) _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr));
	}
    }

    return (_nc_trace_bufcat(bufnum, r_brace));
}
Example #4
0
_tracechtype2(int bufnum, chtype ch)
{
    const char *found;

    strcpy(_nc_trace_buf(bufnum, BUFSIZ), l_brace);
    if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) {
	(void) _nc_trace_bufcat(bufnum, found);
    } else
	(void) _nc_trace_bufcat(bufnum, _tracechar((int)ChCharOf(ch)));

    if (ChAttrOf(ch) != A_NORMAL) {
	(void) _nc_trace_bufcat(bufnum, " | ");
	(void) _nc_trace_bufcat(bufnum,
		_traceattr2(bufnum + 20, ChAttrOf(ch)));
    }

    return (_nc_trace_bufcat(bufnum, r_brace));
}
Example #5
0
_tracechtype2(int bufnum, chtype ch)
{
    const char *found;
    char *result = _nc_trace_buf(bufnum, BUFSIZ);

    if (result != 0) {
	strcpy(result, l_brace);
	if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) {
	    (void) _nc_trace_bufcat(bufnum, found);
	} else
	    (void) _nc_trace_bufcat(bufnum,
				    _nc_tracechar(CURRENT_SCREEN,
						  (int) ChCharOf(ch)));

	if (ChAttrOf(ch) != A_NORMAL) {
	    (void) _nc_trace_bufcat(bufnum, " | ");
	    (void) _nc_trace_bufcat(bufnum,
				    _traceattr2(bufnum + 20, ChAttrOf(ch)));
	}

	result = _nc_trace_bufcat(bufnum, r_brace);
    }
    return result;
}
Example #6
0
_traceattr(attr_t newmode)
{
    return _traceattr2(0, newmode);
}
Example #7
0
char *_tracechtype2(int bufnum, chtype ch)
{
char	*buf = _nc_trace_buf(bufnum, BUFSIZ);
char	*found = 0;

    strcpy(buf, "{");
    if (ch & A_ALTCHARSET)
    {
	char	*cp;
	static const	struct {unsigned int val; const char *name;}
	names[] =
	{
	    {'l', "ACS_ULCORNER"},	/* upper left corner */
	    {'m', "ACS_LLCORNER"},	/* lower left corner */
	    {'k', "ACS_URCORNER"},	/* upper right corner */
	    {'j', "ACS_LRCORNER"},	/* lower right corner */
	    {'t', "ACS_LTEE"},		/* tee pointing right */
	    {'u', "ACS_RTEE"},		/* tee pointing left */
	    {'v', "ACS_BTEE"},		/* tee pointing up */
	    {'w', "ACS_TTEE"},		/* tee pointing down */
	    {'q', "ACS_HLINE"},		/* horizontal line */
	    {'x', "ACS_VLINE"},		/* vertical line */
	    {'n', "ACS_PLUS"},		/* large plus or crossover */
	    {'o', "ACS_S1"},		/* scan line 1 */
	    {'s', "ACS_S9"},		/* scan line 9 */
	    {'`', "ACS_DIAMOND"},	/* diamond */
	    {'a', "ACS_CKBOARD"},	/* checker board (stipple) */
	    {'f', "ACS_DEGREE"},	/* degree symbol */
	    {'g', "ACS_PLMINUS"},	/* plus/minus */
	    {'~', "ACS_BULLET"},	/* bullet */
	    {',', "ACS_LARROW"},	/* arrow pointing left */
	    {'+', "ACS_RARROW"},	/* arrow pointing right */
	    {'.', "ACS_DARROW"},	/* arrow pointing down */
	    {'-', "ACS_UARROW"},	/* arrow pointing up */
	    {'h', "ACS_BOARD"},		/* board of squares */
	    {'i', "ACS_LANTERN"},	/* lantern symbol */
	    {'0', "ACS_BLOCK"},		/* solid square block */
	    {'p', "ACS_S3"},		/* scan line 3 */
	    {'r', "ACS_S7"},		/* scan line 7 */
	    {'y', "ACS_LEQUAL"},	/* less/equal */
	    {'z', "ACS_GEQUAL"},	/* greater/equal */
	    {'{', "ACS_PI"},		/* Pi */
	    {'|', "ACS_NEQUAL"},	/* not equal */
	    {'}', "ACS_STERLING"},	/* UK pound sign */
	    {'\0',(char *)0}
	},
	*sp;

	for (cp = acs_chars; cp[0] && cp[1]; cp += 2)
	{
	    if (TextOf(cp[1]) == TextOf(ch))
	    {
		found = cp;
		/* don't exit from loop - there may be redefinitions */
	    }
	}

	if (found != 0)
	{
	    ch = TextOf(*found);
	    for (sp = names; sp->val; sp++)
		if (sp->val == ch)
		{
		    (void) strcat(buf, sp->name);
		    ch &= ~A_ALTCHARSET;
		    break;
		}
	}
    }

    if (found == 0)
	(void) strcat(buf, _tracechar(TextOf(ch)));

    if (AttrOf(ch) != A_NORMAL)
	(void) sprintf(buf + strlen(buf), " | %s", _traceattr2(bufnum+20,AttrOf(ch)));

    strcat(buf, "}");
    return(buf);
}
_tracecchar_t2(int bufnum, const cchar_t *ch)
{
    char *result = _nc_trace_buf(bufnum, (size_t) BUFSIZ);

    if (result != 0) {
	_nc_STRCPY(result, l_brace, TRACE_BUF_SIZE(bufnum));
	if (ch != 0) {
	    const char *found;
	    attr_t attr = AttrOfD(ch);

	    if ((found = _nc_altcharset_name(attr, (chtype) CharOfD(ch))) != 0) {
		(void) _nc_trace_bufcat(bufnum, found);
		attr &= ~A_ALTCHARSET;
	    } else if (isWidecExt(CHDEREF(ch))) {
		(void) _nc_trace_bufcat(bufnum, "{NAC}");
		attr &= ~A_CHARTEXT;
	    } else {
		PUTC_DATA;
		int n;

		(void) _nc_trace_bufcat(bufnum, "{ ");
		for (PUTC_i = 0; PUTC_i < CCHARW_MAX; ++PUTC_i) {
		    PUTC_ch = ch->chars[PUTC_i];
		    if (PUTC_ch == L'\0') {
			if (PUTC_i == 0)
			    (void) _nc_trace_bufcat(bufnum, "\\000");
			break;
		    }
		    PUTC_INIT;
		    PUTC_n = (int) wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
		    if (PUTC_n <= 0) {
			if (PUTC_ch != L'\0') {
			    /* it could not be a multibyte sequence */
			    (void) _nc_trace_bufcat(bufnum,
						    _nc_tracechar(CURRENT_SCREEN,
								  UChar(ch->chars[PUTC_i])));
			}
			break;
		    } else if (ch->chars[PUTC_i] > 255) {
			char temp[80];
			_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
				    "{%d:\\u%lx}",
				    wcwidth(ch->chars[PUTC_i]),
				    (unsigned long) ch->chars[PUTC_i]);
			(void) _nc_trace_bufcat(bufnum, temp);
			break;
		    }
		    for (n = 0; n < PUTC_n; n++) {
			if (n)
			    (void) _nc_trace_bufcat(bufnum, ", ");
			(void) _nc_trace_bufcat(bufnum,
						_nc_tracechar(CURRENT_SCREEN,
							      UChar(PUTC_buf[n])));
		    }
		}
		(void) _nc_trace_bufcat(bufnum, " }");
	    }
	    if (attr != A_NORMAL) {
		(void) _nc_trace_bufcat(bufnum, " | ");
		(void) _nc_trace_bufcat(bufnum, _traceattr2(bufnum + 20, attr));
	    }
#if NCURSES_EXT_COLORS
	    /*
	     * Just in case the extended color is different from the chtype
	     * value, trace both.
	     */
	    if (ch->ext_color != PairNumber(attr)) {
		char temp[80];
		_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp))
			    " X_COLOR{%d:%d}", ch->ext_color, PairNumber(attr));
		(void) _nc_trace_bufcat(bufnum, temp);
	    }
#endif
	}

	result = _nc_trace_bufcat(bufnum, r_brace);
    }
    return result;
}
Example #9
0
NCURSES_EXPORT(int) (mvchgat) (int a1, int a2, int a3, attr_t a4, short a5, const void * z)
{
	T((T_CALLED("mvchgat(%d,%d,%d,%s,%d,%p)"), a1, a2, a3, _traceattr2(3,a4), a5, (const void *)z)); returnCode((wmove(stdscr,a1,a2) == (-1) ? (-1) : wchgat(stdscr,a3,a4,a5,z)));
}
Example #10
0
NCURSES_EXPORT(int) (attron) (int z)
{
	T((T_CALLED("attron(%s)"), _traceattr2(0,(chtype)z)));
	returnCode(wattr_on(stdscr, (attr_t)((z)), ((void *)0)));
}
Example #11
0
NCURSES_EXPORT(int) (attr_set) (attr_t a1, short a2, void * z)
{
	T((T_CALLED("attr_set(%s,%d,%p)"), _traceattr2(0,a1), a2, (const void *)z)); returnCode(((stdscr)->_attrs = ((a1) & ~((((1UL) << 8) - 1UL) << ((0) + 8))), (stdscr)->_color = (a2), (0)));
}
Example #12
0
NCURSES_EXPORT(int) (attr_on) (attr_t a1, void * z)
{
	T((T_CALLED("attr_on(%s,%p)"), _traceattr2(0,a1), (const void *)z)); returnCode(wattr_on(stdscr,a1,z));
}
Example #13
0
NCURSES_EXPORT(int) (wattr_set) (WINDOW * a1, attr_t a2, short a3, void * z)
{
	T((T_CALLED("wattr_set(%p,%s,%d,%p)"), (const void *)a1, _traceattr2(1,a2), a3, (const void *)z)); returnCode(((a1)->_attrs = ((a2) & ~((((1UL) << 8) - 1UL) << ((0) + 8))), (a1)->_color = (a3), (0)));
}
Example #14
0
NCURSES_EXPORT(int) (slk_attr_on) (attr_t a1, void * z)
{
	T((T_CALLED("slk_attr_on(%s,%p)"), _traceattr2(0,a1), (const void *)z)); returnCode(((z) ? (-1) : slk_attron(a1)));
}
Example #15
0
NCURSES_EXPORT(int) (mvwchgat) (WINDOW * a1, int a2, int a3, int a4, attr_t a5, short a6, const void * z)
{
	T((T_CALLED("mvwchgat(%p,%d,%d,%d,%s,%d,%p)"), (const void *)a1, a2, a3, a4, _traceattr2(4,a5), a6, (const void *)z)); returnCode((wmove(a1,a2,a3) == (-1) ? (-1) : wchgat(a1,a4,a5,a6,z)));
}
Example #16
0
NCURSES_EXPORT(int) (attrset) (int z)
{
	T((T_CALLED("attrset(%s)"), _traceattr2(0,(chtype)z)));
	returnIntAttr((attr_t)((0 != (const void *)((stdscr))) ? ((stdscr)->_color = (int)(((int)((((unsigned long)(((z))) & ((chtype)((((1U) << 8) - 1U)) << ((0) + 8))) >> 8)))), (stdscr)->_attrs = (attr_t)((z)), (0)) : (-1)));
}
Example #17
0
NCURSES_EXPORT(int) (chgat) (int a1, attr_t a2, short a3, const void * z)
{
	T((T_CALLED("chgat(%d,%s,%d,%p)"), a1, _traceattr2(1,a2), a3, (const void *)z)); returnCode(wchgat(stdscr,a1,a2,a3,z));
}