149 #if defined FORCE_DOXYGEN
150 # define POSH_OS_STRING
157 #if defined linux || defined __linux__ || defined FORCE_DOXYGEN
158 # define POSH_OS_LINUX
159 # if !defined FORCE_DOXYGEN
160 # define POSH_OS_STRING "Linux"
168 #if defined(__HAIKU__) || defined FORCE_DOXYGEN
169 # define POSH_OS_HAIKU
170 # if !defined FORCE_DOXYGEN
171 # define POSH_OS_STRING "Haiku"
179 #if defined __CYGWIN32__ || defined FORCE_DOXYGEN
180 # define POSH_OS_CYGWIN32
181 # if !defined FORCE_DOXYGEN
182 # define POSH_OS_STRING "Cygwin"
190 #if defined GO32 && defined DJGPP && defined __MSDOS__ || defined FORCE_DOXYGEN
191 # define POSH_OS_GO32
192 # if !defined FORCE_DOXYGEN
193 # define POSH_OS_STRING "GO32/MS-DOS"
203 #if (defined __WATCOMC__ && defined __386__ && defined __DOS__) || defined FORCE_DOXYGEN
204 # define POSH_OS_DOS32
205 # if !defined FORCE_DOXYGEN
206 # define POSH_OS_STRING "DOS/32-bit"
214 #if defined _UNICOS || defined FORCE_DOXYGEN
215 # define POSH_OS_UNICOS
216 # if !defined FORCE_DOXYGEN
217 # define POSH_OS_STRING "UNICOS"
225 #if (defined __MWERKS__ && defined __powerc && !defined macintosh) || defined __APPLE_CC__ || defined macosx \
226 || defined FORCE_DOXYGEN
228 # if !defined FORCE_DOXYGEN
229 # define POSH_OS_STRING "MacOS X"
237 #if defined __sun__ || defined sun || defined __sun || defined __solaris__ || defined FORCE_DOXYGEN
238 # if defined __SVR4 || defined __svr4__ || defined __solaris__ || defined FORCE_DOXYGEN
239 # if !defined FORCE_DOXYGEN
240 # define POSH_OS_STRING "Solaris"
242 # define POSH_OS_SOLARIS
244 # if defined FORCE_DOXYGEN || !defined POSH_OS_STRING
245 # define POSH_OS_SUNOS
246 # if !defined FORCE_DOXYGEN
247 # define POSH_OS_STRING "SunOS"
256 #if defined __sgi__ || defined sgi || defined __sgi || defined FORCE_DOXYGEN
257 # define POSH_OS_IRIX
258 # if !defined FORCE_DOXYGEN
259 # define POSH_OS_STRING "Irix"
267 #if defined __hpux__ || defined __hpux || defined FORCE_DOXYGEN
268 # define POSH_OS_HPUX
269 # if !defined FORCE_DOXYGEN
270 # define POSH_OS_STRING "HP-UX"
278 #if defined _AIX || defined FORCE_DOXYGEN
280 # if !defined FORCE_DOXYGEN
281 # define POSH_OS_STRING "AIX"
289 #if (defined __alpha && defined __osf__) || defined FORCE_DOXYGEN
290 # define POSH_OS_TRU64
291 # if !defined FORCE_DOXYGEN
292 # define POSH_OS_STRING "Tru64"
300 #if defined __BEOS__ || defined __beos__ || defined FORCE_DOXYGEN
301 # define POSH_OS_BEOS
302 # if !defined FORCE_DOXYGEN
303 # define POSH_OS_STRING "BeOS"
311 #if defined amiga || defined amigados || defined AMIGA || defined _AMIGA || defined FORCE_DOXYGEN
312 # define POSH_OS_AMIGA
313 # if !defined FORCE_DOXYGEN
314 # define POSH_OS_STRING "Amiga"
322 #if defined __unix__ || defined FORCE_DOXYGEN
323 # define POSH_OS_UNIX
324 # if !defined POSH_OS_STRING
325 # define POSH_OS_STRING "Unix-like(generic)"
333 #if defined _WIN32_WCE || defined FORCE_DOXYGEN
334 # define POSH_OS_WINCE
335 # if !defined FORCE_DOXYGEN
336 # define POSH_OS_STRING "Windows CE"
344 #if defined _WIN32 || defined WIN32 || defined __NT__ || defined __WIN32__ || defined FORCE_DOXYGEN
345 # define POSH_OS_WIN32
346 # if defined _WIN64 || defined FORCE_DOXYGEN
347 # define POSH_OS_WIN64
348 # if !defined FORCE_DOXYGEN
349 # define POSH_OS_STRING "Win64"
352 # if !defined FORCE_DOXYGEN
353 # define POSH_OS_STRING "Win32"
362 #if defined __palmos__ || defined FORCE_DOXYGEN
363 # define POSH_OS_PALM
364 # if !defined FORCE_DOXYGEN
365 # define POSH_OS_STRING "PalmOS"
373 #if (defined __MWERKS__ && !defined __powerc) || defined THINK_C || defined macintosh || defined FORCE_DOXYGEN
374 # define POSH_OS_MACOS
375 # if !defined FORCE_DOXYGEN
376 # define POSH_OS_STRING "MacOS"
386 #if defined FORCE_DOXYGEN
387 # define POSH_CPU_STRING
394 #if defined mc68000 || defined m68k || defined __MC68K__ || defined m68000 || defined FORCE_DOXYGEN
395 # define POSH_CPU_68K
396 # if !defined FORCE_DOXYGEN
397 # define POSH_CPU_STRING "MC68000"
405 #if defined __PPC__ || defined __POWERPC__ || defined powerpc || defined _POWER || defined __ppc__ || defined __powerpc__ \
406 || defined FORCE_DOXYGEN
407 # define POSH_CPU_PPC
408 # if !defined FORCE_DOXYGEN
409 # if defined __powerpc64__
410 # define POSH_CPU_STRING "PowerPC64"
412 # define POSH_CPU_STRING "PowerPC"
421 #if defined _CRAYT3E || defined _CRAYMPP || defined FORCE_DOXYGEN
422 # define POSH_CPU_CRAYT3E
423 # if !defined FORCE_DOXYGEN
424 # define POSH_CPU_STRING "Cray T3E (Alpha 21164)"
432 #if defined CRAY || defined _CRAY && !defined _CRAYT3E
433 # error Non-AXP Cray systems not supported
440 #if defined _SH3 || defined FORCE_DOXYGEN
441 # define POSH_CPU_SH3
442 # if !defined FORCE_DOXYGEN
443 # define POSH_CPU_STRING "Hitachi SH-3"
451 #if defined __sh4__ || defined __SH4__ || defined FORCE_DOXYGEN
452 # define POSH_CPU_SH3
453 # define POSH_CPU_SH4
454 # if !defined FORCE_DOXYGEN
455 # define POSH_CPU_STRING "Hitachi SH-4"
463 #if defined __sparc__ || defined __sparc || defined FORCE_DOXYGEN
464 # if defined __arch64__ || defined __sparcv9 || defined __sparc_v9__ || defined FORCE_DOXYGEN
465 # define POSH_CPU_SPARC64
466 # if !defined FORCE_DOXYGEN
467 # define POSH_CPU_STRING "Sparc/64"
470 # if !defined FORCE_DOXYGEN
471 # define POSH_CPU_STRING "Sparc/32"
474 # define POSH_CPU_SPARC
481 #if defined __arm__ || defined _ARM || defined FORCE_DOXYGEN
482 # define POSH_CPU_STRONGARM
483 # if !defined FORCE_DOXYGEN
484 # define POSH_CPU_STRING "ARM"
492 #if defined mips || defined __mips__ || defined __MIPS__ || defined _MIPS || defined FORCE_DOXYGEN
493 # define POSH_CPU_MIPS
494 # if defined _R5900 && !defined FORCE_DOXYGEN
495 # define POSH_CPU_STRING "MIPS R5900 (PS2)"
496 # elif !defined FORCE_DOXYGEN
497 # define POSH_CPU_STRING "MIPS"
505 #if defined __ia64 || defined _M_IA64 || defined __ia64__ || defined FORCE_DOXYGEN
506 # define POSH_CPU_IA64
507 # if !defined FORCE_DOXYGEN
508 # define POSH_CPU_STRING "IA64"
516 #if defined __X86__ || defined __i386__ || defined i386 || defined _M_IX86 || defined __386__ || defined FORCE_DOXYGEN \
517 || defined __amd64__ || defined __AMD64__ || defined __x86_64__
518 # define POSH_CPU_X86
519 # if defined __x86_64__ || defined FORCE_DOXYGEN || defined __amd64__ || defined __AMD64__
520 # define POSH_CPU_X86_64
522 # if !defined FORCE_DOXYGEN
523 # if defined POSH_CPU_X86_64
524 # define POSH_CPU_STRING "AMD x86-64"
526 # define POSH_CPU_STRING "Intel 386+"
535 #if defined __s390__ || defined FORCE_DOXYGEN
536 # define POSH_CPU_S390
537 # if !defined FORCE_DOXYGEN
538 # define POSH_CPU_STRING "S/390"
546 #if defined __alpha || defined alpha || defined _M_ALPHA || defined __alpha__ || defined FORCE_DOXYGEN
547 # define POSH_CPU_AXP
548 # if !defined FORCE_DOXYGEN
549 # define POSH_CPU_STRING "AXP"
557 #if defined __hppa || defined hppa || defined FORCE_DOXYGEN
558 # define POSH_CPU_HPPA
559 # if !defined FORCE_DOXYGEN
560 # define POSH_CPU_STRING "PA-RISC"
566 #if !defined POSH_CPU_STRING
567 # error POSH cannot determine target CPU
571 #if (!defined POSH_OS_STRING) || defined FORCE_DOXYGEN
572 # define POSH_OS_EMBEDDED
573 # if !defined FORCE_DOXYGEN
575 # define POSH_OS_STRING "Sony PS2(embedded)"
577 # define POSH_OS_STRING "Embedded/Unknown"
634 #if !defined FORCE_DOXYGEN && (defined _MSC_VER || defined __WATCOMC__ || defined __GNUC__ || defined __BORLANDC__ \
635 || defined __MWERKS__)
636 # define POSH_CDECL __cdecl
637 # define POSH_STDCALL __stdcall
638 # define POSH_FASTCALL __fastcall
641 # define POSH_STDCALL
642 # define POSH_FASTCALL
693 #if defined POSH_IMPORTEXPORT
694 # undef POSH_IMPORTEXPORT
698 # if defined POSH_OS_WIN32
699 # if defined _MSC_VER
700 # if (_MSC_VER >= 800)
701 # if defined POSH_BUILDING_LIB
702 # define POSH_IMPORTEXPORT __declspec( dllexport )
704 # define POSH_IMPORTEXPORT __declspec( dllimport )
707 # if defined POSH_BUILDING_LIB
708 # define POSH_IMPORTEXPORT __export
710 # define POSH_IMPORTEXPORT
714 # if defined __BORLANDC__
715 # if (__BORLANDC__ >= 0x500)
716 # if defined POSH_BUILDING_LIB
717 # define POSH_IMPORTEXPORT __declspec( dllexport )
719 # define POSH_IMPORTEXPORT __declspec( dllimport )
722 # if defined POSH_BUILDING_LIB
723 # define POSH_IMPORTEXPORT __export
725 # define POSH_IMPORTEXPORT
730 # if defined __GNUC__ || defined __WATCOMC__ || defined __MWERKS__
731 # if defined POSH_BUILDING_LIB
732 # define POSH_IMPORTEXPORT __declspec( dllexport )
734 # define POSH_IMPORTEXPORT __declspec( dllimport )
737 # if !defined POSH_IMPORTEXPORT
738 # error Building DLLs not supported on this compiler (poshlib@poshlib.org if you know how)
744 #if !defined POSH_IMPORTEXPORT
745 # define POSH_IMPORTEXPORT
748 #if defined FORCE_DOXYGEN
750 # define POSH_BUILDING_LIB
757 #ifdef POSH_PUBLIC_API
758 # undef POSH_PUBLIC_API
761 #if ( ( defined _MSC_VER) && (_MSC_VER < 800 ) ) || (defined __BORLANDC__ && (__BORLANDC__ < 0x500 ) )
762 # define POSH_PUBLIC_API( rtype ) extern rtype POSH_IMPORTEXPORT
764 # define POSH_PUBLIC_API( rtype ) extern POSH_IMPORTEXPORT rtype
796 #if defined FORCE_DOXYGEN
797 # define POSH_LITTLE_ENDIAN
798 # define POSH_BIG_ENDIAN
799 #elif defined POSH_CPU_X86 || defined POSH_CPU_AXP || defined POSH_CPU_STRONGARM || defined POSH_OS_WIN32 \
800 || defined POSH_OS_WINCE || defined __MIPSEL__
801 # define POSH_LITTLE_ENDIAN 1
802 # define POSH_ENDIAN_STRING "little"
804 # define POSH_BIG_ENDIAN 1
805 # define POSH_ENDIAN_STRING "big"
822 #if defined FORCE_DOXYGEN
823 # define POSH_COMPILE_TIME_ASSERT( name, x )
825 # define POSH_COMPILE_TIME_ASSERT( name, x ) typedef int _POSH_dummy_##name[(x) ? 1 : -1]
843 #if defined FORCE_DOXYGEN
844 # define POSH_64BIT_INTEGER
845 typedef struct compiler_specific posh_i64_t;
846 typedef struct compiler_specific posh_s64_t;
847 typedef struct compiler_specific posh_u64_t;
848 # define POSH_S64( x )
849 # define POSH_U64( x )
850 #elif defined (__LP64__) || defined (__powerpc64__) || defined POSH_CPU_SPARC64
851 # define POSH_64BIT_INTEGER 1
852 typedef long posh_i64_t;
853 typedef long posh_s64_t;
854 typedef unsigned long posh_u64_t;
855 # define POSH_S64( x ) ( (posh_s64_t) x )
856 # define POSH_U64( x ) ( (posh_u64_t) x )
857 #elif defined __GNUC__ || defined __MWERKS__ || defined __SUNPRO_C || defined __SUNPRO_CC || defined __APPLE_CC__ \
858 || defined POSH_OS_IRIX || defined _LONG_LONG || defined _CRAYC
859 # define POSH_64BIT_INTEGER 1
860 typedef long long posh_i64_t;
861 typedef long long posh_s64_t;
862 typedef unsigned long long posh_u64_t;
863 # define POSH_U64( x ) x##LL
864 # define POSH_S64( x ) x##LL
865 #elif defined _MSC_VER || defined __BORLANDC__ || defined __WATCOMC__ || (defined __alpha && defined __DECC)
866 # define POSH_64BIT_INTEGER 1
867 typedef __int64 posh_i64_t;
868 typedef __int64 posh_s64_t;
869 typedef unsigned __int64 posh_u64_t;
870 # define POSH_S64( x ) ( (posh_s64_t) x )
871 # define POSH_U64( x ) ( (posh_u64_t) x )
940 #if !defined POSH_OS_PALM
964 #if defined FORCE_DOXYGEN
965 # define POSH_NO_FLOAT
974 # undef POSH_NO_FLOAT
992 #if !defined POSH_NO_FLOAT
997 #if defined POSH_64BIT_INTEGER
1014 #if defined FORCE_DOXYGEN
1021 # define POSH_64BIT_POINTER
1025 #if defined POSH_CPU_AXP && (defined POSH_OS_TRU64 || defined POSH_OS_LINUX || defined __FreeBSD__)
1026 # define POSH_64BIT_POINTER 1
1029 #if defined POSH_CPU_X86_64 && defined POSH_OS_LINUX
1030 # define POSH_64BIT_POINTER 1
1033 #if defined POSH_CPU_SPARC64 || defined POSH_OS_WIN64 || defined __64BIT__ || defined __LP64 || defined _LP64 \
1034 || defined __LP64__ || defined _ADDR64 || defined _CRAYC
1035 # define POSH_64BIT_POINTER 1
1038 #if defined POSH_64BIT_POINTER
1108 #if !defined POSH_NO_FLOAT
1147 #if defined POSH_64BIT_INTEGER
1149 extern posh_u64_t POSH_SwapU64( posh_u64_t u );
1150 extern posh_s64_t POSH_SwapS64( posh_s64_t u );
1204 #if defined POSH_64BIT_INTEGER
1205 extern posh_u64_t * POSH_WriteU64ToLittle(
void *dst, posh_u64_t value );
1206 extern posh_s64_t * POSH_WriteS64ToLittle(
void *dst, posh_s64_t value );
1207 extern posh_u64_t * POSH_WriteU64ToBig(
void *dst, posh_u64_t value );
1208 extern posh_s64_t * POSH_WriteS64ToBig(
void *dst, posh_s64_t value );
1210 extern posh_u64_t POSH_ReadU64FromLittle(
const void *src );
1211 extern posh_s64_t POSH_ReadS64FromLittle(
const void *src );
1212 extern posh_u64_t POSH_ReadU64FromBig(
const void *src );
1213 extern posh_s64_t POSH_ReadS64FromBig(
const void *src );
1222 #if defined FORCE_DOXYGEN
1224 #define POSH_LittleU16( x )
1225 #define POSH_LittleU32( x )
1226 #define POSH_LittleU64( x )
1227 #define POSH_LittleS16( x )
1228 #define POSH_LittleS32( x )
1229 #define POSH_LittleS64( x )
1231 #define POSH_BigU16( x )
1232 #define POSH_BigU32( x )
1233 #define POSH_BigU64( x )
1234 #define POSH_BigS16( x )
1235 #define POSH_BigS32( x )
1236 #define POSH_BigS64( x )
1238 #elif defined POSH_LITTLE_ENDIAN
1240 #define POSH_LittleU16( x ) (x)
1241 #define POSH_LittleU32( x ) (x)
1242 #define POSH_LittleS16( x ) (x)
1243 #define POSH_LittleS32( x ) (x)
1244 #if defined POSH_64BIT_INTEGER
1245 # define POSH_LittleU64( x ) (x)
1246 # define POSH_LittleS64( x ) (x)
1249 #define POSH_BigU16( x ) POSH_SwapU16( x )
1250 #define POSH_BigU32( x ) POSH_SwapU32( x )
1251 #define POSH_BigS16( x ) POSH_SwapS16( x )
1252 #define POSH_BigS32( x ) POSH_SwapS32( x )
1253 #if defined POSH_64BIT_INTEGER
1254 # define POSH_BigU64( x ) POSH_SwapU64( x )
1255 # define POSH_BigS64( x ) POSH_SwapS64( x )
1260 #define POSH_BigU16( x ) (x)
1261 #define POSH_BigU32( x ) (x)
1262 #define POSH_BigS16( x ) (x)
1263 #define POSH_BigS32( x ) (x)
1265 #if defined POSH_64BIT_INTEGER
1266 # define POSH_BigU64( x ) (x)
1267 # define POSH_BigS64( x ) (x)
1270 #define POSH_LittleU16( x ) POSH_SwapU16( x )
1271 #define POSH_LittleU32( x ) POSH_SwapU32( x )
1272 #define POSH_LittleS16( x ) POSH_SwapS16( x )
1273 #define POSH_LittleS32( x ) POSH_SwapS32( x )
1275 #if defined POSH_64BIT_INTEGER
1276 # define POSH_LittleU64( x ) POSH_SwapU64( x )
1277 # define POSH_LittleS64( x ) POSH_SwapS64( x )