]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/trace/lib_trace.c
ncurses 5.6
[ncurses.git] / ncurses / trace / lib_trace.c
index 8a5d7e6a650a04c4b9363849103f206bd00c3ddc..7f78122179997aaca583a003d900323e72db3d94 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2005 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            *
 /****************************************************************************
  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *     and: Thomas E. Dickey                        1996-on                 *
  ****************************************************************************/
 
 /*
  *     lib_trace.c - Tracing/Debugging routines
+ *
+ * The _tracef() function is originally from pcurses (by Pavel Curtis) in 1982. 
+ * pcurses allowed one to enable/disable tracing using traceon() and traceoff()
+ * functions.  ncurses provides a trace() function which allows one to
+ * selectively enable or disable several tracing features.
  */
 
 #include <curses.priv.h>
@@ -40,9 +46,9 @@
 
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_trace.c,v 1.53 2003/11/23 00:39:30 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.59 2006/08/19 12:05:25 tom Exp $")
 
-NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0;  /* always define this */
+NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
 
 #ifdef TRACE
 NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace = "";
@@ -108,7 +114,7 @@ _tracef(const char *fmt,...)
     va_list ap;
     bool before = FALSE;
     bool after = FALSE;
-    int doit = _nc_tracing;
+    unsigned doit = _nc_tracing;
     int save_err = errno;
 
     if (strlen(fmt) >= sizeof(Called) - 1) {
@@ -179,9 +185,33 @@ _nc_retrace_ptr(char *code)
     return code;
 }
 
+/* Trace 'const char*' return-values */
+NCURSES_EXPORT(const char *)
+_nc_retrace_cptr(const char *code)
+{
+    T((T_RETURN("%s"), _nc_visbuf(code)));
+    return code;
+}
+
+/* Trace 'NCURSES_CONST void*' return-values */
+NCURSES_EXPORT(NCURSES_CONST void *)
+_nc_retrace_cvoid_ptr(NCURSES_CONST void *code)
+{
+    T((T_RETURN("%p"), code));
+    return code;
+}
+
+/* Trace 'void*' return-values */
+NCURSES_EXPORT(void *)
+_nc_retrace_void_ptr(void *code)
+{
+    T((T_RETURN("%p"), code));
+    return code;
+}
+
 /* Trace 'SCREEN *' return-values */
 NCURSES_EXPORT(SCREEN *)
-_nc_retrace_sp(SCREEN * code)
+_nc_retrace_sp(SCREEN *code)
 {
     T((T_RETURN("%p"), code));
     return code;