A static site generator, written in C
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.

cms_err.h 873B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef CMS_ERR_H
  2. #define CMS_ERR_H
  3. typedef enum cms_err_code
  4. {
  5. CMS_ERR_NONE = 0,
  6. CMS_ERR_UNKNOWN,
  7. CMS_ERR_ALLOC,
  8. CMS_ERR_PARSE,
  9. CMS_ERR_NOENT,
  10. CMS_ERR_NOTFILE,
  11. CMS_ERR_NOTDIR,
  12. CMS_ERR_FILEEXISTS,
  13. CMS_ERR_FILEREAD,
  14. CMS_ERR_DIREXISTS,
  15. CMS_ERR_PERM,
  16. CMS_ERR_INITED,
  17. CMS_ERR_NOTINITED
  18. } cms_err_code;
  19. typedef struct cms_err
  20. {
  21. cms_err_code code;
  22. char* msg;
  23. const char* file;
  24. int line;
  25. } cms_err;
  26. //Create an error. Returns NULL if the error code is CMS_ERR_NONE.
  27. cms_err* _cms_err_create(cms_err_code code, char* msg, const char* file, int line);
  28. #define cms_err_create(code, msg) _cms_err_create(code, msg, __FILE__, __LINE__)
  29. void cms_err_free(cms_err* err);
  30. void cms_err_panic(cms_err* err);
  31. cms_err* _cms_err_from_std_err(int err, const char* file, int line);
  32. #define cms_err_from_std_err(err) _cms_err_from_std_err(err, __FILE__, __LINE__)
  33. #endif