]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/trace/lib_traceatr.c
ncurses 5.7 - patch 20091212
[ncurses.git] / ncurses / trace / lib_traceatr.c
index 50920f2405e8342c92efc254206501b8c37c1c6b..b3d3b7cf1e289f8ab8afffb19476955ccc107c4d 100644 (file)
  */
 
 #include <curses.priv.h>
  */
 
 #include <curses.priv.h>
-#include <term.h>              /* acs_chars */
 
 
-MODULE_ID("$Id: lib_traceatr.c,v 1.64 2009/02/28 21:10:20 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))
 
 
 #define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name))
 
@@ -187,6 +190,9 @@ _nc_altcharset_name(attr_t attr, chtype ch)
        unsigned int val;
        const char *name;
     } ALT_NAMES;
        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 */
     static const ALT_NAMES names[] =
     {
        {'l', "ACS_ULCORNER"},  /* upper left corner */
@@ -226,6 +232,9 @@ _nc_altcharset_name(attr_t attr, chtype ch)
 
     const char *result = 0;
 
 
     const char *result = 0;
 
+#if NCURSES_SP_FUNCS
+    (void) sp;
+#endif
     if ((attr & A_ALTCHARSET) && (acs_chars != 0)) {
        char *cp;
        char *found = 0;
     if ((attr & A_ALTCHARSET) && (acs_chars != 0)) {
        char *cp;
        char *found = 0;
@@ -261,8 +270,9 @@ _tracechtype2(int bufnum, chtype ch)
        if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) {
            (void) _nc_trace_bufcat(bufnum, found);
        } else
        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(CURRENT_SCREEN,
+                                                 (int) ChCharOf(ch)));
 
        if (ChAttrOf(ch) != A_NORMAL) {
            (void) _nc_trace_bufcat(bufnum, " | ");
 
        if (ChAttrOf(ch) != A_NORMAL) {
            (void) _nc_trace_bufcat(bufnum, " | ");
@@ -315,8 +325,11 @@ _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];
                (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;
                        break;
+                   }
                    PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
                    if (PUTC_n <= 0) {
                        if (PUTC_ch != L'\0') {
                    PUTC_n = wcrtomb(PUTC_buf, ch->chars[PUTC_i], &PUT_st);
                    if (PUTC_n <= 0) {
                        if (PUTC_ch != L'\0') {