gwenhywfar 5.10.1
gwenhywfarapi.h
Go to the documentation of this file.
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#ifdef __MINGW32__
94# define GWEN_DIR_SEPARATOR '/'
95# define GWEN_DIR_SEPARATOR_S "/"
96#else
97# define GWEN_DIR_SEPARATOR '\\'
98# define GWEN_DIR_SEPARATOR_S "\\"
99#endif
100# define GWEN_SEARCHPATH_SEPARATOR ';'
101# define GWEN_SEARCHPATH_SEPARATOR_S ";"
102#else
105# define GWEN_DIR_SEPARATOR '/'
108# define GWEN_DIR_SEPARATOR_S "/"
111# define GWEN_SEARCHPATH_SEPARATOR ':'
114# define GWEN_SEARCHPATH_SEPARATOR_S ":"
115#endif
116
117
118/* Convenience macros to test the versions of glibc and gcc. Taken
119 from <features.h> which does not contain this on MinGW systems. */
120#ifndef __GNUC_PREREQ
121# if defined __GNUC__ && defined __GNUC_MINOR__
122# define __GNUC_PREREQ(maj, min) \
123 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
124# else
125# define __GNUC_PREREQ(maj, min) 0
126# endif
127#endif /* __GNUC_PREREQ */
128
129
130/* Taken from <sys/cdefs.h> which does not contain this on MinGW
131 systems. */
132#ifndef __STRING
133# define __STRING(x) #x
134#endif /* __STRING */
135
136
137/* This is needed for PalmOS, because it define some functions needed */
138#include <string.h>
139#include <gwenhywfar/system.h>
140
141
142#if __GNUC_PREREQ(3, 0)
143/* Only available in gcc >= 3.0.x */
144# define GWEN_DEPRECATED __attribute__((deprecated))
145# define GWEN_UNUSED __attribute__((unused))
146# define GWEN_LIKELY(cond) __builtin_expect(!!(cond), 1)
147# define GWEN_UNLIKELY(cond) __builtin_expect(!!(cond), 0)
148#else
149# define GWEN_DEPRECATED
150# define GWEN_UNUSED
151# define GWEN_LIKELY(cond) (!!(cond))
152# define GWEN_UNLIKELY(cond) (!!(cond))
153#endif /* __GNUC__ */
154
155
156#if defined(__GNUC__) && !defined(__MINGW32__)
157# define GWEN_FORMAT(fmt, pos, argstart) \
158 __attribute__ ((format (fmt, pos, argstart)))
159#else
160# define GWEN_FORMAT(fmt, pos, argstart)
161#endif
162
163
164#define GWEN_TIMEOUT_NONE (0)
165#define GWEN_TIMEOUT_FOREVER (-1)
166
167
168#endif
169
170