X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftrace%2Flib_traceatr.c;h=b3d3b7cf1e289f8ab8afffb19476955ccc107c4d;hp=45a03cea05feb194988e2455077354e2244f03b5;hb=3996fe0bf797f113d6abc4329cc869951735a4d8;hpb=8f527f87c0b979d9c2598ef5c3394463af288468;ds=inline diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c index 45a03cea..b3d3b7cf 100644 --- a/ncurses/trace/lib_traceatr.c +++ b/ncurses/trace/lib_traceatr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 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,6 +30,7 @@ * Author: Thomas Dickey 1996-on * * and: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer * ****************************************************************************/ /* @@ -37,9 +38,12 @@ */ #include -#include /* acs_chars */ -MODULE_ID("$Id: lib_traceatr.c,v 1.63 2008/08/03 16:24:53 tom Exp $") +#ifndef CUR +#define CUR SP_TERMTYPE +#endif + +MODULE_ID("$Id: lib_traceatr.c,v 1.68 2009/12/12 21:37:37 tom Exp $") #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) @@ -186,6 +190,9 @@ _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 */ @@ -225,10 +232,13 @@ _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 *sp; + const ALT_NAMES *strp; for (cp = acs_chars; cp[0] && cp[1]; cp += 2) { if (ChCharOf(cp[1]) == ChCharOf(ch)) { @@ -239,9 +249,9 @@ _nc_altcharset_name(attr_t attr, chtype ch) if (found != 0) { ch = ChCharOf(*found); - for (sp = names; sp->val; sp++) - if (sp->val == ch) { - result = sp->name; + for (strp = names; strp->val; strp++) + if (strp->val == ch) { + result = strp->name; break; } } @@ -260,7 +270,9 @@ _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(SP, (int) ChCharOf(ch))); + (void) _nc_trace_bufcat(bufnum, + _nc_tracechar(CURRENT_SCREEN, + (int) ChCharOf(ch))); if (ChAttrOf(ch) != A_NORMAL) { (void) _nc_trace_bufcat(bufnum, " | "); @@ -313,14 +325,17 @@ _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_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(SP, + _nc_tracechar(CURRENT_SCREEN, UChar(ch->chars[PUTC_i]))); } break; @@ -329,7 +344,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch) if (n) (void) _nc_trace_bufcat(bufnum, ", "); (void) _nc_trace_bufcat(bufnum, - _nc_tracechar(SP, + _nc_tracechar(CURRENT_SCREEN, UChar(PUTC_buf[n]))); } }