1 /* Public domain */ 2 3 #ifdef _AGAR_CORE_BEGIN_H_ 4 #error Nested inclusion of <agar/core/begin.h> 5 #endif 6 #define _AGAR_CORE_BEGIN_H_ 7 8 #include <agar/core/types.h> 9 #include <agar/core/attributes.h> 10 11 /* Define internationalization macros if NLS is enabled. */ 12 #if !defined(_) 13 # include <agar/config/enable_nls.h> 14 # ifdef ENABLE_NLS 15 # include <libintl.h> 16 # define _(String) dgettext("agar",String) 17 # ifdef dgettext_noop 18 # define N_(String) dgettext_noop("agar",String) 19 # else 20 # define N_(String) (String) 21 # endif 22 # define _AGAR_CORE_DEFINED_NLS 23 # else 24 # undef _ 25 # undef N_ 26 # undef ngettext 27 # define _(String) (String) 28 # define N_(String) (String) 29 # define ngettext(Singular,Plural,Number) ((Number==1)?(Singular):(Plural)) 30 # define _AGAR_CORE_DEFINED_NLS 31 # endif 32 #endif /* defined(_) */ 33 34 /* Define __BEGIN_DECLS and __END_DECLS if needed. */ 35 #if !defined(__BEGIN_DECLS) || !defined(__END_DECLS) 36 # define _AGAR_CORE_DEFINED_CDECLS 37 # if defined(__cplusplus) 38 # define __BEGIN_DECLS extern "C" { 39 # define __END_DECLS } 40 # else 41 # define __BEGIN_DECLS 42 # define __END_DECLS 43 # endif 44 #endif 45 46 /* 47 * Expand "DECLSPEC" to any compiler-specific keywords, as required for proper 48 * visibility of symbols in shared libraries. 49 * See: http://gcc.gnu.org/wiki/Visibility 50 */ 51 #undef DECLSPEC 52 #ifndef DECLSPEC 53 # if defined(__BEOS__) || defined(__HAIKU__) 54 # if defined(__GNUC__) 55 # define DECLSPEC 56 # else 57 # define DECLSPEC __declspec(export) 58 # endif 59 # elif defined(__WIN32__) 60 # ifdef __BORLANDC__ 61 # ifdef _AGAR_CORE_INTERNAL 62 # define DECLSPEC 63 # else 64 # define DECLSPEC __declspec(dllimport) 65 # endif 66 # else 67 # define DECLSPEC __declspec(dllexport) 68 # endif 69 # elif defined(__OS2__) 70 # ifdef __WATCOMC__ 71 # ifdef _AGAR_CORE_INTERNAL 72 # define DECLSPEC __declspec(dllexport) 73 # else 74 # define DECLSPEC 75 # endif 76 # elif defined (__GNUC__) && __GNUC__ < 4 77 # ifdef _AGAR_CORE_INTERNAL 78 # define DECLSPEC __declspec(dllexport) 79 # else 80 # define DECLSPEC 81 # endif 82 # else 83 # define DECLSPEC 84 # endif 85 # else 86 # if defined(__GNUC__) && __GNUC__ >= 4 87 # define DECLSPEC __attribute__ ((visibility("default"))) 88 # else 89 # define DECLSPEC 90 # endif 91 # endif 92 #endif 93 #ifdef __SYMBIAN32__ 94 #ifndef EKA2 95 #undef DECLSPEC 96 #define DECLSPEC 97 #elif !defined(__WINS__) 98 #undef DECLSPEC 99 #define DECLSPEC __declspec(dllexport) 100 #endif /* !EKA2 */ 101 #endif /* __SYMBIAN32__ */ 102 103 /* 104 * Force structure packing at 4 byte alignment. This is necessary if the 105 * header is included in code which has structure packing set to an alternate 106 * value. The packing is reset to the previous value in close.h. 107 */ 108 #if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) 109 # ifdef _MSC_VER 110 # pragma warning(disable: 4103) 111 # endif 112 # ifdef __BORLANDC__ 113 # pragma nopackwarning 114 # endif 115 # pragma pack(push,4) 116 #elif (defined(__MWERKS__) && defined(__MACOS__)) 117 # pragma options align=mac68k4byte 118 # pragma enumsalwaysint on 119 #endif 120 121 /* 122 * Expand "__inline__" to any compiler-specific keyword needed for defining 123 * an inline function, if supported. 124 */ 125 #ifdef __GNUC__ 126 # define _AGAR_CORE_USE_INLINE 127 #else 128 # if defined(_MSC_VER) || defined(__BORLANDC__) || \ 129 defined(__DMC__) || defined(__SC__) || \ 130 defined(__WATCOMC__) || defined(__LCC__) || \ 131 defined(__DECC) || defined(__EABI__) 132 # ifndef __inline__ 133 # define __inline__ __inline 134 # endif 135 # define _AGAR_CORE_USE_INLINE 136 # else 137 # if !defined(__MRC__) && !defined(_SGI_SOURCE) 138 # ifndef __inline__ 139 # define __inline__ inline 140 # endif 141 # define _AGAR_CORE_USE_INLINE 142 # endif 143 # endif 144 #endif /* !__GNUC__ */ 145 #ifndef _AGAR_CORE_USE_INLINE 146 # define __inline__ 147 #endif 148 149 /* Define NULL if needed. */ 150 #if !defined(NULL) && !defined(__MACH__) 151 # ifdef __cplusplus 152 # define NULL 0 153 # define _AGAR_CORE_DEFINED_NULL 154 # else 155 # define NULL ((void *)0) 156 # define _AGAR_CORE_DEFINED_NULL 157 # endif 158 #endif 159