Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

apr_general.h

Go to the documentation of this file.
00001 /* Copyright 2000-2004 The Apache Software Foundation
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
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 /* __cplusplus */
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 /* !CRAY2 */
00087 
00088 #define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
00089 
00090 #endif /* !CRAY2 */
00091 #endif /* __STDC__ */
00092 #else /* ! (CRAY || __arm) */
00093 
00094 #define APR_OFFSET(p_type,field) \
00095         ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
00096 
00097 #endif /* !CRAY */
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 /* A couple of prototypes for functions in case some platform doesn't 
00120  * have it
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 /* APR_ALIGN() is only to be used to align on a power of 2 boundary */
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 /* TODO: I'm not sure this is the best place to put this prototype...*/
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  /* ! APR_GENERAL_H */

Generated on Fri Apr 23 07:11:26 2004 for Apache Portable Runtime by doxygen 1.3.4