libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cmRpt.h 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //| Copyright: (C) 2009-2020 Kevin Larke <contact AT larke DOT org>
  2. //| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
  3. #ifndef cmRpt_h
  4. #define cmRpt_h
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. //( { file_desc: "The cmRpt class provides console style output for all objects in the cm system." kw:[base]}
  9. //
  10. //
  11. // The cmRpt class provides console output style output, like stdout and stderr
  12. // for most of the classes in the cm library.
  13. //
  14. // By wrapping this functionality in a class it is possible to easily
  15. // redirect output to one or more possible console targets.
  16. //
  17. //)
  18. //(
  19. // Application supplied callback function which is called to deliver text
  20. // to the destination terminal or GUI.
  21. typedef void (*cmRptPrintFunc_t)(void* cmRptUserPtr, const cmChar_t* text);
  22. // Data record used to hold the state information.
  23. typedef struct
  24. {
  25. cmRptPrintFunc_t printFuncPtr; //< Application supplied callback text printing function as set from printFunc argument to cmRptSetup().
  26. cmRptPrintFunc_t errorFuncPtr; //< Application supplied callback error printing function as set from the errFunc argument to cmRptSetup().
  27. void* userPtr; //< Application supplied callback argument (cmRptUserPtr in cmRptPrintFunc_t) to be passed back to the application with each call to printFuncPtr() or errorFuncPtr().
  28. } cmRpt_t;
  29. // A global cmRpt_t object which can be used to initialze another cmRpt_t.
  30. extern cmRpt_t cmRptNull;
  31. // The host application calls cmRptSetup() to initialize a cmRpt object.
  32. void cmRptSetup( cmRpt_t* rpt, cmRptPrintFunc_t printFunc, cmRptPrintFunc_t errFunc, void* userPtr );
  33. // Text output functions:
  34. // Functions to print text to the application console.
  35. void cmRptPrint( cmRpt_t* rpt, const cmChar_t* text );
  36. void cmRptVPrintf( cmRpt_t* rpt, const cmChar_t* fmt, va_list vl );
  37. void cmRptPrintf( cmRpt_t* rpt, const cmChar_t* fmt, ... );
  38. // Error reporting functions:
  39. // Functions to print error messages to the application error console,
  40. void cmRptError( cmRpt_t* rpt, const cmChar_t* text );
  41. void cmRptVErrorf( cmRpt_t* rpt, const cmChar_t* fmt, va_list vl );
  42. void cmRptErrorf( cmRpt_t* rpt, const cmChar_t* fmt, ... );
  43. //)
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif