libcm is a C development framework with an emphasis on audio signal processing applications.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. //( { file_desc:"Format error messages and track the last error generated." kw:[base]}
  4. //
  5. // This class is used to format error messages and track the last error generated.
  6. //
  7. // Most of the cmHandle_t based classes use cmErr_t to format error messages with a
  8. // title, maintain the last result code which indicated an error, and to hold
  9. // a cmRpt_t object to manage application supplied text printing callbacks.
  10. //
  11. //)
  12. //
  13. #ifndef cmErr_h
  14. #define cmErr_h
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //(
  19. typedef struct
  20. {
  21. cmRpt_t* rpt; //< Pointer to a cmRpt_t object which is used to direct error messages to an application supplied console.
  22. const cmChar_t* label; //< This field contains a pointer to a text label used to form the error message title.
  23. cmRC_t rc; //< This is the last result code passed via one of the cmErrXXXMsg() functions.
  24. cmRC_t warnRC; //< Last warning RC
  25. } cmErr_t;
  26. // Setup a cmErr_t record.
  27. //
  28. // Note that rpt and staticLabelStr must point to client supplied objects
  29. // whose lifetime is at least that of this cmErr_t object.
  30. void cmErrSetup( cmErr_t* err, cmRpt_t* rpt, const cmChar_t* staticLabelStr );
  31. // Duplicate a cmErr_t record.
  32. void cmErrClone( cmErr_t* dstErr, const cmErr_t* srcErr );
  33. // Error Reporting functions:
  34. // Functions to signal an error. The rc argument is generally specific to the
  35. // client class using the error. See the kXXXRC enumerations in the handle based
  36. // classes for examples of result codes.
  37. cmRC_t cmErrMsg( cmErr_t* err, cmRC_t rc, const cmChar_t* fmt, ... );
  38. cmRC_t cmErrVMsg(cmErr_t* err, cmRC_t rc, const cmChar_t* fmt, va_list vl );
  39. // Report Errors which contain accompanying system error codes.
  40. // Use these functions when a system error (e.g. Unix errno) gives additional information
  41. // about the source of the error.
  42. cmRC_t cmErrSysMsg( cmErr_t* err, cmRC_t rc, cmSysErrCode_t sysErrCode, const cmChar_t* fmt, ... );
  43. cmRC_t cmErrVSysMsg(cmErr_t* err, cmRC_t rc, cmSysErrCode_t sysErrCode, const cmChar_t* fmt, va_list vl );
  44. // Warning Reporting functions:
  45. // Errors generally result in a task aborting. Warnings are informative but the task is
  46. // expected to continue.
  47. // Functions to signal a warning. The rc argument is generally specific to the
  48. // client class using the error. See the kXXXRC enumerations in the handle based
  49. // classes for examples of result codes.
  50. cmRC_t cmErrWarnMsg( cmErr_t* err, cmRC_t rc, const cmChar_t* fmt, ... );
  51. cmRC_t cmErrWarnVMsg(cmErr_t* err, cmRC_t rc, const cmChar_t* fmt, va_list vl );
  52. // Report warnings which contain accompanying system error codes.
  53. // Use these functions when a system error (e.g. Unix errno) gives additional information
  54. // about the source of the error.
  55. cmRC_t cmErrWarnSysMsg( cmErr_t* err, cmRC_t rc, cmSysErrCode_t sysErrCode, const cmChar_t* fmt, ... );
  56. cmRC_t cmErrWarnVSysMsg(cmErr_t* err, cmRC_t rc, cmSysErrCode_t sysErrCode, const cmChar_t* fmt, va_list vl );
  57. // Return the last recorded RC.
  58. cmRC_t cmErrLastRC( cmErr_t* err );
  59. // Return the last recorded RC and set it to a new value.
  60. cmRC_t cmErrSetRC( cmErr_t* err, cmRC_t rc );
  61. // Return the last recorded RC and set it to cmOkRC.
  62. cmRC_t cmErrClearRC( cmErr_t* err );
  63. //)
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif