summaryrefslogtreecommitdiff
path: root/lib/libcurses/lib_acs.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-11-26 04:02:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-11-26 04:02:03 +0000
commitbda33b7e716d56bf1a9ecccb7e2543889f9ab1d3 (patch)
tree7bc4bcdf70ecc1d045693a309e96b304e1b49c33 /lib/libcurses/lib_acs.c
parentcd15e61d557c4704743905eae7b88ae927cf0394 (diff)
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.
Diffstat (limited to 'lib/libcurses/lib_acs.c')
-rw-r--r--lib/libcurses/lib_acs.c40
1 files changed, 30 insertions, 10 deletions
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 <string.h>
+#include <curses.priv.h>
+#include <term.h> /* 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 */