00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef ETL_ERROR_H
00022 #define ETL_ERROR_H
00023
00024 #include <apr.h>
00025 #include <apr_errno.h>
00026 #include <apr_pools.h>
00027
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031
00032
00033
00034
00035
00036 #define ETL_ERR(expression) do { \
00037 etl_error_t *etl__err = (expression); \
00038 if (etl__err) \
00039 return etl__err; \
00040 } while (0)
00041
00042
00043 #define ETL_SUCCESS NULL
00044
00045
00046 typedef struct {
00047 apr_status_t err;
00048 const char *msg;
00049
00050 apr_uint32_t line;
00051 const char *file;
00052
00053 apr_pool_t *pool;
00054 } etl_error_t;
00055
00056
00057
00058
00059
00060 #define etl_error_create(err, msg) etl_error_create_impl(err, \
00061 msg, \
00062 __LINE__, \
00063 __FILE__)
00064
00065
00066
00067
00068
00069
00070
00071 etl_error_t *
00072 etl_error_create_impl(apr_status_t err,
00073 const char *msg,
00074 apr_uint32_t line,
00075 const char *file);
00076
00077
00078
00079
00080
00081 #define etl_error_createf(err, fmt, ...) etl_error_createf_impl(err, \
00082 __LINE__, \
00083 __FILE__, \
00084 fmt, \
00085 __VA_ARGS__)
00086
00087
00088
00089
00090
00091
00092
00093 etl_error_t *
00094 etl_error_createf_impl(apr_status_t err,
00095 apr_uint32_t line,
00096 const char *file,
00097 const char *fmt,
00098 ...);
00099
00100
00101 void etl_error_clear(etl_error_t *err);
00102
00103 #ifdef __cplusplus
00104 }
00105 #endif
00106
00107 #endif