aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses/trace
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>1999-08-24 01:06:48 +0000
committerPeter Wemm <peter@FreeBSD.org>1999-08-24 01:06:48 +0000
commit0e3d540892016a47f6a68ec9ba2879d35ce5f7c2 (patch)
treead214c5b2c8142ad6dc6d2ce3a9c83e6317d7f77 /contrib/ncurses/ncurses/trace
downloadsrc-0e3d540892016a47f6a68ec9ba2879d35ce5f7c2.tar.gz
src-0e3d540892016a47f6a68ec9ba2879d35ce5f7c2.zip
Import unmodified (but trimmed) ncurses 5.0 prerelease 990821.vendor/ncurses/5.0-19990821
This contains the full eti (panel, form, menu) extensions. bmake glue to follow. Obtained from: ftp://ftp.clark.net/pub/dickey/ncurses
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=50276 svn path=/vendor/ncurses/5.0-19990821/; revision=50278; tag=vendor/ncurses/5.0-19990821
Diffstat (limited to 'contrib/ncurses/ncurses/trace')
-rw-r--r--contrib/ncurses/ncurses/trace/README5
-rw-r--r--contrib/ncurses/ncurses/trace/lib_trace.c200
-rw-r--r--contrib/ncurses/ncurses/trace/lib_traceatr.c218
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracebits.c225
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracechr.c69
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracedmp.c128
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracemse.c95
-rw-r--r--contrib/ncurses/ncurses/trace/trace_buf.c80
-rw-r--r--contrib/ncurses/ncurses/trace/trace_tries.c74
-rw-r--r--contrib/ncurses/ncurses/trace/trace_xnames.c74
10 files changed, 1168 insertions, 0 deletions
diff --git a/contrib/ncurses/ncurses/trace/README b/contrib/ncurses/ncurses/trace/README
new file mode 100644
index 000000000000..a627a537a3d1
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/README
@@ -0,0 +1,5 @@
+-- $Id: README,v 1.1 1998/11/08 00:11:01 tom Exp $
+
+The files in this directory (trace) support both the terminfo and ncurses
+libraries. Most of the functions are linked in only when the libraries
+are compiled with TRACE defined.
diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c
new file mode 100644
index 000000000000..aa4b887111a7
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/lib_trace.c
@@ -0,0 +1,200 @@
+/****************************************************************************
+ * Copyright (c) 1998 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/*
+ * lib_trace.c - Tracing/Debugging routines
+ */
+
+#include <curses.priv.h>
+#include <tic.h>
+
+MODULE_ID("$Id: lib_trace.c,v 1.30 1998/10/03 23:41:42 tom Exp $")
+
+#include <ctype.h>
+#if HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+unsigned _nc_tracing = 0; /* always define this */
+
+#ifdef TRACE
+const char *_nc_tputs_trace = "";
+long _nc_outchars;
+
+static FILE * tracefp; /* default to writing to stderr */
+#endif
+
+void trace(const unsigned int tracelevel GCC_UNUSED)
+{
+#ifdef TRACE
+static bool been_here = FALSE;
+static char my_name[] = "trace";
+
+ _nc_tracing = tracelevel;
+ if (! been_here && tracelevel) {
+ been_here = TRUE;
+
+ if (_nc_access(my_name, W_OK) < 0
+ || (tracefp = fopen(my_name, "w")) == 0) {
+ perror("curses: Can't open 'trace' file: ");
+ exit(EXIT_FAILURE);
+ }
+ /* Try to set line-buffered mode, or (failing that) unbuffered,
+ * so that the trace-output gets flushed automatically at the
+ * end of each line. This is useful in case the program dies.
+ */
+#if HAVE_SETVBUF /* ANSI */
+ (void) setvbuf(tracefp, (char *)0, _IOLBF, 0);
+#elif HAVE_SETBUF /* POSIX */
+ (void) setbuffer(tracefp, (char *)0);
+#endif
+ _tracef("TRACING NCURSES version %s (%d)",
+ NCURSES_VERSION, NCURSES_VERSION_PATCH);
+ }
+#endif
+}
+
+const char *_nc_visbuf2(int bufnum, const char *buf)
+/* visibilize a given string */
+{
+char *vbuf;
+char *tp;
+int c;
+
+ if (buf == 0)
+ return("(null)");
+ if (buf == CANCELLED_STRING)
+ return("(cancelled)");
+
+ tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5);
+ *tp++ = '"';
+ while ((c = *buf++) != '\0') {
+ if (c == '"') {
+ *tp++ = '\\'; *tp++ = '"';
+ } else if (is7bits(c) && (isgraph(c) || c == ' ')) {
+ *tp++ = c;
+ } else if (c == '\n') {
+ *tp++ = '\\'; *tp++ = 'n';
+ } else if (c == '\r') {
+ *tp++ = '\\'; *tp++ = 'r';
+ } else if (c == '\b') {
+ *tp++ = '\\'; *tp++ = 'b';
+ } else if (c == '\033') {
+ *tp++ = '\\'; *tp++ = 'e';
+ } else if (is7bits(c) && iscntrl(c)) {
+ *tp++ = '\\'; *tp++ = '^'; *tp++ = '@' + c;
+ } else {
+ sprintf(tp, "\\%03o", c & 0xff);
+ tp += strlen(tp);
+ }
+ }
+ *tp++ = '"';
+ *tp++ = '\0';
+ return(vbuf);
+}
+
+const char *_nc_visbuf(const char *buf)
+{
+ return _nc_visbuf2(0, buf);
+}
+
+#ifdef TRACE
+void
+_tracef(const char *fmt, ...)
+{
+static const char Called[] = T_CALLED("");
+static const char Return[] = T_RETURN("");
+static int level;
+va_list ap;
+bool before = FALSE;
+bool after = FALSE;
+int doit = _nc_tracing;
+int save_err = errno;
+
+ if (strlen(fmt) >= sizeof(Called) - 1) {
+ if (!strncmp(fmt, Called, sizeof(Called)-1)) {
+ before = TRUE;
+ level++;
+ } else if (!strncmp(fmt, Return, sizeof(Return)-1)) {
+ after = TRUE;
+ }
+ if (before || after) {
+ if ((level <= 1)
+ || (doit & TRACE_ICALLS) != 0)
+ doit &= (TRACE_CALLS|TRACE_CCALLS);
+ else
+ doit = 0;
+ }
+ }
+
+ if (doit != 0) {
+ if (tracefp == 0)
+ tracefp = stderr;
+ if (before || after) {
+ int n;
+ for (n = 1; n < level; n++)
+ fputs("+ ", tracefp);
+ }
+ va_start(ap, fmt);
+ vfprintf(tracefp, fmt, ap);
+ fputc('\n', tracefp);
+ va_end(ap);
+ fflush(tracefp);
+ }
+
+ if (after && level)
+ level--;
+ errno = save_err;
+}
+
+/* Trace 'int' return-values */
+int _nc_retrace_int(int code)
+{
+ T((T_RETURN("%d"), code));
+ return code;
+}
+
+/* Trace 'char*' return-values */
+char * _nc_retrace_ptr(char * code)
+{
+ T((T_RETURN("%s"), _nc_visbuf(code)));
+ return code;
+}
+
+/* Trace 'WINDOW *' return-values */
+WINDOW *_nc_retrace_win(WINDOW *code)
+{
+ T((T_RETURN("%p"), code));
+ return code;
+}
+#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/trace/lib_traceatr.c b/contrib/ncurses/ncurses/trace/lib_traceatr.c
new file mode 100644
index 000000000000..d9e007517f76
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/lib_traceatr.c
@@ -0,0 +1,218 @@
+/****************************************************************************
+ * Copyright (c) 1998 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+
+/*
+ * lib_traceatr.c - Tracing/Debugging routines (attributes)
+ */
+
+#include <curses.priv.h>
+#include <term.h> /* acs_chars */
+
+MODULE_ID("$Id: lib_traceatr.c,v 1.28 1998/03/21 18:39:36 tom Exp $")
+
+#define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name)
+
+#ifdef TRACE
+char *_traceattr2(int bufnum, attr_t newmode)
+{
+char *buf = _nc_trace_buf(bufnum, BUFSIZ);
+char *tmp = buf;
+static const struct {unsigned int val; const char *name;}
+names[] =
+ {
+ { A_STANDOUT, "A_STANDOUT" },
+ { A_UNDERLINE, "A_UNDERLINE" },
+ { A_REVERSE, "A_REVERSE" },
+ { A_BLINK, "A_BLINK" },
+ { A_DIM, "A_DIM" },
+ { A_BOLD, "A_BOLD" },
+ { A_ALTCHARSET, "A_ALTCHARSET" },
+ { A_INVIS, "A_INVIS" },
+ { A_PROTECT, "A_PROTECT" },
+ { A_CHARTEXT, "A_CHARTEXT" },
+ { A_NORMAL, "A_NORMAL" },
+ { A_COLOR, "A_COLOR" },
+ },
+colors[] =
+ {
+ { COLOR_BLACK, "COLOR_BLACK" },
+ { COLOR_RED, "COLOR_RED" },
+ { COLOR_GREEN, "COLOR_GREEN" },
+ { COLOR_YELLOW, "COLOR_YELLOW" },
+ { COLOR_BLUE, "COLOR_BLUE" },
+ { COLOR_MAGENTA, "COLOR_MAGENTA" },
+ { COLOR_CYAN, "COLOR_CYAN" },
+ { COLOR_WHITE, "COLOR_WHITE" },
+ };
+size_t n;
+unsigned save_nc_tracing = _nc_tracing;
+ _nc_tracing = 0;
+
+ strcpy(tmp++, "{");
+
+ for (n = 0; n < SIZEOF(names); n++) {
+ if ((newmode & names[n].val) != 0) {
+ if (buf[1] != '\0')
+ strcat(tmp, "|");
+ strcat(tmp, names[n].name);
+ tmp += strlen(tmp);
+
+ if (names[n].val == A_COLOR)
+ {
+ short pairnum = PAIR_NUMBER(newmode);
+ short fg, bg;
+
+ if (pair_content(pairnum, &fg, &bg) == OK)
+ (void) sprintf(tmp,
+ "{%d = {%s, %s}}",
+ pairnum,
+ COLOR_OF(fg),
+ COLOR_OF(bg)
+ );
+ else
+ (void) sprintf(tmp, "{%d}", pairnum);
+ }
+ }
+ }
+ if (AttrOf(newmode) == A_NORMAL) {
+ if (buf[1] != '\0')
+ strcat(tmp, "|");
+ strcat(tmp, "A_NORMAL");
+ }
+
+ _nc_tracing = save_nc_tracing;
+ return (strcat(buf,"}"));
+}
+
+char *_traceattr(attr_t newmode)
+{
+ return _traceattr2(0, newmode);
+}
+
+/* Trace 'int' return-values */
+attr_t _nc_retrace_attr_t(attr_t code)
+{
+ T((T_RETURN("%s"), _traceattr(code)));
+ return code;
+}
+
+char *_tracechtype2(int bufnum, chtype ch)
+{
+char *buf = _nc_trace_buf(bufnum, BUFSIZ);
+char *found = 0;
+
+ strcpy(buf, "{");
+ if (ch & A_ALTCHARSET)
+ {
+ char *cp;
+ static const struct {unsigned int val; const char *name;}
+ names[] =
+ {
+ {'l', "ACS_ULCORNER"}, /* upper left corner */
+ {'m', "ACS_LLCORNER"}, /* lower left corner */
+ {'k', "ACS_URCORNER"}, /* upper right corner */
+ {'j', "ACS_LRCORNER"}, /* lower right corner */
+ {'t', "ACS_LTEE"}, /* tee pointing right */
+ {'u', "ACS_RTEE"}, /* tee pointing left */
+ {'v', "ACS_BTEE"}, /* tee pointing up */
+ {'w', "ACS_TTEE"}, /* tee pointing down */
+ {'q', "ACS_HLINE"}, /* horizontal line */
+ {'x', "ACS_VLINE"}, /* vertical line */
+ {'n', "ACS_PLUS"}, /* large plus or crossover */
+ {'o', "ACS_S1"}, /* scan line 1 */
+ {'s', "ACS_S9"}, /* scan line 9 */
+ {'`', "ACS_DIAMOND"}, /* diamond */
+ {'a', "ACS_CKBOARD"}, /* checker board (stipple) */
+ {'f', "ACS_DEGREE"}, /* degree symbol */
+ {'g', "ACS_PLMINUS"}, /* plus/minus */
+ {'~', "ACS_BULLET"}, /* bullet */
+ {',', "ACS_LARROW"}, /* arrow pointing left */
+ {'+', "ACS_RARROW"}, /* arrow pointing right */
+ {'.', "ACS_DARROW"}, /* arrow pointing down */
+ {'-', "ACS_UARROW"}, /* arrow pointing up */
+ {'h', "ACS_BOARD"}, /* board of squares */
+ {'i', "ACS_LANTERN"}, /* lantern symbol */
+ {'0', "ACS_BLOCK"}, /* solid square block */
+ {'p', "ACS_S3"}, /* scan line 3 */
+ {'r', "ACS_S7"}, /* scan line 7 */
+ {'y', "ACS_LEQUAL"}, /* less/equal */
+ {'z', "ACS_GEQUAL"}, /* greater/equal */
+ {'{', "ACS_PI"}, /* Pi */
+ {'|', "ACS_NEQUAL"}, /* not equal */
+ {'}', "ACS_STERLING"}, /* UK pound sign */
+ {'\0',(char *)0}
+ },
+ *sp;
+
+ for (cp = acs_chars; cp[0] && cp[1]; cp += 2)
+ {
+ if (TextOf(cp[1]) == TextOf(ch))
+ {
+ found = cp;
+ /* don't exit from loop - there may be redefinitions */
+ }
+ }
+
+ if (found != 0)
+ {
+ ch = TextOf(*found);
+ for (sp = names; sp->val; sp++)
+ if (sp->val == ch)
+ {
+ (void) strcat(buf, sp->name);
+ ch &= ~A_ALTCHARSET;
+ break;
+ }
+ }
+ }
+
+ if (found == 0)
+ (void) strcat(buf, _tracechar(TextOf(ch)));
+
+ if (AttrOf(ch) != A_NORMAL)
+ (void) sprintf(buf + strlen(buf), " | %s", _traceattr2(bufnum+20,AttrOf(ch)));
+
+ strcat(buf, "}");
+ return(buf);
+}
+
+char *_tracechtype(chtype ch)
+{
+ return _tracechtype2(0, ch);
+}
+#else
+extern void _nc_lib_traceatr(void);
+ void _nc_lib_traceatr(void) { }
+#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/trace/lib_tracebits.c b/contrib/ncurses/ncurses/trace/lib_tracebits.c
new file mode 100644
index 000000000000..a92e00a8624e
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/lib_tracebits.c
@@ -0,0 +1,225 @@
+/****************************************************************************
+ * Copyright (c) 1998 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+#include <curses.priv.h>
+#include <term.h> /* cur_term */
+
+MODULE_ID("$Id: lib_tracebits.c,v 1.3 1999/08/21 21:43:48 tom Exp $")
+
+#if defined(SVR4_TERMIO) && !defined(_POSIX_SOURCE)
+#define _POSIX_SOURCE
+#endif
+
+#if HAVE_SYS_TERMIO_H
+#include <sys/termio.h> /* needed for ISC */
+#endif
+
+#ifdef __EMX__
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+/* may be undefined if we're using termio.h */
+#ifndef TOSTOP
+#define TOSTOP 0
+#endif
+#ifndef IEXTEN
+#define IEXTEN 0
+#endif
+
+#ifdef TRACE
+
+typedef struct {unsigned int val; const char *name;} BITNAMES;
+
+static void lookup_bits(char *buf, const BITNAMES *table, const char *label, unsigned int val)
+{
+ const BITNAMES *sp;
+
+ (void) strcat(buf, label);
+ (void) strcat(buf, ": {");
+ for (sp = table; sp->name; sp++)
+ if (sp->val != 0
+ && (val & sp->val) == sp->val)
+ {
+ (void) strcat(buf, sp->name);
+ (void) strcat(buf, ", ");
+ }
+ if (buf[strlen(buf) - 2] == ',')
+ buf[strlen(buf) - 2] = '\0';
+ (void) strcat(buf,"} ");
+}
+
+char *_nc_tracebits(void)
+/* describe the state of the terminal control bits exactly */
+{
+char *buf;
+static const BITNAMES
+
+#ifdef TERMIOS
+iflags[] =
+ {
+ {BRKINT, "BRKINT"},
+ {IGNBRK, "IGNBRK"},
+ {IGNPAR, "IGNPAR"},
+ {PARMRK, "PARMRK"},
+ {INPCK, "INPCK"},
+ {ISTRIP, "ISTRIP"},
+ {INLCR, "INLCR"},
+ {IGNCR, "IGNC"},
+ {ICRNL, "ICRNL"},
+ {IXON, "IXON"},
+ {IXOFF, "IXOFF"},
+ {0, NULL}
+#define ALLIN (BRKINT|IGNBRK|IGNPAR|PARMRK|INPCK|ISTRIP|INLCR|IGNCR|ICRNL|IXON|IXOFF)
+ },
+oflags[] =
+ {
+ {OPOST, "OPOST"},
+ {0, NULL}
+#define ALLOUT (OPOST)
+ },
+cflags[] =
+ {
+ {CLOCAL, "CLOCAL"},
+ {CREAD, "CREAD"},
+ {CSTOPB, "CSTOPB"},
+#if !defined(CS5) || !defined(CS8)
+ {CSIZE, "CSIZE"},
+#endif
+ {HUPCL, "HUPCL"},
+ {PARENB, "PARENB"},
+ {PARODD|PARENB, "PARODD"}, /* concession to readability */
+ {0, NULL}
+#define ALLCTRL (CLOCAL|CREAD|CSIZE|CSTOPB|HUPCL|PARENB|PARODD)
+ },
+lflags[] =
+ {
+ {ECHO, "ECHO"},
+ {ECHOE|ECHO, "ECHOE"}, /* concession to readability */
+ {ECHOK|ECHO, "ECHOK"}, /* concession to readability */
+ {ECHONL, "ECHONL"},
+ {ICANON, "ICANON"},
+ {ISIG, "ISIG"},
+ {NOFLSH, "NOFLSH"},
+ {TOSTOP, "TOSTOP"},
+ {IEXTEN, "IEXTEN"},
+ {0, NULL}
+#define ALLLOCAL (ECHO|ECHONL|ICANON|ISIG|NOFLSH|TOSTOP|IEXTEN)
+ };
+
+
+ buf = _nc_trace_buf(0,
+ 8 + sizeof(iflags) +
+ 8 + sizeof(oflags) +
+ 8 + sizeof(cflags) +
+ 8 + sizeof(lflags) +
+ 8);
+
+ if (cur_term->Nttyb.c_iflag & ALLIN)
+ lookup_bits(buf, iflags, "iflags", cur_term->Nttyb.c_iflag);
+
+ if (cur_term->Nttyb.c_oflag & ALLOUT)
+ lookup_bits(buf, oflags, "oflags", cur_term->Nttyb.c_oflag);
+
+ if (cur_term->Nttyb.c_cflag & ALLCTRL)
+ lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.c_cflag);
+
+#if defined(CS5) && defined(CS8)
+ switch (cur_term->Nttyb.c_cflag & CSIZE) {
+#if defined(CS5) && (CS5 != 0)
+ case CS5: strcat(buf, "CS5 "); break;
+#endif
+#if defined(CS6) && (CS6 != 0)
+ case CS6: strcat(buf, "CS6 "); break;
+#endif
+#if defined(CS7) && (CS7 != 0)
+ case CS7: strcat(buf, "CS7 "); break;
+#endif
+#if defined(CS8) && (CS8 != 0)
+ case CS8: strcat(buf, "CS8 "); break;
+#endif
+ default: strcat(buf, "CSIZE? "); break;
+ }
+#endif
+
+ if (cur_term->Nttyb.c_lflag & ALLLOCAL)
+ lookup_bits(buf, lflags, "lflags", cur_term->Nttyb.c_lflag);
+
+#else
+ /* reference: ttcompat(4M) on SunOS 4.1 */
+#ifndef EVENP
+#define EVENP 0
+#endif
+#ifndef LCASE
+#define LCASE 0
+#endif
+#ifndef LLITOUT
+#define LLITOUT 0
+#endif
+#ifndef ODDP
+#define ODDP 0
+#endif
+#ifndef TANDEM
+#define TANDEM 0
+#endif
+
+cflags[] =
+ {
+ {CBREAK, "CBREAK"},
+ {CRMOD, "CRMOD"},
+ {ECHO, "ECHO"},
+ {EVENP, "EVENP"},
+ {LCASE, "LCASE"},
+ {LLITOUT, "LLITOUT"},
+ {ODDP, "ODDP"},
+ {RAW, "RAW"},
+ {TANDEM, "TANDEM"},
+ {XTABS, "XTABS"},
+ {0, NULL}
+#define ALLCTRL (CBREAK|CRMOD|ECHO|EVENP|LCASE|LLITOUT|ODDP|RAW|TANDEM|XTABS)
+ };
+
+ buf = _nc_trace_buf(0,
+ 8 + sizeof(cflags));
+
+ if (cur_term->Nttyb.sg_flags & ALLCTRL)
+ {
+ lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.sg_flags);
+ }
+
+#endif
+ return(buf);
+}
+#else
+char *_nc_tracebits(void) { static char tmp[] = ""; return tmp; }
+#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/trace/lib_tracechr.c b/contrib/ncurses/ncurses/trace/lib_tracechr.c
new file mode 100644
index 000000000000..e97e67931464
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/lib_tracechr.c
@@ -0,0 +1,69 @@
+/****************************************************************************
+ * Copyright (c) 1998 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+
+/*
+ * lib_tracechr.c - Tracing/Debugging routines
+ */
+
+#ifndef TRACE
+#define TRACE /* turn on internal defs for this module */
+#endif
+
+#include <curses.priv.h>
+
+#include <ctype.h>
+
+#ifdef TRACE
+char *_tracechar(const unsigned char ch)
+{
+ static char crep[20];
+ /*
+ * We can show the actual character if it's either an ordinary printable
+ * or one of the high-half characters.
+ */
+ if (isprint(ch) || (ch & 0x80))
+ {
+ crep[0] = '\'';
+ crep[1] = ch; /* necessary; printf tries too hard on metachars */
+ (void) sprintf(crep + 2, "' = 0x%02x", (unsigned)ch);
+ }
+ else
+ (void) sprintf(crep, "0x%02x", (unsigned)ch);
+ return(crep);
+}
+#else
+extern void _nc_lib_tracechr(void);
+ void _nc_lib_tracechr(void) { }
+#endif
diff --git a/contrib/ncurses/ncurses/trace/lib_tracedmp.c b/contrib/ncurses/ncurses/trace/lib_tracedmp.c
new file mode 100644
index 000000000000..a67a37ef7edd
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/lib_tracedmp.c
@@ -0,0 +1,128 @@
+/****************************************************************************
+ * Copyright (c) 1998 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+/*
+ * lib_tracedmp.c - Tracing/Debugging routines
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_tracedmp.c,v 1.13 1998/03/21 18:39:44 tom Exp $")
+
+#ifdef TRACE
+void _tracedump(const char *name, WINDOW *win)
+{
+ int i, j, n, width;
+
+ /* compute narrowest possible display width */
+ for (width = i = 0; i <= win->_maxy; i++)
+ {
+ n = 0;
+ for (j = 0; j <= win->_maxx; j++)
+ if (win->_line[i].text[j] != ' ')
+ n = j;
+
+ if (n > width)
+ width = n;
+ }
+ if (width < win->_maxx)
+ ++width;
+
+ for (n = 0; n <= win->_maxy; n++)
+ {
+ char buf[BUFSIZ], *ep;
+ bool haveattrs, havecolors;
+
+ /* dump A_CHARTEXT part */
+ (void) sprintf(buf, "%s[%2d] %3d%3d ='",
+ name, n,
+ win->_line[n].firstchar,
+ win->_line[n].lastchar);
+ ep = buf + strlen(buf);
+ for (j = 0; j <= width; j++) {
+ ep[j] = TextOf(win->_line[n].text[j]);
+ if (ep[j] == 0)
+ ep[j] = '.';
+ }
+ ep[j] = '\'';
+ ep[j+1] = '\0';
+ _tracef("%s", buf);
+
+ /* dump A_COLOR part, will screw up if there are more than 96 */
+ havecolors = FALSE;
+ for (j = 0; j <= width; j++)
+ if (win->_line[n].text[j] & A_COLOR)
+ {
+ havecolors = TRUE;
+ break;
+ }
+ if (havecolors)
+ {
+ (void) sprintf(buf, "%*s[%2d]%*s='", (int)strlen(name), "colors", n, 8, " ");
+ ep = buf + strlen(buf);
+ for (j = 0; j <= width; j++)
+ ep[j] = ((win->_line[n].text[j] >> 8) & 0xff) + ' ';
+ ep[j] = '\'';
+ ep[j+1] = '\0';
+ _tracef("%s", buf);
+ }
+
+ for (i = 0; i < 4; i++)
+ {
+ const char *hex = " 123456789ABCDEF";
+ chtype mask = (0xf << ((i + 4) * 4));
+
+ haveattrs = FALSE;
+ for (j = 0; j <= width; j++)
+ if (win->_line[n].text[j] & mask)
+ {
+ haveattrs = TRUE;
+ break;
+ }
+ if (haveattrs)
+ {
+ (void) sprintf(buf, "%*s%d[%2d]%*s='", (int)strlen(name)-1, "attrs", i, n, 8, " ");
+ ep = buf + strlen(buf);
+ for (j = 0; j <= width; j++)
+ ep[j] = hex[(win->_line[n].text[j] & mask) >> ((i + 4) * 4)];
+ ep[j] = '\'';
+ ep[j+1] = '\0';
+ _tracef("%s", buf);
+ }
+ }
+ }
+}
+#else
+extern void _nc_lib_tracedmp(void);
+ void _nc_lib_tracedmp(void) { }
+#endif /* TRACE */
diff --git a/contrib/ncurses/ncurses/trace/lib_tracemse.c b/contrib/ncurses/ncurses/trace/lib_tracemse.c
new file mode 100644
index 000000000000..fbdd2c006de0
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/lib_tracemse.c
@@ -0,0 +1,95 @@
+/****************************************************************************
+ * Copyright (c) 1998 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
+ ****************************************************************************/
+
+
+
+/*
+ * lib_tracemse.c - Tracing/Debugging routines (mouse events)
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: lib_tracemse.c,v 1.6 1998/11/16 14:28:17 Alexander.V.Lukyanov Exp $")
+
+#ifdef TRACE
+
+char *_tracemouse(MEVENT const *ep)
+{
+ static char buf[80];
+
+ (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {",
+ ep->id, ep->x, ep->y, ep->z, ep->bstate);
+
+#define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");}
+ SHOW(BUTTON1_RELEASED, "release-1")
+ SHOW(BUTTON1_PRESSED, "press-1")
+ SHOW(BUTTON1_CLICKED, "click-1")
+ SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1")
+ SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1")
+ SHOW(BUTTON1_RESERVED_EVENT, "reserved-1")
+ SHOW(BUTTON2_RELEASED, "release-2")
+ SHOW(BUTTON2_PRESSED, "press-2")
+ SHOW(BUTTON2_CLICKED, "click-2")
+ SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2")
+ SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2")
+ SHOW(BUTTON2_RESERVED_EVENT, "reserved-2")
+ SHOW(BUTTON3_RELEASED, "release-3")
+ SHOW(BUTTON3_PRESSED, "press-3")
+ SHOW(BUTTON3_CLICKED, "click-3")
+ SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3")
+ SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3")
+ SHOW(BUTTON3_RESERVED_EVENT, "reserved-3")
+ SHOW(BUTTON4_RELEASED, "release-4")
+ SHOW(BUTTON4_PRESSED, "press-4")
+ SHOW(BUTTON4_CLICKED, "click-4")
+ SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4")
+ SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4")
+ SHOW(BUTTON4_RESERVED_EVENT, "reserved-4")
+ SHOW(BUTTON_CTRL, "ctrl")
+ SHOW(BUTTON_SHIFT, "shift")
+ SHOW(BUTTON_ALT, "alt")
+ SHOW(ALL_MOUSE_EVENTS, "all-events")
+ SHOW(REPORT_MOUSE_POSITION, "position")
+#undef SHOW
+
+ if (buf[strlen(buf)-1] == ' ')
+ buf[strlen(buf)-2] = '\0';
+ (void) strcat(buf, "}");
+ return(buf);
+}
+
+#else /* !TRACE */
+/* don't make empty module */
+void _nc_lib_tracemouse(void);
+void _nc_lib_tracemouse(void) {}
+#endif
diff --git a/contrib/ncurses/ncurses/trace/trace_buf.c b/contrib/ncurses/ncurses/trace/trace_buf.c
new file mode 100644
index 000000000000..48f93d43d1ef
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/trace_buf.c
@@ -0,0 +1,80 @@
+/****************************************************************************
+ * Copyright (c) 1998 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Thomas E. Dickey <dickey@clark.net> 1997 *
+ ****************************************************************************/
+/*
+ * trace_buf.c - Tracing/Debugging buffers (attributes)
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: trace_buf.c,v 1.7 1999/02/27 19:50:58 tom Exp $")
+
+typedef struct {
+ char *text;
+ size_t size;
+} LIST;
+
+char * _nc_trace_buf(int bufnum, size_t want)
+{
+ static LIST *list;
+ static size_t have;
+
+#if NO_LEAKS
+ if (bufnum < 0) {
+ if (have) {
+ while (have--) {
+ free(list[have].text);
+ }
+ free(list);
+ }
+ return 0;
+ }
+#endif
+
+ if ((size_t)(bufnum+1) > have) {
+ size_t need = (bufnum + 1) * 2;
+ if ((list = typeRealloc(LIST, need, list)) == 0)
+ return(0);
+ while (need > have)
+ list[have++].text = 0;
+ }
+
+ if (list[bufnum].text == 0
+ || want > list[bufnum].size)
+ {
+ if ((list[bufnum].text = typeRealloc(char, want, list[bufnum].text)) != 0)
+ list[bufnum].size = want;
+ }
+
+ if (list[bufnum].text != 0)
+ *(list[bufnum].text) = '\0';
+ return list[bufnum].text;
+}
diff --git a/contrib/ncurses/ncurses/trace/trace_tries.c b/contrib/ncurses/ncurses/trace/trace_tries.c
new file mode 100644
index 000000000000..abd5db47a818
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/trace_tries.c
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * Copyright (c) 1999 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Thomas E. Dickey <dickey@clark.net> 1999 *
+ ****************************************************************************/
+/*
+ * trace_tries.c - Tracing/Debugging buffers (keycode tries-trees)
+ */
+
+#include <curses.priv.h>
+
+MODULE_ID("$Id: trace_tries.c,v 1.6 1999/03/06 22:51:07 tom Exp $")
+
+#ifdef TRACE
+static unsigned char *buffer;
+static unsigned len;
+
+static void recur_tries(struct tries *tree, unsigned level)
+{
+ if (level > len)
+ buffer = (unsigned char *)realloc(buffer, len = (level + 1) * 4);
+
+ while (tree != 0) {
+ if ((buffer[level] = tree->ch) == 0)
+ buffer[level] = 128;
+ buffer[level+1] = 0;
+ if (tree->value != 0) {
+ _tracef("%5d: %s (%s)", tree->value, _nc_visbuf((char *)buffer), keyname(tree->value));
+ }
+ if (tree->child)
+ recur_tries(tree->child, level+1);
+ tree = tree->sibling;
+ }
+}
+
+void _nc_trace_tries(struct tries *tree)
+{
+ buffer = typeMalloc(unsigned char, len = 80);
+ _tracef("BEGIN tries %p", tree);
+ recur_tries(tree, 0);
+ _tracef(". . . tries %p", tree);
+ free(buffer);
+}
+#else
+void _nc_trace_tries(struct tries *tree GCC_UNUSED)
+{
+}
+#endif
diff --git a/contrib/ncurses/ncurses/trace/trace_xnames.c b/contrib/ncurses/ncurses/trace/trace_xnames.c
new file mode 100644
index 000000000000..6287fc85c0a6
--- /dev/null
+++ b/contrib/ncurses/ncurses/trace/trace_xnames.c
@@ -0,0 +1,74 @@
+/****************************************************************************
+ * Copyright (c) 1999 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Thomas E. Dickey <dickey@clark.net> 1999 *
+ ****************************************************************************/
+/*
+ * trace_xnames.c - Tracing/Debugging buffers (TERMTYPE extended names)
+ */
+
+#include <curses.priv.h>
+#include <term_entry.h>
+
+MODULE_ID("$Id: trace_xnames.c,v 1.3 1999/03/02 01:20:38 tom Exp $")
+
+void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED)
+{
+#ifdef TRACE
+#if NCURSES_XNAMES
+ int limit = tp->ext_Booleans + tp->ext_Numbers + tp->ext_Strings;
+ int n, m;
+ if (limit) {
+ int begin_num = tp->ext_Booleans;
+ int begin_str = tp->ext_Booleans + tp->ext_Numbers;
+
+ _tracef("extended names (%s) %d = %d+%d+%d of %d+%d+%d",
+ tp->term_names,
+ limit,
+ tp->ext_Booleans, tp->ext_Numbers, tp->ext_Strings,
+ tp->num_Booleans, tp->num_Numbers, tp->num_Strings);
+ for (n = 0; n < limit; n++) {
+ if ((m = n - begin_str) >= 0) {
+ _tracef("[%d] %s = %s", n,
+ tp->ext_Names[n],
+ _nc_visbuf(tp->Strings[tp->num_Strings + m - tp->ext_Strings]));
+ } else if ((m = n - begin_num) >= 0) {
+ _tracef("[%d] %s = %d (num)", n,
+ tp->ext_Names[n],
+ tp->Numbers[tp->num_Numbers + m - tp->ext_Numbers]);
+ } else {
+ _tracef("[%d] %s = %d (bool)", n,
+ tp->ext_Names[n],
+ tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]);
+ }
+ }
+ }
+#endif
+#endif
+}