dump.h 1.7 KB

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