ncurses 5.7 - patch 20091010
[ncurses.git] / ncurses / trace / lib_traceatr.c
index 45a03cea05feb194988e2455077354e2244f03b5..66d35f40b69b66fa85010d95c4a94be109f7836f 100644 (file)
@@ -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 <zmbenhal@netcom.com> 1992,1995               *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Juergen Pfeifer                                                 *
  ****************************************************************************/
 
 /*
  */
 
 #include <curses.priv.h>
-#include <term.h>              /* 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.66 2009/05/10 00:48:29 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 */
@@ -228,7 +235,7 @@ _nc_altcharset_name(attr_t attr, chtype ch)
     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 +246,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 +267,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, " | ");
@@ -320,7 +329,7 @@ _tracecchar_t2(int bufnum, const cchar_t *ch)
                        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 +338,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])));
                    }
                }