Sierra Toolkit Version of the Day
eaplatform_eastl.h
00001 /*
00002 Copyright (C) 2009 Electronic Arts, Inc.  All rights reserved.
00003 
00004 Redistribution and use in source and binary forms, with or without
00005 modification, are permitted provided that the following conditions
00006 are met:
00007 
00008 1.  Redistributions of source code must retain the above copyright
00009     notice, this list of conditions and the following disclaimer.
00010 2.  Redistributions in binary form must reproduce the above copyright
00011     notice, this list of conditions and the following disclaimer in the
00012     documentation and/or other materials provided with the distribution.
00013 3.  Neither the name of Electronic Arts, Inc. ("EA") nor the names of
00014     its contributors may be used to endorse or promote products derived
00015     from this software without specific prior written permission.
00016 
00017 THIS SOFTWARE IS PROVIDED BY ELECTRONIC ARTS AND ITS CONTRIBUTORS "AS IS" AND ANY
00018 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00019 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00020 DISCLAIMED. IN NO EVENT SHALL ELECTRONIC ARTS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
00021 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00022 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00023 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00024 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027 */
00028 
00029 /*-----------------------------------------------------------------------------
00030  * config/eaplatform.h
00031  *
00032  * Copyright (c) 2002 - 2005 Electronic Arts Inc. All rights reserved.
00033  * Maintained by Paul Pedriana, Maxis
00034  *
00035  *-----------------------------------------------------------------------------
00036  * Currently supported platform indentification defines include:
00037  *    EA_PLATFORM_PS3
00038  *    EA_PLATFORM_PS3_PPU
00039  *    EA_PLATFORM_PS3_SPU
00040  *    EA_PLATFORM_XENON (a.k.a. XBox2)
00041  *    EA_PLATFORM_MAC
00042  *    EA_PLATFORM_OSX
00043  *    EA_PLATFORM_LINUX
00044  *    EA_PLATFORM_WINDOWS
00045  *    EA_PLATFORM_WIN32
00046  *    EA_PLATFORM_WIN64
00047  *    EA_PLATFORM_HPUX
00048  *    EA_PLATFORM_SUN
00049  *    EA_PLATFORM_LRB (Larrabee)
00050  *    EA_PLATFORM_UNIX      (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
00051  *    EA_PLATFORM_CYGWIN    (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
00052  *    EA_PLATFORM_MINGW     (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
00053  *    EA_PLATFORM_MICROSOFT (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
00054  *
00055  * Other definitions emanated from this file inclue:
00056  *    EA_PLATFORM_NAME = <string>
00057  *    EA_PLATFORM_DESCRIPTION = <string>
00058  *    EA_PROCESSOR_XXX
00059  *    EA_SYSTEM_LITTLE_ENDIAN | EA_SYSTEM_BIG_ENDIAN
00060  *    EA_ASM_STYLE_ATT | EA_ASM_STYLE_INTEL | EA_ASM_STYLE_MOTOROLA
00061  *    EA_PLATFORM_PTR_SIZE = <integer size in bytes>
00062  *    EA_PLATFORM_WORD_SIZE = <integer size in bytes>
00063  *
00064  *---------------------------------------------------------------------------*/
00065 
00066 
00067 #ifndef INCLUDED_eaplatform_H
00068 #define INCLUDED_eaplatform_H
00069 
00070 
00071 // Cygwin
00072 // This is a pseudo-platform which will be defined along with EA_PLATFORM_LINUX when
00073 // using the Cygwin build environment.
00074 #if defined(__CYGWIN__)
00075     #define EA_PLATFORM_CYGWIN
00076     #define EA_PLATFORM_DESKTOP
00077 #endif
00078 
00079 // MinGW
00080 // This is a pseudo-platform which will be defined along with EA_PLATFORM_WINDOWS when
00081 // using the MinGW Windows build environment.
00082 #if defined(__MINGW32__) || defined(__MINGW64__)
00083     #define EA_PLATFORM_MINGW
00084     #define EA_PLATFORM_DESKTOP
00085 #endif
00086 
00087 // PlayStation 3 PPU (Primary Processing Unit)
00088 #if defined(EA_PLATFORM_PS3_PPU) || defined(EA_PLATFORM_PS3) || defined(__PU__) || defined(__PPU__)
00089     #undef  EA_PLATFORM_PS3_PPU
00090     #define EA_PLATFORM_PS3_PPU 1
00091     #undef  EA_PLATFORM_PS3
00092     #define EA_PLATFORM_PS3 1
00093     #define EA_PLATFORM_NAME "PS3"
00094     #define EA_PROCESSOR_POWERPC
00095     #define EA_PROCESSOR_POWERPC_64
00096     #define EA_SYSTEM_BIG_ENDIAN
00097     #define EA_PLATFORM_DESCRIPTION "PS3 on PowerPC"
00098     #define EA_PLATFORM_CONSOLE
00099 
00100 // PlayStation 3 SPU (Synergistic Processing Unit)
00101 #elif defined(EA_PLATFORM_PS3_SPU) || defined(__SPU__)
00102     #undef  EA_PLATFORM_PS3_SPU
00103     #define EA_PLATFORM_PS3_SPU 1
00104     #define EA_PLATFORM_NAME "PS3 SPU"
00105     #define EA_PROCESSOR_SPU
00106     #define EA_SYSTEM_BIG_ENDIAN
00107     #define EA_PLATFORM_DESCRIPTION "PS3 SPU on SPU"
00108     #define EA_PLATFORM_CONSOLE
00109 
00110 // XBox
00111 // _XBOX is defined by the VC++ project, not the compiler. There is no way
00112 // to tell if the compiler is compiling for XBox unless _XBOX is #defined
00113 // in the project files or otherwise. _M_IX86 is the VC++ way of detecting
00114 // an x86 target, which would mean XBox and not Xenon (a.k.a. XBox2).
00115 #elif defined(EA_PLATFORM_XBOX) || (defined(_XBOX) && defined(_M_IX86))
00116     #undef  EA_PLATFORM_XBOX
00117     #define EA_PLATFORM_XBOX 1
00118     #define EA_PLATFORM_NAME "XBox"
00119     #define EA_PROCESSOR_X86
00120     #define EA_SYSTEM_LITTLE_ENDIAN
00121     #define EA_PLATFORM_DESCRIPTION "XBox on X86"
00122     #if defined(_MSC_VER) || defined(__ICL)
00123        #define EA_ASM_STYLE_INTEL
00124     #endif
00125     #define EA_PLATFORM_CONSOLE
00126 
00127 // Xenon (XBox 360)
00128 // The Xenon compiler doesn't define anything in particular to indicate that the
00129 // target is the Xenon platform. The Xenon SDK, however, expects that XBOX and
00130 // _XBOX are #defined, so the project build file must make sure these are defined.
00131 // Since the Xenon compiler in fact defines _M_PPC, we can use this information
00132 // to infer that Xenon is the target if neither _XENON nor _XBOX2 are specifically
00133 // defined by the project build file.
00134 #elif defined(EA_PLATFORM_XENON) || defined(_XENON) || defined(_XBOX2) || ((defined(_XBOX) || defined(XBOX)) && defined(_M_PPC))
00135     #undef  EA_PLATFORM_XENON
00136     #define EA_PLATFORM_XENON 1
00137     #define EA_PLATFORM_NAME "Xenon"
00138     #define EA_PROCESSOR_POWERPC
00139     #define EA_PROCESSOR_POWERPC_64
00140     #define EA_SYSTEM_BIG_ENDIAN
00141     #define EA_PLATFORM_DESCRIPTION "Xenon on PowerPC"
00142     #if defined(_MSC_VER) || defined(__ICL)
00143        #define EA_ASM_STYLE_INTEL
00144     #endif
00145     #define EA_PLATFORM_CONSOLE
00146     #define EA_PLATFORM_MICROSOFT 1
00147 
00148 // Larrabee                                           // This part to be removed once __LRB__ is supported by the Larrabee compiler in 2009.
00149 #elif defined(EA_PLATFORM_LRB) || defined(__LRB__) || (defined(__EDG__) && defined(__ICC) && defined(__x86_64__))
00150     #undef  EA_PLATFORM_LRB
00151     #define EA_PLATFORM_LRB         1
00152     #define EA_PLATFORM_NAME        "Larrabee"
00153     #define EA_PLATFORM_DESCRIPTION "Larrabee on LRB1"
00154     #define EA_PROCESSOR_X86_64
00155     #if defined(BYTE_ORDER) && (BYTE_ORDER == 4321)
00156         #define EA_SYSTEM_BIG_ENDIAN
00157     #else
00158         #define EA_SYSTEM_LITTLE_ENDIAN
00159     #endif
00160     #define EA_PROCESSOR_LRB
00161     #define EA_PROCESSOR_LRB1       // Larrabee version 1
00162     #define EA_ASM_STYLE_ATT        // Both types of asm style
00163     #define EA_ASM_STYLE_INTEL      // are supported.
00164     #define EA_PLATFORM_DESKTOP
00165 
00166 // Android (Google phone OS)
00167 #elif defined(EA_PLATFORM_ANDROID) || defined(__ANDROID__)
00168     #undef  EA_PLATFORM_ANDROID
00169     #define EA_PLATFORM_ANDROID 1
00170     #define EA_PLATFORM_LINUX 1
00171     #define EA_PLATFORM_UNIX 1
00172     #define EA_PLATFORM_NAME "Android"
00173     #define EA_ASM_STYLE_ATT
00174     #if defined(__arm__)
00175         #define EA_PROCESSOR_ARM
00176         #define EA_PLATFORM_DESCRIPTION "Android on ARM"
00177     #else
00178         #error Unknown processor
00179     #endif
00180     #if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN)
00181         #define EA_SYSTEM_LITTLE_ENDIAN
00182     #endif
00183     #define EA_PLATFORM_MOBILE
00184 
00185 // Palm OS for Mobile (Linux variant)
00186 #elif defined(EA_PLATFORM_PALM)
00187     #undef  EA_PLATFORM_PALM
00188     #define EA_PLATFORM_PALM 1
00189     #define EA_PLATFORM_LINUX 1
00190     #define EA_PLATFORM_UNIX 1
00191     #define EA_PLATFORM_NAME "Palm"
00192     #define EA_POSIX_THREADS_AVAILABLE 1
00193     #define EA_ASM_STYLE_ATT
00194     #if defined(__arm__)
00195         #define EA_PROCESSOR_ARM
00196         #define EA_PLATFORM_DESCRIPTION "Palm on ARM"
00197     #else
00198         #error Unknown processor
00199     #endif
00200     #if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN)
00201         #define EA_SYSTEM_LITTLE_ENDIAN
00202     #endif
00203     #define EA_PLATFORM_MOBILE
00204 
00205 // Airplay
00206 #elif defined(EA_PLATFORM_AIRPLAY) || defined(__S3E__)
00207     #undef  EA_PLATFORM_AIRPLAY
00208     #define EA_PLATFORM_AIRPLAY
00209     #define EA_PLATFORM_NAME "Airplay"
00210     #if defined(__arm__)
00211         #define EA_PROCESSOR_ARM
00212         #define EA_PLATFORM_DESCRIPTION "Airplay on ARM"
00213         #define EA_ASM_STYLE_ATT
00214         #undef _MSC_VER
00215     #elif defined(_M_IX86)
00216         #define EA_PROCESSOR_X86
00217         #define EA_PLATFORM_DESCRIPTION "Airplay on x86"
00218         #define EA_ASM_STYLE_INTEL
00219     #else
00220         #error Unknown processor
00221     #endif
00222     #if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN)
00223         #if defined(HAVE_BIG_ENDIAN) || (defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && (__BYTE_ORDER == __BIG_ENDIAN)))
00224             #define EA_SYSTEM_BIG_ENDIAN
00225         #else
00226             #define EA_SYSTEM_LITTLE_ENDIAN
00227         #endif
00228     #endif
00229     #define EA_PLATFORM_MOBILE
00230 
00231 // Samsung Bada OS for Mobile (Linux variant)
00232 #elif defined(EA_PLATFORM_BADA)
00233     #undef  EA_PLATFORM_BADA
00234     #define EA_PLATFORM_BADA 1
00235   //#define EA_PLATFORM_LINUX 1     // The underlying OS is Linux, but the app mostly doesn't see this.
00236   //#define EA_PLATFORM_UNIX 1
00237     #define EA_PLATFORM_NAME "bada"
00238     #define EA_ASM_STYLE_ATT
00239     #if defined(__arm__)
00240         #define EA_PROCESSOR_ARM
00241         #define EA_PLATFORM_DESCRIPTION "bada on ARM"
00242     #elif defined(__i386__)
00243         #define EA_PLATFORM_BADA_SIMULATOR
00244         #define EA_PROCESSOR_X86
00245         #define EA_PLATFORM_DESCRIPTION "bada simulator on x86"
00246     #else
00247         #error Unknown processor
00248     #endif
00249     #if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN)
00250         #define EA_SYSTEM_LITTLE_ENDIAN
00251     #endif
00252     #define EA_PLATFORM_MOBILE
00253 
00254 #elif defined(__APPLE__) && __APPLE__
00255     #include <TargetConditionals.h>
00256 
00257     // Apple family of operating systems.
00258     #define EA_PLATFORM_APPLE
00259 
00260     // iPhone
00261     // TARGET_OS_IPHONE will be undefined on an unknown compiler, and will be defined on gcc.
00262     #if defined(EA_PLATFORM_IPHONE) || defined(__IPHONE__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
00263         #undef  EA_PLATFORM_IPHONE
00264         #define EA_PLATFORM_IPHONE 1
00265         #define EA_PLATFORM_NAME "iPhone"
00266         #define EA_ASM_STYLE_ATT
00267         #define EA_POSIX_THREADS_AVAILABLE 1
00268         #if defined(__arm__)
00269             #define EA_PROCESSOR_ARM
00270             #define EA_SYSTEM_LITTLE_ENDIAN
00271             #define EA_PLATFORM_DESCRIPTION "iPhone on ARM"
00272         #elif defined(__i386__)
00273             #define EA_PLATFORM_IPHONE_SIMULATOR
00274             #define EA_PROCESSOR_X86
00275             #define EA_SYSTEM_LITTLE_ENDIAN
00276             #define EA_PLATFORM_DESCRIPTION "iPhone simulator on x86"
00277         #else
00278             #error Unknown processor
00279         #endif
00280         #define EA_PLATFORM_MOBILE
00281 
00282     // Macintosh OSX
00283     // TARGET_OS_MAC is defined by the Metrowerks and older AppleC compilers.
00284     // Howerver, TARGET_OS_MAC is defined to be 1 in all cases.
00285     // __i386__ and __intel__ are defined by the GCC compiler.
00286     // __dest_os is defined by the Metrowerks compiler.
00287     // __MACH__ is defined by the Metrowerks and GCC compilers.
00288     // powerc and __powerc are defined by the Metrowerks and GCC compilers.
00289     #elif defined(EA_PLATFORM_OSX) || defined(__MACH__) || (defined(__MSL__) && (__dest_os == __mac_os_x))
00290         #undef  EA_PLATFORM_OSX
00291         #define EA_PLATFORM_OSX 1
00292         #define EA_PLATFORM_UNIX 1
00293         #define EA_PLATFORM_NAME "OSX"
00294         #if defined(__i386__) || defined(__intel__)
00295             #define EA_PROCESSOR_X86
00296             #define EA_SYSTEM_LITTLE_ENDIAN
00297             #define EA_PLATFORM_DESCRIPTION "OSX on x86"
00298         #elif defined(__x86_64) || defined(__amd64)
00299             #define EA_PROCESSOR_X86_64
00300             #define EA_SYSTEM_LITTLE_ENDIAN
00301             #define EA_PLATFORM_DESCRIPTION "OSX on x86-64"
00302         #elif defined(__arm__)
00303             #define EA_PROCESSOR_ARM
00304             #define EA_SYSTEM_LITTLE_ENDIAN
00305             #define EA_PLATFORM_DESCRIPTION "OSX on ARM"
00306         #elif defined(__POWERPC64__) || defined(__powerpc64__)
00307             #define EA_PROCESSOR_POWERPC
00308             #define EA_PROCESSOR_POWERPC_64
00309             #define EA_SYSTEM_BIG_ENDIAN
00310             #define EA_PLATFORM_DESCRIPTION "OSX on PowerPC 64"
00311         #elif defined(__POWERPC__) || defined(__powerpc__)
00312             #define EA_PROCESSOR_POWERPC
00313             #define EA_PROCESSOR_POWERPC_32
00314             #define EA_SYSTEM_BIG_ENDIAN
00315             #define EA_PLATFORM_DESCRIPTION "OSX on PowerPC"
00316         #else
00317             #error Unknown processor
00318         #endif
00319         #if defined(__GNUC__)
00320             #define EA_ASM_STYLE_ATT
00321         #else
00322             #define EA_ASM_STYLE_MOTOROLA
00323         #endif
00324         #define EA_PLATFORM_DESKTOP
00325 
00326     #else
00327         #error Unknown Apple Platform
00328     #endif
00329 
00330 // Linux
00331 // __linux and __linux__ are defined by the GCC and Borland compiler.
00332 // __i386__ and __intel__ are defined by the GCC compiler.
00333 // __i386__ is defined by the Metrowerks compiler.
00334 // _M_IX86 is defined by the Borland compiler.
00335 // __sparc__ is defined by the GCC compiler.
00336 // __powerpc__ is defined by the GCC compiler.
00337 #elif defined(EA_PLATFORM_LINUX) || (defined(__linux) || defined(__linux__))
00338     #undef  EA_PLATFORM_LINUX
00339     #define EA_PLATFORM_LINUX 1
00340     #define EA_PLATFORM_UNIX 1
00341     #define EA_PLATFORM_NAME "Linux"
00342     #if defined(__i386__) || defined(__intel__) || defined(_M_IX86)
00343         #define EA_PROCESSOR_X86
00344         #define EA_SYSTEM_LITTLE_ENDIAN
00345         #define EA_PLATFORM_DESCRIPTION "Linux on x86"
00346     #elif defined(__x86_64__)
00347         #define EA_PROCESSOR_X86_64
00348         #define EA_SYSTEM_LITTLE_ENDIAN
00349         #define EA_PLATFORM_DESCRIPTION "Linux on x86-64"
00350     #elif defined(__powerpc64__)
00351         #define EA_PROCESSOR_POWERPC
00352         #define EA_PROCESSOR_POWERPC_64
00353         #define EA_SYSTEM_BIG_ENDIAN
00354         #define EA_PLATFORM_DESCRIPTION "Linux on PowerPC 64"
00355     #elif defined(__powerpc__)
00356         #define EA_PROCESSOR_POWERPC
00357         #define EA_PROCESSOR_POWERPC_32
00358         #define EA_SYSTEM_BIG_ENDIAN
00359         #define EA_PLATFORM_DESCRIPTION "Linux on PowerPC"
00360     #else
00361         #error Unknown processor
00362         #error Unknown endianness
00363     #endif
00364     #if defined(__GNUC__)
00365         #define EA_ASM_STYLE_ATT
00366     #endif
00367     #define EA_PLATFORM_DESKTOP
00368 
00369 // Win CE (Windows mobile)
00370 #elif defined(EA_PLATFORM_WINCE) || defined(_WIN32_WCE)
00371     #undef  EA_PLATFORM_WINCE
00372     #define EA_PLATFORM_WINCE 1
00373     #define EA_PLATFORM_NAME "WinCE"
00374     #define EA_ASM_STYLE_INTEL
00375     #define EA_SYSTEM_LITTLE_ENDIAN
00376     #if defined(_M_ARM) // Also there is _M_ARMT
00377         #define EA_PROCESSOR_ARM
00378         #define EA_PLATFORM_DESCRIPTION "Windows CE on ARM"
00379     #elif defined(_M_IX86)
00380         #define EA_PROCESSOR_X86
00381         #define EA_PLATFORM_DESCRIPTION "Windows CE on X86"
00382     #else //Possibly other Windows CE variants
00383         #error Unknown processor
00384     #endif
00385     #define EA_PLATFORM_MOBILE
00386 
00387 // Windows
00388 // _WIN32 is defined by the VC++, Intel and GCC compilers.
00389 // _WIN64 is defined by the VC++, Intel and GCC compilers.
00390 // __WIN32__ is defined by the Borland compiler.
00391 // __INTEL__ is defined by the Metrowerks compiler.
00392 // _M_IX86, _M_AMD64 and _M_IA64 are defined by the VC++, Intel, and Borland compilers.
00393 // _X86_, _AMD64_, and _IA64_ are defined by the Metrowerks compiler.
00394 // _M_ARM is defined by the VC++ compiler.
00395 #elif (defined(EA_PLATFORM_WINDOWS) || (defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || (defined(__MWERKS__) && defined(_X86_)))) && !defined(_XBOX)
00396     #undef  EA_PLATFORM_WINDOWS
00397     #define EA_PLATFORM_WINDOWS 1
00398     #define EA_PLATFORM_NAME "Windows"
00399     #ifdef _WIN64 // VC++ defines both _WIN32 and _WIN64 when compiling for Win64.
00400         #define EA_PLATFORM_WIN64
00401     #else
00402         #define EA_PLATFORM_WIN32
00403     #endif
00404     #if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
00405         #define EA_PROCESSOR_X86_64
00406         #define EA_SYSTEM_LITTLE_ENDIAN
00407         #define EA_PLATFORM_DESCRIPTION "Windows on X86-64"
00408     #elif defined(_M_IX86) || defined(_X86_)
00409         #define EA_PROCESSOR_X86
00410         #define EA_SYSTEM_LITTLE_ENDIAN
00411         #define EA_PLATFORM_DESCRIPTION "Windows on X86"
00412     #elif defined(_M_IA64) || defined(_IA64_)
00413         #define EA_PROCESSOR_IA64
00414         #define EA_SYSTEM_LITTLE_ENDIAN
00415         #define EA_PLATFORM_DESCRIPTION "Windows on IA-64"
00416     #elif defined(_M_ARM)
00417         #define EA_PROCESSOR_ARM
00418         #define EA_SYSTEM_LITTLE_ENDIAN
00419         #define EA_PLATFORM_DESCRIPTION "Windows CE on ARM"
00420     #else //Possibly other Windows CE variants
00421         #error Unknown processor
00422         #error Unknown endianness
00423     #endif
00424     #if defined(__GNUC__)
00425         #define EA_ASM_STYLE_ATT
00426     #elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__ICL)
00427         #define EA_ASM_STYLE_INTEL
00428     #endif
00429     #define EA_PLATFORM_DESKTOP
00430     #define EA_PLATFORM_MICROSOFT 1
00431 
00432 // Sun (Solaris)
00433 // __SUNPRO_CC is defined by the Sun compiler.
00434 // __sun is defined by the GCC compiler.
00435 // __i386 is defined by the Sun and GCC compilers.
00436 // __sparc is defined by the Sun and GCC compilers.
00437 #elif defined(EA_PLATFORM_SUN) || (defined(__SUNPRO_CC) || defined(__sun))
00438     #undef  EA_PLATFORM_SUN
00439     #define EA_PLATFORM_SUN 1
00440     #define EA_PLATFORM_UNIX 1
00441     #define EA_PLATFORM_NAME "SUN"
00442     #if defined(__i386)
00443         #define EA_PROCESSOR_X86
00444         #define EA_SYSTEM_LITTLE_ENDIAN
00445         #define EA_PLATFORM_DESCRIPTION "SUN on x86"
00446     #elif defined(__sparc)
00447         #define EA_PROCESSOR_SPARC
00448         #define EA_SYSTEM_BIG_ENDIAN
00449         #define EA_PLATFORM_DESCRIPTION "SUN on Sparc"
00450     #else
00451         #error Unknown processor
00452         #error Unknown endianness
00453     #endif
00454     #define EA_PLATFORM_DESKTOP
00455 
00456 #else
00457     #error Unknown platform
00458     #error Unknown processor
00459     #error Unknown endianness
00460 #endif
00461 
00462 
00463 
00464 // EA_PLATFORM_PTR_SIZE
00465 // Platform pointer size; same as sizeof(void*).
00466 // This is not the same as sizeof(int), as int is usually 32 bits on
00467 // even 64 bit platforms.
00468 //
00469 // _WIN64 is defined by Win64 compilers, such as VC++.
00470 // _M_IA64 is defined by VC++ and Intel compilers for IA64 processors.
00471 // __LP64__ is defined by HP compilers for the LP64 standard.
00472 // _LP64 is defined by the GCC and Sun compilers for the LP64 standard.
00473 // __ia64__ is defined by the GCC compiler for IA64 processors.
00474 // __arch64__ is defined by the Sparc compiler for 64 bit processors.
00475 // __mips64__ is defined by the GCC compiler for MIPS processors.
00476 // __powerpc64__ is defined by the GCC compiler for PowerPC processors.
00477 // __64BIT__ is defined by the AIX compiler for 64 bit processors.
00478 // __sizeof_ptr is defined by the ARM compiler (armcc, armcpp).
00479 //
00480 #ifndef EA_PLATFORM_PTR_SIZE
00481     #if defined(__WORDSIZE) // Defined by some variations of GCC.
00482         #define EA_PLATFORM_PTR_SIZE ((__WORDSIZE) / 8)
00483     #elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || defined(__ia64__) || defined(__arch64__) || defined(__mips64__) || defined(__64BIT__)
00484         #define EA_PLATFORM_PTR_SIZE 8
00485     #elif defined(__CC_ARM) && (__sizeof_ptr == 8)
00486         #define EA_PLATFORM_PTR_SIZE 8
00487     #else
00488         #define EA_PLATFORM_PTR_SIZE 4
00489     #endif
00490 #endif
00491 
00492 
00493 
00494 // EA_PLATFORM_WORD_SIZE
00495 // This defines the size of a machine word. This will be the same as
00496 // the size of registers on the machine but not necessarily the same
00497 // as the size of pointers on the machine. A number of 64 bit platforms
00498 // have 64 bit registers but 32 bit pointers.
00499 //
00500 #ifndef EA_PLATFORM_WORD_SIZE
00501    #if defined(EA_PLATFORM_XENON) || defined(EA_PLATFORM_PS3)
00502       #define EA_PLATFORM_WORD_SIZE 8
00503    #else
00504       #define EA_PLATFORM_WORD_SIZE EA_PLATFORM_PTR_SIZE
00505    #endif
00506 #endif
00507 
00508 
00509 
00510 // Disabled until and unless deemed useful:
00511 //
00512 // Platform integer types
00513 // These definitions allow us to define other things properly, such as
00514 // sized integer types. In order to bring some order to this chaos,
00515 // we follow a variation of the standard LP64 conventions defined at:
00516 //    http://www.opengroup.org/public/tech/aspen/lp64_wp.htm
00517 //
00518 // #if defined(EA_PLATFORM_LINUX) || defined(EA_PLATFORM_OSX) || defined(EA_PLATFORM_XBOX) || defined(EA_PLATFORM_XENON)
00519 //    #define EA_PLATFORM_ILP32_LL64         // int, long, ptr = 32 bits; long long = 64 bits.
00520 //
00521 // #elif defined(EA_PLATFORM_SUN) || defined(EA_PLATFORM_SGI)
00522 //    #if (EA_PLATFORM_WORD_SIZE == 32)
00523 //       #define ILP32_LL64                  // int, long, ptr = 32 bits; long long = 64 bits.
00524 //    #else // 64 bit platform
00525 //       #define EA_PLATFORM_I32_LLLP64      // int = 32 bits; long, long long, ptr = 64 bits.
00526 //    #endif
00527 //
00528 // #elif defined(EA_PLATFORM_WINDOWS)
00529 //    #if (EA_PLATFORM_WORD_SIZE == 32)
00530 //       #define ILP32_LL64                  // int, long, ptr = 32 bits; long long = 64 bits.
00531 //    #else // 64 bit platform
00532 //       #if defined(__MWERKS__) || defined(__GNUC__)
00533 //          #define EA_PLATFORM_I32_LLLP64   // int = 32 bits; long, long long, ptr = 64 bits.
00534 //       #else // MSVC
00535 //          #define EA_PLATFORM_IL32_LLP64   // int, long = 32 bits; long long, ptr = 64 bits.
00536 //       #endif
00537 //    #endif
00538 // #endif
00539 
00540 
00541 #endif // INCLUDED_eaplatform_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines