00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef APR_GENERAL_H
00018 #define APR_GENERAL_H
00019
00028 #include "apr.h"
00029 #include "apr_pools.h"
00030 #include "apr_errno.h"
00031
00032 #if APR_HAVE_SIGNAL_H
00033 #include <signal.h>
00034 #endif
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00050 #ifndef FALSE
00051 #define FALSE 0
00052 #endif
00053
00054 #ifndef TRUE
00055 #define TRUE (!FALSE)
00056 #endif
00057
00059 #define APR_ASCII_BLANK '\040'
00060
00061 #define APR_ASCII_CR '\015'
00062
00063 #define APR_ASCII_LF '\012'
00064
00065 #define APR_ASCII_TAB '\011'
00066
00068 typedef int apr_signum_t;
00069
00079 #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
00080 #ifdef __STDC__
00081 #define APR_OFFSET(p_type,field) _Offsetof(p_type,field)
00082 #else
00083 #ifdef CRAY2
00084 #define APR_OFFSET(p_type,field) \
00085 (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
00086
00087 #else
00088
00089 #define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
00090
00091 #endif
00092 #endif
00093 #else
00094
00095 #define APR_OFFSET(p_type,field) \
00096 ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
00097
00098 #endif
00099
00106 #if defined(offsetof) && !defined(__cplusplus)
00107 #define APR_OFFSETOF(s_type,field) offsetof(s_type,field)
00108 #else
00109 #define APR_OFFSETOF(s_type,field) APR_OFFSET(s_type*,field)
00110 #endif
00111
00113 #define APR_XtOffset APR_OFFSET
00114
00116 #define APR_XtOffsetOf APR_OFFSETOF
00117
00118 #ifndef DOXYGEN
00119
00120
00121
00122
00123 #if (!APR_HAVE_STRCASECMP) && (APR_HAVE_STRICMP)
00124 #define strcasecmp(s1, s2) stricmp(s1, s2)
00125 #elif (!APR_HAVE_STRCASECMP)
00126 int strcasecmp(const char *a, const char *b);
00127 #endif
00128
00129 #if (!APR_HAVE_STRNCASECMP) && (APR_HAVE_STRNICMP)
00130 #define strncasecmp(s1, s2, n) strnicmp(s1, s2, n)
00131 #elif (!APR_HAVE_STRNCASECMP)
00132 int strncasecmp(const char *a, const char *b, size_t n);
00133 #endif
00134
00135 #endif
00136
00141
00142 #define APR_ALIGN(size, boundary) \
00143 (((size) + ((boundary) - 1)) & ~((boundary) - 1))
00144
00146 #define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
00147
00148
00154 #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
00155
00156 #define APR_STRINGIFY_HELPER(n) #n
00157
00158 #if (!APR_HAVE_MEMMOVE)
00159 #define memmove(a,b,c) bcopy(b,a,c)
00160 #endif
00161
00162 #if (!APR_HAVE_MEMCHR)
00163 void *memchr(const void *s, int c, size_t n);
00164 #endif
00165
00179 APR_DECLARE(apr_status_t) apr_initialize(void);
00180
00193 APR_DECLARE(apr_status_t) apr_app_initialize(int *argc,
00194 char const * const * *argv,
00195 char const * const * *env);
00196
00206 APR_DECLARE_NONSTD(void) apr_terminate(void);
00207
00217 APR_DECLARE(void) apr_terminate2(void);
00218
00226 #if APR_HAS_RANDOM || defined(DOXYGEN)
00227
00228
00234 #ifdef APR_ENABLE_FOR_1_0
00235 APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf,
00236 apr_size_t length);
00237 #else
00238 APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf,
00239 int length);
00240 #endif
00241
00242 #endif
00243
00245 #ifdef __cplusplus
00246 }
00247 #endif
00248
00249 #endif