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