| 1 |
/** |
| 2 |
@file posh.h |
| 3 |
@author Brian Hook |
| 4 |
@version 1.3.001 |
| 5 |
|
| 6 |
Header file for POSH, the Portable Open Source Harness project. |
| 7 |
|
| 8 |
NOTE: Unlike most header files, this one is designed to be included |
| 9 |
multiple times, which is why it does not have the @#ifndef/@#define |
| 10 |
preamble. |
| 11 |
|
| 12 |
POSH relies on environment specified preprocessor symbols in order |
| 13 |
to infer as much as possible about the target OS/architecture and |
| 14 |
the host compiler capabilities. |
| 15 |
|
| 16 |
NOTE: POSH is simple and focused. It attempts to provide basic |
| 17 |
functionality and information, but it does NOT attempt to emulate |
| 18 |
missing functionality. I am also not willing to make POSH dirty |
| 19 |
and hackish to support truly ancient and/or outmoded and/or bizarre |
| 20 |
technologies such as non-ANSI compilers, systems with non-IEEE |
| 21 |
floating point formats, segmented 16-bit operating systems, etc. |
| 22 |
|
| 23 |
Please refer to the accompanying HTML documentation or visit |
| 24 |
http://www.poshlib.org for more information on how to use POSH. |
| 25 |
|
| 26 |
LICENSE: |
| 27 |
|
| 28 |
Copyright (c) 2004, Brian Hook |
| 29 |
All rights reserved. |
| 30 |
|
| 31 |
Redistribution and use in source and binary forms, with or without |
| 32 |
modification, are permitted provided that the following conditions are |
| 33 |
met: |
| 34 |
|
| 35 |
* Redistributions of source code must retain the above copyright |
| 36 |
notice, this list of conditions and the following disclaimer. |
| 37 |
|
| 38 |
* Redistributions in binary form must reproduce the above |
| 39 |
copyright notice, this list of conditions and the following |
| 40 |
disclaimer in the documentation and/or other materials provided |
| 41 |
with the distribution. |
| 42 |
|
| 43 |
* The names of this package'ss contributors contributors may not |
| 44 |
be used to endorse or promote products derived from this |
| 45 |
software without specific prior written permission. |
| 46 |
|
| 47 |
|
| 48 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 49 |
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 50 |
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 51 |
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 52 |
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 53 |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 54 |
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 55 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 56 |
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 57 |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 58 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 59 |
|
| 60 |
REVISION: |
| 61 |
|
| 62 |
I've been lax about revision histories, so this starts at, um, 1.3.001. |
| 63 |
Sorry for any inconveniences. |
| 64 |
|
| 65 |
1.3.001 - 2/23/2006 - Incorporated fix for bug reported by Bill Cary, |
| 66 |
where I was not detecting Visual Studio |
| 67 |
compilation on x86-64 systems. Added check for |
| 68 |
_M_X64 which should fix that. |
| 69 |
|
| 70 |
*/ |
| 71 |
/* |
| 72 |
I have yet to find an authoritative reference on preprocessor |
| 73 |
symbols, but so far this is what I've gleaned: |
| 74 |
|
| 75 |
GNU GCC/G++: |
| 76 |
- __GNUC__: GNU C version |
| 77 |
- __GNUG__: GNU C++ compiler |
| 78 |
- __sun__ : on Sun platforms |
| 79 |
- __svr4__: on Solaris and other SysV R4 platforms |
| 80 |
- __mips__: on MIPS processor platforms |
| 81 |
- __sparc_v9__: on Sparc 64-bit CPUs |
| 82 |
- __sparcv9: 64-bit Solaris |
| 83 |
- __MIPSEL__: mips processor, compiled for little endian |
| 84 |
- __MIPSEB__: mips processor, compiled for big endian |
| 85 |
- _R5900: MIPS/Sony/Toshiba R5900 (PS2) |
| 86 |
- mc68000: 68K |
| 87 |
- m68000: 68K |
| 88 |
- m68k: 68K |
| 89 |
- __palmos__: PalmOS |
| 90 |
- __e2k__: on MCST Elbrus 2000 processor platforms |
| 91 |
|
| 92 |
Intel C/C++ Compiler: |
| 93 |
- __ECC : compiler version, IA64 only |
| 94 |
- __EDG__ |
| 95 |
- __ELF__ |
| 96 |
- __GXX_ABI_VERSION |
| 97 |
- __i386 : IA-32 only |
| 98 |
- __i386__ : IA-32 only |
| 99 |
- i386 : IA-32 only |
| 100 |
- __ia64 : IA-64 only |
| 101 |
- __ia64__ : IA-64 only |
| 102 |
- ia64 : IA-64 only |
| 103 |
- __ICC : IA-32 only |
| 104 |
- __INTEL_COMPILER : IA-32 or IA-64, newer versions only |
| 105 |
|
| 106 |
Apple's C/C++ Compiler for OS X: |
| 107 |
- __APPLE_CC__ |
| 108 |
- __APPLE__ |
| 109 |
- __BIG_ENDIAN__ |
| 110 |
- __APPLE__ |
| 111 |
- __ppc__ |
| 112 |
- __MACH__ |
| 113 |
|
| 114 |
DJGPP: |
| 115 |
- __MSDOS__ |
| 116 |
- __unix__ |
| 117 |
- __unix |
| 118 |
- __GNUC__ |
| 119 |
- __GO32 |
| 120 |
- DJGPP |
| 121 |
- __i386, __i386, i386 |
| 122 |
|
| 123 |
Cray's C compiler: |
| 124 |
- _ADDR64: if 64-bit pointers |
| 125 |
- _UNICOS: |
| 126 |
- __unix: |
| 127 |
|
| 128 |
SGI's CC compiler predefines the following (and more) with -ansi: |
| 129 |
- __sgi |
| 130 |
- __unix |
| 131 |
- __host_mips |
| 132 |
- _SYSTYPE_SVR4 |
| 133 |
- __mips |
| 134 |
- _MIPSEB |
| 135 |
- anyone know if there is a predefined symbol for the compiler?! |
| 136 |
|
| 137 |
MinGW: |
| 138 |
- as GnuC but also defines _WIN32, __WIN32, WIN32, _X86_, __i386, __i386__, and several others |
| 139 |
- __MINGW32__ |
| 140 |
|
| 141 |
Cygwin: |
| 142 |
- as Gnu C, but also |
| 143 |
- __unix__ |
| 144 |
- __CYGWIN32__ |
| 145 |
|
| 146 |
Microsoft Visual Studio predefines the following: |
| 147 |
- _MSC_VER |
| 148 |
- _WIN32: on Win32 |
| 149 |
- _M_IX6 (on x86 systems) |
| 150 |
- _M_X64: on x86-64 systems |
| 151 |
- _M_ALPHA (on DEC AXP systems) |
| 152 |
- _SH3: WinCE, Hitachi SH-3 |
| 153 |
- _MIPS: WinCE, MIPS |
| 154 |
- _ARM: WinCE, ARM |
| 155 |
|
| 156 |
Sun's C Compiler: |
| 157 |
- sun and _sun |
| 158 |
- unix and _unix |
| 159 |
- sparc and _sparc (SPARC systems only) |
| 160 |
- i386 and _i386 (x86 systems only) |
| 161 |
- __SVR4 (Solaris only) |
| 162 |
- __sparcv9: 64-bit solaris |
| 163 |
- __SUNPRO_C |
| 164 |
- _LP64: defined in 64-bit LP64 mode, but only if <sys/types.h> is included |
| 165 |
|
| 166 |
Borland C/C++ predefines the following: |
| 167 |
- __BORLANDC__: |
| 168 |
|
| 169 |
DEC/Compaq C/C++ on Alpha: |
| 170 |
- __alpha |
| 171 |
- __arch64__ |
| 172 |
- __unix__ (on Tru64 Unix) |
| 173 |
- __osf__ |
| 174 |
- __DECC |
| 175 |
- __DECCXX (C++ compilation) |
| 176 |
- __DECC_VER |
| 177 |
- __DECCXX_VER |
| 178 |
|
| 179 |
IBM's AIX compiler: |
| 180 |
- __64BIT__ if 64-bit mode |
| 181 |
- _AIX |
| 182 |
- __IBMC__: C compiler version |
| 183 |
- __IBMCPP__: C++ compiler version |
| 184 |
- _LONG_LONG: compiler allows long long |
| 185 |
|
| 186 |
Watcom: |
| 187 |
- __WATCOMC__ |
| 188 |
- __DOS__ : if targeting DOS |
| 189 |
- __386__ : if 32-bit support |
| 190 |
- __WIN32__ : if targetin 32-bit Windows |
| 191 |
|
| 192 |
HP-UX C/C++ Compiler: |
| 193 |
- __hpux |
| 194 |
- __unix |
| 195 |
- __hppa (on PA-RISC) |
| 196 |
- __LP64__: if compiled in 64-bit mode |
| 197 |
|
| 198 |
Metrowerks: |
| 199 |
- __MWERKS__ |
| 200 |
- __powerpc__ |
| 201 |
- _powerc |
| 202 |
- __MC68K__ |
| 203 |
- macintosh when compiling for MacOS |
| 204 |
- __INTEL__ for x86 targets |
| 205 |
- __POWERPC__ |
| 206 |
|
| 207 |
LLVM: |
| 208 |
- __llvm__ |
| 209 |
- __clang__ |
| 210 |
|
| 211 |
LCC predefines the following: |
| 212 |
- __LCC__: |
| 213 |
if also defined e2k it is MCST eLbrus C Compiler |
| 214 |
else it is Local (or Little) C Compiler |
| 215 |
*/ |
| 216 |
|
| 217 |
/* |
| 218 |
** ---------------------------------------------------------------------------- |
| 219 |
** Include <limits.h> optionally |
| 220 |
** ---------------------------------------------------------------------------- |
| 221 |
*/ |
| 222 |
#ifdef POSH_USE_LIMITS_H |
| 223 |
# include <limits.h> |
| 224 |
#endif |
| 225 |
|
| 226 |
/* |
| 227 |
** ---------------------------------------------------------------------------- |
| 228 |
** Determine compilation environment |
| 229 |
** ---------------------------------------------------------------------------- |
| 230 |
*/ |
| 231 |
#if defined __ECC || defined __ICC || defined __INTEL_COMPILER |
| 232 |
# define POSH_COMPILER_STRING "Intel C/C++" |
| 233 |
# define POSH_COMPILER_INTEL 1 |
| 234 |
#endif |
| 235 |
|
| 236 |
#if ( defined __host_mips || defined __sgi ) && !defined __GNUC__cxx . . $ `<built-in>:8:9`! |
| 237 |
# define POSH_COMPILER_STRING "MIPSpro C/C++" |
| 238 |
# define POSH_COMPILER_MIPSPRO 1 |
| 239 |
#endif |
| 240 |
|
| 241 |
#if defined __hpux && !defined __GNUC__cxx . . $ `<built-in>:8:9`! |
| 242 |
# define POSH_COMPILER_STRING "HP-UX CC" |
| 243 |
# define POSH_COMPILER_HPCC 1 |
| 244 |
#endif |
| 245 |
|
| 246 |
#if defined __clang__cxx . . $ `<built-in>:3:9`! |
| 247 |
# define POSH_COMPILER_STRINGcxx . . $ `extern/poshlib/posh.h:247:11`! "Clang" |
| 248 |
# define POSH_COMPILER_CLANGcxx . . $ `extern/poshlib/posh.h:248:11`! 1 |
| 249 |
#endif |
| 250 |
|
| 251 |
#if defined __GNUC__cxx . . $ `<built-in>:8:9`! && !defined __clang__cxx . . $ `<built-in>:3:9`! |
| 252 |
# define POSH_COMPILER_STRING "Gnu GCC" |
| 253 |
# define POSH_COMPILER_GCC 1 |
| 254 |
#endif |
| 255 |
|
| 256 |
#if defined __APPLE_CC__ |
| 257 |
/* we don't define the compiler string here, let it be GNU */ |
| 258 |
# define POSH_COMPILER_APPLECC 1 |
| 259 |
#endif |
| 260 |
|
| 261 |
#if defined __IBMC__ || defined __IBMCPP__ |
| 262 |
# define POSH_COMPILER_STRING "IBM C/C++" |
| 263 |
# define POSH_COMPILER_IBM 1 |
| 264 |
#endif |
| 265 |
|
| 266 |
#if defined _MSC_VER |
| 267 |
# define POSH_COMPILER_STRING "Microsoft Visual C++" |
| 268 |
# define POSH_COMPILER_MSVC 1 |
| 269 |
#endif |
| 270 |
|
| 271 |
#if defined __SUNPRO_C |
| 272 |
# define POSH_COMPILER_STRING "Sun Pro" |
| 273 |
# define POSH_COMPILER_SUN 1 |
| 274 |
#endif |
| 275 |
|
| 276 |
#if defined __BORLANDC__ |
| 277 |
# define POSH_COMPILER_STRING "Borland C/C++" |
| 278 |
# define POSH_COMPILER_BORLAND 1 |
| 279 |
#endif |
| 280 |
|
| 281 |
#if defined __MWERKS__ |
| 282 |
# define POSH_COMPILER_STRING "MetroWerks CodeWarrior" |
| 283 |
# define POSH_COMPILER_METROWERKS 1 |
| 284 |
#endif |
| 285 |
|
| 286 |
#if defined __DECC || defined __DECCXX |
| 287 |
# define POSH_COMPILER_STRING "Compaq/DEC C/C++" |
| 288 |
# define POSH_COMPILER_DEC 1 |
| 289 |
#endif |
| 290 |
|
| 291 |
#if defined __WATCOMC__ |
| 292 |
# define POSH_COMPILER_STRING "Watcom C/C++" |
| 293 |
# define POSH_COMPILER_WATCOM 1 |
| 294 |
#endif |
| 295 |
|
| 296 |
#if !defined POSH_COMPILER_STRINGcxx . . $ `extern/poshlib/posh.h:247:11`! |
| 297 |
# define POSH_COMPILER_STRING "Unknown compiler" |
| 298 |
#endif |
| 299 |
|
| 300 |
/* |
| 301 |
** ---------------------------------------------------------------------------- |
| 302 |
** Determine target operating system |
| 303 |
** ---------------------------------------------------------------------------- |
| 304 |
*/ |
| 305 |
#if defined linux || defined __linux__cxx . . $ `<built-in>:434:9`! |
| 306 |
# define POSH_OS_LINUXcxx . . $ `extern/poshlib/posh.h:306:11`! 1 |
| 307 |
# define POSH_OS_STRINGcxx . . $ `extern/poshlib/posh.h:307:11`! "Linux" |
| 308 |
#endif |
| 309 |
|
| 310 |
#if defined __FreeBSD__ |
| 311 |
# define POSH_OS_FREEBSD 1 |
| 312 |
# define POSH_OS_STRING "FreeBSD" |
| 313 |
#endif |
| 314 |
|
| 315 |
#if defined __NetBSD__ |
| 316 |
# define POSH_OS_NETBSD 1 |
| 317 |
# define POSH_OS_STRING "NetBSD" |
| 318 |
#endif |
| 319 |
|
| 320 |
#if defined __OpenBSD__ |
| 321 |
# define POSH_OS_OPENBSD 1 |
| 322 |
# define POSH_OS_STRING "OpenBSD" |
| 323 |
#endif |
| 324 |
|
| 325 |
#if defined __CYGWIN32__ |
| 326 |
# define POSH_OS_CYGWIN32 1 |
| 327 |
# define POSH_OS_STRING "Cygwin" |
| 328 |
#endif |
| 329 |
|
| 330 |
#if defined GEKKO |
| 331 |
# define POSH_OS_GAMECUBE |
| 332 |
# define __powerpc__ |
| 333 |
# define POSH_OS_STRING "GameCube" |
| 334 |
#endif |
| 335 |
|
| 336 |
#if defined __MINGW32__ |
| 337 |
# define POSH_OS_MINGW 1 |
| 338 |
# define POSH_OS_STRING "MinGW" |
| 339 |
#endif |
| 340 |
|
| 341 |
#if defined GO32 && defined DJGPP && defined __MSDOS__ |
| 342 |
# define POSH_OS_GO32 1 |
| 343 |
# define POSH_OS_STRING "GO32/MS-DOS" |
| 344 |
#endif |
| 345 |
|
| 346 |
/* NOTE: make sure you use /bt=DOS if compiling for 32-bit DOS, |
| 347 |
otherwise Watcom assumes host=target */ |
| 348 |
#if defined __WATCOMC__ && defined __386__ && defined __DOS__ |
| 349 |
# define POSH_OS_DOS32 1 |
| 350 |
# define POSH_OS_STRING "DOS/32-bit" |
| 351 |
#endif |
| 352 |
|
| 353 |
#if defined _UNICOS |
| 354 |
# define POSH_OS_UNICOS 1 |
| 355 |
# define POSH_OS_STRING "UNICOS" |
| 356 |
#endif |
| 357 |
|
| 358 |
//ACS if we're in xcode, look at the target conditionals to figure out if this is ios or osx |
| 359 |
#if defined __APPLE__ |
| 360 |
# include "TargetConditionals.h" |
| 361 |
#endif |
| 362 |
#if TARGET_OS_IPHONE |
| 363 |
# define POSH_OS_IOS 1 |
| 364 |
# define POSH_OS_STRING "iOS" |
| 365 |
#else |
| 366 |
# if ( defined __MWERKS__ && defined __powerc && !defined macintosh ) || defined __APPLE_CC__ || defined macosx |
| 367 |
# define POSH_OS_OSX 1 |
| 368 |
# define POSH_OS_STRING "MacOS X" |
| 369 |
# endif |
| 370 |
#endif |
| 371 |
|
| 372 |
#if defined __sun__ || defined sun || defined __sun || defined __solaris__ |
| 373 |
# if defined __SVR4 || defined __svr4__ || defined __solaris__ |
| 374 |
# define POSH_OS_STRING "Solaris" |
| 375 |
# define POSH_OS_SOLARIS 1 |
| 376 |
# endif |
| 377 |
# if !defined POSH_OS_STRING |
| 378 |
# define POSH_OS_STRING "SunOS" |
| 379 |
# define POSH_OS_SUNOS 1 |
| 380 |
# endif |
| 381 |
#endif |
| 382 |
|
| 383 |
#if defined __sgi__ || defined sgi || defined __sgi |
| 384 |
# define POSH_OS_IRIX 1 |
| 385 |
# define POSH_OS_STRING "Irix" |
| 386 |
#endif |
| 387 |
|
| 388 |
#if defined __hpux__ || defined __hpux |
| 389 |
# define POSH_OS_HPUX 1 |
| 390 |
# define POSH_OS_STRING "HP-UX" |
| 391 |
#endif |
| 392 |
|
| 393 |
#if defined _AIX |
| 394 |
# define POSH_OS_AIX 1 |
| 395 |
# define POSH_OS_STRING "AIX" |
| 396 |
#endif |
| 397 |
|
| 398 |
#if ( defined __alpha && defined __osf__ ) |
| 399 |
# define POSH_OS_TRU64 1 |
| 400 |
# define POSH_OS_STRING "Tru64" |
| 401 |
#endif |
| 402 |
|
| 403 |
#if defined __BEOS__ || defined __beos__ |
| 404 |
# define POSH_OS_BEOS 1 |
| 405 |
# define POSH_OS_STRING "BeOS" |
| 406 |
#endif |
| 407 |
|
| 408 |
#if defined amiga || defined amigados || defined AMIGA || defined _AMIGA |
| 409 |
# define POSH_OS_AMIGA 1 |
| 410 |
# define POSH_OS_STRING "Amiga" |
| 411 |
#endif |
| 412 |
|
| 413 |
#if defined __unix__cxx . . $ `<built-in>:432:9`! |
| 414 |
# define POSH_OS_UNIXcxx . . $ `extern/poshlib/posh.h:414:11`! 1 |
| 415 |
# if !defined POSH_OS_STRINGcxx . . $ `extern/poshlib/posh.h:307:11`! |
| 416 |
# define POSH_OS_STRING "Unix-like(generic)" |
| 417 |
# endif |
| 418 |
#endif |
| 419 |
|
| 420 |
#if defined _WIN32_WCE |
| 421 |
# define POSH_OS_WINCE 1 |
| 422 |
# define POSH_OS_STRING "Windows CE" |
| 423 |
#endif |
| 424 |
|
| 425 |
#if defined _XBOX || defined _XBOX_VER |
| 426 |
# define POSH_OS_XBOX 1 |
| 427 |
# define POSH_OS_STRING "XBOX" |
| 428 |
#endif |
| 429 |
|
| 430 |
#if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ |
| 431 |
# define POSH_OS_WIN32 1 |
| 432 |
# if !defined POSH_OS_XBOX |
| 433 |
# if defined _WIN64 |
| 434 |
# define POSH_OS_WIN64 1 |
| 435 |
# define POSH_OS_STRING "Win64" |
| 436 |
# else |
| 437 |
# if !defined POSH_OS_STRING |
| 438 |
# define POSH_OS_STRING "Win32" |
| 439 |
# endif |
| 440 |
# endif |
| 441 |
# endif |
| 442 |
#endif |
| 443 |
|
| 444 |
#if defined __palmos__ |
| 445 |
# define POSH_OS_PALM 1 |
| 446 |
# define POSH_OS_STRING "PalmOS" |
| 447 |
#endif |
| 448 |
|
| 449 |
#if defined THINK_C || defined macintosh |
| 450 |
# define POSH_OS_MACOS 1 |
| 451 |
# define POSH_OS_STRING "MacOS" |
| 452 |
#endif |
| 453 |
|
| 454 |
/* |
| 455 |
** ----------------------------------------------------------------------------- |
| 456 |
** Determine target CPU |
| 457 |
** ----------------------------------------------------------------------------- |
| 458 |
*/ |
| 459 |
|
| 460 |
#if defined GEKKO |
| 461 |
# define POSH_CPU_PPC750 1 |
| 462 |
# define POSH_CPU_STRING "IBM PowerPC 750 (NGC)" |
| 463 |
#endif |
| 464 |
|
| 465 |
#if defined mc68000 || defined m68k || defined __MC68K__ || defined m68000 |
| 466 |
# define POSH_CPU_68K 1 |
| 467 |
# define POSH_CPU_STRING "MC68000" |
| 468 |
#endif |
| 469 |
|
| 470 |
#if defined __PPC__ || defined __POWERPC__ || defined powerpc || defined _POWER || defined __ppc__ || defined __powerpc__ || defined _M_PPC |
| 471 |
# define POSH_CPU_PPC 1 |
| 472 |
# if !defined POSH_CPU_STRING |
| 473 |
# if defined __powerpc64__ |
| 474 |
# define POSH_CPU_PPC64 1 |
| 475 |
# define POSH_CPU_STRING "PowerPC64" |
| 476 |
# else |
| 477 |
# define POSH_CPU_STRING "PowerPC" |
| 478 |
# endif |
| 479 |
# endif |
| 480 |
#endif |
| 481 |
|
| 482 |
#if defined _CRAYT3E || defined _CRAYMPP |
| 483 |
# define POSH_CPU_CRAYT3E 1 /* target processor is a DEC Alpha 21164 used in a Cray T3E*/ |
| 484 |
# define POSH_CPU_STRING "Cray T3E (Alpha 21164)" |
| 485 |
#endif |
| 486 |
|
| 487 |
#if defined CRAY || defined _CRAY && !defined _CRAYT3E |
| 488 |
# error Non-AXP Cray systems not supported |
| 489 |
#endif |
| 490 |
|
| 491 |
#if defined _SH3 |
| 492 |
# define POSH_CPU_SH3 1 |
| 493 |
# define POSH_CPU_STRING "Hitachi SH-3" |
| 494 |
#endif |
| 495 |
|
| 496 |
#if defined __sh4__ || defined __SH4__ |
| 497 |
# define POSH_CPU_SH3 1 |
| 498 |
# define POSH_CPU_SH4 1 |
| 499 |
# define POSH_CPU_STRING "Hitachi SH-4" |
| 500 |
#endif |
| 501 |
|
| 502 |
#if defined __sparc__ || defined __sparc |
| 503 |
# if defined __arch64__ || defined __sparcv9 || defined __sparc_v9__ |
| 504 |
# define POSH_CPU_SPARC64 1 |
| 505 |
# define POSH_CPU_STRING "Sparc/64" |
| 506 |
# else |
| 507 |
# define POSH_CPU_STRING "Sparc/32" |
| 508 |
# endif |
| 509 |
# define POSH_CPU_SPARC 1 |
| 510 |
#endif |
| 511 |
|
| 512 |
#if defined ARM || defined __arm__ || defined _ARM |
| 513 |
# define POSH_CPU_STRONGARM 1 |
| 514 |
# define POSH_CPU_STRING "ARM" |
| 515 |
#endif |
| 516 |
|
| •517 |
#if defined __aarch64__ || defined __arm64__ |
| 518 |
# define POSH_CPU_AARCH64 1 |
| 519 |
# define POSH_CPU_STRING "ARM64" |
| 520 |
#endif |
| 521 |
|
| 522 |
#if defined mips || defined __mips__ || defined __MIPS__ || defined _MIPS |
| 523 |
# define POSH_CPU_MIPS 1 |
| 524 |
# if defined _R5900 |
| 525 |
# define POSH_CPU_STRING "MIPS R5900 (PS2)" |
| 526 |
# else |
| 527 |
# define POSH_CPU_STRING "MIPS" |
| 528 |
# endif |
| 529 |
#endif |
| 530 |
|
| 531 |
#if defined __ia64 || defined _M_IA64 || defined __ia64__ |
| 532 |
# define POSH_CPU_IA64 1 |
| 533 |
# define POSH_CPU_STRING "IA64" |
| 534 |
#endif |
| 535 |
|
| 536 |
#if defined __X86__ || defined __i386__ || defined i386 || defined _M_IX86 || defined __386__ || defined __x86_64__cxx . . $ `<built-in>:410:9`! || defined _M_X64 |
| 537 |
# define POSH_CPU_X86cxx . . $ `extern/poshlib/posh.h:537:11`! 1 |
| 538 |
# if defined __x86_64__cxx . . $ `<built-in>:410:9`! || defined _M_X64 |
| 539 |
# define POSH_CPU_X86_64cxx . . $ `extern/poshlib/posh.h:539:14`! 1 |
| 540 |
# endif |
| 541 |
# if defined POSH_CPU_X86_64cxx . . $ `extern/poshlib/posh.h:539:14`! |
| 542 |
# define POSH_CPU_STRINGcxx . . $ `extern/poshlib/posh.h:542:14`! "AMD x86-64" |
| 543 |
# else |
| 544 |
# define POSH_CPU_STRING "Intel 386+" |
| 545 |
# endif |
| 546 |
#endif |
| 547 |
|
| 548 |
#if defined __alpha || defined alpha || defined _M_ALPHA || defined __alpha__ |
| 549 |
# define POSH_CPU_AXP 1 |
| 550 |
# define POSH_CPU_STRING "AXP" |
| 551 |
#endif |
| 552 |
|
| 553 |
#if defined __hppa || defined hppa |
| 554 |
# define POSH_CPU_HPPA 1 |
| 555 |
# define POSH_CPU_STRING "PA-RISC" |
| 556 |
#endif |
| 557 |
|
| 558 |
#if defined __e2k__ |
| 559 |
# define POSH_CPU_E2K 1 |
| 560 |
# define POSH_CPU_STRING "MCST Elbrus 2000" |
| 561 |
#endif |
| 562 |
|
| •563 |
#if defined __s390x__ |
| 564 |
# define POSH_CPU_S390 1 |
| 565 |
# define POSH_CPU_STRING "S390" |
| 566 |
#endif |
| 567 |
|
| •568 |
#if defined __riscv |
| 569 |
# define POSH_CPU_RISCV 1 |
| 570 |
# if __riscv_xlen == 64 |
| 571 |
# define POSH_CPU_RISCV64 1 |
| 572 |
# define POSH_CPU_STRING "riscv64" |
| 573 |
# elif __riscv_xlen == 32 |
| 574 |
# define POSH_CPU_RISCV32 1 |
| 575 |
# define POSH_CPU_STRING "riscv32" |
| 576 |
# endif |
| 577 |
#endif |
| 578 |
|
| •579 |
#if defined __loongarch64 |
| 580 |
# define POSH_CPU_LOONGARCH64 1 |
| 581 |
# define POSH_CPU_STRING "LoongArch64" |
| 582 |
#endif |
| 583 |
|
| 584 |
#if !defined POSH_CPU_STRINGcxx . . $ `extern/poshlib/posh.h:542:14`! |
| 585 |
# error POSH cannot determine target CPU |
| 586 |
# define POSH_CPU_STRING "Unknown" /* this is here for Doxygen's benefit */ |
| 587 |
#endif |
| 588 |
|
| 589 |
/* |
| 590 |
** ----------------------------------------------------------------------------- |
| 591 |
** Attempt to autodetect building for embedded on Sony PS2 |
| 592 |
** ----------------------------------------------------------------------------- |
| 593 |
*/ |
| 594 |
#if !defined POSH_OS_STRINGcxx . . $ `extern/poshlib/posh.h:307:11`! |
| 595 |
# if !defined FORCE_DOXYGEN |
| 596 |
# define POSH_OS_EMBEDDED 1 |
| 597 |
# endif |
| 598 |
# if defined _R5900 |
| 599 |
# define POSH_OS_STRING "Sony PS2(embedded)" |
| 600 |
# else |
| 601 |
# define POSH_OS_STRING "Embedded/Unknown" |
| 602 |
# endif |
| 603 |
#endif |
| 604 |
|
| 605 |
/* |
| 606 |
** --------------------------------------------------------------------------- |
| 607 |
** Handle cdecl, stdcall, fastcall, etc. |
| 608 |
** --------------------------------------------------------------------------- |
| 609 |
*/ |
| 610 |
#if defined POSH_CPU_X86cxx . . $ `extern/poshlib/posh.h:537:11`! && !defined POSH_CPU_X86_64cxx . . $ `extern/poshlib/posh.h:539:14`! |
| 611 |
# if defined __GNUC__ |
| 612 |
# define POSH_CDECL __attribute__((cdecl)) |
| 613 |
# define POSH_STDCALL __attribute__((stdcall)) |
| 614 |
# define POSH_FASTCALL __attribute__((fastcall)) |
| 615 |
# elif ( defined _MSC_VER || defined __WATCOMC__ || defined __BORLANDC__ || defined __MWERKS__ ) |
| 616 |
# define POSH_CDECL __cdecl |
| 617 |
# define POSH_STDCALL __stdcall |
| 618 |
# define POSH_FASTCALL __fastcall |
| 619 |
# endif |
| 620 |
#else |
| 621 |
# define POSH_CDECLcxx . . $ `extern/poshlib/posh.h:621:11`! |
| 622 |
# define POSH_STDCALLcxx . . $ `extern/poshlib/posh.h:622:11`! |
| 623 |
# define POSH_FASTCALLcxx . . $ `extern/poshlib/posh.h:623:11`! |
| 624 |
#endif |
| 625 |
|
| 626 |
/* |
| 627 |
** --------------------------------------------------------------------------- |
| 628 |
** Define POSH_IMPORTEXPORT signature based on POSH_DLL and POSH_BUILDING_LIB |
| 629 |
** --------------------------------------------------------------------------- |
| 630 |
*/ |
| 631 |
|
| 632 |
/* |
| 633 |
** We undefine this so that multiple inclusions will work |
| 634 |
*/ |
| 635 |
#if defined POSH_IMPORTEXPORT |
| 636 |
# undef POSH_IMPORTEXPORT |
| 637 |
#endif |
| 638 |
|
| 639 |
#if defined POSH_DLL |
| 640 |
# if defined POSH_OS_WIN32 |
| 641 |
# if defined _MSC_VER |
| 642 |
# if ( _MSC_VER >= 800 ) |
| 643 |
# if defined POSH_BUILDING_LIB |
| 644 |
# define POSH_IMPORTEXPORT __declspec( dllexport ) |
| 645 |
# else |
| 646 |
# define POSH_IMPORTEXPORT __declspec( dllimport ) |
| 647 |
# endif |
| 648 |
# else |
| 649 |
# if defined POSH_BUILDING_LIB |
| 650 |
# define POSH_IMPORTEXPORT __export |
| 651 |
# else |
| 652 |
# define POSH_IMPORTEXPORT |
| 653 |
# endif |
| 654 |
# endif |
| 655 |
# endif /* defined _MSC_VER */ |
| 656 |
# if defined __BORLANDC__ |
| 657 |
# if ( __BORLANDC__ >= 0x500 ) |
| 658 |
# if defined POSH_BUILDING_LIB |
| 659 |
# define POSH_IMPORTEXPORT __declspec( dllexport ) |
| 660 |
# else |
| 661 |
# define POSH_IMPORTEXPORT __declspec( dllimport ) |
| 662 |
# endif |
| 663 |
# else |
| 664 |
# if defined POSH_BUILDING_LIB |
| 665 |
# define POSH_IMPORTEXPORT __export |
| 666 |
# else |
| 667 |
# define POSH_IMPORTEXPORT |
| 668 |
# endif |
| 669 |
# endif |
| 670 |
# endif /* defined __BORLANDC__ */ |
| 671 |
/* for all other compilers, we're just making a blanket assumption */ |
| 672 |
# if defined __GNUC__ || defined __WATCOMC__ || defined __MWERKS__ |
| 673 |
# if defined POSH_BUILDING_LIB |
| 674 |
# define POSH_IMPORTEXPORT __declspec( dllexport ) |
| 675 |
# else |
| 676 |
# define POSH_IMPORTEXPORT __declspec( dllimport ) |
| 677 |
# endif |
| 678 |
# endif /* all other compilers */ |
| 679 |
# if !defined POSH_IMPORTEXPORT |
| 680 |
# error Building DLLs not supported on this compiler ([email protected] if you know how) |
| 681 |
# endif |
| 682 |
# endif /* defined POSH_OS_WIN32 */ |
| 683 |
#endif |
| 684 |
|
| 685 |
/* On pretty much everything else, we can thankfully just ignore this */ |
| 686 |
#if !defined POSH_IMPORTEXPORT |
| 687 |
# define POSH_IMPORTEXPORTcxx . . $ `extern/poshlib/posh.h:687:11`! |
| 688 |
#endif |
| 689 |
|
| 690 |
#if defined FORCE_DOXYGEN |
| 691 |
# define POSH_DLL |
| 692 |
# define POSH_BUILDING_LIB |
| 693 |
# undef POSH_DLL |
| 694 |
# undef POSH_BUILDING_LIB |
| 695 |
#endif |
| 696 |
|
| 697 |
/* |
| 698 |
** ---------------------------------------------------------------------------- |
| 699 |
** (Re)define POSH_PUBLIC_API export signature |
| 700 |
** ---------------------------------------------------------------------------- |
| 701 |
*/ |
| 702 |
#ifdef POSH_PUBLIC_API |
| 703 |
# undef POSH_PUBLIC_API |
| 704 |
#endif |
| 705 |
|
| 706 |
#if ( ( defined _MSC_VER ) && ( _MSC_VER < 800 ) ) || ( defined __BORLANDC__ && ( __BORLANDC__ < 0x500 ) ) |
| 707 |
# define POSH_PUBLIC_API(rtype) extern rtype POSH_IMPORTEXPORT |
| 708 |
#else |
| 709 |
# define POSH_PUBLIC_APIcxx . . $ `extern/poshlib/posh.h:709:11`!(rtype) extern POSH_IMPORTEXPORT rtype |
| 710 |
#endif |
| 711 |
|
| 712 |
/* |
| 713 |
** ---------------------------------------------------------------------------- |
| 714 |
** Try to infer endianess. Basically we just go through the CPUs we know are |
| 715 |
** little endian, and assume anything that isn't one of those is big endian. |
| 716 |
** As a sanity check, we also do this with operating systems we know are |
| 717 |
** little endian, such as Windows. Some processors are bi-endian, such as |
| 718 |
** the MIPS series, so we have to be careful about those. |
| 719 |
** ---------------------------------------------------------------------------- |
| 720 |
*/ |
| 721 |
#if defined POSH_CPU_X86cxx . . $ `extern/poshlib/posh.h:537:11`! || defined POSH_CPU_AXP || defined POSH_CPU_STRONGARM || defined POSH_CPU_AARCH64 || defined POSH_OS_WIN32 || defined POSH_OS_WINCE || defined __MIPSEL__ || defined __ORDER_LITTLE_ENDIAN__cxx . . $ `<built-in>:82:9`! || defined POSH_CPU_E2K |
| 722 |
# define POSH_ENDIAN_STRINGcxx . . $ `extern/poshlib/posh.h:722:11`! "little" |
| 723 |
# define POSH_LITTLE_ENDIANcxx . . $ `extern/poshlib/posh.h:723:11`! 1 |
| 724 |
#else |
| 725 |
# define POSH_ENDIAN_STRING "big" |
| 726 |
# define POSH_BIG_ENDIAN 1 |
| 727 |
#endif |
| 728 |
|
| 729 |
#if defined FORCE_DOXYGEN |
| 730 |
# define POSH_LITTLE_ENDIAN |
| 731 |
#endif |
| 732 |
|
| 733 |
/* |
| 734 |
** ---------------------------------------------------------------------------- |
| 735 |
** Cross-platform compile time assertion macro |
| 736 |
** ---------------------------------------------------------------------------- |
| 737 |
*/ |
| 738 |
#define POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(name, x) typedef int _POSH_dummy_ ## name[(x) ? 1 : -1 ] |
| 739 |
|
| 740 |
/* |
| 741 |
** ---------------------------------------------------------------------------- |
| 742 |
** 64-bit Integer |
| 743 |
** |
| 744 |
** We don't require 64-bit support, nor do we emulate its functionality, we |
| 745 |
** simply export it if it's available. Since we can't count on <limits.h> |
| 746 |
** for 64-bit support, we ignore the POSH_USE_LIMITS_H directive. |
| 747 |
** ---------------------------------------------------------------------------- |
| 748 |
*/ |
| 749 |
#if defined ( __LP64__cxx . . $ `<built-in>:88:9`! ) || defined ( __powerpc64__ ) || defined POSH_CPU_SPARC64 || defined POSH_CPU_E2K |
| 750 |
# define POSH_64BIT_INTEGERcxx . . $ `extern/poshlib/posh.h:750:11`! 1 |
| 751 |
typedef long posh_i64_tcxx . . $ posh_i64_t#; |
| 752 |
typedef unsigned long posh_u64_tcxx . . $ posh_u64_t#; |
| 753 |
# define POSH_I64cxx . . $ `extern/poshlib/posh.h:753:11`!( x ) ((posh_i64_t)x) |
| 754 |
# define POSH_U64cxx . . $ `extern/poshlib/posh.h:754:11`!( x ) ((posh_u64_t)x) |
| 755 |
# define POSH_I64_PRINTF_PREFIXcxx . . $ `extern/poshlib/posh.h:755:11`! "l" |
| 756 |
#elif defined _MSC_VER || defined __BORLANDC__ || defined __WATCOMC__ || ( defined __alpha && defined __DECC ) |
| 757 |
# define POSH_64BIT_INTEGER 1 |
| 758 |
typedef __int64 posh_i64_t; |
| 759 |
typedef unsigned __int64 posh_u64_t; |
| 760 |
# define POSH_I64( x ) ((posh_i64_t)(x##i64)) |
| 761 |
# define POSH_U64( x ) ((posh_u64_t)(x##ui64)) |
| 762 |
# define POSH_I64_PRINTF_PREFIX "I64" |
| 763 |
#elif defined __GNUC__ || defined __MWERKS__ || defined __SUNPRO_C || defined __SUNPRO_CC || defined __APPLE_CC__ || defined POSH_OS_IRIX || defined _LONG_LONG || defined _CRAYC |
| 764 |
# define POSH_64BIT_INTEGER 1 |
| 765 |
typedef long long posh_i64_t; |
| 766 |
typedef unsigned long long posh_u64_t; |
| 767 |
# define POSH_U64( x ) ((posh_u64_t)(x##LL)) |
| 768 |
# define POSH_I64( x ) ((posh_i64_t)(x##LL)) |
| 769 |
# define POSH_I64_PRINTF_PREFIX "ll" |
| 770 |
#endif |
| 771 |
|
| 772 |
/* hack */ |
| 773 |
/*#ifdef __MINGW32__ |
| 774 |
#undef POSH_I64 |
| 775 |
#undef POSH_U64 |
| 776 |
#undef POSH_I64_PRINTF_PREFIX |
| 777 |
#define POSH_I64( x ) ((posh_i64_t)x) |
| 778 |
#define POSH_U64( x ) ((posh_u64_t)x) |
| 779 |
#define POSH_I64_PRINTF_PREFIX "I64" |
| 780 |
#endif*/ |
| 781 |
|
| 782 |
#ifdef FORCE_DOXYGEN |
| 783 |
typedef long long posh_i64_t; |
| 784 |
typedef unsigned long posh_u64_t; |
| 785 |
# define POSH_64BIT_INTEGER |
| 786 |
# define POSH_I64_PRINTF_PREFIX |
| 787 |
# define POSH_I64(x) |
| 788 |
# define POSH_U64(x) |
| 789 |
#endif |
| 790 |
|
| 791 |
/** Minimum value for a 64-bit signed integer */ |
| 792 |
#define POSH_I64_MINcxx . . $ `extern/poshlib/posh.h:792:9`! POSH_I64(0x8000000000000000) |
| 793 |
/** Maximum value for a 64-bit signed integer */ |
| 794 |
#define POSH_I64_MAXcxx . . $ `extern/poshlib/posh.h:794:9`! POSH_I64(0x7FFFFFFFFFFFFFFF) |
| 795 |
/** Minimum value for a 64-bit unsigned integer */ |
| 796 |
#define POSH_U64_MINcxx . . $ `extern/poshlib/posh.h:796:9`! POSH_U64(0) |
| 797 |
/** Maximum value for a 64-bit unsigned integer */ |
| 798 |
#define POSH_U64_MAXcxx . . $ `extern/poshlib/posh.h:798:9`! POSH_U64(0xFFFFFFFFFFFFFFFF) |
| 799 |
|
| 800 |
/* ---------------------------------------------------------------------------- |
| 801 |
** Basic Sized Types |
| 802 |
** |
| 803 |
** These types are expected to be EXACTLY sized so you can use them for |
| 804 |
** serialization. |
| 805 |
** ---------------------------------------------------------------------------- |
| 806 |
*/ |
| 807 |
#define POSH_FALSEcxx . . $ `extern/poshlib/posh.h:807:9`! 0 |
| 808 |
#define POSH_TRUEcxx . . $ `extern/poshlib/posh.h:808:9`! 1 |
| 809 |
|
| 810 |
typedef int posh_bool_tcxx . . $ posh_bool_t#; |
| 811 |
typedef unsigned char posh_byte_tcxx . . $ posh_byte_t#; |
| 812 |
|
| 813 |
/* NOTE: These assume that CHAR_BIT is 8!! */ |
| 814 |
typedef unsigned char posh_u8_tcxx . . $ posh_u8_t#; |
| 815 |
typedef signed char posh_i8_tcxx . . $ posh_i8_t#; |
| 816 |
|
| 817 |
#if defined POSH_USE_LIMITS_H |
| 818 |
# if CHAR_BITS > 8 |
| 819 |
# error This machine uses 9-bit characters. This is a warning, you can comment this out now. |
| 820 |
# endif /* CHAR_BITS > 8 */ |
| 821 |
|
| 822 |
/* 16-bit */ |
| 823 |
# if ( USHRT_MAX == 65535 ) |
| 824 |
typedef unsigned short posh_u16_t; |
| 825 |
typedef short posh_i16_t; |
| 826 |
# else |
| 827 |
/* Yes, in theory there could still be a 16-bit character type and shorts are |
| 828 |
32-bits in size...if you find such an architecture, let me know =P */ |
| 829 |
# error No 16-bit type found |
| 830 |
# endif |
| 831 |
|
| 832 |
/* 32-bit */ |
| 833 |
# if ( INT_MAX == 2147483647 ) |
| 834 |
typedef unsigned posh_u32_t; |
| 835 |
typedef int posh_i32_t; |
| 836 |
# elif ( LONG_MAX == 2147483647 ) |
| 837 |
typedef unsigned long posh_u32_t; |
| 838 |
typedef long posh_i32_t; |
| 839 |
# else |
| 840 |
error No 32-bit type found |
| 841 |
# endif |
| 842 |
|
| 843 |
#else /* POSH_USE_LIMITS_H */ |
| 844 |
|
| 845 |
typedef unsigned short posh_u16_tcxx . . $ posh_u16_t#; |
| 846 |
typedef short posh_i16_tcxx . . $ posh_i16_t#; |
| 847 |
|
| 848 |
# if !defined POSH_OS_PALM |
| 849 |
typedef unsigned posh_u32_tcxx . . $ posh_u32_t#; |
| 850 |
typedef int posh_i32_tcxx . . $ posh_i32_t#; |
| 851 |
# else |
| 852 |
typedef unsigned long posh_u32_t; |
| 853 |
typedef long posh_i32_t; |
| 854 |
# endif |
| 855 |
#endif |
| 856 |
|
| 857 |
/** Minimum value for a byte */ |
| 858 |
#define POSH_BYTE_MINcxx . . $ `extern/poshlib/posh.h:858:9`! 0 |
| 859 |
/** Maximum value for an 8-bit unsigned value */ |
| 860 |
#define POSH_BYTE_MAXcxx . . $ `extern/poshlib/posh.h:860:9`! 255 |
| 861 |
/** Minimum value for a byte */ |
| 862 |
#define POSH_I16_MINcxx . . $ `extern/poshlib/posh.h:862:9`! ( ( posh_i16_t ) 0x8000 ) |
| 863 |
/** Maximum value for a 16-bit signed value */ |
| 864 |
#define POSH_I16_MAXcxx . . $ `extern/poshlib/posh.h:864:9`! ( ( posh_i16_t ) 0x7FFF ) |
| 865 |
/** Minimum value for a 16-bit unsigned value */ |
| 866 |
#define POSH_U16_MINcxx . . $ `extern/poshlib/posh.h:866:9`! 0 |
| 867 |
/** Maximum value for a 16-bit unsigned value */ |
| 868 |
#define POSH_U16_MAXcxx . . $ `extern/poshlib/posh.h:868:9`! ( ( posh_u16_t ) 0xFFFF ) |
| 869 |
/** Minimum value for a 32-bit signed value */ |
| 870 |
#define POSH_I32_MINcxx . . $ `extern/poshlib/posh.h:870:9`! ( ( posh_i32_t ) 0x80000000 ) |
| 871 |
/** Maximum value for a 32-bit signed value */ |
| 872 |
#define POSH_I32_MAXcxx . . $ `extern/poshlib/posh.h:872:9`! ( ( posh_i32_t ) 0x7FFFFFFF ) |
| 873 |
/** Minimum value for a 32-bit unsigned value */ |
| 874 |
#define POSH_U32_MINcxx . . $ `extern/poshlib/posh.h:874:9`! 0 |
| 875 |
/** Maximum value for a 32-bit unsigned value */ |
| 876 |
#define POSH_U32_MAXcxx . . $ `extern/poshlib/posh.h:876:9`! ( ( posh_u32_t ) 0xFFFFFFFF ) |
| 877 |
|
| 878 |
/* |
| 879 |
** ---------------------------------------------------------------------------- |
| 880 |
** Sanity checks on expected sizes |
| 881 |
** ---------------------------------------------------------------------------- |
| 882 |
*/ |
| 883 |
#if !defined FORCE_DOXYGEN |
| 884 |
|
| 885 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_byte_t, sizeof(posh_byte_t) == 1); |
| 886 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_u8_t, sizeof(posh_u8_t) == 1); |
| 887 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_i8_t, sizeof(posh_i8_t) == 1); |
| 888 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_u16_t, sizeof(posh_u16_t) == 2); |
| 889 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_i16_t, sizeof(posh_i16_t) == 2); |
| 890 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_u32_t, sizeof(posh_u32_t) == 4); |
| 891 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_i32_t, sizeof(posh_i32_t) == 4); |
| 892 |
|
| 893 |
#if !defined POSH_NO_FLOAT |
| 894 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_testfloat_t, sizeof(float)==4 ); |
| 895 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_testdouble_t, sizeof(double)==8); |
| 896 |
#endif |
| 897 |
|
| 898 |
#if defined POSH_64BIT_INTEGERcxx . . $ `extern/poshlib/posh.h:750:11`! |
| 899 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_u64_t, sizeof(posh_u64_t) == 8); |
| 900 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!(posh_i64_t, sizeof(posh_i64_t) == 8); |
| 901 |
#endif |
| 902 |
|
| 903 |
#endif |
| 904 |
|
| 905 |
/* |
| 906 |
** ---------------------------------------------------------------------------- |
| 907 |
** 64-bit pointer support |
| 908 |
** ---------------------------------------------------------------------------- |
| 909 |
*/ |
| 910 |
#if defined POSH_CPU_AXP && ( defined POSH_OS_TRU64 || defined POSH_OS_LINUXcxx . . $ `extern/poshlib/posh.h:306:11`! ) |
| 911 |
# define POSH_64BIT_POINTER 1 |
| 912 |
#endif |
| 913 |
|
| •914 |
#if defined POSH_CPU_X86_64cxx . . $ `extern/poshlib/posh.h:539:14`! && defined POSH_OS_LINUXcxx . . $ `extern/poshlib/posh.h:306:11`! && ! defined __ILP32__ |
| 915 |
# define POSH_64BIT_POINTERcxx . . $ `extern/poshlib/posh.h:915:11`! 1 |
| 916 |
#endif |
| 917 |
|
| 918 |
#if defined POSH_CPU_SPARC64 || defined POSH_OS_WIN64 || defined __64BIT__ || defined __LP64 || defined _LP64cxx . . $ `<built-in>:87:9`! || defined __LP64__cxx . . $ `<built-in>:88:9`! || defined _ADDR64 || defined _CRAYC || defined POSH_CPU_E2K |
| 919 |
# define POSH_64BIT_POINTERcxx . . $ `extern/poshlib/posh.h:919:12`! 1 |
| 920 |
#endif |
| 921 |
|
| 922 |
#if defined POSH_64BIT_POINTERcxx . . $ `extern/poshlib/posh.h:919:12`! |
| 923 |
POSH_COMPILE_TIME_ASSERTcxx . . $ `extern/poshlib/posh.h:738:9`!( posh_64bit_pointer, sizeof( void * ) == 8 ); |
| 924 |
#elif !defined FORCE_DOXYGEN |
| 925 |
/* if this assertion is hit then you're on a system that either has 64-bit |
| 926 |
addressing and we didn't catch it, or you're on a system with 16-bit |
| 927 |
pointers. In the latter case, POSH doesn't actually care, we're just |
| 928 |
triggering this assertion to make sure you're aware of the situation, |
| 929 |
so feel free to delete it. |
| 930 |
|
| 931 |
If this assertion is triggered on a known 32 or 64-bit platform, |
| 932 |
please let us know ([email protected]) */ |
| 933 |
POSH_COMPILE_TIME_ASSERT( posh_32bit_pointer, sizeof( void * ) == 4 ); |
| 934 |
#endif |
| 935 |
|
| 936 |
#if defined FORCE_DOXYGEN |
| 937 |
# define POSH_64BIT_POINTER |
| 938 |
#endif |
| 939 |
|
| 940 |
/* |
| 941 |
** ---------------------------------------------------------------------------- |
| 942 |
** POSH Utility Functions |
| 943 |
** |
| 944 |
** These are optional POSH utility functions that are not required if you don't |
| 945 |
** need anything except static checking of your host and target environment. |
| 946 |
** |
| 947 |
** These functions are NOT wrapped with POSH_PUBLIC_API because I didn't want |
| 948 |
** to enforce their export if your own library is only using them internally. |
| 949 |
** ---------------------------------------------------------------------------- |
| 950 |
*/ |
| 951 |
#ifdef __cpluspluscxx . . $ `<built-in>:440:9`! |
| 952 |
extern "C" { |
| 953 |
#endif |
| 954 |
|
| 955 |
const char *POSH_GetArchString( void ); |
| 956 |
|
| 957 |
#if !defined POSH_NO_FLOAT |
| 958 |
|
| 959 |
posh_u32_tcxx . . $ posh_u32_t# POSH_LittleFloatBits( float f ); |
| 960 |
posh_u32_tcxx . . $ posh_u32_t# POSH_BigFloatBits( float f ); |
| 961 |
float POSH_FloatFromLittleBits( posh_u32_tcxx . . $ posh_u32_t# bits ); |
| 962 |
float POSH_FloatFromBigBits( posh_u32_tcxx . . $ posh_u32_t# bits ); |
| 963 |
|
| 964 |
void POSH_DoubleBits( double d, posh_byte_tcxx . . $ posh_byte_t# dst[ 8 ] ); |
| 965 |
double POSH_DoubleFromBits( const posh_byte_tcxx . . $ posh_byte_t# src[ 8 ] ); |
| 966 |
|
| 967 |
/* unimplemented |
| 968 |
float *POSH_WriteFloatToLittle( void *dst, float f ); |
| 969 |
float *POSH_WriteFloatToBig( void *dst, float f ); |
| 970 |
float POSH_ReadFloatFromLittle( const void *src ); |
| 971 |
float POSH_ReadFloatFromBig( const void *src ); |
| 972 |
|
| 973 |
double *POSH_WriteDoubleToLittle( void *dst, double d ); |
| 974 |
double *POSH_WriteDoubleToBig( void *dst, double d ); |
| 975 |
double POSH_ReadDoubleFromLittle( const void *src ); |
| 976 |
double POSH_ReadDoubleFromBig( const void *src ); |
| 977 |
*/ |
| 978 |
#endif /* !defined POSH_NO_FLOAT */ |
| 979 |
|
| 980 |
#if defined FORCE_DOXYGEN |
| 981 |
# define POSH_NO_FLOAT |
| 982 |
# undef POSH_NO_FLOAT |
| 983 |
#endif |
| 984 |
|
| 985 |
extern posh_u16_tcxx . . $ posh_u16_t# POSH_SwapU16( posh_u16_tcxx . . $ posh_u16_t# u ); |
| 986 |
extern posh_i16_tcxx . . $ posh_i16_t# POSH_SwapI16( posh_i16_tcxx . . $ posh_i16_t# u ); |
| 987 |
extern posh_u32_tcxx . . $ posh_u32_t# POSH_SwapU32( posh_u32_tcxx . . $ posh_u32_t# u ); |
| 988 |
extern posh_i32_tcxx . . $ posh_i32_t# POSH_SwapI32( posh_i32_tcxx . . $ posh_i32_t# u ); |
| 989 |
|
| 990 |
#if defined POSH_64BIT_INTEGERcxx . . $ `extern/poshlib/posh.h:750:11`! |
| 991 |
|
| 992 |
extern posh_u64_tcxx . . $ posh_u64_t# POSH_SwapU64( posh_u64_tcxx . . $ posh_u64_t# u ); |
| 993 |
extern posh_i64_tcxx . . $ posh_i64_t# POSH_SwapI64( posh_i64_tcxx . . $ posh_i64_t# u ); |
| 994 |
|
| 995 |
#endif /*POSH_64BIT_INTEGER */ |
| 996 |
|
| 997 |
extern posh_u16_tcxx . . $ posh_u16_t# *POSH_WriteU16ToLittle( void *dst, posh_u16_tcxx . . $ posh_u16_t# value ); |
| 998 |
extern posh_i16_tcxx . . $ posh_i16_t# *POSH_WriteI16ToLittle( void *dst, posh_i16_tcxx . . $ posh_i16_t# value ); |
| 999 |
extern posh_u32_tcxx . . $ posh_u32_t# *POSH_WriteU32ToLittle( void *dst, posh_u32_tcxx . . $ posh_u32_t# value ); |
| 1000 |
extern posh_i32_tcxx . . $ posh_i32_t# *POSH_WriteI32ToLittle( void *dst, posh_i32_tcxx . . $ posh_i32_t# value ); |
| 1001 |
|
| 1002 |
extern posh_u16_tcxx . . $ posh_u16_t# *POSH_WriteU16ToBig( void *dst, posh_u16_tcxx . . $ posh_u16_t# value ); |
| 1003 |
extern posh_i16_tcxx . . $ posh_i16_t# *POSH_WriteI16ToBig( void *dst, posh_i16_tcxx . . $ posh_i16_t# value ); |
| 1004 |
extern posh_u32_tcxx . . $ posh_u32_t# *POSH_WriteU32ToBig( void *dst, posh_u32_tcxx . . $ posh_u32_t# value ); |
| 1005 |
extern posh_i32_tcxx . . $ posh_i32_t# *POSH_WriteI32ToBig( void *dst, posh_i32_tcxx . . $ posh_i32_t# value ); |
| 1006 |
|
| 1007 |
extern posh_u16_tcxx . . $ posh_u16_t# POSH_ReadU16FromLittle( const void *src ); |
| 1008 |
extern posh_i16_tcxx . . $ posh_i16_t# POSH_ReadI16FromLittle( const void *src ); |
| 1009 |
extern posh_u32_tcxx . . $ posh_u32_t# POSH_ReadU32FromLittle( const void *src ); |
| 1010 |
extern posh_i32_tcxx . . $ posh_i32_t# POSH_ReadI32FromLittle( const void *src ); |
| 1011 |
|
| 1012 |
extern posh_u16_tcxx . . $ posh_u16_t# POSH_ReadU16FromBig( const void *src ); |
| 1013 |
extern posh_i16_tcxx . . $ posh_i16_t# POSH_ReadI16FromBig( const void *src ); |
| 1014 |
extern posh_u32_tcxx . . $ posh_u32_t# POSH_ReadU32FromBig( const void *src ); |
| 1015 |
extern posh_i32_tcxx . . $ posh_i32_t# POSH_ReadI32FromBig( const void *src ); |
| 1016 |
|
| 1017 |
#if defined POSH_64BIT_INTEGERcxx . . $ `extern/poshlib/posh.h:750:11`! |
| 1018 |
extern posh_u64_tcxx . . $ posh_u64_t# *POSH_WriteU64ToLittle( void *dst, posh_u64_tcxx . . $ posh_u64_t# value ); |
| 1019 |
extern posh_i64_tcxx . . $ posh_i64_t# *POSH_WriteI64ToLittle( void *dst, posh_i64_tcxx . . $ posh_i64_t# value ); |
| 1020 |
extern posh_u64_tcxx . . $ posh_u64_t# *POSH_WriteU64ToBig( void *dst, posh_u64_tcxx . . $ posh_u64_t# value ); |
| 1021 |
extern posh_i64_tcxx . . $ posh_i64_t# *POSH_WriteI64ToBig( void *dst, posh_i64_tcxx . . $ posh_i64_t# value ); |
| 1022 |
|
| 1023 |
extern posh_u64_tcxx . . $ posh_u64_t# POSH_ReadU64FromLittle( const void *src ); |
| 1024 |
extern posh_i64_tcxx . . $ posh_i64_t# POSH_ReadI64FromLittle( const void *src ); |
| 1025 |
extern posh_u64_tcxx . . $ posh_u64_t# POSH_ReadU64FromBig( const void *src ); |
| 1026 |
extern posh_i64_tcxx . . $ posh_i64_t# POSH_ReadI64FromBig( const void *src ); |
| 1027 |
#endif /* POSH_64BIT_INTEGER */ |
| 1028 |
|
| 1029 |
#if defined POSH_LITTLE_ENDIANcxx . . $ `extern/poshlib/posh.h:723:11`! |
| 1030 |
|
| 1031 |
# define POSH_LittleU16cxx . . $ `extern/poshlib/posh.h:1031:11`!(x) (x) |
| 1032 |
# define POSH_LittleU32cxx . . $ `extern/poshlib/posh.h:1032:11`!(x) (x) |
| 1033 |
# define POSH_LittleI16cxx . . $ `extern/poshlib/posh.h:1033:11`!(x) (x) |
| 1034 |
# define POSH_LittleI32cxx . . $ `extern/poshlib/posh.h:1034:11`!(x) (x) |
| 1035 |
# if defined POSH_64BIT_INTEGERcxx . . $ `extern/poshlib/posh.h:750:11`! |
| 1036 |
# define POSH_LittleU64cxx . . $ `extern/poshlib/posh.h:1036:13`!(x) (x) |
| 1037 |
# define POSH_LittleI64cxx . . $ `extern/poshlib/posh.h:1037:13`!(x) (x) |
| 1038 |
# endif /* defined POSH_64BIT_INTEGER */ |
| 1039 |
|
| 1040 |
# define POSH_BigU16cxx . . $ `extern/poshlib/posh.h:1040:11`!(x) POSH_SwapU16(x) |
| 1041 |
# define POSH_BigU32cxx . . $ `extern/poshlib/posh.h:1041:11`!(x) POSH_SwapU32(x) |
| 1042 |
# define POSH_BigI16cxx . . $ `extern/poshlib/posh.h:1042:11`!(x) POSH_SwapI16(x) |
| 1043 |
# define POSH_BigI32cxx . . $ `extern/poshlib/posh.h:1043:11`!(x) POSH_SwapI32(x) |
| 1044 |
# if defined POSH_64BIT_INTEGERcxx . . $ `extern/poshlib/posh.h:750:11`! |
| 1045 |
# define POSH_BigU64cxx . . $ `extern/poshlib/posh.h:1045:13`!(x) POSH_SwapU64(x) |
| 1046 |
# define POSH_BigI64cxx . . $ `extern/poshlib/posh.h:1046:13`!(x) POSH_SwapI64(x) |
| 1047 |
# endif /* defined POSH_64BIT_INTEGER */ |
| 1048 |
|
| 1049 |
#else |
| 1050 |
|
| 1051 |
# define POSH_BigU16(x) (x) |
| 1052 |
# define POSH_BigU32(x) (x) |
| 1053 |
# define POSH_BigI16(x) (x) |
| 1054 |
# define POSH_BigI32(x) (x) |
| 1055 |
|
| 1056 |
# if defined POSH_64BIT_INTEGER |
| 1057 |
# define POSH_BigU64(x) (x) |
| 1058 |
# define POSH_BigI64(x) (x) |
| 1059 |
# endif /* POSH_64BIT_INTEGER */ |
| 1060 |
|
| 1061 |
# define POSH_LittleU16(x) POSH_SwapU16(x) |
| 1062 |
# define POSH_LittleU32(x) POSH_SwapU32(x) |
| 1063 |
# define POSH_LittleI16(x) POSH_SwapI16(x) |
| 1064 |
# define POSH_LittleI32(x) POSH_SwapI32(x) |
| 1065 |
|
| 1066 |
# if defined POSH_64BIT_INTEGER |
| 1067 |
# define POSH_LittleU64(x) POSH_SwapU64(x) |
| 1068 |
# define POSH_LittleI64(x) POSH_SwapI64(x) |
| 1069 |
# endif /* POSH_64BIT_INTEGER */ |
| 1070 |
|
| 1071 |
#endif |
| 1072 |
|
| 1073 |
#ifdef __cpluspluscxx . . $ `<built-in>:440:9`! |
| 1074 |
} |
| 1075 |
#endif |