00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _LCN_TYPES_H
00023 #define _LCN_TYPES_H
00024
00025 #include <apr.h>
00026 #include <apr_pools.h>
00027
00028 #ifdef __cplusplus
00029 extern "C" {
00030 #endif
00031
00032
00033 typedef int lcn_boolean_t;
00034
00035 #ifndef FALSE
00036
00037 #define FALSE 0
00038 #endif
00039
00040 #ifndef TRUE
00041
00042 #define TRUE 1
00043 #endif
00044
00045
00046 typedef struct lcn_error_t {
00047 apr_status_t apr_err;
00048
00049 const char *message;
00050
00051 struct lcn_error_t *child;
00052
00053 apr_pool_t *pool;
00054
00055 } lcn_error_t;
00056
00057
00058 #define LCN_NO_ERROR 0
00059
00060
00061
00062
00063 lcn_error_t *
00064 lcn_error_create (apr_status_t apr_err,
00065 lcn_error_t *child,
00066 const char *message);
00067
00068
00069 lcn_error_t *
00070 lcn_error_createf (apr_status_t apr_err,
00071 lcn_error_t *child,
00072 const char *fmt,
00073 ...)
00074 #ifdef DOXYGEN_SHOULD_SKIP_THIS
00075 ;
00076 #else
00077 __attribute__ ((format (printf, 3, 4)));
00078 #endif
00079
00080
00081 void lcn_error_clear (lcn_error_t *error);
00082
00083
00084
00085
00086 #define LCN_ERR(expr) \
00087 do { \
00088 lcn_error_t *lcn_err__temp = (expr); \
00089 if (lcn_err__temp) \
00090 return lcn_err__temp; \
00091 } while (0)
00092
00093
00094 typedef apr_uint16_t lcn_char_t;
00095
00096
00097 apr_size_t lcn_strlen (const lcn_char_t *str);
00098
00099
00100 #define LCN_STRING_SIZE(str) ((lcn_strlen (str) + 1) * sizeof (lcn_char_t))
00101
00102
00103 int lcn_strcmp (const lcn_char_t *first, const lcn_char_t *second);
00104
00105
00106 lcn_char_t *
00107 lcn_strcpy (const lcn_char_t *str, apr_pool_t *pool);
00108
00109
00110
00111
00112
00113
00114 lcn_error_t *
00115 lcn_str_to_cstring (char **out, const lcn_char_t *in, apr_pool_t *pool);
00116
00117
00118
00119
00120 lcn_char_t *
00121 lcn_str_from_cstring (const char *in, apr_pool_t *pool);
00122
00123
00124 #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
00125
00126
00127 #define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push (ary)))
00128
00129
00130 apr_pool_t *lcn_pool_create (apr_pool_t *parent);
00131
00132
00133 #define lcn_pool_destroy apr_pool_destroy
00134
00135 #ifdef __cplusplus
00136 }
00137 #endif
00138
00139 #endif