1 /*
2  * dump.h
3  */
4 /**
5 \ingroup lub
6 \defgroup lub_dump dump
7 @{
8 
9 \brief This utility provides a simple hierachical debugging mechanism.
10 
11 By indenting and undenting the output, printing nested debug messages is made
12 easy.
13 */
14 #ifndef _lub_dump_h
15 #define _lub_dump_h
16 
17 #define LUB_DUMP_NULL "(null)"
18 #define LUB_DUMP_STR(str) ( str ? str : LUB_DUMP_NULL )
19 #define LUB_DUMP_BOOL(val) ( val ? "true" : "false" )
20 
21 #include <stdarg.h>
22 /*=====================================
23  * DUMP INTERFACE
24  *===================================== */
25 /**
26  * This operation behaves identically to the standard printf() function
27  * with the exception that the offset at the begining of the line is
28  * determined by the current indent settings.
29  * \pre
30  * - none
31  *
32  * \return
33  * The number of characters sent to stdout.
34  *
35  * \post
36  * - The formatted message will be sent to stdout.
37  */
38  /*lint -esym(534,lub_dump_printf) Ignoring return value of function */
39 int lub_dump_printf(
40 	    /**
41              * printf-like format string
42              */
43 			   const char *fmt, ...
44     );
45 /**
46  * This operation indicates that the offset for messages should be increased by
47  * one level.
48  *
49  * \pre
50  * - none
51  *
52  * \post
53  * - An indentation divider will be sent to stdout to emphasise the change
54  *   in offset.
55  * - Subsequent calls to lub_dump_printf() will output at this new offset.
56  * - Client may call lub_undent() to restore offset.
57  */
58 void lub_dump_indent(void);
59 /**
60  * This operation indicates that the offset for messages should be decreased by
61  * one level.
62  *
63  * \pre
64  * - lub_dump_indent() should have been called at least one more time than
65  *   this function.
66  *
67  * \post
68  * - An indentation divider will be sent to stdout to emphasise the change
69  *   in offset.
70  * - Subsequent calls to lub_dump_printf() will output at this new offset.
71  */
72 void lub_dump_undent(void);
73 
74 #endif				/* _lub_dump_h */
75 /** @} lub_dump */
76