3 * $Id: trace.h,v 1.1 1998/06/17 23:44:42 mdw Exp $
5 * Tracing functions for debugging
7 * (c) 1998 Straylight/Edgeware
10 /*----- Licensing notice --------------------------------------------------*
12 * This file is part of the mLib utilities library.
14 * mLib is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * mLib is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with mLib; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 /*----- Revision history --------------------------------------------------*
32 * Revision 1.1 1998/06/17 23:44:42 mdw
46 /*----- Functions provided ------------------------------------------------*/
50 * Arguments: @unsigned int l@ = trace level for output
51 * @const char *f@ = a @printf@-style format string
52 * @...@ = other arguments
56 * Use: Reports a message to the trace output.
59 extern void trace(unsigned int /*l*/, const char */*f*/, ...);
61 /* --- @trace_block@ --- *
63 * Arguments: @unsigned int l@ = trace level for output
64 * @const char *s@ = some header string to write
65 * @const void *b@ = pointer to a block of memory to dump
66 * @size_t sz@ = size of the block of memory
70 * Use: Dumps the contents of a block to the trace output.
73 extern void trace_block(unsigned int /*l*/, const char */*s*/,
74 const void */*b*/, size_t /*sz*/);
76 /* --- @trace_on@ --- *
78 * Arguments: @FILE *fp@ = a file to trace on
79 * @unsigned int l@ = trace level to set
83 * Use: Enables tracing to a file.
86 extern void trace_on(FILE */*fp*/, unsigned int /*l*/);
88 /* --- @trace_setLevel@ --- *
90 * Arguments: @unsigned int l@ = trace level to set
94 * Use: Sets the tracing level.
97 extern void trace_setLevel(unsigned int /*l*/);
99 /* --- @tracing@ --- *
103 * Returns: Zero if not tracing, tracing level if tracing.
105 * Use: Informs the caller whether tracing is enabled.
108 extern unsigned int tracing(void);
110 /*----- Tracing macros ----------------------------------------------------*/
114 # define IF_TRACING(l, x) if ((l) & tracing()) x
117 # define IF_TRACING(l, x)
120 /*----- That's all, folks -------------------------------------------------*/