dump.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 lub_dump_printf(
  33. /**
  34. * printf-like format string
  35. */
  36. const char *fmt, ...
  37. );
  38. /**
  39. * This operation indicates that the offset for messages should be increased by
  40. * one level.
  41. *
  42. * \pre
  43. * - none
  44. *
  45. * \post
  46. * - An indentation divider will be sent to stdout to emphasise the change
  47. * in offset.
  48. * - Subsequent calls to lub_dump_printf() will output at this new offset.
  49. * - Client may call lub_undent() to restore offset.
  50. */
  51. void lub_dump_indent(void);
  52. /**
  53. * This operation indicates that the offset for messages should be decreased by
  54. * one level.
  55. *
  56. * \pre
  57. * - lub_dump_indent() should have been called at least one more time than
  58. * this function.
  59. *
  60. * \post
  61. * - An indentation divider will be sent to stdout to emphasise the change
  62. * in offset.
  63. * - Subsequent calls to lub_dump_printf() will output at this new offset.
  64. */
  65. void lub_dump_undent(void);
  66. #endif /* _lub_dump_h */
  67. /** @} lub_dump */