1 /*************************************************************************** 2 $RCSfile$ 3 ------------------- 4 cvs : $Id$ 5 begin : Wed Sep 02 2002 6 copyright : (C) 2002 by Martin Preuss 7 email : martin@libchipcard.de 8 9 *************************************************************************** 10 * * 11 * This library is free software; you can redistribute it and/or * 12 * modify it under the terms of the GNU Lesser General Public * 13 * License as published by the Free Software Foundation; either * 14 * version 2.1 of the License, or (at your option) any later version. * 15 * * 16 * This library is distributed in the hope that it will be useful, * 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 19 * Lesser General Public License for more details. * 20 * * 21 * You should have received a copy of the GNU Lesser General Public * 22 * License along with this library; if not, write to the Free Software * 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * 24 * MA 02111-1307 USA * 25 * * 26 ***************************************************************************/ 27 28 #ifndef GWENHYWFARAPI_H 29 #define GWENHYWFARAPI_H 30 31 #include <gwenhywfar/types.h> 32 33 #ifdef GWENHYWFAR_IS_SUBPROJECT 34 # define GWENHYWFAR_API 35 # define GWENHYWFAR_EXPORT 36 # define GWENHYWFAR_NOEXPORT 37 # define GWEN_UNUSED 38 #else 39 # ifdef BUILDING_GWENHYWFAR 40 /* building Gwenhywfar */ 41 # if GWENHYWFAR_SYS_IS_WINDOWS 42 /* for windows */ 43 # ifdef __declspec 44 # define GWENHYWFAR_API __declspec (dllexport) 45 # else /* if __declspec */ 46 # define GWENHYWFAR_API 47 # endif /* if NOT __declspec */ 48 # else 49 /* for non-win32 */ 50 # ifdef GCC_WITH_VISIBILITY_ATTRIBUTE 51 # define GWENHYWFAR_API __attribute__((visibility("default"))) 52 # else 53 # define GWENHYWFAR_API 54 # endif 55 # endif 56 # else 57 /* not building Gwenhywfar */ 58 # if GWENHYWFAR_SYS_IS_WINDOWS 59 /* for windows */ 60 # ifdef __declspec 61 # define GWENHYWFAR_API __declspec (dllimport) 62 # else /* if __declspec */ 63 # define GWENHYWFAR_API 64 # endif /* if NOT __declspec */ 65 # else 66 /* for non-win32 */ 67 # define GWENHYWFAR_API 68 # endif 69 # endif 70 71 # ifdef GCC_WITH_VISIBILITY_ATTRIBUTE 72 # define GWENHYWFAR_EXPORT __attribute__((visibility("default"))) 73 # define GWENHYWFAR_NOEXPORT __attribute__((visibility("hidden"))) 74 # else 75 # define GWENHYWFAR_EXPORT 76 # define GWENHYWFAR_NOEXPORT 77 # endif 78 79 # ifdef __GNUC__ 80 # define GWEN_UNUSED __attribute__((unused)) 81 # else 82 # define GWEN_UNUSED 83 # endif 84 #endif 85 86 #if GWENHYWFAR_SYS_IS_WINDOWS 87 # define GWENHYWFAR_CB __stdcall 88 #else 89 # define GWENHYWFAR_CB 90 #endif 91 92 #if GWENHYWFAR_SYS_IS_WINDOWS 93 # define GWEN_DIR_SEPARATOR '\\' 94 # define GWEN_DIR_SEPARATOR_S "\\" 95 # define GWEN_SEARCHPATH_SEPARATOR ';' 96 # define GWEN_SEARCHPATH_SEPARATOR_S ";" 97 #else 98 /** The directory separator character. This is '/' on UNIX 99 machines and '\' under Windows. Since gwenhywfar-2.5.4. */ 100 # define GWEN_DIR_SEPARATOR '/' 101 /** The directory separator as a string. This is "/" on UNIX 102 machines and "\" under Windows. Since gwenhywfar-2.5.4. */ 103 # define GWEN_DIR_SEPARATOR_S "/" 104 /** The search path separator character. This is ':' on UNIX 105 machines and ';' under Windows. Since gwenhywfar-2.5.4. */ 106 # define GWEN_SEARCHPATH_SEPARATOR ':' 107 /** The search path separator as a string. This is ":" on UNIX 108 machines and ";" under Windows. Since gwenhywfar-2.5.4. */ 109 # define GWEN_SEARCHPATH_SEPARATOR_S ":" 110 #endif 111 112 113 /* Convenience macros to test the versions of glibc and gcc. Taken 114 from <features.h> which does not contain this on MinGW systems. */ 115 #ifndef __GNUC_PREREQ 116 # if defined __GNUC__ && defined __GNUC_MINOR__ 117 # define __GNUC_PREREQ(maj, min) \ 118 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) 119 # else 120 # define __GNUC_PREREQ(maj, min) 0 121 # endif 122 #endif /* __GNUC_PREREQ */ 123 124 125 /* Taken from <sys/cdefs.h> which does not contain this on MinGW 126 systems. */ 127 #ifndef __STRING 128 # define __STRING(x) #x 129 #endif /* __STRING */ 130 131 132 /* This is needed for PalmOS, because it define some functions needed */ 133 #include <string.h> 134 #include <gwenhywfar/system.h> 135 136 137 #if __GNUC_PREREQ(3, 0) 138 /* Only available in gcc >= 3.0.x */ 139 # define DEPRECATED __attribute__((deprecated)) 140 # define GWEN_UNUSED __attribute__((unused)) 141 # define GWEN_LIKELY(cond) __builtin_expect(!!(cond), 1) 142 # define GWEN_UNLIKELY(cond) __builtin_expect(!!(cond), 0) 143 #else 144 # define DEPRECATED 145 # define GWEN_UNUSED 146 # define GWEN_LIKELY(cond) (!!(cond)) 147 # define GWEN_UNLIKELY(cond) (!!(cond)) 148 #endif /* __GNUC__ */ 149 150 151 #if defined(__GNUC__) && !defined(__MINGW32__) 152 # define GWEN_FORMAT(fmt, pos, argstart) \ 153 __attribute__ ((format (fmt, pos, argstart))) 154 #else 155 # define GWEN_FORMAT(fmt, pos, argstart) 156 #endif 157 158 159 #define GWEN_TIMEOUT_NONE (0) 160 #define GWEN_TIMEOUT_FOREVER (-1) 161 162 163 #endif 164 165 166