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

/home/oden/RPM/BUILD/apr-util-0.9.4/include/apr_optional_hooks.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 */ 00021 #ifndef APR_OPTIONAL_HOOK_H 00022 #define APR_OPTIONAL_HOOK_H 00023 00024 #include "apr_tables.h" 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00047 APU_DECLARE(void) apr_optional_hook_add(const char *szName,void (*pfn)(void), 00048 const char * const *aszPre, 00049 const char * const *aszSucc, 00050 int nOrder); 00051 00063 #define APR_OPTIONAL_HOOK(ns,name,pfn,aszPre,aszSucc,nOrder) do { \ 00064 ns##_HOOK_##name##_t *apu__hook = pfn; \ 00065 apr_optional_hook_add(#name,(void (*)(void))apu__hook,aszPre, aszSucc, nOrder); \ 00066 } while (0) 00067 00073 APU_DECLARE(apr_array_header_t *) apr_optional_hook_get(const char *szName); 00074 00089 #define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline) \ 00090 link##_DECLARE(ret) ns##_run_##name args_decl \ 00091 { \ 00092 ns##_LINK_##name##_t *pHook; \ 00093 int n; \ 00094 ret rv; \ 00095 apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \ 00096 \ 00097 if(!pHookArray) \ 00098 return ok; \ 00099 \ 00100 pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \ 00101 for(n=0 ; n < pHookArray->nelts ; ++n) \ 00102 { \ 00103 rv=(pHook[n].pFunc)args_use; \ 00104 \ 00105 if(rv != ok && rv != decline) \ 00106 return rv; \ 00107 } \ 00108 return ok; \ 00109 } 00110 00112 #ifdef __cplusplus 00113 } 00114 #endif 00115 00116 #endif /* APR_OPTIONAL_HOOK_H */

Generated on Wed Sep 15 18:51:15 2004 for Apache Portable Runtime Utility Library by doxygen 1.3.7