24 #include "libical_ical_export.h"
40 #define ICAL_SETERROR_ISFUNC
63 #pragma GCC visibility push(default)
111 #pragma GCC visibility pop
144 #define icalerrno (*(icalerrno_return()))
189 #define icalerror_warn(message) \
190 {fprintf(stderr, "%s(), %s:%d: %s\n", __FUNCTION__, __FILE__, __LINE__, message);}
192 #define icalerror_warn(message) \
193 {fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, message);}
282 LIBICAL_ICAL_EXPORT
void ical_bt(
void);
338 #if !defined(ICAL_SETERROR_ISFUNC)
339 #define icalerror_set_errno(x) \
341 if(icalerror_get_error_state(x) == ICAL_ERROR_FATAL || \
342 (icalerror_get_error_state(x) == ICAL_ERROR_DEFAULT && \
343 icalerror_get_errors_are_fatal() == 1)){ \
344 icalerror_warn(icalerror_strerror(x)); \
378 #if !defined(ICAL_ERRORS_ARE_FATAL)
379 #define ICAL_ERRORS_ARE_FATAL 0
382 #if ICAL_ERRORS_ARE_FATAL == 1
386 #define icalerror_check_value_type(value,type);
387 #define icalerror_check_property_type(value,type);
388 #define icalerror_check_parameter_type(value,type);
389 #define icalerror_check_component_type(value,type);
403 #if ICAL_ERRORS_ARE_FATAL == 1
406 #define icalerror_assert(test,message) \
408 fprintf(stderr, "%s(), %s:%d: %s\n", __FUNCTION__, __FILE__, __LINE__, message); \
409 icalerror_stop_here(); \
412 #define icalerror_assert(test,message) \
414 fprintf(stderr, "%s:%d: %s\n", __FILE__, __LINE__, message); \
415 icalerror_stop_here(); \
420 #define icalerror_assert(test,message)
441 #define icalerror_check_arg(test,arg) \
443 icalerror_set_errno(ICAL_BADARG_ERROR); \
465 #define icalerror_check_arg_rv(test,arg) \
467 icalerror_set_errno(ICAL_BADARG_ERROR); \
491 #define icalerror_check_arg_rz(test,arg) \
493 icalerror_set_errno(ICAL_BADARG_ERROR); \
518 #define icalerror_check_arg_re(test,arg,error) \
520 icalerror_stop_here(); \
546 #define icalerror_check_arg_rx(test,arg,x) \
548 icalerror_set_errno(ICAL_BADARG_ERROR); \
void icalerror_set_errors_are_fatal(int fatal)
Change if errors are fatal.
Definition: icalerror.c:106
void icalerror_crash_here(void)
Triggered to abort the process.
Definition: icalerror.c:84
void ical_bt(void)
Prints backtrace.
Definition: icalerror.c:260
icalerrorstate
Determine if an error is fatal or non-fatal.
Definition: icalerror.h:215
@ ICAL_ERROR_UNKNOWN
Definition: icalerror.h:226
@ ICAL_ERROR_FATAL
Definition: icalerror.h:217
@ ICAL_ERROR_DEFAULT
Definition: icalerror.h:223
@ ICAL_ERROR_NONFATAL
Definition: icalerror.h:220
int icalerror_get_errors_are_fatal(void)
Determine if errors are fatal.
Definition: icalerror.c:111
const char * icalerror_perror(void)
Returns the description string for the current error in icalerrno.
Definition: icalerror.c:209
icalerrorstate icalerror_get_error_state(icalerrorenum error)
Gets the error state (severity) for a given error.
Definition: icalerror.c:234
icalerrorenum
Represents the different types of errors that can be triggered in libical.
Definition: icalerror.h:76
@ ICAL_NEWFAILED_ERROR
Definition: icalerror.h:84
@ ICAL_BADARG_ERROR
Definition: icalerror.h:81
@ ICAL_FILE_ERROR
Definition: icalerror.h:99
@ ICAL_ALLOCATION_ERROR
Definition: icalerror.h:87
@ ICAL_INTERNAL_ERROR
Definition: icalerror.h:96
@ ICAL_NO_ERROR
Definition: icalerror.h:78
@ ICAL_MALFORMEDDATA_ERROR
Definition: icalerror.h:90
@ ICAL_UNKNOWN_ERROR
Definition: icalerror.h:108
@ ICAL_PARSE_ERROR
Definition: icalerror.h:93
@ ICAL_UNIMPLEMENTED_ERROR
Definition: icalerror.h:105
@ ICAL_USAGE_ERROR
Definition: icalerror.h:102
void icalerror_set_error_state(icalerrorenum error, icalerrorstate state)
Sets the icalerrorstate for a given icalerrorenum error.
Definition: icalerror.c:223
void icalerror_set_errno(icalerrorenum x)
Sets the icalerrno to a given error.
Definition: icalerror.c:117
void icalerror_restore(const char *error, icalerrorstate es)
Definition: icalerror.c:214
void icalerror_stop_here(void)
Triggered before any error is called.
Definition: icalerror.c:79
icalerrorenum icalerror_error_from_string(const char *str)
Reads an error from a string.
Definition: icalerror.c:181
icalerrorenum * icalerrno_return(void)
Returns the current icalerrno value.
Definition: icalerror.c:70
const char * icalerror_strerror(icalerrorenum e)
Finds the description string for error.
Definition: icalerror.c:247
void icalerror_clear_errno(void)
Resets icalerrno to ICAL_NO_ERROR.
Definition: icalerror.c:95
icalerrorstate icalerror_supress(const char *error)
Suppresses a given error.
Definition: icalerror.c:194