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

apr_general.h

Go to the documentation of this file.
00001 /* ==================================================================== 00002 * The Apache Software License, Version 1.1 00003 * 00004 * Copyright (c) 2000-2003 The Apache Software Foundation. All rights 00005 * reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * 1. Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * 2. Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in 00016 * the documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * 3. The end-user documentation included with the redistribution, 00020 * if any, must include the following acknowledgment: 00021 * "This product includes software developed by the 00022 * Apache Software Foundation (http://www.apache.org/)." 00023 * Alternately, this acknowledgment may appear in the software itself, 00024 * if and wherever such third-party acknowledgments normally appear. 00025 * 00026 * 4. The names "Apache" and "Apache Software Foundation" must 00027 * not be used to endorse or promote products derived from this 00028 * software without prior written permission. For written 00029 * permission, please contact apache@apache.org. 00030 * 00031 * 5. Products derived from this software may not be called "Apache", 00032 * nor may "Apache" appear in their name, without prior written 00033 * permission of the Apache Software Foundation. 00034 * 00035 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 00036 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00037 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00038 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 00039 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00040 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00041 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 00042 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00043 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00044 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00045 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00046 * SUCH DAMAGE. 00047 * ==================================================================== 00048 * 00049 * This software consists of voluntary contributions made by many 00050 * individuals on behalf of the Apache Software Foundation. For more 00051 * information on the Apache Software Foundation, please see 00052 * <http://www.apache.org/>. 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 /* __cplusplus */ 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 /* !CRAY2 */ 00126 00127 #define APR_OFFSET(p_type,field) ((unsigned int)&(((p_type)NULL)->field)) 00128 00129 #endif /* !CRAY2 */ 00130 #endif /* __STDC__ */ 00131 #else /* ! (CRAY || __arm) */ 00132 00133 #define APR_OFFSET(p_type,field) \ 00134 ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL))) 00135 00136 #endif /* !CRAY */ 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 /* A couple of prototypes for functions in case some platform doesn't 00159 * have it 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 /* APR_ALIGN() is only to be used to align on a power of 2 boundary */ 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 /* TODO: I'm not sure this is the best place to put this prototype...*/ 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 /* ! APR_GENERAL_H */

Generated on Wed Sep 1 05:16:36 2004 for Apache Portable Runtime by doxygen 1.3.8