aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/ncurses/trace
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ncurses/ncurses/trace')
-rw-r--r--contrib/ncurses/ncurses/trace/lib_trace.c40
-rw-r--r--contrib/ncurses/ncurses/trace/lib_traceatr.c23
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracebits.c22
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracechr.c18
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracedmp.c75
-rw-r--r--contrib/ncurses/ncurses/trace/lib_tracemse.c89
-rw-r--r--contrib/ncurses/ncurses/trace/trace_buf.c64
-rw-r--r--contrib/ncurses/ncurses/trace/trace_tries.c49
-rw-r--r--contrib/ncurses/ncurses/trace/trace_xnames.c19
9 files changed, 209 insertions, 190 deletions
diff --git a/contrib/ncurses/ncurses/trace/lib_trace.c b/contrib/ncurses/ncurses/trace/lib_trace.c
index 51260aec6b17..08790bb25ce2 100644
--- a/contrib/ncurses/ncurses/trace/lib_trace.c
+++ b/contrib/ncurses/ncurses/trace/lib_trace.c
@@ -40,17 +40,20 @@
#include <ctype.h>
-MODULE_ID("$Id: lib_trace.c,v 1.34 2000/04/01 20:25:47 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.38 2000/12/10 03:02:45 tom Exp $")
-unsigned _nc_tracing = 0; /* always define this */
+NCURSES_EXPORT_VAR(unsigned)
+_nc_tracing = 0; /* always define this */
#ifdef TRACE
-const char *_nc_tputs_trace = "";
-long _nc_outchars = 0;
+NCURSES_EXPORT_VAR(const char *)
+_nc_tputs_trace = "";
+NCURSES_EXPORT_VAR(long)
+_nc_outchars = 0;
-static FILE *tracefp; /* default to writing to stderr */
+ static FILE *tracefp; /* default to writing to stderr */
-void
+NCURSES_EXPORT(void)
trace(const unsigned int tracelevel GCC_UNUSED)
{
static bool been_here = FALSE;
@@ -61,7 +64,7 @@ trace(const unsigned int tracelevel GCC_UNUSED)
been_here = TRUE;
if (_nc_access(my_name, W_OK) < 0
- || (tracefp = fopen(my_name, "w")) == 0) {
+ || (tracefp = fopen(my_name, "wb")) == 0) {
perror("curses: Can't open 'trace' file: ");
exit(EXIT_FAILURE);
}
@@ -74,13 +77,12 @@ trace(const unsigned int tracelevel GCC_UNUSED)
#elif HAVE_SETBUF /* POSIX */
(void) setbuffer(tracefp, (char *) 0);
#endif
- _tracef("TRACING NCURSES version %s (%d)",
- NCURSES_VERSION, NCURSES_VERSION_PATCH);
+ _tracef("TRACING NCURSES version %s", curses_version());
}
}
#endif
-const char *
+NCURSES_EXPORT(const char *)
_nc_visbuf2(int bufnum, const char *buf)
/* visibilize a given string */
{
@@ -97,9 +99,9 @@ _nc_visbuf2(int bufnum, const char *buf)
tp = vbuf = _nc_trace_buf(bufnum, (strlen(buf) * 4) + 5);
#else
{
- static char *mybuf[2];
- mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5);
- tp = vbuf = mybuf[bufnum];
+ static char *mybuf[2];
+ mybuf[bufnum] = _nc_doalloc(mybuf[bufnum], (strlen(buf) * 4) + 5);
+ tp = vbuf = mybuf[bufnum];
}
#endif
*tp++ = '"';
@@ -126,7 +128,7 @@ _nc_visbuf2(int bufnum, const char *buf)
*tp++ = '^';
*tp++ = '@' + c;
} else {
- sprintf(tp, "\\%03o", c & 0xff);
+ sprintf(tp, "\\%03o", CharOf(c));
tp += strlen(tp);
}
}
@@ -135,14 +137,14 @@ _nc_visbuf2(int bufnum, const char *buf)
return (vbuf);
}
-const char *
+NCURSES_EXPORT(const char *)
_nc_visbuf(const char *buf)
{
return _nc_visbuf2(0, buf);
}
#ifdef TRACE
-void
+NCURSES_EXPORT(void)
_tracef(const char *fmt,...)
{
static const char Called[] = T_CALLED("");
@@ -191,7 +193,7 @@ _tracef(const char *fmt,...)
}
/* Trace 'int' return-values */
-int
+NCURSES_EXPORT(int)
_nc_retrace_int(int code)
{
T((T_RETURN("%d"), code));
@@ -199,7 +201,7 @@ _nc_retrace_int(int code)
}
/* Trace 'char*' return-values */
-char *
+NCURSES_EXPORT(char *)
_nc_retrace_ptr(char *code)
{
T((T_RETURN("%s"), _nc_visbuf(code)));
@@ -207,7 +209,7 @@ _nc_retrace_ptr(char *code)
}
/* Trace 'WINDOW *' return-values */
-WINDOW *
+NCURSES_EXPORT(WINDOW *)
_nc_retrace_win(WINDOW *code)
{
T((T_RETURN("%p"), code));
diff --git a/contrib/ncurses/ncurses/trace/lib_traceatr.c b/contrib/ncurses/ncurses/trace/lib_traceatr.c
index c65c584f8600..3584b6e76c52 100644
--- a/contrib/ncurses/ncurses/trace/lib_traceatr.c
+++ b/contrib/ncurses/ncurses/trace/lib_traceatr.c
@@ -38,12 +38,12 @@
#include <curses.priv.h>
#include <term.h> /* acs_chars */
-MODULE_ID("$Id: lib_traceatr.c,v 1.30 2000/07/29 18:06:09 tom Exp $")
+MODULE_ID("$Id: lib_traceatr.c,v 1.32 2000/12/10 03:02:45 tom Exp $")
#define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name)
#ifdef TRACE
-char *
+NCURSES_EXPORT(char *)
_traceattr2(int bufnum, attr_t newmode)
{
char *buf = _nc_trace_buf(bufnum, BUFSIZ);
@@ -122,21 +122,21 @@ _traceattr2(int bufnum, attr_t newmode)
return (strcat(buf, "}"));
}
-char *
+NCURSES_EXPORT(char *)
_traceattr(attr_t newmode)
{
return _traceattr2(0, newmode);
}
/* Trace 'int' return-values */
-attr_t
+NCURSES_EXPORT(attr_t)
_nc_retrace_attr_t(attr_t code)
{
T((T_RETURN("%s"), _traceattr(code)));
return code;
}
-char *
+NCURSES_EXPORT(char *)
_tracechtype2(int bufnum, chtype ch)
{
char *buf = _nc_trace_buf(bufnum, BUFSIZ);
@@ -217,24 +217,23 @@ _tracechtype2(int bufnum, chtype ch)
return (buf);
}
-char *
-_tracechtype(chtype ch)
+NCURSES_EXPORT(char *)
+_tracechtype (chtype ch)
{
return _tracechtype2(0, ch);
}
/* Trace 'chtype' return-values */
-attr_t
-_nc_retrace_chtype(attr_t code)
+NCURSES_EXPORT(attr_t)
+_nc_retrace_chtype (attr_t code)
{
T((T_RETURN("%s"), _tracechtype(code)));
return code;
}
#else
-extern void _nc_lib_traceatr(void);
-void
-_nc_lib_traceatr(void)
+extern NCURSES_EXPORT(void) _nc_lib_traceatr (void);
+NCURSES_EXPORT(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
index a8cb343be59f..21a3b923bf85 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracebits.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracebits.c
@@ -34,7 +34,7 @@
#include <curses.priv.h>
#include <term.h> /* cur_term */
-MODULE_ID("$Id: lib_tracebits.c,v 1.7 2000/09/02 18:08:37 tom Exp $")
+MODULE_ID("$Id: lib_tracebits.c,v 1.10 2001/03/24 21:58:23 tom Exp $")
#if SVR4_TERMIO && !defined(_POSIX_SOURCE)
#define _POSIX_SOURCE
@@ -81,7 +81,7 @@ lookup_bits(char *buf, const BITNAMES * table, const char *label, unsigned int v
(void) strcat(buf, "} ");
}
-char *
+NCURSES_EXPORT(char *)
_nc_tracebits(void)
/* describe the state of the terminal control bits exactly */
{
@@ -137,11 +137,11 @@ _nc_tracebits(void)
};
buf = _nc_trace_buf(0,
- 8 + sizeof(iflags) +
- 8 + sizeof(oflags) +
- 8 + sizeof(cflags) +
- 8 + sizeof(lflags) +
- 8);
+ 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);
@@ -155,7 +155,7 @@ _nc_tracebits(void)
#if defined(CS5) && defined(CS8)
{
static struct {
- char *name;
+ const char *name;
int value;
} csizes[] = {
{
@@ -175,7 +175,7 @@ _nc_tracebits(void)
"CS8 ", CS8
},
};
- char *result = "CSIZE? ";
+ const char *result = "CSIZE? ";
int value = (cur_term->Nttyb.c_cflag & CSIZE);
unsigned n;
@@ -229,7 +229,7 @@ _nc_tracebits(void)
};
buf = _nc_trace_buf(0,
- 8 + sizeof(cflags));
+ 8 + sizeof(cflags));
if (cur_term->Nttyb.sg_flags & ALLCTRL) {
lookup_bits(buf, cflags, "cflags", cur_term->Nttyb.sg_flags);
@@ -238,7 +238,7 @@ _nc_tracebits(void)
return (buf);
}
#else
-char *
+NCURSES_EXPORT(char *)
_nc_tracebits(void)
{
static char tmp[] = "";
diff --git a/contrib/ncurses/ncurses/trace/lib_tracechr.c b/contrib/ncurses/ncurses/trace/lib_tracechr.c
index bf004f35294e..a019969a4711 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracechr.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracechr.c
@@ -36,16 +36,22 @@
*/
#include <curses.priv.h>
-MODULE_ID("$Id: lib_tracechr.c,v 1.2 2000/04/01 20:17:26 tom Exp $")
+MODULE_ID("$Id: lib_tracechr.c,v 1.4 2000/12/10 03:02:45 tom Exp $")
#ifdef TRACE
-char *_tracechar(const unsigned char ch)
+NCURSES_EXPORT(char *)
+_tracechar(const unsigned char ch)
{
static char crep[20];
- (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned)ch);
- return(crep);
+ (void) sprintf(crep, "'%s' = 0x%02x", unctrl(ch), (unsigned) ch);
+ return (crep);
}
#else
-extern void _nc_lib_tracechr(void);
- void _nc_lib_tracechr(void) { }
+extern
+NCURSES_EXPORT(void)
+_nc_lib_tracechr(void);
+NCURSES_EXPORT(void)
+_nc_lib_tracechr(void)
+{
+}
#endif
diff --git a/contrib/ncurses/ncurses/trace/lib_tracedmp.c b/contrib/ncurses/ncurses/trace/lib_tracedmp.c
index a67a37ef7edd..22304ce73187 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracedmp.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracedmp.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 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 *
@@ -37,92 +37,93 @@
#include <curses.priv.h>
-MODULE_ID("$Id: lib_tracedmp.c,v 1.13 1998/03/21 18:39:44 tom Exp $")
+MODULE_ID("$Id: lib_tracedmp.c,v 1.16 2000/12/10 03:02:45 tom Exp $")
#ifdef TRACE
-void _tracedump(const char *name, WINDOW *win)
+NCURSES_EXPORT(void)
+_tracedump(const char *name, WINDOW *win)
{
- int i, j, n, width;
+ int i, j, n, width;
/* compute narrowest possible display width */
- for (width = i = 0; i <= win->_maxy; i++)
- {
+ 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 (win->_line[i].text[j] != ' ')
+ n = j;
if (n > width)
- width = n;
+ width = n;
}
if (width < win->_maxx)
- ++width;
+ ++width;
- for (n = 0; n <= win->_maxy; n++)
- {
- char buf[BUFSIZ], *ep;
+ 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);
+ 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] = '\'';
- ep[j+1] = '\0';
+ 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)
- {
+ 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, " ");
+ 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] = CharOf(win->_line[n].text[j] >> 8) + ' ';
ep[j] = '\'';
- ep[j+1] = '\0';
+ ep[j + 1] = '\0';
_tracef("%s", buf);
}
- for (i = 0; i < 4; i++)
- {
- const char *hex = " 123456789ABCDEF";
- chtype mask = (0xf << ((i + 4) * 4));
+ 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)
- {
+ 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, " ");
+ 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';
+ ep[j + 1] = '\0';
_tracef("%s", buf);
}
}
}
}
#else
-extern void _nc_lib_tracedmp(void);
- void _nc_lib_tracedmp(void) { }
+extern
+NCURSES_EXPORT(void)
+_nc_lib_tracedmp(void);
+NCURSES_EXPORT(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
index fbdd2c006de0..38dd57ec0bff 100644
--- a/contrib/ncurses/ncurses/trace/lib_tracemse.c
+++ b/contrib/ncurses/ncurses/trace/lib_tracemse.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000 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 *
@@ -31,65 +31,68 @@
* 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 $")
+MODULE_ID("$Id: lib_tracemse.c,v 1.8 2000/12/10 03:02:45 tom Exp $")
#ifdef TRACE
-char *_tracemouse(MEVENT const *ep)
+NCURSES_EXPORT(char *)
+_tracemouse(MEVENT const *ep)
{
- static char buf[80];
+ 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);
+ (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")
+ 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);
+ 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) {}
+NCURSES_EXPORT(void)
+_nc_lib_tracemouse(void);
+NCURSES_EXPORT(void)
+_nc_lib_tracemouse(void)
+{
+}
#endif
diff --git a/contrib/ncurses/ncurses/trace/trace_buf.c b/contrib/ncurses/ncurses/trace/trace_buf.c
index 48f93d43d1ef..15748d423d9e 100644
--- a/contrib/ncurses/ncurses/trace/trace_buf.c
+++ b/contrib/ncurses/ncurses/trace/trace_buf.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998,2000,2001 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 *
@@ -35,46 +35,48 @@
#include <curses.priv.h>
-MODULE_ID("$Id: trace_buf.c,v 1.7 1999/02/27 19:50:58 tom Exp $")
+MODULE_ID("$Id: trace_buf.c,v 1.10 2001/04/21 21:19:18 tom Exp $")
typedef struct {
- char *text;
- size_t size;
+ char *text;
+ size_t size;
} LIST;
-char * _nc_trace_buf(int bufnum, size_t want)
+NCURSES_EXPORT(char *)
+_nc_trace_buf(int bufnum, size_t want)
{
- static LIST *list;
- static size_t have;
+ 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;
+ if (bufnum < 0) {
+ if (have) {
+ while (have--) {
+ if (list[have].text != 0)
+ 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 ((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
+ || 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;
+ 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
index abd5db47a818..fdf3a09de0b1 100644
--- a/contrib/ncurses/ncurses/trace/trace_tries.c
+++ b/contrib/ncurses/ncurses/trace/trace_tries.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1999,2000 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 *
@@ -35,40 +35,45 @@
#include <curses.priv.h>
-MODULE_ID("$Id: trace_tries.c,v 1.6 1999/03/06 22:51:07 tom Exp $")
+MODULE_ID("$Id: trace_tries.c,v 1.8 2000/12/10 03:03:51 tom Exp $")
#ifdef TRACE
static unsigned char *buffer;
static unsigned len;
-static void recur_tries(struct tries *tree, unsigned level)
+static void
+recur_tries(struct tries *tree, unsigned level)
{
- if (level > len)
- buffer = (unsigned char *)realloc(buffer, len = (level + 1) * 4);
+ 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;
+ 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)
+NCURSES_EXPORT(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);
+ 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)
+NCURSES_EXPORT(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
index 6287fc85c0a6..9b0b5920d814 100644
--- a/contrib/ncurses/ncurses/trace/trace_xnames.c
+++ b/contrib/ncurses/ncurses/trace/trace_xnames.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1999,2000 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 *
@@ -36,9 +36,10 @@
#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 $")
+MODULE_ID("$Id: trace_xnames.c,v 1.5 2000/12/10 03:02:45 tom Exp $")
-void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED)
+NCURSES_EXPORT(void)
+_nc_trace_xnames(TERMTYPE * tp GCC_UNUSED)
{
#ifdef TRACE
#if NCURSES_XNAMES
@@ -56,16 +57,16 @@ void _nc_trace_xnames(TERMTYPE *tp GCC_UNUSED)
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]));
+ 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]);
+ 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]);
+ tp->ext_Names[n],
+ tp->Booleans[tp->num_Booleans + n - tp->ext_Booleans]);
}
}
}