summaryrefslogtreecommitdiffstats
path: root/ncurses/trace/lib_traceatr.c
diff options
context:
space:
mode:
Diffstat (limited to 'ncurses/trace/lib_traceatr.c')
-rw-r--r--ncurses/trace/lib_traceatr.c55
1 files changed, 16 insertions, 39 deletions
diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c
index 35ba0d3..45a03ce 100644
--- a/ncurses/trace/lib_traceatr.c
+++ b/ncurses/trace/lib_traceatr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -30,7 +30,6 @@
* Author: Thomas Dickey 1996-on *
* and: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
- * and: Juergen Pfeifer *
****************************************************************************/
/*
@@ -38,12 +37,9 @@
*/
#include <curses.priv.h>
+#include <term.h> /* acs_chars */
-#ifndef CUR
-#define CUR SP_TERMTYPE
-#endif
-
-MODULE_ID("$Id: lib_traceatr.c,v 1.74 2011/01/22 19:48:01 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.63 2008/08/03 16:24:53 tom Exp $")
#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
@@ -132,11 +128,11 @@ _traceattr2(int bufnum, chtype newmode)
for (n = 0; n < SIZEOF(names); n++) {
if ((newmode & names[n].val) != 0) {
if (result[1] != '\0')
- (void) _nc_trace_bufcat(bufnum, "|");
+ result = _nc_trace_bufcat(bufnum, "|");
result = _nc_trace_bufcat(bufnum, names[n].name);
if (names[n].val == A_COLOR) {
- short pairnum = (short) PairNumber(newmode);
+ short pairnum = PAIR_NUMBER(newmode);
#ifdef USE_TERMLIB
/* pair_content lives in libncurses */
(void) sprintf(temp, "{%d}", pairnum);
@@ -176,14 +172,6 @@ _traceattr(attr_t newmode)
}
/* Trace 'int' return-values */
-NCURSES_EXPORT(int)
-_nc_retrace_int_attr_t(attr_t code)
-{
- T((T_RETURN("%s"), _traceattr(code)));
- return (int) code;
-}
-
-/* Trace 'attr_t' return-values */
NCURSES_EXPORT(attr_t)
_nc_retrace_attr_t(attr_t code)
{
@@ -198,9 +186,6 @@ _nc_altcharset_name(attr_t attr, chtype ch)
unsigned int val;
const char *name;
} ALT_NAMES;
-#if NCURSES_SP_FUNCS
- SCREEN *sp = CURRENT_SCREEN;
-#endif
static const ALT_NAMES names[] =
{
{'l', "ACS_ULCORNER"}, /* upper left corner */
@@ -240,26 +225,23 @@ _nc_altcharset_name(attr_t attr, chtype ch)
const char *result = 0;
-#if NCURSES_SP_FUNCS
- (void) sp;
-#endif
if ((attr & A_ALTCHARSET) && (acs_chars != 0)) {
char *cp;
char *found = 0;
- const ALT_NAMES *strp;
+ const ALT_NAMES *sp;
for (cp = acs_chars; cp[0] && cp[1]; cp += 2) {
- if (ChCharOf(UChar(cp[1])) == ChCharOf(ch)) {
+ if (ChCharOf(cp[1]) == ChCharOf(ch)) {
found = cp;
/* don't exit from loop - there may be redefinitions */
}
}
if (found != 0) {
- ch = ChCharOf(UChar(*found));
- for (strp = names; strp->val; strp++)
- if (strp->val == ch) {
- result = strp->name;
+ ch = ChCharOf(*found);
+ for (sp = names; sp->val; sp++)
+ if (sp->val == ch) {
+ result = sp->name;
break;
}
}
@@ -278,9 +260,7 @@ _tracechtype2(int bufnum, chtype ch)
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)));
+ (void) _nc_trace_bufcat(bufnum, _nc_tracechar(SP, (int) ChCharOf(ch)));
if (ChAttrOf(ch) != A_NORMAL) {
(void) _nc_trace_bufcat(bufnum, " | ");
@@ -333,17 +313,14 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
(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");
+ if (PUTC_ch == L'\0')
break;
- }
- PUTC_n = (int) wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
+ 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,
+ _nc_tracechar(SP,
UChar(ch->chars[PUTC_i])));
}
break;
@@ -352,7 +329,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
if (n)
(void) _nc_trace_bufcat(bufnum, ", ");
(void) _nc_trace_bufcat(bufnum,
- _nc_tracechar(CURRENT_SCREEN,
+ _nc_tracechar(SP,
UChar(PUTC_buf[n])));
}
}
OpenPOWER on IntegriCloud