A
download platform.h
Language: C
License: LGPL
Copyright: Copyright 2006 John Poole.
LOC: 87
Project Info
geekinfo - Cross-platform system information tool(geekinfo)
Server: Google
Type: svn
Google\g\geekinfo\trunk\
   basesystem.cpp
   basesystem.h
   cpucount.cpp
   cpucount.h
   cpucount_asm.asm
   cpucount_asm.h
   geekinfo.cpp
   geekinfo.h
   geekinfo_c.cpp
   geekinfo_c.h
   geekinfo_c_test.c
   linuxsystem.cpp
   linuxsystem.h
   macosxsystem.cpp
   macosxsystem.h
   Makefile.win32
   Makefile_c.win32
   model.cpp
   model.h
   model.py
   platform.h
   solarissystem.cpp
   solarissystem.h
   system.cpp
   system.h
   types.h
   win32system.cpp
   win32system.h
   wmi.cpp
   wmi.h

/*
	platform.h

    Copyright 2006 John Poole.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
*/

#ifndef INC_PLATFORM_H
#define INC_PLATFORM_H

#if defined( __APPLE__ )
    #define PLATFORM_MACOSX
    #define PLATFORM_UNIX
    #if defined( __POWERPC__ )
        #define ARCH_PPC
        #if defined( __ppc64__ ) 
			#define ARCH_64BIT
        #else
			#define ARCH_32BIT
		#endif
    #elif defined( __i386__ )
        #define ARCH_X86
		#define ARCH_32BIT
	#elif defined( __x86_64 )
        #define ARCH_X86
		#define ARCH_64BIT
	#else
        #error Unsupported architecture
    #endif
#elif defined( WIN32 )
    #define PLATFORM_WINDOWS
	#define ARCH_X86
    #if defined( _WIN64 )
       	#define ARCH_64BIT
    #else
		#define ARCH_32BIT
	#endif
#elif defined( __linux__ )
    #define PLATFORM_LINUX
    #define PLATFORM_UNIX
	#if defined( __x86_64 )
        #define ARCH_X86
		#define ARCH_64BIT
    #elif defined( __i386__ )
        #define ARCH_X86
		#define ARCH_32BIT
	#elif defined( __PPC64__ )
		#define ARCH_PPC
		#define ARCH_64BIT
	#elif defined( __PPC__ )
		#define ARCH_PPC
		#define ARCH_PPC32
		#define ARCH_32BIT
    #else
        #error Unsupported architecture
    #endif
#elif defined( __sun )
    #define PLATFORM_SOLARIS
    #define PLATFORM_UNIX
    #if defined( __i386 )
        #define ARCH_X86
		#define ARCH_32BIT
    #elif defined( __amd64 )
        #define ARCH_X86
        #define ARCH_64BIT
    #else
        #error Unsupported architecture
    #endif
#else
    #error Unsupported platform
#endif

#if defined( ARCH_X86 ) 
	#define SIMD_MMX
	#define SIMD_SSE
#elif defined( ARCH_PPC ) 
	#define SIMD_ALTIVEC
#else
	#error Unsupported architecture
#endif

/*
	Sanity checks
*/

#if defined( ARCH_32BIT ) && defined( ARCH_64BIT )
	#error Conflicting architectures
#endif

#if !defined( ARCH_32BIT ) && !defined( ARCH_64BIT )
	#error No architecture.
#endif

#if defined( ARCH_PPC ) && defined( ARCH_X86 )
	#error Conflicting architectures
#endif

#if defined( PLATFORM_MACOSX ) && ( defined( PLATFORM_LINUX ) || defined( PLATFORM_WINDOWS ) )
	#error Conflicting platforms 
#endif

#if defined( PLATFORM_LINUX ) && ( defined( PLATFORM_MACOSX ) || defined( PLATFORM_WINDOWS ) )
	#error Conflicting platforms 
#endif

#endif

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us