Changeset 1652 for code/branches/gui/src/util
- Timestamp:
- Jul 28, 2008, 8:45:31 PM (16 years ago)
- Location:
- code/branches/gui/src/util
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/util/ArgReader.cc
r1638 r1652 35 35 #include "ArgReader.h" 36 36 #include "SubString.h" 37 37 38 38 39 std::string ArgReader::parse(int argc, char **argv) -
code/branches/gui/src/util/OrxonoxPlatform.h
r1638 r1652 25 25 * Reto Grieder 26 26 * 27 * Original code: OgrePlatform.h, licensed under the LGPL. The code 28 * has changed quite a bit however. 29 * 27 30 */ 28 31 29 32 /** 30 33 @file 31 @brief Various constants for compiler, architecture and platform. It's a mere32 copy of the file found in the Ogre source code (OgrePlatform.h).34 @brief 35 Various constants for compiler, architecture and platform. 33 36 */ 34 37 … … 36 39 #define _OrxonoxPlatform_H__ 37 40 38 /* Initial platform/compiler-related stuff to set. 39 */ 41 /* Initial platform/compiler-related stuff to set. */ 42 40 43 #define ORXONOX_PLATFORM_WIN32 1 41 44 #define ORXONOX_PLATFORM_LINUX 2 … … 52 55 #define ORXONOX_ARCHITECTURE_64 2 53 56 54 /* Finds the compiler type and version. 55 */ 57 58 /* Finds the compiler type and version. */ 59 56 60 #if defined( _MSC_VER ) 57 61 # define ORXONOX_COMPILER ORXONOX_COMPILER_MSVC … … 73 77 #endif 74 78 79 75 80 /* See if we can use __forceinline or if we need to use __inline instead */ 76 81 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC … … 87 92 88 93 /* Finds the current platform */ 89 90 94 #if defined( __WIN32__ ) || defined( _WIN32 ) 91 95 # define ORXONOX_PLATFORM ORXONOX_PLATFORM_WIN32 92 93 96 #elif defined( __APPLE_CC__) 94 97 # define ORXONOX_PLATFORM ORXONOX_PLATFORM_APPLE 95 96 98 #else 97 99 # define ORXONOX_PLATFORM ORXONOX_PLATFORM_LINUX 98 100 #endif 99 101 100 102 /* Find the arch type */ 101 103 #if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) 102 104 # define ORXONOX_ARCH_TYPE ORXONOX_ARCHITECTURE_64 … … 105 107 #endif 106 108 107 / / try to define function information109 /* Try to define function information */ 108 110 #ifndef __FUNCTIONNAME__ 109 111 # if ORXONOX_COMPILER == ORXONOX_COMPILER_BORL … … 118 120 #endif 119 121 120 // For generating compiler warnings - should work on any compiler 121 // As a side note, if you start your message with 'Warning: ', the MSVC 122 // IDE actually does catch a warning :) 123 // FIXME: Try this on linux box. Doesn't work with msvc 124 //#define ORXONOX_QUOTE_INPLACE(x) # x 125 //#define ORXONOX_QUOTE(x) ORXONOX_QUOTE_INPLACE(x) 126 //#define ORXONOX_WARN( x ) message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" ) 127 128 //---------------------------------------------------------------------------- 129 // Windows Settings 122 /* Determine whether we're building in debug mode */ 123 #if defined(_DEBUG) || defined(DEBUG) 124 # define ORXONOX_DEBUG_MODE 1 125 #else 126 # define ORXONOX_DEBUG_MODE 0 127 #endif 128 129 /* Define configurable floating point type */ 130 namespace orxonox 131 { 132 #ifdef ORXONOX_DOUBLE_PRECISION 133 typedef double Real; 134 #else 135 typedef float Real; 136 #endif 137 } 138 139 140 141 /*--------------------------------- 142 * Windows Settings 143 *-------------------------------*/ 130 144 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 131 132 // Win32 compilers use _DEBUG for specifying debug builds. 133 # ifdef _DEBUG 134 # define ORXONOX_DEBUG_MODE 1 135 # else 136 # define ORXONOX_DEBUG_MODE 0 137 # endif 138 139 // Disable unicode support on MingW at the moment, poorly supported in stdlibc++ 140 // STLPORT fixes this though so allow if found 141 // MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h 145 /* Disable unicode support on MingW at the moment, poorly supported in stdlibc++ 146 * STLPORT fixes this though so allow if found 147 * MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h */ 142 148 # if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION) 143 149 # include<_mingw.h> … … 150 156 # define ORXONOX_UNICODE_SUPPORT 1 151 157 # endif 152 153 158 #endif /* Platform Win32 */ 154 //---------------------------------------------------------------------------- 155 156 //---------------------------------------------------------------------------- 157 // Linux/Apple Settings 159 160 161 /*--------------------------------- 162 * Linux/Apple Settings 163 *-------------------------------*/ 158 164 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_LINUX || ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE 159 165 160 161 // A quick define to overcome different names for the same function 166 /* A quick define to overcome different names for the same function */ 162 167 # define stricmp strcasecmp 163 168 164 // Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when 165 // specifying a debug build. 166 // (??? this is wrong, on Linux debug builds aren't marked in any way unless 167 // you mark it yourself any way you like it -- zap ???) 168 # ifdef DEBUG 169 # define ORXONOX_DEBUG_MODE 1 170 # else 171 # define ORXONOX_DEBUG_MODE 0 172 # endif 173 174 /* FIXME: Check what this actually is and whether we need it or not 169 /* TODO: Check what this actually is and whether we need it or not */ 170 #if 0 175 171 # if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE 176 172 # define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle" 177 173 # else 178 / / ORXONOX_PLATFORM_LINUX174 /* ORXONOX_PLATFORM_LINUX */ 179 175 # define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so" 180 176 # endif 181 */ 182 183 / /Always enable unicode support for the moment184 // Perhaps disable in old versions of gcc if necessary 177 #endif 178 179 /* Always enable unicode support for the moment 180 * Perhaps disable in old versions of gcc if necessary */ 185 181 # define ORXONOX_UNICODE_SUPPORT 1 186 182 187 183 #endif /* Patform Linux/Apple */ 188 184 189 //For apple, we always have a custom config.h file 185 186 /*--------------------------------- 187 * Apple Settings 188 *-------------------------------*/ 189 /* For apple, we always have a custom config.h file */ 190 190 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE 191 191 # include "config.h" 192 192 #endif 193 193 194 //---------------------------------------------------------------------------- 195 196 //---------------------------------------------------------------------------- 197 // Endian Settings 198 // check for BIG_ENDIAN config flag, set ORXONOX_ENDIAN correctly 199 #ifdef ORXONOX_CONFIG_BIG_ENDIAN 200 # define ORXONOX_ENDIAN ORXONOX_ENDIAN_BIG 201 #else 202 # define ORXONOX_ENDIAN ORXONOX_ENDIAN_LITTLE 203 #endif 204 205 //----------------------------------------------------------------------- 206 // fixed width integers 207 //----------------------------------------------------------------------- 194 195 /*--------------------------------- 196 * Visual Studio Settings 197 *-------------------------------*/ 208 198 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC 209 typedef __int8 int8_t; 210 typedef __int16 int16_t; 211 typedef __int32 int32_t; 212 typedef __int64 int64_t; 213 typedef unsigned __int8 uint8_t; 214 typedef unsigned __int16 uint16_t; 215 typedef unsigned __int32 uint32_t; 216 typedef unsigned __int64 uint64_t; 217 #else 218 # include "inttypes.h" 219 #endif 220 221 namespace orxonox { 222 #ifdef ORXONOX_DOUBLE_PRECISION 223 typedef double Real; 224 #else 225 typedef float Real; 226 #endif 227 } 228 229 230 #if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC 231 // Turn off warnings generated by long std templates 232 // This warns about truncation to 255 characters in debug/browse info 233 //# pragma warning (disable : 4786) 234 235 // Turn off warnings generated by long std templates 236 // This warns about truncation to 255 characters in debug/browse info 237 //# pragma warning (disable : 4503) 238 239 // disable: conversion from 'double' to 'float', possible loss of data 240 // disable: conversion from 'ogg_int64_t' to 'long', possible loss of data 241 // This has been dealt with in base_properties of the solution since the 242 // warning primarily occurs in library header files (which are mostly 243 // included before OrxonoxPlatform.h is) 244 //# pragma warning (disable : 4244) 245 246 // disable: "conversion from 'size_t' to 'unsigned int', possible loss of data 247 //# pragma warning (disable : 4267) 248 249 // disable: "truncation from 'double' to 'float' 250 //# pragma warning (disable : 4305) 251 252 // set to level 4: "<type> needs to have dll-interface to be used by clients' 253 // Happens on STL member variables which are not public therefore is ok 199 /* Turn off warnings generated by long std templates 200 * This warns about truncation to 255 characters in debug/browse info */ 201 /*# pragma warning (disable : 4786)*/ 202 203 /* Turn off warnings generated by long std templates 204 * This warns about truncation to 255 characters in debug/browse info */ 205 /*# pragma warning (disable : 4503)*/ 206 207 /* disable: conversion from 'double' to 'float', possible loss of data 208 * disable: conversion from 'ogg_int64_t' to 'long', possible loss of data 209 * This has been dealt with in base_properties of the solution since the 210 * warning primarily occurs in library header files (which are mostly 211 * included before OrxonoxPlatform.h is) */ 212 /*# pragma warning (disable : 4244)*/ 213 214 /* disable: "conversion from 'size_t' to 'unsigned int', possible loss of data */ 215 /*# pragma warning (disable : 4267)*/ 216 217 /* disable: "truncation from 'double' to 'float' */ 218 /*# pragma warning (disable : 4305)*/ 219 220 /* set to level 4: "<type> needs to have dll-interface to be used by clients' 221 * Happens on STL member variables which are not public therefore is ok */ 254 222 # pragma warning (disable : 4251) 255 223 256 / /disable: 'MultiTypeString' : multiple assignment operators specified257 // Used in MultiType and works fine so far 258 / /# pragma warning (disable : 4522)259 260 / /disable: "non dll-interface class used as base for dll-interface class"261 //Happens when deriving from Singleton because bug in compiler ignores262 // template export 263 / /# pragma warning (disable : 4275)264 265 / /disable: "C++ Exception Specification ignored"266 //This is because MSVC 6 did not implement all the C++ exception267 // specifications in the ANSI C++ draft. 268 / /# pragma warning( disable : 4290 )269 270 / /disable: "no suitable definition provided for explicit template271 //instantiation request" Occurs in VC7 for no justifiable reason on all272 // #includes of Singleton 273 / /# pragma warning( disable: 4661)274 275 / /disable: deprecation warnings when using CRT calls in VC8276 //These show up on all C runtime lib code in VC8, disable since they clutter277 //the warnings with things we may not be able to do anything about (e.g.278 //generated code from nvparse etc). I doubt very much that these calls279 // will ever be actually removed from VC anyway, it would break too much code. 280 / /# pragma warning( disable: 4996)281 282 / /disable: "conditional expression constant", always occurs on283 // ORXONOX_MUTEX_CONDITIONAL when no threading enabled 284 / /# pragma warning (disable : 201)285 286 287 / / Define the english written operators like and, or, xor224 /* disable: 'MultiTypeString' : multiple assignment operators specified 225 * Used in MultiType and works fine so far */ 226 /*# pragma warning (disable : 4522)*/ 227 228 /* disable: "non dll-interface class used as base for dll-interface class" 229 * Happens when deriving from Singleton because bug in compiler ignores 230 * template export */ 231 /*# pragma warning (disable : 4275)*/ 232 233 /* disable: "C++ Exception Specification ignored" 234 * This is because MSVC 6 did not implement all the C++ exception 235 * specifications in the ANSI C++ draft. */ 236 /*# pragma warning( disable : 4290 )*/ 237 238 /* disable: "no suitable definition provided for explicit template 239 * instantiation request" Occurs in VC7 for no justifiable reason on all 240 * #includes of Singleton */ 241 /*# pragma warning( disable: 4661)*/ 242 243 /* disable: deprecation warnings when using CRT calls in VC8 244 * These show up on all C runtime lib code in VC8, disable since they clutter 245 * the warnings with things we may not be able to do anything about (e.g. 246 * generated code from nvparse etc). I doubt very much that these calls 247 * will ever be actually removed from VC anyway, it would break too much code. */ 248 /*# pragma warning( disable: 4996)*/ 249 250 /* disable: "conditional expression constant", always occurs on 251 * ORXONOX_MUTEX_CONDITIONAL when no threading enabled */ 252 /*# pragma warning (disable : 201)*/ 253 254 255 /* Define the english written operators like and, or, xor */ 288 256 #include <iso646.h> 289 257 258 /* include visual leak detector to search for memory leaks */ 259 /* #include <vld.h> */ 260 290 261 #endif /* ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC */ 291 262 292 // include visual leak detector to search for memory leaks293 //#include <vld.h>294 295 263 #endif /* _OrxonoxPlatform_H__ */ -
code/branches/gui/src/util/Sleep.h
r1638 r1652 28 28 29 29 /** 30 @file Sleep.h 31 @brief Functions for using sleep() and usleep() under windows 30 @file 31 @brief 32 Functions for using sleep() and usleep() under windows. 32 33 */ 33 34 34 #include "UtilPrereqs.h" 35 #ifndef _Sleep_H__ 36 #define _Sleep_H__ 37 38 #include "OrxonoxPlatform.h" 35 39 36 40 #if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 37 # ifndef WIN32_LEAN_AND_MEAN 38 # define WIN32_LEAN_AND_MEAN 39 # endif 40 # include <windows.h> 41 42 #ifndef WIN32_LEAN_AND_MEAN 43 # define WIN32_LEAN_AND_MEAN 44 #endif 45 #include <windows.h> 46 41 47 inline void usleep(DWORD dwMicroseconds) 42 48 { 43 49 Sleep(dwMicroseconds / 1000); 44 50 } 51 45 52 inline void msleep(DWORD dwMilliseconds) 46 53 { 47 54 Sleep(dwMilliseconds); 48 55 } 56 49 57 inline void sleep(DWORD dwSeconds) 50 58 { 51 59 Sleep(dwSeconds * 1000); 52 60 } 53 #else 54 # include <unistd.h> 61 62 #else /* Linux/Apple */ 63 64 #include <unistd.h> 65 55 66 inline void msleep(unsigned long msec) 56 67 { 57 68 usleep(msec * 1000); 58 69 } 70 59 71 #endif 72 73 #endif /* _Sleep_H__ */
Note: See TracChangeset
for help on using the changeset viewer.