Config.h

Go to the documentation of this file.
00001 
00002 //
00003 // SFML - Simple and Fast Multimedia Library
00004 // Copyright (C) 2007 Laurent Gomila (laurent.gom@gmail.com)
00005 //
00006 // This software is provided 'as-is', without any express or implied warranty.
00007 // In no event will the authors be held liable for any damages arising from the use of this software.
00008 //
00009 // Permission is granted to anyone to use this software for any purpose,
00010 // including commercial applications, and to alter it and redistribute it freely,
00011 // subject to the following restrictions:
00012 //
00013 // 1. The origin of this software must not be misrepresented;
00014 //    you must not claim that you wrote the original software.
00015 //    If you use this software in a product, an acknowledgment
00016 //    in the product documentation would be appreciated but is not required.
00017 //
00018 // 2. Altered source versions must be plainly marked as such,
00019 //    and must not be misrepresented as being the original software.
00020 //
00021 // 3. This notice may not be removed or altered from any source distribution.
00022 //
00024 
00025 #ifndef SFML_CONFIG_H
00026 #define SFML_CONFIG_H
00027 
00028 
00030 // Identify the operating system
00032 #if defined(_WIN32) || defined(__WIN32__)
00033 
00034     // Windows
00035     #define CSFML_SYSTEM_WINDOWS
00036 
00037 #elif defined(linux) || defined(__linux)
00038 
00039     // Linux
00040     #define CSFML_SYSTEM_LINUX
00041 
00042 #elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
00043 
00044     // MacOS
00045     #define CSFML_SYSTEM_MACOS
00046 
00047 #else
00048 
00049     // Unsupported system
00050     #error This operating system is not supported by SFML library
00051 
00052 #endif
00053 
00054 
00056 // Define portable import / export macros
00058 #ifdef CSFML_EXPORTS
00059 
00060     #define CSFML_API extern "C"
00061 
00062 #else
00063 
00064     #define CSFML_API extern
00065 
00066 #endif
00067 
00068 
00070 // Define a portable boolean type
00072 typedef int sfBool;
00073 #define sfFalse 0
00074 #define sfTrue  1
00075 
00076 
00078 // Define portable types
00080 #include <stdlib.h>
00081 #include <limits.h>
00082 
00083 // 8 bits integer types
00084 #if UCHAR_MAX == 0xFF
00085     typedef signed   char sfInt8;
00086     typedef unsigned char sfUint8;
00087 #else
00088     #error No 8 bits integer type for this platform
00089 #endif
00090 
00091 // 16 bits integer types
00092 #if USHRT_MAX == 0xFFFF
00093     typedef signed   short sfInt16;
00094     typedef unsigned short sfUint16;
00095 #elif UINT_MAX == 0xFFFF
00096     typedef signed   int sfInt16;
00097     typedef unsigned int sfUint16;
00098 #elif ULONG_MAX == 0xFFFF
00099     typedef signed   long sfInt16;
00100     typedef unsigned long sfUint16;
00101 #else
00102     #error No 16 bits integer type for this platform
00103 #endif
00104 
00105 // 32 bits integer types
00106 #if USHRT_MAX == 0xFFFFFFFF
00107     typedef signed   short sfInt32;
00108     typedef unsigned short sfUint32;
00109 #elif UINT_MAX == 0xFFFFFFFF
00110     typedef signed   int sfInt32;
00111     typedef unsigned int sfUint32;
00112 #elif ULONG_MAX == 0xFFFFFFFF
00113     typedef signed   long sfInt32;
00114     typedef unsigned long sfUint32;
00115 #else
00116     #error No 32 bits integer type for this platform
00117 #endif
00118 
00119 
00120 #endif // SFML_CONFIG_H