From bda33b7e716d56bf1a9ecccb7e2543889f9ab1d3 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 26 Nov 1997 04:02:03 +0000 Subject: ncurses 4.1 + changes to work with our terminfo libs (instead of the ncurses ones). Changes are #ifdef EXTERN_TERMINFO. Post 4.1 patches will be applied in a separate commit. --- lib/libcurses/lib_acs.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'lib/libcurses/lib_acs.c') diff --git a/lib/libcurses/lib_acs.c b/lib/libcurses/lib_acs.c index ba867d7cc73..e72c653bebf 100644 --- a/lib/libcurses/lib_acs.c +++ b/lib/libcurses/lib_acs.c @@ -21,9 +21,10 @@ -#include "curses.priv.h" -#include "term.h" /* ena_acs, acs_chars */ -#include +#include +#include /* ena_acs, acs_chars */ + +MODULE_ID("Id: lib_acs.c,v 1.8 1997/04/24 11:04:07 tom Exp $") chtype acs_map[128]; @@ -61,7 +62,7 @@ void init_acs(void) ACS_LANTERN = '#'; /* should be lantern symbol */ ACS_BLOCK = '#'; /* should be solid square block */ /* these defaults were invented for ncurses */ - ACS_S3 = '-'; /* should be scan line 3 */ + ACS_S3 = '-'; /* should be scan line 3 */ ACS_S7 = '-'; /* should be scan line 7 */ ACS_LEQUAL = '<'; /* should be less-than-or-equal-to */ ACS_GEQUAL = '>'; /* should be greater-than-or-equal-to */ @@ -78,13 +79,13 @@ void init_acs(void) #endif /* ena_acs */ #ifdef acs_chars -#define ALTCHAR(c) ((chtype)(c) & A_CHARTEXT) | A_ALTCHARSET +#define ALTCHAR(c) (TextOf(c) | A_ALTCHARSET) if (acs_chars != NULL) { size_t i = 0; size_t length = strlen(acs_chars); - - while (i < length) + + while (i < length) switch (acs_chars[i]) { case 'l':case 'm':case 'k':case 'j': case 'u':case 't':case 'v':case 'w': @@ -94,7 +95,7 @@ void init_acs(void) case '.':case '-':case 'h':case 'I': case '0':case 'p':case 'r':case 'y': case 'z':case '{':case '|':case '}': - acs_map[(unsigned int)acs_chars[i]] = + acs_map[(unsigned int)acs_chars[i]] = ALTCHAR(acs_chars[i+1]); i++; /* FALLTHRU */ @@ -104,8 +105,27 @@ void init_acs(void) } } #ifdef TRACE - else { - T(("acsc not defined, using default mapping")); +#define SIZEOF(v) (sizeof(v)/sizeof(v[0])) + /* Show the equivalent mapping, noting if it does not match the + * given attribute, whether by re-ordering or duplication. + */ + if (_nc_tracing & TRACE_CALLS) { + size_t n, m; + char show[SIZEOF(acs_map) + 1]; + for (n = 1, m = 0; n < SIZEOF(acs_map); n++) { + if (acs_map[n] != 0) { + show[m++] = (char)n; + show[m++] = TextOf(acs_map[n]); + } + } + show[m] = 0; + _tracef("%s acs_chars %s", + (acs_chars == NULL) + ? "NULL" + : (strcmp(acs_chars, show) + ? "DIFF" + : "SAME"), + _nc_visbuf(show)); } #endif /* TRACE */ #endif /* acs_char */ -- cgit v1.2.3