[21299] | 1 | /*
|
---|
| 2 | * ODIN - Build Environment Definition
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 1999 Patrick Haller <phaller@gmx.net>
|
---|
| 5 | *
|
---|
| 6 | * ------------------------------------------------------------
|
---|
| 7 | * Note: Only compiler linkage definitions and similar stuff
|
---|
| 8 | * goes here. Nothing else.
|
---|
| 9 | * ------------------------------------------------------------
|
---|
| 10 | *
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | #ifndef _ODIN_H_
|
---|
| 15 | #define _ODIN_H_
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | /***********************************
|
---|
| 19 | * Compiler Environment Definition *
|
---|
| 20 | ***********************************/
|
---|
| 21 |
|
---|
| 22 | #ifdef CDECL
|
---|
| 23 | # undef CDECL
|
---|
| 24 | #endif
|
---|
| 25 |
|
---|
| 26 | #ifdef EXPORT
|
---|
| 27 | # undef EXPORT
|
---|
| 28 | #endif
|
---|
| 29 |
|
---|
| 30 | #ifdef WIN32API
|
---|
| 31 | # undef WIN32API
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | #ifdef SYSTEM
|
---|
| 35 | # undef SYSTEM
|
---|
| 36 | #endif
|
---|
| 37 |
|
---|
| 38 | #ifdef PASCAL
|
---|
| 39 | # undef PASCAL
|
---|
| 40 | #endif
|
---|
| 41 |
|
---|
| 42 | #ifdef UNALIGNED
|
---|
| 43 | # undef UNALIGNED
|
---|
| 44 | #endif
|
---|
| 45 |
|
---|
| 46 |
|
---|
| 47 | /* ---------- WATCOM C ---------- */
|
---|
| 48 | #ifdef __WATCOMC__
|
---|
| 49 | #define CDECL _cdecl
|
---|
| 50 | #define EXPORT _export
|
---|
| 51 | #define WIN32API __stdcall
|
---|
| 52 | #define WINAPI __stdcall
|
---|
| 53 | #define SYSTEM _System
|
---|
| 54 | #define PASCAL __stdcall
|
---|
| 55 | #ifdef __cplusplus
|
---|
| 56 | #define INLINE inline
|
---|
| 57 | #else
|
---|
| 58 | #define INLINE __inline
|
---|
| 59 | #define inline __inline
|
---|
| 60 | #endif
|
---|
| 61 | #define UNALIGNED
|
---|
| 62 | #define __attribute__(x)
|
---|
| 63 |
|
---|
| 64 | //MN: For some strange reason Watcom doesn't define these for C++!
|
---|
| 65 | // This is not the best place to define them though.
|
---|
| 66 | #ifdef __cplusplus
|
---|
| 67 | #define min(a,b) (((a) < (b)) ? (a) : (b))
|
---|
| 68 | #define max(a,b) (((a) > (b)) ? (a) : (b))
|
---|
| 69 | #endif
|
---|
| 70 |
|
---|
| 71 | #else
|
---|
| 72 |
|
---|
| 73 | /* ---------- GCC/EMX ---------- */
|
---|
| 74 | #ifdef __GNUC__
|
---|
| 75 | #if defined(__GNUC__) && (__GNUC__ <= 3) && (__GNUC_MINOR__ < 2)
|
---|
| 76 | #error You need gcc >= 3.2 to build Odin32
|
---|
| 77 | #endif
|
---|
| 78 | #if !defined(__stdcall__) /* this is also defined in windef.h if !defined(WIN32OS2) */
|
---|
| 79 | #define __stdcall __attribute__((__stdcall__))
|
---|
| 80 | #define __cdecl __attribute__((__cdecl__))
|
---|
| 81 | #endif
|
---|
| 82 | #define CDECL _cdecl
|
---|
[21916] | 83 | #define EXPORT __attribute__ ((dllexport))
|
---|
[21299] | 84 | #define WIN32API __stdcall
|
---|
| 85 | #define WINAPI __stdcall
|
---|
| 86 | #define PASCAL __stdcall
|
---|
[21523] | 87 | #define INLINE static __inline__
|
---|
[21299] | 88 | #define UNALIGNED
|
---|
[21400] | 89 | #if (__GNUC__ < 4)
|
---|
| 90 | #define NONAMELESSUNION
|
---|
| 91 | #define NONAMELESSSTRUCT
|
---|
| 92 | #endif
|
---|
[21299] | 93 | #ifdef __INNOTEK_LIBC__
|
---|
| 94 | #define SYSTEM _System
|
---|
[21916] | 95 | #define _LNK_CONV
|
---|
[21299] | 96 | #else
|
---|
| 97 | #define SYSTEM CDECL
|
---|
| 98 | #endif
|
---|
| 99 |
|
---|
[21916] | 100 | #define min(a,b) \
|
---|
| 101 | ({ __typeof__ (a) _a = (a); \
|
---|
| 102 | __typeof__ (b) _b = (b); \
|
---|
| 103 | _a < _b ? _a : _b; })
|
---|
| 104 | #define max(a,b) \
|
---|
| 105 | ({ __typeof__ (a) _a = (a); \
|
---|
| 106 | __typeof__ (b) _b = (b); \
|
---|
| 107 | _a > _b ? _a : _b; })
|
---|
| 108 |
|
---|
| 109 | #define _interrupt(n) __asm__ __volatile__ ("int" #n "\n\tnop")
|
---|
| 110 |
|
---|
[21299] | 111 | #else
|
---|
| 112 |
|
---|
| 113 | /* ---------- VAC ---------- */
|
---|
| 114 | #if (defined(__IBMCPP__) || defined(__IBMC__))
|
---|
| 115 |
|
---|
| 116 | #define CDECL __cdecl
|
---|
| 117 | #define EXPORT _Export
|
---|
| 118 | #define WIN32API __stdcall
|
---|
| 119 | #define WINAPI __stdcall
|
---|
| 120 | #define SYSTEM _System
|
---|
| 121 | #define PASCAL __stdcall
|
---|
| 122 | #define UNALIGNED
|
---|
| 123 | #ifndef __cplusplus
|
---|
| 124 | #define INLINE _Inline
|
---|
[21597] | 125 | #ifndef inline
|
---|
[21299] | 126 | #define inline INLINE
|
---|
[21597] | 127 | #endif
|
---|
[21299] | 128 | #else
|
---|
| 129 | #define INLINE inline
|
---|
| 130 | #endif
|
---|
| 131 | #define __inline__ INLINE
|
---|
| 132 | #define __attribute__(x)
|
---|
| 133 |
|
---|
| 134 |
|
---|
| 135 | #ifndef RC_INVOKED
|
---|
| 136 | //Nameless unions or structures are not supported in C mode
|
---|
| 137 | //(nameless unions only in CPP mode and nameless unions only in VAC 3.6.5 CPP mode)
|
---|
| 138 | #ifdef __IBMC__
|
---|
| 139 | #define NONAMELESSUNION
|
---|
| 140 | #define NONAMELESSSTRUCT
|
---|
| 141 | #endif
|
---|
| 142 | #if (__IBMCPP__ == 300)
|
---|
| 143 | #define NONAMELESSSTRUCT
|
---|
| 144 | #endif
|
---|
| 145 | #endif
|
---|
| 146 |
|
---|
| 147 | #ifndef RC_INVOKED
|
---|
| 148 | #include <builtin.h>
|
---|
| 149 | #endif
|
---|
| 150 |
|
---|
| 151 | #else
|
---|
| 152 | #ifdef RC_INVOKED
|
---|
| 153 | //SvL: wrc chokes on calling conventions....
|
---|
| 154 | #define CDECL
|
---|
| 155 | #define EXPORT
|
---|
| 156 | #define WIN32API
|
---|
| 157 | #define WINAPI
|
---|
| 158 | #define CALLBACK
|
---|
| 159 | #define SYSTEM
|
---|
| 160 | #define PASCAL
|
---|
| 161 | #define UNALIGNED
|
---|
| 162 | #define __cdecl
|
---|
| 163 | #define _System
|
---|
| 164 | #define __inline__
|
---|
| 165 | #define INLINE
|
---|
| 166 | #else
|
---|
| 167 | /* ---------- ??? ---------- */
|
---|
| 168 | #error No known compiler.
|
---|
| 169 | #endif
|
---|
| 170 | #endif
|
---|
| 171 | #endif
|
---|
| 172 | #endif
|
---|
| 173 |
|
---|
[21941] | 174 | #ifdef __cplusplus
|
---|
| 175 | #define DEF_VAL(v) = v
|
---|
| 176 | #else
|
---|
| 177 | #define DEF_VAL(v)
|
---|
| 178 | #endif
|
---|
| 179 |
|
---|
[21916] | 180 | #ifdef __GNUC__
|
---|
| 181 | // __stdcall in GCC for OS/2 incorrectly mangles vararg functions; according to
|
---|
| 182 | // MSDN, they should be equal to __cdecl instead of getting the @N suffix
|
---|
| 183 | #define WIN32API_VA __cdecl
|
---|
| 184 | #else
|
---|
| 185 | #define WIN32API_VA WIN32API
|
---|
| 186 | #endif
|
---|
[21299] | 187 |
|
---|
| 188 | #endif /* _ODIN_H_*/
|
---|
| 189 |
|
---|