00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef _SQUAREBALL_ERROR_H
00010 #define _SQUAREBALL_ERROR_H
00011
00012 #include <stdarg.h>
00013 #include <stdlib.h>
00014
00030 typedef struct {
00031
00039 int code;
00040
00044 char *msg;
00045
00046 } sb_error_t;
00047
00055 enum {
00056 SB_ERROR_FILE_OPEN = -1,
00057 SB_ERROR_FILE_READ = -2,
00058 SB_ERROR_FILE_WRITE = -3,
00059 SB_ERROR_DIR_CREATE = -4,
00060
00061 SB_ERROR_CONFIGPARSER = -10,
00062 };
00063
00071 sb_error_t* sb_error_new(int code, const char *msg);
00072
00082 sb_error_t* sb_error_new_printf(int code, const char *format, ...);
00083
00096 sb_error_t* sb_error_new_printf_parser(int code, const char *src, size_t src_len,
00097 size_t current, const char *format, ...);
00098
00104 void sb_error_free(sb_error_t *err);
00105
00108 #endif