| 1 | // | 
|---|
| 2 | // Platform.h | 
|---|
| 3 | // | 
|---|
| 4 | // Library: Foundation | 
|---|
| 5 | // Package: Core | 
|---|
| 6 | // Module:  Platform | 
|---|
| 7 | // | 
|---|
| 8 | // Platform and architecture identification macros. | 
|---|
| 9 | // | 
|---|
| 10 | // NOTE: This file may be included from both C++ and C code, so it | 
|---|
| 11 | //       must not contain any C++ specific things. | 
|---|
| 12 | // | 
|---|
| 13 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | 
|---|
| 14 | // and Contributors. | 
|---|
| 15 | // | 
|---|
| 16 | // SPDX-License-Identifier:	BSL-1.0 | 
|---|
| 17 | // | 
|---|
| 18 |  | 
|---|
| 19 |  | 
|---|
| 20 | #ifndef Foundation_Platform_INCLUDED | 
|---|
| 21 | #define Foundation_Platform_INCLUDED | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 | // | 
|---|
| 25 | // Platform Identification | 
|---|
| 26 | // | 
|---|
| 27 | #define POCO_OS_FREE_BSD      0x0001 | 
|---|
| 28 | #define POCO_OS_AIX           0x0002 | 
|---|
| 29 | #define POCO_OS_HPUX          0x0003 | 
|---|
| 30 | #define POCO_OS_TRU64         0x0004 | 
|---|
| 31 | #define POCO_OS_LINUX         0x0005 | 
|---|
| 32 | #define POCO_OS_MAC_OS_X      0x0006 | 
|---|
| 33 | #define POCO_OS_NET_BSD       0x0007 | 
|---|
| 34 | #define POCO_OS_OPEN_BSD      0x0008 | 
|---|
| 35 | #define POCO_OS_IRIX          0x0009 | 
|---|
| 36 | #define POCO_OS_SOLARIS       0x000a | 
|---|
| 37 | #define POCO_OS_QNX           0x000b | 
|---|
| 38 | #define POCO_OS_VXWORKS       0x000c | 
|---|
| 39 | #define POCO_OS_CYGWIN        0x000d | 
|---|
| 40 | #define POCO_OS_NACL	      0x000e | 
|---|
| 41 | #define POCO_OS_EMSCRIPTEN    0x000f | 
|---|
| 42 | #define POCO_OS_UNKNOWN_UNIX  0x00ff | 
|---|
| 43 | #define POCO_OS_WINDOWS_NT    0x1001 | 
|---|
| 44 | #define POCO_OS_WINDOWS_CE    0x1011 | 
|---|
| 45 | #define POCO_OS_VMS           0x2001 | 
|---|
| 46 |  | 
|---|
| 47 |  | 
|---|
| 48 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) | 
|---|
| 49 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 50 | #define POCO_OS_FAMILY_BSD 1 | 
|---|
| 51 | #define POCO_OS POCO_OS_FREE_BSD | 
|---|
| 52 | #elif defined(_AIX) || defined(__TOS_AIX__) | 
|---|
| 53 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 54 | #define POCO_OS POCO_OS_AIX | 
|---|
| 55 | #elif defined(hpux) || defined(_hpux) || defined(__hpux) | 
|---|
| 56 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 57 | #define POCO_OS POCO_OS_HPUX | 
|---|
| 58 | #elif defined(__digital__) || defined(__osf__) | 
|---|
| 59 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 60 | #define POCO_OS POCO_OS_TRU64 | 
|---|
| 61 | #elif defined(__NACL__) | 
|---|
| 62 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 63 | #define POCO_OS POCO_OS_NACL | 
|---|
| 64 | #elif defined(__EMSCRIPTEN__) || defined(EMSCRIPTEN) | 
|---|
| 65 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 66 | #define POCO_OS POCO_OS_EMSCRIPTEN | 
|---|
| 67 | #elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__) | 
|---|
| 68 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 69 | #define POCO_OS POCO_OS_LINUX | 
|---|
| 70 | #elif defined(__APPLE__) || defined(__TOS_MACOS__) | 
|---|
| 71 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 72 | #define POCO_OS_FAMILY_BSD 1 | 
|---|
| 73 | #define POCO_OS POCO_OS_MAC_OS_X | 
|---|
| 74 | #elif defined(__NetBSD__) | 
|---|
| 75 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 76 | #define POCO_OS_FAMILY_BSD 1 | 
|---|
| 77 | #define POCO_OS POCO_OS_NET_BSD | 
|---|
| 78 | #elif defined(__OpenBSD__) | 
|---|
| 79 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 80 | #define POCO_OS_FAMILY_BSD 1 | 
|---|
| 81 | #define POCO_OS POCO_OS_OPEN_BSD | 
|---|
| 82 | #elif defined(sgi) || defined(__sgi) | 
|---|
| 83 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 84 | #define POCO_OS POCO_OS_IRIX | 
|---|
| 85 | #elif defined(sun) || defined(__sun) | 
|---|
| 86 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 87 | #define POCO_OS POCO_OS_SOLARIS | 
|---|
| 88 | #elif defined(__QNX__) | 
|---|
| 89 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 90 | #define POCO_OS POCO_OS_QNX | 
|---|
| 91 | #elif defined(__CYGWIN__) | 
|---|
| 92 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 93 | #define POCO_OS POCO_OS_CYGWIN | 
|---|
| 94 | #elif defined(POCO_VXWORKS) | 
|---|
| 95 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 96 | #define POCO_OS POCO_OS_VXWORKS | 
|---|
| 97 | #elif defined(unix) || defined(__unix) || defined(__unix__) | 
|---|
| 98 | #define POCO_OS_FAMILY_UNIX 1 | 
|---|
| 99 | #define POCO_OS POCO_OS_UNKNOWN_UNIX | 
|---|
| 100 | #elif defined(_WIN32_WCE) | 
|---|
| 101 | #define POCO_OS_FAMILY_WINDOWS 1 | 
|---|
| 102 | #define POCO_OS POCO_OS_WINDOWS_CE | 
|---|
| 103 | #elif defined(_WIN32) || defined(_WIN64) | 
|---|
| 104 | #define POCO_OS_FAMILY_WINDOWS 1 | 
|---|
| 105 | #define POCO_OS POCO_OS_WINDOWS_NT | 
|---|
| 106 | #elif defined(__VMS) | 
|---|
| 107 | #define POCO_OS_FAMILY_VMS 1 | 
|---|
| 108 | #define POCO_OS POCO_OS_VMS | 
|---|
| 109 | #endif | 
|---|
| 110 |  | 
|---|
| 111 |  | 
|---|
| 112 | #if !defined(POCO_OS) | 
|---|
| 113 | #error "Unknown Platform." | 
|---|
| 114 | #endif | 
|---|
| 115 |  | 
|---|
| 116 |  | 
|---|
| 117 | // | 
|---|
| 118 | // Hardware Architecture and Byte Order | 
|---|
| 119 | // | 
|---|
| 120 | #define POCO_ARCH_ALPHA   0x01 | 
|---|
| 121 | #define POCO_ARCH_IA32    0x02 | 
|---|
| 122 | #define POCO_ARCH_IA64    0x03 | 
|---|
| 123 | #define POCO_ARCH_MIPS    0x04 | 
|---|
| 124 | #define POCO_ARCH_HPPA    0x05 | 
|---|
| 125 | #define POCO_ARCH_PPC     0x06 | 
|---|
| 126 | #define POCO_ARCH_POWER   0x07 | 
|---|
| 127 | #define POCO_ARCH_SPARC   0x08 | 
|---|
| 128 | #define POCO_ARCH_AMD64   0x09 | 
|---|
| 129 | #define POCO_ARCH_ARM     0x0a | 
|---|
| 130 | #define POCO_ARCH_M68K    0x0b | 
|---|
| 131 | #define POCO_ARCH_S390    0x0c | 
|---|
| 132 | #define POCO_ARCH_SH      0x0d | 
|---|
| 133 | #define POCO_ARCH_NIOS2   0x0e | 
|---|
| 134 | #define POCO_ARCH_AARCH64 0x0f | 
|---|
| 135 |  | 
|---|
| 136 |  | 
|---|
| 137 | #if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) | 
|---|
| 138 | #define POCO_ARCH POCO_ARCH_ALPHA | 
|---|
| 139 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 140 | #elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(EMSCRIPTEN) || defined(__EMSCRIPTEN__) | 
|---|
| 141 | #define POCO_ARCH POCO_ARCH_IA32 | 
|---|
| 142 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 143 | #elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64) | 
|---|
| 144 | #define POCO_ARCH POCO_ARCH_IA64 | 
|---|
| 145 | #if defined(hpux) || defined(_hpux) | 
|---|
| 146 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 147 | #else | 
|---|
| 148 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 149 | #endif | 
|---|
| 150 | #elif defined(__x86_64__) || defined(_M_X64) | 
|---|
| 151 | #define POCO_ARCH POCO_ARCH_AMD64 | 
|---|
| 152 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 153 | #elif defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(_M_MRX000) | 
|---|
| 154 | #define POCO_ARCH POCO_ARCH_MIPS | 
|---|
| 155 | #if defined(POCO_OS_FAMILY_WINDOWS) | 
|---|
| 156 | // Is this OK? Supports windows only little endian?? | 
|---|
| 157 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 158 | #elif defined(__MIPSEB__) || defined(_MIPSEB) || defined(__MIPSEB) | 
|---|
| 159 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 160 | #elif defined(__MIPSEL__) || defined(_MIPSEL) || defined(__MIPSEL) | 
|---|
| 161 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 162 | #else | 
|---|
| 163 | #error "MIPS but neither MIPSEL nor MIPSEB?" | 
|---|
| 164 | #endif | 
|---|
| 165 | #elif defined(__hppa) || defined(__hppa__) | 
|---|
| 166 | #define POCO_ARCH POCO_ARCH_HPPA | 
|---|
| 167 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 168 | #elif defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__PPC__) || \ | 
|---|
| 169 | defined(__powerpc__) || defined(__ppc__) || defined(__ppc) || defined(_ARCH_PPC) || defined(_M_PPC) | 
|---|
| 170 | #define POCO_ARCH POCO_ARCH_PPC | 
|---|
| 171 | #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) | 
|---|
| 172 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 173 | #else | 
|---|
| 174 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 175 | #endif | 
|---|
| 176 | #elif defined(_POWER) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_ARCH_PWR3) || \ | 
|---|
| 177 | defined(_ARCH_PWR4) || defined(__THW_RS6000) | 
|---|
| 178 | #define POCO_ARCH POCO_ARCH_POWER | 
|---|
| 179 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 180 | #elif defined(__sparc__) || defined(__sparc) || defined(sparc) | 
|---|
| 181 | #define POCO_ARCH POCO_ARCH_SPARC | 
|---|
| 182 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 183 | #elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM) | 
|---|
| 184 | #define POCO_ARCH POCO_ARCH_ARM | 
|---|
| 185 | #if defined(__ARMEB__) | 
|---|
| 186 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 187 | #else | 
|---|
| 188 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 189 | #endif | 
|---|
| 190 | #elif defined(__arm64__) || defined(__arm64) | 
|---|
| 191 | #define POCO_ARCH POCO_ARCH_ARM64 | 
|---|
| 192 | #if defined(__ARMEB__) | 
|---|
| 193 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 194 | #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ | 
|---|
| 195 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 196 | #else | 
|---|
| 197 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 198 | #endif | 
|---|
| 199 | #elif defined(__m68k__) | 
|---|
| 200 | #define POCO_ARCH POCO_ARCH_M68K | 
|---|
| 201 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 202 | #elif defined(__s390__) | 
|---|
| 203 | #define POCO_ARCH POCO_ARCH_S390 | 
|---|
| 204 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 205 | #elif defined(__sh__) || defined(__sh) || defined(SHx) || defined(_SHX_) | 
|---|
| 206 | #define POCO_ARCH POCO_ARCH_SH | 
|---|
| 207 | #if defined(__LITTLE_ENDIAN__) || (POCO_OS == POCO_OS_WINDOWS_CE) | 
|---|
| 208 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 209 | #else | 
|---|
| 210 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 211 | #endif | 
|---|
| 212 | #elif defined (nios2) || defined(__nios2) || defined(__nios2__) | 
|---|
| 213 | #define POCO_ARCH POCO_ARCH_NIOS2 | 
|---|
| 214 | #if defined(__nios2_little_endian) || defined(nios2_little_endian) || defined(__nios2_little_endian__) | 
|---|
| 215 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 216 | #else | 
|---|
| 217 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 218 | #endif | 
|---|
| 219 | #elif defined(__AARCH64EL__) | 
|---|
| 220 | #define POCO_ARCH POCO_ARCH_AARCH64 | 
|---|
| 221 | #define POCO_ARCH_LITTLE_ENDIAN 1 | 
|---|
| 222 | #elif defined(__AARCH64EB__) | 
|---|
| 223 | #define POCO_ARCH POCO_ARCH_AARCH64 | 
|---|
| 224 | #define POCO_ARCH_BIG_ENDIAN 1 | 
|---|
| 225 | #endif | 
|---|
| 226 |  | 
|---|
| 227 |  | 
|---|
| 228 | #if defined(_MSC_VER) | 
|---|
| 229 | #define POCO_COMPILER_MSVC | 
|---|
| 230 | #elif defined(__clang__) | 
|---|
| 231 | #define POCO_COMPILER_CLANG | 
|---|
| 232 | #if defined(__apple_build_version__) | 
|---|
| 233 | #define POCO_COMPILER_APPLECLANG | 
|---|
| 234 | #endif | 
|---|
| 235 | #elif defined (__GNUC__) | 
|---|
| 236 | #define POCO_COMPILER_GCC | 
|---|
| 237 | #elif defined (__MINGW32__) || defined (__MINGW64__) | 
|---|
| 238 | #define POCO_COMPILER_MINGW | 
|---|
| 239 | #elif defined (__INTEL_COMPILER) || defined(__ICC) || defined(__ECC) || defined(__ICL) | 
|---|
| 240 | #define POCO_COMPILER_INTEL | 
|---|
| 241 | #elif defined (__SUNPRO_CC) | 
|---|
| 242 | #define POCO_COMPILER_SUN | 
|---|
| 243 | #elif defined (__MWERKS__) || defined(__CWCC__) | 
|---|
| 244 | #define POCO_COMPILER_CODEWARRIOR | 
|---|
| 245 | #elif defined (__sgi) || defined(sgi) | 
|---|
| 246 | #define POCO_COMPILER_SGI | 
|---|
| 247 | #elif defined (__HP_aCC) | 
|---|
| 248 | #define POCO_COMPILER_HP_ACC | 
|---|
| 249 | #elif defined (__BORLANDC__) || defined(__CODEGEARC__) | 
|---|
| 250 | #define POCO_COMPILER_CBUILDER | 
|---|
| 251 | #elif defined (__DMC__) | 
|---|
| 252 | #define POCO_COMPILER_DMARS | 
|---|
| 253 | #elif defined (__DECCXX) | 
|---|
| 254 | #define POCO_COMPILER_COMPAC | 
|---|
| 255 | #elif (defined (__xlc__) || defined (__xlC__)) && defined(__IBMCPP__) | 
|---|
| 256 | #define POCO_COMPILER_IBM_XLC // IBM XL C++ | 
|---|
| 257 | #elif defined (__IBMCPP__) && defined(__COMPILER_VER__) | 
|---|
| 258 | #define POCO_COMPILER_IBM_XLC_ZOS // IBM z/OS C++ | 
|---|
| 259 | #endif | 
|---|
| 260 |  | 
|---|
| 261 |  | 
|---|
| 262 | #ifdef __GNUC__ | 
|---|
| 263 | #define POCO_UNUSED __attribute__((unused)) | 
|---|
| 264 | #else | 
|---|
| 265 | #define POCO_UNUSED | 
|---|
| 266 | #endif // __GNUC__ | 
|---|
| 267 |  | 
|---|
| 268 |  | 
|---|
| 269 | #if !defined(POCO_ARCH) | 
|---|
| 270 | #error "Unknown Hardware Architecture." | 
|---|
| 271 | #endif | 
|---|
| 272 |  | 
|---|
| 273 |  | 
|---|
| 274 | #if defined(POCO_OS_FAMILY_WINDOWS) | 
|---|
| 275 | #define POCO_DEFAULT_NEWLINE_CHARS "\r\n" | 
|---|
| 276 | #else | 
|---|
| 277 | #define POCO_DEFAULT_NEWLINE_CHARS "\n" | 
|---|
| 278 | #endif | 
|---|
| 279 |  | 
|---|
| 280 |  | 
|---|
| 281 | #endif // Foundation_Platform_INCLUDED | 
|---|
| 282 |  | 
|---|