00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #ifndef APR_GENERAL_H
00056 #define APR_GENERAL_H
00057
00066 #include "apr.h"
00067 #include "apr_pools.h"
00068 #include "apr_errno.h"
00069
00070 #if APR_HAVE_SIGNAL_H
00071 #include <signal.h>
00072 #endif
00073
00074 #ifdef __cplusplus
00075 extern "C" {
00076 #endif
00077
00088 #ifndef FALSE
00089 #define FALSE 0
00090 #endif
00091
00092 #ifndef TRUE
00093 #define TRUE (!FALSE)
00094 #endif
00095
00097 #define APR_ASCII_BLANK '\040'
00098
00099 #define APR_ASCII_CR '\015'
00100
00101 #define APR_ASCII_LF '\012'
00102
00103 #define APR_ASCII_TAB '\011'
00104
00106 typedef int apr_signum_t;
00107
00117 #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
00118 #ifdef __STDC__
00119 #define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
00120 #else
00121 #ifdef CRAY2
00122 #define APR_OFFSET(p_type,field) \
00123 (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
00124
00125 #else
00126
00127 #define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
00128
00129 #endif
00130 #endif
00131 #else
00132
00133 #define APR_OFFSET(p_type,field) \
00134 ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
00135
00136 #endif
00137
00144 #if defined(offsetof) && !defined(__cplusplus)
00145 #define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
00146 #else
00147 #define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
00148 #endif
00149
00151 #define APR_XtOffset APR_OFFSET
00152
00154 #define APR_XtOffsetOf APR_OFFSETOF
00155
00156 #ifndef DOXYGEN
00157
00158
00159
00160
00161 #if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
00162 #define strcasecmp(s1, s2) stricmp(s1, s2)
00163 #elif (!APR_HAVE_STRCASECMP)
00164 int strcasecmp(const char *a, const char *b);
00165 #endif
00166
00167 #if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
00168 #define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
00169 #elif (!APR_HAVE_STRNCASECMP)
00170 int strncasecmp(const char *a, const char *b, size_t n);
00171 #endif
00172
00173 #endif
00174
00179
00180 #define APR_ALIGN(size, boundary) \
00181 (((size) + ((boundary) - 1)) & ~((boundary) - 1))
00182
00184 #define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
00185
00186
00192 #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
00193
00194 #define APR_STRINGIFY_HELPER(n) #n
00195
00196 #if (!APR_HAVE_MEMMOVE)
00197 #define memmove(a,b,c) bcopy(b,a,c)
00198 #endif
00199
00200 #if (!APR_HAVE_MEMCHR)
00201 void *memchr(const void *s, int c, size_t n);
00202 #endif
00203
00217 APR_DECLARE(apr_status_t) apr_initialize(void);
00218
00231 APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
00232 char const * const * *argv,
00233 char const * const * *env);
00234
00244 APR_DECLARE_NONSTD(void) apr_terminate(void);
00245
00255 APR_DECLARE(void) apr_terminate2(void);
00256
00264 #if APR_HAS_RANDOM || defined(DOXYGEN)
00265
00266
00272 #ifdef APR_ENABLE_FOR_1_0
00273 APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf,
00274 apr_size_t length);
00275 #else
00276 APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf,
00277 int length);
00278 #endif
00279
00280 #endif
00283 #ifdef __cplusplus
00284 }
00285 #endif
00286
00287 #endif