]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Centralise compile checks
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 29 Dec 2017 07:16:48 +0000 (18:16 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 29 Dec 2017 07:16:48 +0000 (18:16 +1100)
134 files changed:
contrib/bobtoolz/DBrush.cpp
contrib/bobtoolz/DEntity.cpp
contrib/bobtoolz/bsploader.cpp
contrib/bobtoolz/funchandlers-GTK.cpp
contrib/bobtoolz/lists.cpp
contrib/bobtoolz/misc.cpp
contrib/brushexport/export.cpp
contrib/camera/funchandlers.cpp
contrib/camera/misc.cpp
contrib/camera/misc.h
contrib/gtkgensurf/gensurf.h
contrib/prtview/portals.cpp
contrib/sunplug/sunplug.cpp
contrib/ufoaiplug/ufoai_filters.cpp
include/igl.h
include/ipatch.h
include/modulesystem.h
include/warnings.h
libs/CMakeLists.txt
libs/bytestreamutils.h
libs/cmdlib.h
libs/cmdlib/cmdlib.cpp
libs/container/array.h
libs/container/hashtable.cpp
libs/ddslib/ddslib.c
libs/debugging/debugging.h
libs/generic/callback.cpp
libs/generic/constant.cpp
libs/generic/object.h
libs/generic/static.cpp
libs/globaldefs.h [new file with mode: 0644]
libs/gtkutil/clipboard.cpp
libs/gtkutil/glfont.cpp
libs/l_net/l_net.c
libs/math/vector.h
libs/md5lib/md5lib.c
libs/os/file.h
libs/os/path.h
libs/picomodel/lwo/lwio.c
libs/picomodel/lwo/lwo2.c
libs/picomodel/lwo/lwo2.h
libs/picomodel/lwo/lwob.c
libs/picomodel/picointernal.c
libs/picomodel/picointernal.h
libs/picomodel/pm_ms3d.c
libs/picomodel/pm_obj.c
libs/scenelib.h
libs/splines/math_matrix.h
libs/splines/math_vector.h
libs/splines/q_shared.h
libs/splines/util_str.cpp
libs/splines/util_str.h
libs/str.h
libs/stream/textstream.h
libs/string/pooledstring.cpp
libs/string/string.h
plugins/md3model/model.h
plugins/model/model.cpp
plugins/shaders/shaders.cpp
plugins/textool/StdAfx.h
plugins/vfspk3/vfs.cpp
radiant/autosave.cpp
radiant/brush_primit.cpp
radiant/environment.cpp
radiant/error.cpp
radiant/groupdialog.cpp
radiant/gtkdlgs.cpp
radiant/gtkdlgs.h
radiant/main.cpp
radiant/mainframe.cpp
radiant/multimon.h
radiant/patch.h
radiant/preferences.cpp
radiant/qe3.cpp
radiant/qgl.cpp
radiant/referencecache.cpp
radiant/selection.cpp
radiant/server.cpp
radiant/sockets.cpp
radiant/stacktrace.cpp
radiant/timer.cpp
radiant/treemodel.cpp
radiant/url.cpp
radiant/view.h
radiant/watchbsp.cpp
tools/quake2/common/cmdlib.c
tools/quake2/common/cmdlib.h
tools/quake2/common/inout.c
tools/quake2/common/inout.h
tools/quake2/common/path_init.c
tools/quake2/common/qfiles.h
tools/quake2/common/threads.c
tools/quake2/extra/bsp/qrad3/qrad.h
tools/quake2/extra/common/cmdlib.c
tools/quake2/extra/common/cmdlib.h
tools/quake2/extra/common/threads.c
tools/quake2/extra/qdata/qdata.c
tools/quake2/extra/qe4/cmdlib.c
tools/quake2/extra/qe4/mru.c
tools/quake2/extra/qe4/mru.h
tools/quake2/extra/qe4/qe3.h
tools/quake2/q2map/q2map.h
tools/quake2/q2map/qbsp.h
tools/quake2/q2map/qrad.h
tools/quake2/q2map/qvis.h
tools/quake2/qdata/qdata.c
tools/quake2/qdata/qdata.h
tools/quake2/qdata_heretic2/common/cmdlib.c
tools/quake2/qdata_heretic2/common/cmdlib.h
tools/quake2/qdata_heretic2/common/inout.c
tools/quake2/qdata_heretic2/common/inout.h
tools/quake2/qdata_heretic2/common/mathlib.c
tools/quake2/qdata_heretic2/common/path_init.c
tools/quake2/qdata_heretic2/common/threads.c
tools/quake2/qdata_heretic2/fmodels.c
tools/quake2/qdata_heretic2/images.c
tools/quake2/qdata_heretic2/joints.h
tools/quake2/qdata_heretic2/qcommon/angles.h
tools/quake2/qdata_heretic2/qcommon/arrayedlist.h
tools/quake2/qdata_heretic2/qdata.c
tools/quake2/qdata_heretic2/qdata.h
tools/quake3/common/aselib.c
tools/quake3/common/cmdlib.c
tools/quake3/common/cmdlib.h
tools/quake3/common/inout.c
tools/quake3/common/inout.h
tools/quake3/common/mutex.c
tools/quake3/common/threads.c
tools/quake3/common/trilib.c
tools/quake3/common/vfs.h
tools/quake3/q3data/md3lib.c
tools/quake3/q3data/p3dlib.c
tools/quake3/q3data/q3data.c
tools/quake3/q3map2/q3map2.h

index 4a2b9c097969c4fa9766ab0ffd3cda41d5b211b5..6e650807bd331294b745b8fae462e326b1512102 100644 (file)
@@ -22,8 +22,9 @@
 //////////////////////////////////////////////////////////////////////
 
 #include "DBrush.h"
+#include "globaldefs.h"
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4786)
 #endif
 
@@ -68,7 +69,7 @@ DBrush::~DBrush(){
 //////////////////////////////////////////////////////////////////////
 
 DPlane* DBrush::AddFace( const vec3_t va, const vec3_t vb, const vec3_t vc, const _QERFaceData* texData ){
-#ifdef _DEBUG
+#if GDEF_DEBUG
 //     Sys_Printf("(%f %f %f) (%f %f %f) (%f %f %f)\n", va[0], va[1], va[2], vb[0], vb[1], vb[2], vc[0], vc[1], vc[2]);
 #endif
        bBoundsBuilt = false;
@@ -117,7 +118,7 @@ int DBrush::BuildPoints(){
                }
        }
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
 //     Sys_Printf("%i points on brush\n", pointList.size());
 #endif
 
index 38ab47f43c240269785cb019b46b3898b98df803..9fccf6b7637926061b85daa4eee35d3768daa265 100644 (file)
@@ -22,8 +22,9 @@
 //////////////////////////////////////////////////////////////////////
 
 #include "DEntity.h"
+#include "globaldefs.h"
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4786)
 #endif
 
index 0fb93c575e1672125b2f9ee60b2d09287ff0a9fd..0c442e16ce0f2258abac3775b662a62e1c235027 100644 (file)
@@ -1,3 +1,4 @@
+#include <globaldefs.h>
 #include "bsploader.h"
 #include "dialogs/dialogs-gtk.h"
 #include "cmdlib.h"
@@ -71,16 +72,16 @@ bool    LoadFile( const char *filename, byte **bufferptr ){
 }
 
 int    LittleLong( int l ){
-#if defined( __BIG_ENDIAN__ )
-       std::reverse( reinterpret_cast<unsigned char*>( &l ), reinterpret_cast<unsigned char*>( &l ) + sizeof( int ) );
-#endif
+       if (GDEF_ARCH_ENDIAN_BIG) {
+               std::reverse(reinterpret_cast<unsigned char *>( &l ), reinterpret_cast<unsigned char *>( &l ) + sizeof(int));
+       }
        return l;
 }
 
 float   LittleFloat( float l ){
-#if defined( __BIG_ENDIAN__ )
-       std::reverse( reinterpret_cast<unsigned char*>( &l ), reinterpret_cast<unsigned char*>( &l ) + sizeof( float ) );
-#endif
+       if (GDEF_ARCH_ENDIAN_BIG) {
+               std::reverse( reinterpret_cast<unsigned char*>( &l ), reinterpret_cast<unsigned char*>( &l ) + sizeof( float ) );
+       }
        return l;
 }
 
index aa8e64786a1eeba47bc8acc455514b706e1acfc4..b07bf328f7642c0d5776bc70a340d9801d506d1b 100644 (file)
@@ -18,8 +18,9 @@
  */
 
 #include "funchandlers.h"
+#include "globaldefs.h"
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4786)
 #endif
 
index 96aff1976aabe0c309917ac322b2678ae8976e8c..38ec080e794a65a2ebe7bd38b0976ed16f18f26f 100644 (file)
@@ -18,8 +18,9 @@
  */
 
 #include "lists.h"
+#include "globaldefs.h"
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4786)
 #endif
 
index 202065fc0a70cd9b3068d8bc435a8df8f70f890d..f73c9787a0267a0fe49236bac473542e91f1c986 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include "misc.h"
+#include "globaldefs.h"
 
 #include <list>
 #include "str.h"
@@ -31,7 +32,7 @@
 
 #include "funchandlers.h"
 
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
 #include <sys/types.h>
 #include <unistd.h>
 #endif
@@ -146,7 +147,7 @@ char* TranslateString( char *buf ){
 
 
 char* UnixToDosPath( char* path ){
-#ifndef WIN32
+#if !GDEF_OS_WINDOWS
        return path;
 #else
        for ( char* p = path; *p; p++ )
@@ -182,7 +183,7 @@ extern char* PLUGIN_NAME;
     return buffer;
    }*/
 
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
 // the bCreateConsole parameter is ignored on linux ..
 bool Q_Exec( const char *pCmd, bool bCreateConsole ){
        switch ( fork() )
@@ -192,7 +193,7 @@ bool Q_Exec( const char *pCmd, bool bCreateConsole ){
 //      Error ("CreateProcess failed");
                break;
        case 0:
-#ifdef _DEBUG
+#if GDEF_DEBUG
                printf( "Running system...\n" );
                printf( "Command: %s\n", pCmd );
 #endif
@@ -208,7 +209,7 @@ bool Q_Exec( const char *pCmd, bool bCreateConsole ){
 }
 #endif
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 #include <windows.h>
 
index 09720d8d6fe72b578d8706f5a52dfe8303ab4ece..cbc4abf608fc26dae7fbb56e20c5b3df6bee9829 100644 (file)
@@ -1,4 +1,5 @@
 #include "export.h"
+#include "globaldefs.h"
 #include "debugging/debugging.h"
 #include "ibrush.h"
 #include "iscenegraph.h"
@@ -126,7 +127,7 @@ void ExportData::AddBrushFace( Face& f ){
        // add face to current group
        current->faces.push_back( &f );
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
        globalOutputStream() << "Added Face to group " << current->name.c_str() << "\n";
 #endif
 }
@@ -143,7 +144,7 @@ void ExportData::GetShaderNameFromShaderPath( const char* path, std::string& nam
                name = tmp.substr( last_slash + 1, tmp.length() - last_slash );
        }
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
        globalOutputStream() << "Last: " << (const unsigned int) last_slash << " " << "length: " << (const unsigned int)tmp.length() << "Name: " << name.c_str() << "\n";
 #endif
 }
index 4134a889eda465366e89e360b87173420e267b3a..f3be8e3bf62183dd5e64820739011b9990fde510 100644 (file)
  */
 
 #include "camera.h"
+#include "globaldefs.h"
 
 extern GtkWidget *g_pEditModeAddRadioButton;
 
 char* Q_realpath( const char *path, char *resolved_path, size_t size ){
-#if defined( POSIX )
+#if GDEF_OS_POSIX
        return realpath( path, resolved_path );
-#elif defined( WIN32 )
+#elif GDEF_OS_WINDOWS
        return _fullpath( resolved_path, path, size );
 #else
 #error "unsupported platform"
index 372dc7bc5e8ae54f6d4e64fc17075e8571537460..88207af7de5022bd66b355dc866a48fc730bcefb 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include "camera.h"
+#include "globaldefs.h"
 
 void Sys_ERROR( char* text, ... ){
        va_list argptr;
@@ -38,7 +39,7 @@ void Sys_ERROR( char* text, ... ){
 }
 
 char* UnixToDosPath( char* path ){
-#ifndef WIN32
+#if !GDEF_OS_WINDOWS
        return path;
 #else
        for ( char* p = path; *p; p++ )
@@ -132,7 +133,7 @@ void CDECL Com_Printf( const char* msg, ... ){
 }
 
 void CDECL Com_DPrintf( const char* msg, ... ){
-#ifdef _DEBUG
+#if GDEF_DEBUG
        va_list argptr;
        char buf[32768];
 
@@ -156,7 +157,7 @@ void Com_Dealloc( void *ptr ) {
 // Filesystem
 //
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
        #pragma warning(disable : 4311)
        #pragma warning(disable : 4312)
 #endif
index 6e226d33f5e4a1a8e5e42366139aff8b51091ea6..9b3f71b7d67e8b51a19a87b9a1bbb5bfb54b718b 100644 (file)
@@ -24,6 +24,8 @@
    Copyright (C) 2002 Splash Damage Ltd.
  */
 
+#include "globaldefs.h"
+
 void Sys_ERROR( char* text, ... );
 char* UnixToDosPath( char* path );
 void ExtractFilePath( const char *path, char *dest );
@@ -40,7 +42,7 @@ void Cbuf_Execute( void );
 
 // common
 #ifndef CDECL
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        #define CDECL __cdecl
 #else
        #define CDECL
index cb4a2d55bbda84b8d4931ca91651e84759a347e7..7a90cb64227c713e167f26a30b1518d2c628f8e3 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef _GENSURF_H_
 #define _GENSURF_H_
 
+#include "globaldefs.h"
 #include <string.h>
 #include "qertypes.h"
 #include <stdio.h>
@@ -56,7 +57,7 @@ extern _QERBrushTable __BRUSHTABLENAME;
 #define PLUGIN
 #define Q3RADIANT
 
-//#if defined(__linux__) || defined(__APPLE__)
+//#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #if 1
 #include <algorithm>
 #else
index efc8d5050ade2d88466591378ef8969293f2242d..7a2d99d15ee76bea40ca854201e4a147d2d1a66c 100644 (file)
  */
 
 #include "portals.h"
+#include "globaldefs.h"
 #include <string.h>
 #include <stdlib.h>
-#ifndef __APPLE__
+#if !GDEF_OS_MACOS
 #include <search.h>
 #endif
 #include <stdio.h>
index a6928537ee9119782e76ea9894399429a745a0f4..afa4b20d821e46c5a3de2214a30ba0eb2f17731f 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "sunplug.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 
@@ -39,7 +40,7 @@
 void about_plugin_window();
 void MapCoordinator();
 
-#ifndef _WIN32
+#if !GDEF_OS_WINDOWS
 // linux itoa implementation
 char* itoa( int value, char* result, int base ){
        // check that the base if valid
index 84a9665252d0245df6ff6d8ed781e694f9d96542..c40de733bb4385e09282d02dd5618f34eea177e6 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include "ufoai_filters.h"
+#include "globaldefs.h"
 
 #include "ibrush.h"
 #include "ientity.h"
@@ -100,7 +101,7 @@ ForEachFace( Brush& brush )
 }
 
 void visit( Face& face ) const {
-#if _DEBUG
+#if GDEF_DEBUG
        if ( m_surfaceFlagsVis < 0 ) {
                m_surfaceFlagsVis = face.getShader().m_flags.m_surfaceFlags;
        }
@@ -215,7 +216,7 @@ void filter_level( int flag ){
        GlobalSceneGraph().traverse( EntityFindByName( "misc_model", entities, level, true ) );
        GlobalSceneGraph().traverse( EntityFindByName( "misc_particle", entities, level, true ) );
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
        if ( brushes.empty() ) {
                globalOutputStream() << "UFO:AI: No brushes.\n";
        }
@@ -264,7 +265,7 @@ void filter_nodraw( void ){
        brushlist_t brushes;
        GlobalSceneGraph().traverse( BrushGetLevel( brushes, SURF_NODRAW, false, false, nodraw_active ) );
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
        if ( brushes.empty() ) {
                globalOutputStream() << "UFO:AI: No brushes.\n";
        }
@@ -285,7 +286,7 @@ void filter_actorclip( void ){
        brushlist_t brushes;
        GlobalSceneGraph().traverse( BrushGetLevel( brushes, CONTENTS_ACTORCLIP, true, false, actorclip_active ) );
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
        if ( brushes.empty() ) {
                globalOutputStream() << "UFO:AI: No brushes.\n";
        }
@@ -306,7 +307,7 @@ void filter_weaponclip( void ){
        brushlist_t brushes;
        GlobalSceneGraph().traverse( BrushGetLevel( brushes, CONTENTS_WEAPONCLIP, true, false, weaponclip_active ) );
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
        if ( brushes.empty() ) {
                globalOutputStream() << "UFO:AI: No brushes.\n";
        }
index eca09ae74d653e6c7e19ad1a6223adf8992d76b0..cb7b66d17ac07171dae5fc67dfa56ca8ab1da736 100644 (file)
 #if !defined( INCLUDED_IGL_H )
 #define INCLUDED_IGL_H
 
+#include "globaldefs.h"
 #include <cstddef>
 #include <string.h>
 #include "generic/constant.h"
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 #define QGL_DLLEXPORT __stdcall
 #else
 #define QGL_DLLEXPORT
@@ -2805,7 +2806,7 @@ inline OpenGLBinding& GlobalOpenGL(){
        return GlobalOpenGLModule::getTable();
 }
 
-#if defined( _DEBUG )
+#if GDEF_DEBUG
 #define GlobalOpenGL_debugAssertNoErrors() GlobalOpenGL().assertNoErrors( __FILE__, __LINE__ )
 #else
 #define GlobalOpenGL_debugAssertNoErrors()
index 81cba69a4ccbcf189a0947282b28532952390350..bf26e8b45e5507b3d82177f54def97ecf8734d64 100644 (file)
@@ -22,6 +22,7 @@
 #if !defined( INCLUDED_IPATCH_H )
 #define INCLUDED_IPATCH_H
 
+#include "globaldefs.h"
 #include "debugging/debugging.h"
 #include "generic/constant.h"
 #include "generic/vector.h"
@@ -62,13 +63,13 @@ const_iterator end() const {
 }
 
 value_type& operator[]( std::size_t index ){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( index < size(), "array index out of bounds" );
 #endif
        return m_data[index];
 }
 const value_type& operator[]( std::size_t index ) const {
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( index < size(), "array index out of bounds" );
 #endif
        return m_data[index];
@@ -167,25 +168,25 @@ const_iterator end() const {
 }
 
 value_type& operator[]( std::size_t index ){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( index < size(), "array index out of bounds" );
 #endif
        return m_data[index];
 }
 const value_type& operator[]( std::size_t index ) const {
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( index < size(), "array index out of bounds" );
 #endif
        return m_data[index];
 }
 value_type& operator()( std::size_t x, std::size_t y ){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( x < m_x && y < m_y, "array index out of bounds" );
 #endif
        return m_data[x * m_y + y];
 }
 const value_type& operator()( std::size_t x, std::size_t y ) const {
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( x < m_x && y < m_y, "array index out of bounds" );
 #endif
        return m_data[x * m_y + y];
index b8c83489261fd879787b95709719e7494f90a7d4..f7d4656440a1f71c0a54d0474e33225a420ff1af 100644 (file)
 #if !defined( INCLUDED_MODULESYSTEM_H )
 #define INCLUDED_MODULESYSTEM_H
 
+#include "globaldefs.h"
 #include "generic/static.h"
 #include "debugging/debugging.h"
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 #define RADIANT_DLLEXPORT __declspec(dllexport)
 #define RADIANT_DLLIMPORT __declspec(dllimport)
 #else
@@ -145,7 +146,7 @@ ModuleRef( const char* name ) : m_table( 0 ){
        }
 }
 Type* getTable(){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( m_table != 0, "ModuleRef::getTable: type=" << makeQuoted( typename Type::Name() ) << " version=" << makeQuoted( typename Type::Version() ) << " - module-reference used without being initialised" );
 #endif
        return m_table;
@@ -176,7 +177,7 @@ void initialise( const char* name ){
 }
 
 Type* getTable(){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( m_table != 0, "SingletonModuleRef::getTable: type=" << makeQuoted( typename Type::Name() ) << " version=" << makeQuoted( typename Type::Version() ) << " - module-reference used without being initialised" );
 #endif
        return m_table;
index e067fd11eb53c3086d6380dc984f968a13447d64..ebbd4f88c8d39b623120600938f53af675b7683e 100644 (file)
@@ -22,7 +22,9 @@
 #if !defined ( INCLUDED_WARNINGS_H )
 #define INCLUDED_WARNINGS_H
 
-#if _MSC_VER > 1000 && defined( WIN32 )
+#include "globaldefs.h"
+
+#if GDEF_COMPILER_MSVC && _MSC_VER > 1000
 #pragma warning(disable:4355) // 'this' : used in base member initializer list
 #pragma warning(disable:4503) // '[symbol]' : decorated name length exceeded, name was truncated
 #endif
index 03347d71ef0bd894feda504f140205f2caa66991..9094354e83cfe53274b09a4d2a18076aa935ad52 100644 (file)
@@ -37,6 +37,7 @@ add_library(libs
         entityxml.h
         fs_filesystem.h
         fs_path.h
+        globaldefs.h
         imagelib.h
         instancelib.h
         maplib.h
index 90a9048a61cd16b30a52ecdc3827b8567913686f..69ec3755f9c0ca1da77eecc976f53f2d0f7d55d4 100644 (file)
@@ -22,7 +22,9 @@
 #if !defined( INCLUDED_BYTESTREAMUTILS_H )
 #define INCLUDED_BYTESTREAMUTILS_H
 
-#if defined( __GNUC__ )
+#include "globaldefs.h"
+
+#if GDEF_COMPILER_GNU
 
 #define _ISOC9X_SOURCE  1
 #define _ISOC99_SOURCE  1
@@ -55,18 +57,20 @@ typedef unsigned int uint32_t;
 
 template<typename InputStreamType, typename Type>
 inline void istream_read_little_endian( InputStreamType& istream, Type& value ){
-       istream.read( reinterpret_cast<typename InputStreamType::byte_type*>( &value ), sizeof( Type ) );
-#if defined( __BIG_ENDIAN__ )
-       std::reverse( reinterpret_cast<typename InputStreamType::byte_type*>( &value ), reinterpret_cast<typename InputStreamType::byte_type*>( &value ) + sizeof( Type ) );
-#endif
+       istream.read(reinterpret_cast<typename InputStreamType::byte_type *>( &value ), sizeof(Type));
+       if (GDEF_ARCH_ENDIAN_BIG) {
+               std::reverse(reinterpret_cast<typename InputStreamType::byte_type *>( &value ),
+                                        reinterpret_cast<typename InputStreamType::byte_type *>( &value ) + sizeof(Type));
+       }
 }
 
 template<typename InputStreamType, typename Type>
 inline void istream_read_big_endian( InputStreamType& istream, Type& value ){
-       istream.read( reinterpret_cast<typename InputStreamType::byte_type*>( &value ), sizeof( Type ) );
-#if !defined( __BIG_ENDIAN__ )
-       std::reverse( reinterpret_cast<typename InputStreamType::byte_type*>( &value ), reinterpret_cast<typename InputStreamType::byte_type*>( &value ) + sizeof( Type ) );
-#endif
+       istream.read(reinterpret_cast<typename InputStreamType::byte_type *>( &value ), sizeof(Type));
+       if (!GDEF_ARCH_ENDIAN_BIG) {
+               std::reverse(reinterpret_cast<typename InputStreamType::byte_type *>( &value ),
+                                        reinterpret_cast<typename InputStreamType::byte_type *>( &value ) + sizeof(Type));
+       }
 }
 
 template<typename InputStreamType>
index 843dee76368813bf469914e77d7c5d7f8ef2c2d7..abdc15a6fd3cfd6d4d2da873c2f65d58d0c54713 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef __CMDLIB__
 #define __CMDLIB__
 
+#include "globaldefs.h"
 #include <time.h>
 
 
@@ -78,7 +79,7 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *execdir, bool bCreateCo
 
 // Q_mkdir
 // returns true if succeeded in creating directory
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 inline bool Q_mkdir( const char* name ){
        return _mkdir( name ) != -1;
index 2a9ab55a35182430f3a94c202fb2d7d700ceaa7f..9bfd24364dc4bff37e09a5354b10f3070cf7d364 100644 (file)
@@ -24,6 +24,7 @@
 //
 
 #include "cmdlib.h"
+#include "globaldefs.h"
 
 #include <string.h>
 #include <stdio.h>
@@ -33,7 +34,7 @@
 #include "container/array.h"
 
 
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
 
 #include <unistd.h>
 #include <sys/types.h>
@@ -43,7 +44,7 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *, bool, bool waitfor ){
        char fullcmd[2048];
        char *pCmd;
        pid_t pid;
-#ifdef _DEBUG
+#if GDEF_DEBUG
        printf( "Q_Exec damnit\n" );
 #endif
        switch ( ( pid = fork() ) )
@@ -71,12 +72,12 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *, bool, bool waitfor ){
                pCmd = fullcmd;
                while ( *pCmd == ' ' )
                        pCmd++;
-#ifdef _DEBUG
+#if GDEF_DEBUG
                printf( "Running system...\n" );
                printf( "Command: %s\n", pCmd );
 #endif
                system( pCmd );
-#ifdef _DEBUG
+#if GDEF_DEBUG
                printf( "system() returned\n" );
 #endif
                _exit( 0 );
@@ -85,7 +86,7 @@ bool Q_Exec( const char *cmd, char *cmdline, const char *, bool, bool waitfor ){
        return true;
 }
 
-#elif defined( WIN32 )
+#elif GDEF_OS_WINDOWS
 
 #include <windows.h>
 
index 390282a72e0f38b3ebfa1a0f21cbed74dbfa3ddd..5de4fe824852ffbe6059eaf899070ed77bc40232 100644 (file)
@@ -22,6 +22,7 @@
 #if !defined( INCLUDED_CONTAINER_ARRAY_H )
 #define INCLUDED_CONTAINER_ARRAY_H
 
+#include "globaldefs.h"
 #include <cstddef>
 #include <algorithm>
 
@@ -119,13 +120,13 @@ const_iterator end() const {
 }
 
 value_type& operator[]( std::size_t index ){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( index < size(), "array index out of bounds" );
 #endif
        return m_data[index];
 }
 const value_type& operator[]( std::size_t index ) const {
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( index < size(), "array index out of bounds" );
 #endif
        return m_data[index];
index edcaff637bdca4b646ea8f21d5e6b65ef35f7d0d..f2e66022385e2988aaef24eaaba2e2cc6b4af1d5 100644 (file)
@@ -20,8 +20,9 @@
  */
 
 #include "hashtable.h"
+#include "globaldefs.h"
 
-#if defined( _DEBUG ) || defined( DOXYGEN )
+#if GDEF_DEBUG || defined( DOXYGEN )
 
 #include "hashfunc.h"
 
index 26ccf2e9f6a648b173c10d57de2c9e3b5a02bd77..15dbef80a25172fe9d28b5dfae800dc1fb128dd8 100644 (file)
@@ -37,8 +37,7 @@
 
 /* dependencies */
 #include "ddslib.h"
-
-
+#include "globaldefs.h"
 
 /* endian tomfoolery */
 typedef union
@@ -48,15 +47,7 @@ typedef union
 }
 floatSwapUnion;
 
-
-#ifndef __BIG_ENDIAN__
-       #ifdef _SGI_SOURCE
-               #define __BIG_ENDIAN__
-       #endif
-#endif
-
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 int   DDSBigLong( int src ) { return src; }
 short DDSBigShort( short src ) { return src; }
index 0e008b6135c7774187a9f4ef8513f09750768c2f..405131d24433703cffaf095d5ee5fde618c888bc 100644 (file)
 /// \file
 /// \brief Debugging macros for fatal error/assert messages.
 
+#include "globaldefs.h"
 #include "stream/textstream.h"
 #include "warnings.h"
 #include "generic/static.h"
 
-#if defined( _MSC_VER ) && ( defined( _M_IX86 ) || defined( _M_AMD64 ) )
+#if GDEF_COMPILER_MSVC && ( defined( _M_IX86 ) || defined( _M_AMD64 ) )
 #define DEBUGGER_BREAKPOINT() __asm { int 3 }
-#elif ( defined ( __i386__ ) || defined ( __x86_64__ ) ) && defined ( __GNUC__ ) && __GNUC__ >= 2
+#elif GDEF_COMPILER_GNU && __GNUC__ >= 2 && ( defined ( __i386__ ) || defined ( __x86_64__ ) )
 #define DEBUGGER_BREAKPOINT() __asm__ __volatile__ ( "int $03" )
 #else
 #include <signal.h>
@@ -43,9 +44,7 @@
 #define STR2( x ) STR( x )
 #define FILE_LINE __FILE__ ":" STR2( __LINE__ )
 
-#if defined( _DEBUG ) || 1
 #define DEBUG_ASSERTS
-#endif
 
 class DebugMessageHandler
 {
@@ -72,7 +71,7 @@ virtual TextOutputStream& getOutputStream(){
        return globalErrorStream();
 }
 virtual bool handleMessage(){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        return false; // send debug-break
 #else
        return true;
index c4fefb8e32360a034c26a7cc49fd292e984dace3..74fe6ee03cacb459232a8b770994dcfb7c484b22 100644 (file)
@@ -20,8 +20,9 @@
  */
 
 #include "callback.h"
+#include "globaldefs.h"
 
-#if defined( _DEBUG ) || defined( DOXYGEN )
+#if GDEF_DEBUG || defined( DOXYGEN )
 
 namespace ExampleMemberCaller
 {
index 7c3c2fa65911bc04e6e1353cfece470a5b5f19a9..bcf9b4e5527a824e25877832604fce4010ed6d29 100644 (file)
@@ -20,8 +20,9 @@
  */
 
 #include "constant.h"
+#include "globaldefs.h"
 
-#if defined( _DEBUG ) || defined( DOXYGEN )
+#if GDEF_DEBUG || defined( DOXYGEN )
 
 namespace ExampleConstant
 {
index 5677a0e3428253338a1cae403f3598808458eb2b..084f760c7e465ce12f18382abc3f45e9437a7958 100644 (file)
 #if !defined( INCLUDED_GENERIC_OBJECT_H )
 #define INCLUDED_GENERIC_OBJECT_H
 
+#include "globaldefs.h"
+
 /// \file
 /// \brief Convenience functions (syntactic sugar) to wrap explicit constructor (aka in-place 'new') and destructor calls.
 ///
 /// Use makeReference() to wrap non-const-reference constructor parameters.
 
-#if _MSC_VER > 1000 && defined( WIN32 )
+#if GDEF_COMPILER_MSVC && _MSC_VER > 1000
 #pragma warning(disable:4345) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
 #endif
 
index b32972de84231eb0f72bc6042440331d7a9b0306..a92246bb4100eb8d560a1ca7e86814a0faf1aff4 100644 (file)
@@ -20,8 +20,9 @@
  */
 
 #include "static.h"
+#include "globaldefs.h"
 
-#if defined( _DEBUG ) || defined( DOXYGEN )
+#if GDEF_DEBUG || defined( DOXYGEN )
 
 namespace ExampleStatic
 {
diff --git a/libs/globaldefs.h b/libs/globaldefs.h
new file mode 100644 (file)
index 0000000..146dd78
--- /dev/null
@@ -0,0 +1,125 @@
+#ifndef INCLUDED_LIBS_GLOBALDEFS
+#define INCLUDED_LIBS_GLOBALDEFS
+
+// ARCH_ENDIAN
+
+#if defined(__BIG_ENDIAN__) || defined(_SGI_SOURCE)
+#define GDEF_ARCH_ENDIAN_BIG 1
+#else
+#define GDEF_ARCH_ENDIAN_BIG 0
+#endif
+
+// ARCH_BITS
+
+#if defined(__i386__) || defined(_M_IX86)
+#define GDEF_ARCH_BITS_32 1
+#else
+#define GDEF_ARCH_BITS_32 0
+#endif
+
+#if defined(__LP64__) || defined(_M_X64) || defined(_M_AMD64) || defined(_WIN64)
+#define GDEF_ARCH_BITS_64 1
+#else
+#define GDEF_ARCH_BITS_64 0
+#endif
+
+// OS
+
+#if defined(POSIX)
+#define GDEF_OS_POSIX 1
+#else
+#define GDEF_OS_POSIX 0
+#endif
+
+#if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
+#define GDEF_OS_WINDOWS 1
+#else
+#define GDEF_OS_WINDOWS 0
+#endif
+
+#if defined(__APPLE__)
+#define GDEF_OS_MACOS 1
+#else
+#define GDEF_OS_MACOS 0
+#endif
+
+#if defined(__linux__)
+#define GDEF_OS_LINUX 1
+#else
+#define GDEF_OS_LINUX 0
+#endif
+
+
+#define GDEF_OS_BSD 0
+
+#if defined(__FreeBSD__)
+#undef GDEF_OS_BSD
+#define GDEF_OS_BSD 1
+#define GDEF_OS_BSD_FREE 1
+#else
+#define GDEF_OS_BSD_FREE 0
+#endif
+
+#if defined(__NetBSD__)
+#undef GDEF_OS_BSD
+#define GDEF_OS_BSD 1
+#define GDEF_OS_BSD_NET 1
+#else
+#define GDEF_OS_BSD_NET 0
+#endif
+
+#if defined(__OpenBSD__)
+#undef GDEF_OS_BSD
+#define GDEF_OS_BSD 1
+#define GDEF_OS_BSD_OPEN 1
+#else
+#define GDEF_OS_BSD_OPEN 0
+#endif
+
+#if defined(__DragonFly__)
+#undef GDEF_OS_BSD
+#define GDEF_OS_BSD 1
+#define GDEF_OS_BSD_DRAGONFLY 1
+#else
+#define GDEF_OS_BSD_DRAGONFLY 0
+#endif
+
+// COMPILER
+
+#if defined(_MSC_VER)
+#define GDEF_COMPILER_MSVC 1
+#else
+#define GDEF_COMPILER_MSVC 0
+#endif
+
+#if defined(__GNUC__)
+#define GDEF_COMPILER_GNU 1
+#else
+#define GDEF_COMPILER_GNU 0
+#endif
+
+// ATTRIBUTE
+
+#if GDEF_COMPILER_GNU
+#define GDEF_ATTRIBUTE_NORETURN __attribute__((noreturn))
+#else
+#define GDEF_ATTRIBUTE_NORETURN
+#endif
+
+#ifdef GDEF_COMPILER_MSVC
+#define GDEF_ATTRIBUTE_INLINE __inline
+#else
+#define GDEF_ATTRIBUTE_INLINE inline
+#endif
+
+// MISC
+
+#define GDEF_DEBUG 0
+#if defined(_DEBUG)
+#if _DEBUG
+#undef GDEF_DEBUG
+#define GDEF_DEBUG 1
+#endif
+#endif
+
+#endif
index 7d45bd1a59c3baa8e6f068edbb05e7ca9cf8917f..fd36f39e547b951336a61036bc3b778936135366 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "clipboard.h"
 
+#include "globaldefs.h"
 #include "stream/memstream.h"
 #include "stream/textstream.h"
 
@@ -28,7 +29,7 @@
 /// \file
 /// \brief Platform-independent GTK clipboard support.
 /// \todo Using GDK_SELECTION_CLIPBOARD fails on win32, so we use the win32 API directly for now.
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 
 const char* c_clipboard_format = "RadiantClippings";
 
index e0d7f3eed96c54c7bcaab014eff8a50fb0483a2a..afe8546e7c8dd00305c8b0b43935c875fedf7687 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "glfont.h"
+#include "globaldefs.h"
 #include "igl.h"
 
 // generic string printing with call lists
@@ -50,7 +51,7 @@ virtual int getPixelHeight() const {
 }
 };
 
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
        #include <windows.h>
 #endif
 #include "debugging/debugging.h"
index fa7b31f486a7c571c12f994bdfebc4bb4528a622..1872722444a868e2f57afe9271b8bf97d05ce4a1 100644 (file)
@@ -29,6 +29,7 @@
 // Notes:
 //====================================================================
 
+#include "globaldefs.h"
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
@@ -36,7 +37,7 @@
 #include "l_net.h"
 #include "l_net_wins.h"
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
 void WinPrint( const char *str, ... ){
        va_list argptr;
        char text[4096];
@@ -72,7 +73,7 @@ void Net_SetAddressPort( address_t *address, int port ){
 // Changes Globals:            -
 //===========================================================================
 int Net_AddressCompare( address_t *addr1, address_t *addr2 ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        return _stricmp( addr1->ip, addr2->ip );
 #else
        return strcasecmp( addr1->ip, addr2->ip );
@@ -163,7 +164,7 @@ int Net_Receive( socket_t *sock, netmessage_t *msg ){
                return msg->size - 4;
        } //end if
          //the message has not been completely read yet
-#ifdef _DEBUG
+#if GDEF_DEBUG
        printf( "++timo TODO: debug the Net_Receive on big size messages\n" );
 #endif
        return 0;
index 9ec5159ff905ed2328e66245e93d6b523e7e5a8e..9bb3ef5111a0bdbb712f7453f13b26b4896784a1 100644 (file)
@@ -26,8 +26,9 @@
 /// \brief Vector data types and related operations.
 
 #include "generic/vector.h"
+#include "globaldefs.h"
 
-#if defined ( _MSC_VER )
+#if GDEF_COMPILER_MSVC
 
 inline int lrint( double flt ){
        int i;
@@ -45,7 +46,7 @@ inline __int64 llrint( double f ){
        return static_cast<__int64>( f + 0.5 );
 }
 
-#elif defined( __FreeBSD__ )
+#elif GDEF_OS_BSD
 
 inline long lrint( double f ){
        return static_cast<long>( f + 0.5 );
@@ -55,7 +56,7 @@ inline long long llrint( double f ){
        return static_cast<long long>( f + 0.5 );
 }
 
-#elif defined( __GNUC__ )
+#elif GDEF_COMPILER_GNU
 
 // lrint is part of ISO C99
 #define _ISOC9X_SOURCE  1
index eb0478245c072ab0427ebbc1edae3ae654d2f274..897e524f75ca27a291a28ab1f1700ef1983e9edd 100644 (file)
  */
 
 #include "md5lib.h" /* ydnar */
+#include "globaldefs.h"
 #include <string.h>
 
-/* ydnar: gtkradiant endian picking */
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 #define ARCH_IS_BIG_ENDIAN  1
 #else
 #define ARCH_IS_BIG_ENDIAN  0
 /* ydnar: end */
 
 #undef BYTE_ORDER   /* 1 = big-endian, -1 = little-endian, 0 = unknown */
-#ifdef ARCH_IS_BIG_ENDIAN
 #define BYTE_ORDER ( ARCH_IS_BIG_ENDIAN ? 1 : -1 )
-#else
-#define BYTE_ORDER 0
-#endif
 
 #define T_MASK ( ( md5_word_t ) ~0 )
 #define T1 /* 0xd76aa478 */ ( T_MASK ^ 0x28955b87 )
index 140be78cb5ab9b0788396d2f44eedf8d738525f8..144627e65a9dcea34a7ad9adf8a03aef9a613d9d 100644 (file)
 #if !defined( INCLUDED_OS_FILE_H )
 #define INCLUDED_OS_FILE_H
 
+#include "globaldefs.h"
+
 /// \file
 /// \brief OS file-system querying and manipulation.
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 #define S_ISDIR( mode ) ( mode & _S_IFDIR )
 #include <io.h> // _access()
 #define access( path, mode ) _access( path, mode )
index e3329a758c76ec79291659a0af7cc2807ccbc0bb..a3db167cb484ad84abbff192fc9289ae3408fcc1 100644 (file)
@@ -22,6 +22,8 @@
 #if !defined ( INCLUDED_OS_PATH_H )
 #define INCLUDED_OS_PATH_H
 
+#include "globaldefs.h"
+
 /// \file
 /// \brief OS file-system path comparison, decomposition and manipulation.
 ///
@@ -33,7 +35,7 @@
 
 #include "string/string.h"
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 #define OS_CASE_INSENSITIVE
 #endif
 
@@ -85,10 +87,10 @@ inline bool path_equal_n( const char* path, const char* other, std::size_t n ){
 /// \brief Returns true if \p path is a fully qualified file-system path.
 /// O(1)
 inline bool path_is_absolute( const char* path ){
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
        return path[0] == '/'
                   || ( path[0] != '\0' && path[1] == ':' ); // local drive
-#elif defined( POSIX )
+#elif GDEF_OS_POSIX
        return path[0] == '/';
 #endif
 }
index 824a693fd8df2803247a66956f343374aa1a3119..e825a3403e97d0b5b6f458cbefed03ae2513eea7 100644 (file)
@@ -10,6 +10,7 @@
 #include "../picointernal.h"
 #include "lwo2.h"
 #include <limits.h>
+#include "globaldefs.h"
 
 
 /*
@@ -32,7 +33,7 @@ void set_flen( int i ) { flen = i; }
 int get_flen( void ) { return flen; }
 
 
-#ifndef __BIG_ENDIAN__
+#if !GDEF_ARCH_ENDIAN_BIG
 /*
    =====================================================================
    revbytes()
index 5299d29718b5fcaaa2bced92aac0d7353bf8ddd8..fd367e4fea2139dd4e896d99f47725b06188bd24 100644 (file)
@@ -9,9 +9,10 @@
 
 #include "../picointernal.h"
 #include "lwo2.h"
+#include "globaldefs.h"
 
 /* disable warnings */
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning( disable:4018 )                /* signed/unsigned mismatch */
 #endif
 
index d055c13e50b3003a26614afb19056c319ae75f99..b1dc7470ba5fc228419680f534493979a3489e73 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef LWO2_H
 #define LWO2_H
 
+#include "globaldefs.h"
+
 /* chunk and subchunk IDs */
 
 #define LWID_( a,b,c,d ) ( ( ( a ) << 24 ) | ( ( b ) << 16 ) | ( ( c ) << 8 ) | ( d ) )
@@ -642,7 +644,7 @@ int   sgetVX( unsigned char **bp );
 float sgetF4( unsigned char **bp );
 char *sgetS0( unsigned char **bp );
 
-#ifndef __BIG_ENDIAN__
+#if !GDEF_ARCH_ENDIAN_BIG
 void revbytes( void *bp, int elsize, int elcount );
 #else
   #define revbytes( b, s, c )
index e0256c091f42c21ec41341b8d5ce0aec01d7e9b3..459c656011f1cd3ab80deb3ca303fcc0b6df8775 100644 (file)
 
 #include "../picointernal.h"
 #include "lwo2.h"
+#include "globaldefs.h"
 
 /* disable warnings */
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning( disable:4018 )                /* signed/unsigned mismatch */
 #endif
 
index e5e9238bf152b033bd3002ed155a1feb19c05421..4e45fb6f285730906044b969ffcda1cf1175f4ba 100644 (file)
@@ -39,6 +39,7 @@
 /* dependencies */
 #include <string.h>
 #include "picointernal.h"
+#include "globaldefs.h"
 
 
 
@@ -476,7 +477,7 @@ void _pico_copy_color( picoColor_t src, picoColor_t dest ){
        dest[ 3 ] = src[ 3 ];
 }
 
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 int   _pico_big_long( int src ) { return src; }
 short _pico_big_short( short src ) { return src; }
index 07c24cb570c39b2a5b2d102ee253f4addf158a2c..f393523665ae8a0afdd305d7b7d53d14f744baf7 100644 (file)
@@ -38,6 +38,8 @@
 #ifndef PICOINTERNAL_H
 #define PICOINTERNAL_H
 
+#include "globaldefs.h"
+
 #ifdef __cplusplus
 extern "C"
 {
@@ -56,7 +58,7 @@ extern "C"
 
 
 /* os dependent replacements */
-#if WIN32 || _WIN32
+#if GDEF_OS_WINDOWS
        #define _pico_stricmp stricmp
        #define _pico_strnicmp strnicmp
 #else
index c0c3987f52b18a47ba9ef9401680feec9e9b9e0d..378265f30a5504d59206c95b08d6f43fb103bce7 100644 (file)
 
 /* dependencies */
 #include "picointernal.h"
+#include "globaldefs.h"
 
 /* disable warnings */
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning( disable:4100 )                /* unref param */
 #endif
 
index a97cf5264e4c298d4987f844044ea32ee57be20c..24f3ee8ac6ad7cc3e23046c377d586a70b4288cc 100644 (file)
 
 /* dependencies */
 #include "picointernal.h"
+#include "globaldefs.h"
 
 /* disable warnings */
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning( disable:4100 )                /* unref param */
 #endif
 
index 29402065252cf7c8f2cb4d040d244e48d2e67427..7488186d80da8b9c3653165986adfe2b9e967486 100644 (file)
@@ -22,6 +22,7 @@
 #if !defined ( INCLUDED_SCENELIB_H )
 #define INCLUDED_SCENELIB_H
 
+#include "globaldefs.h"
 #include "iscenegraph.h"
 #include "iselection.h"
 
@@ -108,7 +109,7 @@ void initialise(){
 }
 typedef MemberCaller<NodeType<Type>, &NodeType<Type>::initialise> InitialiseCaller;
 TypeId getTypeId(){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( m_typeId != NODETYPEID_NONE, "node-type " << makeQuoted( Name() ) << " used before being initialised" );
 #endif
        return m_typeId;
@@ -443,7 +444,7 @@ void initialise(){
 }
 typedef MemberCaller<InstanceType<Type>, &InstanceType<Type>::initialise> InitialiseCaller;
 TypeId getTypeId(){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        ASSERT_MESSAGE( m_typeId != INSTANCETYPEID_NONE, "instance-type " << makeQuoted( Name() ) << " used before being initialised" );
 #endif
        return m_typeId;
index 306b9bc981d46f7ac24c16fcc063ecbfb4cae40d..b4427dcde922c6159953971174c4b2b595140c6c 100644 (file)
 #include <string.h>
 #include "math_vector.h"
 
-#ifndef ID_INLINE
-#ifdef _WIN32
-#define ID_INLINE __inline
-#else
-#define ID_INLINE inline
-#endif
-#endif
-
 class quat_t;
 class angles_t;
 
index dde072578cc470a2b805c13052205c3de0398f15..4fbe8d9dc5820f8071af22b13308e98aaad0288b 100644 (file)
@@ -22,7 +22,9 @@
 #ifndef __MATH_VECTOR_H__
 #define __MATH_VECTOR_H__
 
-#ifdef WIN32
+#include "globaldefs.h"
+
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4244)
 #endif
 
 float Q_fabs( float f );
 
 #ifndef ID_INLINE
-#ifdef _WIN32
-#define ID_INLINE __inline
-#else
-#define ID_INLINE inline
-#endif
+#define ID_INLINE GDEF_ATTRIBUTE_INLINE
 #endif
 
 // if this is defined, vec3 will take four elements, which may allow
@@ -98,7 +96,7 @@ static inline float idSqrt( float x ) {
        }
        B = x;
 
-#ifdef __GNUC__
+#if GDEF_COMPILER_GNU
        asm ( "frsqrte %0,%1" : "=f" ( y0 ) : "f" ( B ) );
 #else
        y0 = __frsqrte( B );
index 95c0cc5a4f731280f13ce216dad88efc7ff25cb6..10a75625cb8cc8405c1d34324b60d98ca4e565f0 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef __Q_SHARED_H
 #define __Q_SHARED_H
 
+#include "globaldefs.h"
+
 // q_shared.h -- included first by ALL program modules.
 // these are the definitions that have no dependance on
 // central system services, and can be used by any part
@@ -35,7 +37,7 @@
 #define ALIGN_ON
 #define ALIGN_OFF
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 
 #pragma warning(disable : 4018)     // signed/unsigned mismatch
 #pragma warning(disable : 4032)
 #include <ctype.h>
 #include <cstddef>
 
-#ifdef WIN32                // mac doesn't have malloc.h
+#if GDEF_OS_WINDOWS                // mac doesn't have malloc.h
 #include <malloc.h>         // for _alloca()
 #endif
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 
 //#pragma intrinsic( memset, memcpy )
 
@@ -78,7 +80,7 @@
 
 
 // this is the define for determining if we have an asm version of a C function
-#if ( defined _M_IX86 || defined __i386__ ) && !defined __sun__  && !defined __LCC__
+#if GDEF_ARCH_BITS_32 && !defined __sun__  && !defined __LCC__
 #define id386   1
 #else
 #define id386   0
@@ -90,7 +92,7 @@
 
 //======================= WIN32 DEFINES =================================
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 #define MAC_STATIC
 
 
 // buildstring will be incorporated into the version string
 #ifdef NDEBUG
-#ifdef _M_IX86
+#if GDEF_ARCH_BITS_32
 #define CPUSTRING   "win-x86"
 #elif defined _M_ALPHA
 #define CPUSTRING   "win-AXP"
 #endif
 #else
-#ifdef _M_IX86
+#if GDEF_ARCH_BITS_32
 #define CPUSTRING   "win-x86-debug"
 #elif defined _M_ALPHA
 #define CPUSTRING   "win-AXP-debug"
 
 //======================= MAC OS X SERVER DEFINES =====================
 
-#if defined( __MACH__ ) && defined( __APPLE__ )
+#if GDEF_OS_MACOS && defined( __MACH__ )
 
 #define MAC_STATIC
 
 #ifdef __ppc__
 #define CPUSTRING   "MacOSXS-ppc"
-#elif defined __i386__
+#elif GDEF_ARCH_BITS_32
 #define CPUSTRING   "MacOSXS-i386"
 #else
 #define CPUSTRING   "MacOSXS-other"
@@ -190,11 +192,11 @@ void Sys_PumpEvents( void );
 
 // the mac compiler can't handle >32k of locals, so we
 // just waste space and make big arrays static...
-#ifdef __linux__
+#if GDEF_OS_LINUX
 
 #define MAC_STATIC
 
-#ifdef __i386__
+#if GDEF_ARCH_BITS_32
 #define CPUSTRING   "linux-i386"
 #elif defined __axp__
 #define CPUSTRING   "linux-alpha"
index 2c5e49454e30bdc536b767120ad06db66da1d84b..c64ca73b7f52acac1edbb1bbb07c2ee3e36efafb 100644 (file)
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include <stdarg.h>
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4244)     // 'conversion' conversion from 'type1' to 'type2', possible loss of data
 #pragma warning(disable : 4710)     // function 'blah' not inlined
 #endif
@@ -455,7 +455,7 @@ void idStr::snprintf
        strncpy( dst, buffer, size - 1 );
 }
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4189)     // local variable is initialized but not referenced
 #endif
 
@@ -571,7 +571,7 @@ void TestStringClass
        a[1] = '1';                  // a.data = "t1st", b.data = "test"
 }
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(default : 4189)     // local variable is initialized but not referenced
 #pragma warning(disable : 4514)     // unreferenced inline function has been removed
 #endif
index 57f05b5a000b3fe09dce30652e9aa1e15d62b219..02240ced728fba4ebf9f8cd589838ec11f73b0f6 100644 (file)
@@ -28,7 +28,7 @@
 #include <string.h>
 #include <stdio.h>
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4710)     // function 'blah' not inlined
 #endif
 
index 47be309dd2318e6e75f150e1d81ee369a5dcb573..e7ef600efada9c9d23cbeca5ae5d94154f1d979b 100644 (file)
@@ -31,6 +31,8 @@
 #ifndef __STR__
 #define __STR__
 
+#include "globaldefs.h"
+
 //
 // class Str
 // loose replacement for CString from MFC
@@ -44,7 +46,7 @@
 
 #include <cstdio>
 
-#ifdef _MSC_VER
+#if GDEF_COMPILER_MSVC
 #define strcasecmp strcmpi
 #if _MSC_VER < 1400
 #define vsnprintf std::vsnprintf
@@ -67,7 +69,7 @@ inline char* Q_StrDup( const char* pStr ){
        return strcpy( new char[strlen( pStr ) + 1], pStr );
 }
 
-#if !defined( WIN32 )
+#if !GDEF_OS_WINDOWS
 #define strcmpi strcasecmp
 #define stricmp strcasecmp
 #define strnicmp strncasecmp
index 7f8be898c12bc503e8173cfe95ba4eeffd03ea8e..25f3d1ad42d90b12db37b2cb395f8011da5e1aa0 100644 (file)
@@ -22,6 +22,8 @@
 #if !defined( INCLUDED_STREAM_TEXTSTREAM_H )
 #define INCLUDED_STREAM_TEXTSTREAM_H
 
+#include "globaldefs.h"
+
 /// \file
 /// \brief Text-output-formatting.
 
@@ -48,7 +50,7 @@ inline char* write_unsigned_nonzero_decimal_backward( char* ptr, unsigned int de
        return ptr;
 }
 
-  #if defined ( _WIN64 ) || defined ( __LP64__ )
+  #if GDEF_ARCH_BITS_64
 inline char* write_size_t_nonzero_decimal_backward( char* ptr, size_t decimal ){
        for (; decimal != 0; decimal /= 10 )
        {
@@ -78,7 +80,7 @@ inline char* write_unsigned_nonzero_decimal_backward( char* ptr, unsigned int de
        return ptr;
 }
 
-  #if defined ( _WIN64 ) || defined ( __LP64__ )
+  #if GDEF_ARCH_BITS_64
 inline char* write_size_t_nonzero_decimal_backward( char* ptr, size_t decimal, bool show_positive ){
        ptr = write_size_t_nonzero_decimal_backward( ptr, decimal );
        if ( show_positive ) {
@@ -110,7 +112,7 @@ inline char* write_unsigned_decimal_backward( char* ptr, unsigned int decimal, b
        return ptr;
 }
 
-  #if defined ( _WIN64 ) || defined ( __LP64__ )
+  #if GDEF_ARCH_BITS_64
 inline char* write_size_t_decimal_backward( char* ptr, size_t decimal, bool show_positive ){
        if ( decimal == 0 ) {
                *--ptr = '0';
@@ -125,7 +127,7 @@ inline char* write_size_t_decimal_backward( char* ptr, size_t decimal, bool show
 }
 
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #define snprintf _snprintf
 #endif
 
@@ -186,7 +188,7 @@ inline TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const
        return ostream;
 }
 
-#if defined ( _WIN64 ) || defined ( __LP64__ )
+#if GDEF_ARCH_BITS_64
 
 /// \brief Writes a size_t \p i to \p ostream in decimal form.
 template<typename TextOutputStreamType>
index 96cb298d56cd94c7feb34c724cc4208d338ea39c..d43863311374c07261402b225ab85a5d35508535 100644 (file)
@@ -1,8 +1,9 @@
 
 #include "pooledstring.h"
+#include "globaldefs.h"
 #include "generic/static.h"
 
-#if defined( _DEBUG )
+#if GDEF_DEBUG
 
 namespace ExamplePooledString
 {
@@ -21,4 +22,4 @@ struct Always
 } always;
 }
 
-#endif
\ No newline at end of file
+#endif
index c9ef2c4dbb46fb0a404145585b0bbce75c39d518..ff7dc4536c9245ce116e612534f0d1ff826a49a6 100644 (file)
@@ -22,6 +22,8 @@
 #if !defined( INCLUDED_STRING_STRING_H )
 #define INCLUDED_STRING_STRING_H
 
+#include "globaldefs.h"
+
 /// \file
 /// C-style null-terminated-character-array string library.
 
@@ -81,7 +83,7 @@ inline bool string_greater( const char* string, const char* other ){
 /// Returns 0 if \p string is lexicographically equal to \p other after converting both to lower-case.
 /// O(n)
 inline int string_compare_nocase( const char* string, const char* other ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        return _stricmp( string, other );
 #else
        return strcasecmp( string, other );
@@ -94,7 +96,7 @@ inline int string_compare_nocase( const char* string, const char* other ){
 /// Treats all ascii characters as lower-case during comparisons.
 /// O(n)
 inline int string_compare_nocase_n( const char* string, const char* other, std::size_t n ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        return _strnicmp( string, other, n );
 #else
        return strncasecmp( string, other, n );
index ee76006494978a9b94b6d24376619ba0820fe527..946ee198ebd3da766ece72effeea5cc999330d75 100644 (file)
@@ -22,6 +22,7 @@
 #if !defined( INCLUDED_MODEL_H )
 #define INCLUDED_MODEL_H
 
+#include "globaldefs.h"
 #include "cullable.h"
 #include "renderable.h"
 #include "selectable.h"
@@ -180,7 +181,7 @@ void render( RenderStateFlags state ) const {
        glEnd();
 #endif
 
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        glBegin( GL_LINES );
 
        for ( VertexBuffer<ArbitraryMeshVertex>::const_iterator i = m_vertices.begin(); i != m_vertices.end(); ++i )
index defa472aa0fd56503aea26bb1216fab8044062be..aad851cf1082c89cfc5bb0443ef25df146a6defe 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "model.h"
+#include "globaldefs.h"
 
 #include "picomodel.h"
 
@@ -113,7 +114,7 @@ void render( RenderStateFlags state ) const {
        glVertexPointer( 3, GL_FLOAT, sizeof( ArbitraryMeshVertex ), &m_vertices.data()->vertex );
        glDrawElements( GL_TRIANGLES, GLsizei( m_indices.size() ), RenderIndexTypeID, m_indices.data() );
 
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        GLfloat modelview[16];
        glGetFloatv( GL_MODELVIEW_MATRIX, modelview ); // I know this is slow as hell, but hey - we're in _DEBUG
        Matrix4 modelview_inv(
index a7a3078dbbde5f319d21b777f7fde25ad25184e3..656c1d8404cb85eab959046c87d4f27d16800ea8 100644 (file)
@@ -35,6 +35,7 @@
 //
 
 #include "shaders.h"
+#include "globaldefs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -1369,7 +1370,7 @@ void ParseShaderFile( Tokeniser& tokeniser, const char* filename ){
                                if ( result ) {
                                        // do we already have this shader?
                                        if ( !g_shaderDefinitions.insert( ShaderDefinitionMap::value_type( shaderTemplate->getName(), ShaderDefinition( shaderTemplate.get(), ShaderArguments(), filename ) ) ).second ) {
-  #ifdef _DEBUG
+  #if GDEF_DEBUG
                                                globalOutputStream() << "WARNING: shader " << shaderTemplate->getName() << " is already in memory, definition in " << filename << " ignored.\n";
   #endif
                                        }
index f884c53e75f8e269158bce9073b00405ab320edc..2ebd1b012c10209066a116a7a8db9778738bd6ab 100644 (file)
 // stdafx.h
 // precompiled headers
 
+#include "globaldefs.h"
+
 // standard headers
 #include <stdio.h>
 #include <stdlib.h>
 
-#if !defined( WIN32 )
+#if !GDEF_OS_WINDOWS
 
 // Necessary for proper boolean type declaration
 #include "qertypes.h"
index 8776ad3b02147a21c5cd27058b13001e2d331a16..1cd50a31bd9cf7ed852e6a9f2a7477d0c4ee38da 100644 (file)
@@ -42,6 +42,7 @@
 //
 
 #include "vfs.h"
+#include "globaldefs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -64,7 +65,7 @@ ArchiveModules& FileSystemQ3API_getArchiveModules();
 
 const int VFS_MAXDIRS = 64;
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 #define PATH_MAX 260
 #endif
 
index b9f9b824abd26a5e71c0d0880f842994e38049f8..8b3de4f765eb54f29c8005e01035304c04c9e319 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <uilib/uilib.h>
 #include "autosave.h"
+#include "globaldefs.h"
 
 #include "os/file.h"
 #include "os/path.h"
@@ -36,7 +37,7 @@
 #include "preferences.h"
 
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 #define PATH_MAX 260
 #endif
 
index 066adfcd385e58eb70f7a5ab4034d5a8c1d7b404..2b11807e548721443ecb88748c62410a40f51d13 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "brush_primit.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 
@@ -397,11 +398,11 @@ inline BasicVector3<Element> vector3_inverse( const BasicVector3<Element>& self
 void BPMatMul( float A[2][3], float B[2][3], float C[2][3] );
 // apply a rotation (degrees)
 void BPMatRotate( float A[2][3], float theta );
-#ifdef _DEBUG
+#if GDEF_DEBUG
 void BPMatDump( float A[2][3] );
 #endif
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
 //#define DBG_BP
 #endif
 
index 7b87bc9fb7657ce5eb2387b7bad2bd44386f1a22..1c297f03b353531708a78ab8b5264903d16c5450 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "environment.h"
+#include "globaldefs.h"
 
 #include "stream/textstream.h"
 #include "string/string.h"
@@ -127,9 +128,9 @@ void gamedetect(){
                        // TODO add more games to this
 
                        // try to detect Nexuiz installs
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
                        if ( gamedetect_check_game( "nexuiz.game", "data/common-spog.pk3", "nexuiz.exe", buf, p - buf ) )
-#elif defined( __APPLE__ )
+#elif GDEF_OS_MACOS
                        if ( gamedetect_check_game( "nexuiz.game", "data/common-spog.pk3", "Nexuiz.app/Contents/Info.plist", buf, p - buf ) )
 #else
                        if ( gamedetect_check_game( "nexuiz.game", "data/common-spog.pk3", "nexuiz-linux-glx.sh", buf, p - buf ) )
@@ -179,7 +180,7 @@ bool portable_app_setup(){
        return false;
 }
 
-#if defined( POSIX )
+#if GDEF_OS_POSIX
 
 #include <stdlib.h>
 #include <pwd.h>
@@ -188,7 +189,7 @@ bool portable_app_setup(){
 #include <glib.h>
 
 const char* LINK_NAME =
-#if defined ( __linux__ )
+#if GDEF_OS_LINUX
        "/proc/self/exe"
 #else // FreeBSD and OSX
        "/proc/curproc/file"
@@ -252,7 +253,7 @@ void environment_init( int argc, char const* argv[] ){
        gamedetect();
 }
 
-#elif defined( WIN32 )
+#elif GDEF_OS_WINDOWS
 
 #include <windows.h>
 
index fda7f79f8361fbc32619bd2d289b0173090076ad..50a089645b43140b52fe2c8a311123dfdc34d98f 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "error.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 #include "igl.h"
@@ -29,7 +30,7 @@
 #include "preferences.h"
 
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #define UNICODE
 #include <windows.h>
 #else
@@ -63,7 +64,7 @@ void Error( const char *error, ... ){
 
        strcat( text, "\n" );
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        if ( GetLastError() != 0 ) {
                LPVOID lpMsgBuf;
                FormatMessage(
index eae8538060ef77a5353ba6ad17e1b76e15a125ed..1eeb35b2a65ceb85d61f58bef1fb9fc3c169d336 100644 (file)
@@ -27,6 +27,7 @@
 //
 
 #include "groupdialog.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 
@@ -101,7 +102,7 @@ void GroupDlg::Create( ui::Window parent ){
 
        m_window = window;
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        if ( g_multimon_globals.m_bStartOnPrimMon ) {
                WindowPosition pos( m_position_tracker.getPosition() );
                PositionWindowOnPrimaryScreen( pos );
index 3d65f8a6e120ba6043c18c1f6bf045e4fdc5b04c..278edab17b521e982a6f0e566e257204c9fe6a2e 100644 (file)
@@ -35,6 +35,7 @@
 //
 
 #include "gtkdlgs.h"
+#include "globaldefs.h"
 
 #include <gtk/gtk.h>
 
@@ -822,7 +823,7 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos ){
                // trying to show later
                text_editor.show();
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
                ui::process();
 #endif
 
@@ -837,7 +838,7 @@ static void DoGtkTextEditor( const char* filename, guint cursorpos ){
                        gtk_text_buffer_place_cursor( text_buffer, &text_iter );
                }
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
                gtk_widget_queue_draw( text_widget );
 #endif
 
@@ -1030,11 +1031,11 @@ EMessageBoxReturn DoShaderInfoDlg( const char* name, const char* filename, const
 
 
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <gdk/gdkwin32.h>
 #endif
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 // use the file associations to open files instead of builtin Gtk editor
 bool g_TextEditor_useWin32Editor = true;
 #else
@@ -1044,7 +1045,7 @@ CopiedString g_TextEditor_editorCommand( "" );
 #endif
 
 void DoTextEditor( const char* filename, int cursorpos ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        if ( g_TextEditor_useWin32Editor ) {
                globalOutputStream() << "opening file '" << filename << "' (line " << cursorpos << " info ignored)\n";
                ShellExecute( (HWND)GDK_WINDOW_HWND( gtk_widget_get_window( MainFrame_getWindow() ) ), "open", filename, 0, 0, SW_SHOW );
index 05f8b8b9ea38c31b9d42cac79d0f4664b8610e56..0dad793a95552463b4fafb7a11df2530765b7ff1 100644 (file)
@@ -31,6 +31,7 @@
 #if !defined( INCLUDED_GTKDLGS_H )
 #define INCLUDED_GTKDLGS_H
 
+#include "globaldefs.h"
 #include "qerplugin.h"
 #include "string/string.h"
 
@@ -47,7 +48,7 @@ void DoSides( int type, int axis );
 void DoAbout();
 
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 extern bool g_TextEditor_useWin32Editor;
 #else
 #include "string/stringfwd.h"
index d80fd0b45ee080f717ee19b4adc627cea61831a1..4fa42d272a364ddda471e230184fe5a00c4ee302 100644 (file)
@@ -62,6 +62,7 @@
  */
 
 #include "main.h"
+#include "globaldefs.h"
 
 #include "version.h"
 
@@ -89,7 +90,7 @@
 #include "referencecache.h"
 #include "stacktrace.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <windows.h>
 #endif
 
@@ -213,12 +214,12 @@ void error_redirect( const gchar *domain, GLogLevelFlags log_level, const gchar
     }
 }
 
-#if defined ( _DEBUG ) && defined ( WIN32 ) && defined ( _MSC_VER )
+#if GDEF_COMPILER_MSVC && GDEF_DEBUG
 #include "crtdbg.h"
 #endif
 
 void crt_init(){
-#if defined ( _DEBUG ) && defined ( WIN32 ) && defined ( _MSC_VER )
+#if GDEF_COMPILER_MSVC && GDEF_DEBUG
        _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
 #endif
 }
@@ -301,7 +302,7 @@ bool handleMessage(){
        globalErrorStream() << m_buffer.c_str();
        if ( !m_lock.locked() ) {
                ScopedLock lock( m_lock );
-#if defined _DEBUG
+#if GDEF_DEBUG
                m_buffer << "Break into the debugger?\n";
                bool handled = ui::root.alert( m_buffer.c_str(), "Radiant - Runtime Error", ui::alert_type::YESNO, ui::alert_icon::Error ) == ui::alert_response::NO;
                m_buffer.clear();
@@ -367,7 +368,7 @@ bool check_version(){
        // make something idiot proof and someone will make better idiots, this may be overkill
        // let's leave it disabled in debug mode in any case
        // http://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=431
-#ifndef _DEBUG
+#if !GDEF_DEBUG
 #define CHECK_VERSION
 #endif
 #ifdef CHECK_VERSION
@@ -421,7 +422,7 @@ void create_global_pid(){
                }
 
                // in debug, never prompt to clean registry, turn console logging auto after a failed start
-#if !defined( _DEBUG )
+#if !GDEF_DEBUG
                StringOutputStream msg( 256 );
                msg << "Radiant failed to start properly the last time it was run.\n"
                           "The failure may be related to current global preferences.\n"
@@ -480,7 +481,7 @@ void create_local_pid(){
                }
 
                // in debug, never prompt to clean registry, turn console logging auto after a failed start
-#if !defined( _DEBUG )
+#if !GDEF_DEBUG
                StringOutputStream msg;
                msg << "Radiant failed to start properly the last time it was run.\n"
                           "The failure may be caused by current preferences.\n"
@@ -539,7 +540,7 @@ int main( int argc, char* argv[] ){
 
        streams_init();
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        HMODULE lib;
        lib = LoadLibrary( "dwmapi.dll" );
        if ( lib != 0 ) {
index b54ff8277f8344d536b75bd934e8d00342769c82..5868e28883361840efc1d645b8f4b49776cc9b17 100644 (file)
@@ -26,6 +26,7 @@
 //
 
 #include "mainframe.h"
+#include "globaldefs.h"
 
 #include <gtk/gtk.h>
 
@@ -180,7 +181,7 @@ void VFS_Destroy(){
 
 // Home Paths
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <shlobj.h>
 #include <objbase.h>
 const GUID qFOLDERID_SavedGames = {0x4C5C32FF, 0xBB9D, 0x43b0, {0xB5, 0xB4, 0x2D, 0x72, 0xE5, 0x4E, 0xAA, 0xA4}};
@@ -197,7 +198,7 @@ void HomePaths_Realise(){
                if ( !string_empty( prefix ) ) {
                        StringOutputStream path( 256 );
 
-#if defined( __APPLE__ )
+#if GDEF_OS_MACOS
                        path.clear();
                        path << DirectoryCleaned( g_get_home_dir() ) << "Library/Application Support" << ( prefix + 1 ) << "/";
                        if ( file_is_directory( path.c_str() ) ) {
@@ -208,7 +209,7 @@ void HomePaths_Realise(){
                        path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
 #endif
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
                        TCHAR mydocsdir[MAX_PATH + 1];
                        wchar_t *mydocsdirw;
                        HMODULE shfolder = LoadLibrary( "shfolder.dll" );
@@ -247,7 +248,7 @@ void HomePaths_Realise(){
                        }
 #endif
 
-#if defined( POSIX )
+#if GDEF_OS_POSIX
                        path.clear();
                        path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
                        g_qeglobals.m_userEnginePath = path.c_str();
@@ -539,11 +540,11 @@ void operator()( const char* name ) const {
 const char* const c_library_extension =
 #if defined( CMAKE_SHARED_MODULE_SUFFIX )
     CMAKE_SHARED_MODULE_SUFFIX
-#elif defined( WIN32 )
+#elif GDEF_OS_WINDOWS
        "dll"
-#elif defined ( __APPLE__ )
+#elif GDEF_OS_MACOS
        "dylib"
-#elif defined( __linux__ ) || defined ( __FreeBSD__ )
+#elif GDEF_OS_LINUX || GDEF_OS_BSD
        "so"
 #endif
 ;
@@ -2602,7 +2603,7 @@ void MainFrame::CreateContexts(){
 #endif
 }
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
 //#define DBG_SLEEP
 #endif
 
@@ -2711,7 +2712,7 @@ void MainFrame::Create(){
 
        gtk_window_set_transient_for( splash_screen, window );
 
-#if !defined( WIN32 )
+#if !GDEF_OS_WINDOWS
        {
                GdkPixbuf* pixbuf = pixbuf_new_from_file_with_mask( "bitmaps/icon.png" );
                if ( pixbuf != 0 ) {
@@ -2767,7 +2768,7 @@ void MainFrame::Create(){
                g_page_console = GroupDialog_addPage( "Console", Console_constructWindow( GroupDialog_getWindow() ), RawStringExportCaller( "Console" ) );
        }
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        if ( g_multimon_globals.m_bStartOnPrimMon ) {
                PositionWindowOnPrimaryScreen( g_layout_globals.m_position );
                window_set_position( window, g_layout_globals.m_position );
@@ -3107,7 +3108,7 @@ void GlobalGL_sharedContextCreated(){
        GlobalShaderCache().realise();
        Textures_Realise();
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        /* win32 is dodgy here, just use courier new then */
        g_font = glfont_create( "arial 9" );
 #else
@@ -3313,11 +3314,11 @@ void MainFrame_Construct(){
 
        {
                const char* ENGINEPATH_ATTRIBUTE =
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
                        "enginepath_win32"
-#elif defined( __APPLE__ )
+#elif GDEF_OS_MACOS
                        "enginepath_macos"
-#elif defined( __linux__ ) || defined ( __FreeBSD__ )
+#elif GDEF_OS_LINUX || GDEF_OS_BSD
                        "enginepath_linux"
 #else
 #error "unknown platform"
index a81220e72878b7e4333973c99d3af928a0c984c2..c51bb9d028ff874480f1cf00c6db2e5ab7caad4a 100644 (file)
@@ -22,6 +22,8 @@
 #if !defined( INCLUDED_MULTIMON_H )
 #define INCLUDED_MULTIMON_H
 
+#include "globaldefs.h"
+
 struct WindowPosition;
 
 void PositionWindowOnPrimaryScreen( WindowPosition& position );
@@ -37,7 +39,7 @@ struct multimon_globals_t
 
 extern multimon_globals_t g_multimon_globals;
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 void MultiMon_Construct();
 void MultiMon_Destroy();
 #else
index a1f1d272a20a682bb987337d12f8f481925d787b..96c9b76e081c7cab192a73f7911d59bba19e8123 100644 (file)
@@ -30,7 +30,7 @@
 /// The surface is recursively tesselated until the angle between each triangle
 /// edge is smaller than a specified tolerance.
 
-
+#include "globaldefs.h"
 #include "nameable.h"
 #include "ifilter.h"
 #include "imap.h"
@@ -317,7 +317,7 @@ void render( RenderStateFlags state ) const {
                }
        }
 
-#if defined( _DEBUG )
+#if GDEF_DEBUG
        RenderNormals();
 #endif
 }
index 523408ebbe17de6a11b3b9479085097049c541a2..d67bd40c4ab1be25d4c4e9b65b5486fa1d62c6b0 100644 (file)
@@ -26,6 +26,7 @@
 //
 
 #include "preferences.h"
+#include "globaldefs.h"
 
 #include <gtk/gtk.h>
 #include "environment.h"
@@ -57,7 +58,7 @@ void Global_constructPreferences( PreferencesPage& page ){
 }
 
 void Interface_constructPreferences( PreferencesPage& page ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        page.appendCheckBox( "", "Default Text Editor", g_TextEditor_useWin32Editor );
 #else
        {
@@ -949,7 +950,7 @@ typedef FreeCaller1<const StringImportCallback&, GameMode_exportString> GameMode
 
 
 void RegisterPreferences( PreferenceSystem& preferences ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        preferences.registerPreference( "UseCustomShaderEditor", BoolImportStringCaller( g_TextEditor_useWin32Editor ), BoolExportStringCaller( g_TextEditor_useWin32Editor ) );
 #else
        preferences.registerPreference( "UseCustomShaderEditor", BoolImportStringCaller( g_TextEditor_useCustomEditor ), BoolExportStringCaller( g_TextEditor_useCustomEditor ) );
index 7d685bae3465b5152f82114afa28adcdc9c93ac7..b2b61791c02bb76cee32af1e0930dc16fa098f2e 100644 (file)
@@ -33,6 +33,7 @@
 //
 
 #include "qe3.h"
+#include "globaldefs.h"
 
 #include <gtk/gtk.h>
 
@@ -66,7 +67,7 @@
 QEGlobals_t g_qeglobals;
 
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 #define PATH_MAX 260
 #endif
 
@@ -281,10 +282,10 @@ void RunBSP( const char* name ){
                strcat( junkpath, "junk.txt" );
 
                char batpath[PATH_MAX];
-#if defined( POSIX )
+#if GDEF_OS_POSIX
                strcpy( batpath, SettingsPath_get() );
                strcat( batpath, "qe3bsp.sh" );
-#elif defined( WIN32 )
+#elif GDEF_OS_WINDOWS
                strcpy( batpath, SettingsPath_get() );
                strcat( batpath, "qe3bsp.bat" );
 #else
@@ -294,7 +295,7 @@ void RunBSP( const char* name ){
                {
                        TextFileOutputStream batchFile( batpath );
                        if ( !batchFile.failed() ) {
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
                                batchFile << "#!/bin/sh \n\n";
 #endif
                                BatchCommandListener listener( batchFile, junkpath );
@@ -303,7 +304,7 @@ void RunBSP( const char* name ){
                        }
                }
                if ( written ) {
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
                        chmod( batpath, 0744 );
 #endif
                        globalOutputStream() << "Writing the compile script to '" << batpath << "'\n";
index a352b8d0723cde907f5a69bf0914deb25e31fcc3..d64b7a5fe2f37e3b95c768ef0ab83535eb0ae982 100644 (file)
@@ -21,6 +21,7 @@
 
 
 #include "qgl.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 
 #include <stdlib.h>
 #include <string.h>
 
-#if defined( _WIN32 )
+#if GDEF_OS_WINDOWS
 #define WINGDIAPI __declspec( dllimport )
 #define APIENTRY __stdcall
 #endif
 
-#if defined( __APPLE__ ) && !defined( XWINDOWS )
+#if GDEF_OS_MACOS && !defined( XWINDOWS )
 #include <OpenGL/gl.h>
 #else
 #include <GL/gl.h>
 #endif
 
-#if defined( _WIN32 )
+#if GDEF_OS_WINDOWS
 #undef WINGDIAPI
 #undef APIENTRY
 #endif
@@ -49,7 +50,7 @@
 
 
 
-#if defined( _WIN32 )
+#if GDEF_OS_WINDOWS
 
 #include <wtypes.h>
 
@@ -64,7 +65,7 @@ Bool ( *qglXQueryExtension )( Display *dpy, int *errorb, int *event );
 void*        ( *qglXGetProcAddressARB )( const GLubyte * procName );
 typedef void* ( *glXGetProcAddressARBProc )( const GLubyte *procName );
 
-#elif defined(__APPLE__)
+#elif GDEF_OS_MACOS
 #include <mach-o/dyld.h>
 #include <stdlib.h>
 #include <string.h>
@@ -76,12 +77,12 @@ typedef void* ( *glXGetProcAddressARBProc )( const GLubyte *procName );
 void QGL_Shutdown( OpenGLBinding& table ){
        globalOutputStream() << "Shutting down OpenGL module...";
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
        qwglGetProcAddress           = 0;
 #elif defined( XWINDOWS )
        qglXQueryExtension           = glXQueryExtension;
        qglXGetProcAddressARB        = 0;
-#elif defined(__APPLE__)
+#elif GDEF_OS_MACOS
 #else
 #error "unsupported platform"
 #endif
@@ -138,7 +139,7 @@ bool QGL_ExtensionSupported( const char* extension ){
        }
 
        extensions = GlobalOpenGL().m_glGetString( GL_EXTENSIONS );
-#ifndef __APPLE__
+#if !GDEF_OS_MACOS
        if ( !extensions ) {
                return false;
        }
@@ -179,7 +180,7 @@ QGLFunctionPointer QGL_getExtensionFunc( const char* symbol ){
        {
                return (QGLFunctionPointer) qglXGetProcAddressARB( reinterpret_cast<const GLubyte*>( symbol ) );
        }
-#elif defined(__APPLE__)
+#elif GDEF_OS_MACOS
        // Prepend a '_' for the Unix C symbol mangling convention
        char *symbolName = (char *) malloc(strlen(symbol) + 2);
        strcpy(symbolName + 1, symbol);
@@ -188,7 +189,7 @@ QGLFunctionPointer QGL_getExtensionFunc( const char* symbol ){
        if (NSIsSymbolNameDefined(symbolName)) nssymbol = NSLookupAndBindSymbol(symbolName);
        free(symbolName);
     return nssymbol ? reinterpret_cast<QGLFunctionPointer>(NSAddressOfSymbol(nssymbol)) : reinterpret_cast<QGLFunctionPointer>(glInvalidFunction);
-#elif defined( WIN32 )
+#elif GDEF_OS_WINDOWS
        ASSERT_NOTNULL( qwglGetProcAddress );
        return (QGLFunctionPointer) qwglGetProcAddress( symbol );
 #else
@@ -550,14 +551,14 @@ void QGL_clear( OpenGLBinding& table ){
 int QGL_Init( OpenGLBinding& table ){
        QGL_clear( table );
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
        qwglGetProcAddress           = wglGetProcAddress;
 #elif defined( XWINDOWS )
        qglXGetProcAddressARB = (glXGetProcAddressARBProc)dlsym( RTLD_DEFAULT, "glXGetProcAddressARB" );
        if ( ( qglXQueryExtension == 0 ) || ( qglXQueryExtension(XOpenDisplay(nullptr), 0, 0) != True ) ) {
                return 0;
        }
-#elif defined (__APPLE__)
+#elif GDEF_OS_MACOS
 #else
 #error "unsupported platform"
 #endif
index ee3ab8061e17f4a16201458e6b66d641cfb4eef0..8cd9eb2001d93a7fab6490fe838848b493f32a57 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "referencecache.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 
@@ -206,7 +207,7 @@ NodeSmartReference ModelResource_load( ModelLoader* loader, const char* name ){
 
 
 inline hash_t path_hash( const char* path, hash_t previous = 0 ){
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
        return string_hash_nocase( path, previous );
 #else // UNIX
        return string_hash( path, previous );
index e26319170992d0364cb0d337fc8262785b0daafd..e04fd91c3695f608169640c3e756ed88fd62eb8c 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "selection.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 
@@ -156,7 +157,7 @@ inline float angle_between( const Vector3& a, const Vector3& b ){
 }
 
 
-#if defined( _DEBUG )
+#if GDEF_DEBUG
 class test_quat
 {
 public:
@@ -466,7 +467,7 @@ void add_one(){
 }
 };
 
-#if defined( _DEBUG )
+#if GDEF_DEBUG
 #define DEBUG_SELECTION
 #endif
 
index 21d95c20f65c54de7daf8cbd1ded886eb2856890..fde6f86d601daa3fbb15eefbb1b0dc09dbfe18b0 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "server.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 #include "warnings.h"
@@ -89,7 +90,7 @@ void foreachModule( const char* type, int version, const Visitor& visitor ){
 };
 
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 
 #include <windows.h>
 
@@ -140,7 +141,7 @@ FunctionPointer findSymbol( const char* symbol ){
 }
 };
 
-#elif defined( POSIX )
+#elif GDEF_OS_POSIX
 
 #include <dlfcn.h>
 
index d95663d130eef36c25af1df2ca03074ff23bcd7b..d2a27d7e01848315d92ff3aaf407a0ac3128f850 100644 (file)
@@ -1,25 +1,25 @@
-
 #include "sockets.h"
+#include "globaldefs.h"
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 #include <winsock2.h>
-#elif defined ( POSIX )
+#elif GDEF_OS_POSIX
 #include <sys/time.h>
 const int SOCKET_ERROR = -1;
 #else
 #error "unsupported platform"
 #endif
 
-#ifdef __APPLE__
+#if GDEF_OS_MACOS
 #include <unistd.h>
 #endif
 
 int Net_Wait( socket_t *sock, long sec, long usec ){
 // used for select()
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        TIMEVAL tout = { sec, usec };
 #endif
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
        timeval tout;
        tout.tv_sec = sec;
        tout.tv_usec = usec;
index 51ef50387bdc377685eac76242c3a20e7c63807a..5e63857428fae5ae54a22ea94ab0a55e965658b8 100644 (file)
  */
 
 #include "stacktrace.h"
+#include "globaldefs.h"
+
 #include "stream/textstream.h"
 
 #include "environment.h"
 
-#ifdef __linux__
+#if GDEF_OS_LINUX
 #include <execinfo.h>
 
 void write_stack_trace( TextOutputStream& outputStream ){
@@ -48,7 +50,7 @@ void write_stack_trace( TextOutputStream& outputStream ){
                free( symbol_names );
        }
 }
-#elif defined ( WIN32 ) && defined ( _MSC_VER )
+#elif GDEF_COMPILER_MSVC
 
 #include "windows.h"
 #include "winnt.h"
@@ -288,7 +290,7 @@ void write_stack_trace( TextOutputStream& outputStream ){
        }
 }
 
-#elif defined ( WIN32 )
+#elif GDEF_OS_WINDOWS
 void write_stack_trace( TextOutputStream& outputStream ){
        outputStream << "\nStacktrace is disabled on this compiler\n";
 }
index 1c55d93022c7f51ebb82b98e53f3eedda10991f4..8d10b82ba8b36cc8cda79ee82fcc541f0b78f263 100644 (file)
  */
 
 #include "timer.h"
+#include "globaldefs.h"
 
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 
 #include <windows.h>
 
@@ -62,7 +63,7 @@ public:
 
 
 
-#elif defined( POSIX )
+#elif GDEF_OS_POSIX
 
 #include <time.h>
 #include "sys/time.h"
index d5a7a54a8b6a9dda4977210b55c6976f843c872e..97d02265cf82b289dd2fbd778a0ce1f9dc16b14e 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "treemodel.h"
+#include "globaldefs.h"
 
 #include "debugging/debugging.h"
 
@@ -465,7 +466,7 @@ static void graph_tree_model_tree_model_init( GtkTreeModelIface *iface ){
 }
 
 static gboolean graph_tree_model_row_draggable( GtkTreeDragSource *drag_source, GtkTreePath *path ){
-#ifdef _DEBUG
+#if GDEF_DEBUG
        gint depth = gtk_tree_path_get_depth( path );
 #endif
        return gtk_tree_path_get_depth( path ) > 1;
index e92d1ba1a146375c3e48ea05efb287582ace8213..425948f8ca5bf00d426a1a49e9294090208c4391 100644 (file)
  */
 
 #include "url.h"
+#include "globaldefs.h"
 
 #include "mainframe.h"
 #include "gtkutil/messagebox.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <gtk/gtk.h>
 #include <gdk/gdkwin32.h>
 #include <shellapi.h>
@@ -33,7 +34,7 @@ bool open_url( const char* url ){
 }
 #endif
 
-#if defined( __linux__ ) || defined( __FreeBSD__ )
+#if GDEF_OS_LINUX || GDEF_OS_BSD
 #include <stdlib.h>
 bool open_url( const char* url ){
        char command[2 * PATH_MAX];
@@ -43,7 +44,7 @@ bool open_url( const char* url ){
 }
 #endif
 
-#ifdef __APPLE__
+#if GDEF_OS_MACOS
 #include <stdlib.h>
 bool open_url( const char* url ){
        char command[2 * PATH_MAX];
index 7e8cdf957bfe69ceb89f934b48b3604e39b2c977..ad322d5d817c6e76da75e2723cdf0ab4a855e938 100644 (file)
 #if !defined( INCLUDED_VIEW_H )
 #define INCLUDED_VIEW_H
 
+#include "globaldefs.h"
 #include "cullable.h"
 #include "math/frustum.h"
 
 
-#if defined( _DEBUG )
+#if GDEF_DEBUG
 #define DEBUG_CULLING
 #endif
 
index cddc0a5c00cc9e52ab8c00ed2cc5bc17252e962c..ada5eb435b0c32bff74537c08f6b32d595c54ae4 100644 (file)
@@ -34,6 +34,7 @@
 // monitoring window for running BSP processes (and possibly various other stuff)
 
 #include "watchbsp.h"
+#include "globaldefs.h"
 
 #include <algorithm>
 
@@ -343,7 +344,7 @@ static void saxEndElement( message_info_t *data, const xmlChar *name ){
        }
        if ( data->recurse == data->stop_depth ) {
                message_flush( data );
-#ifdef _DEBUG
+#if GDEF_DEBUG
                globalOutputStream() << "Received error msg .. shutting down..\n";
 #endif
                GetWatchBSP()->EndMonitoringLoop();
@@ -494,7 +495,7 @@ void CWatchBSP::Reset(){
 }
 
 bool CWatchBSP::SetupListening(){
-#ifdef _DEBUG
+#if GDEF_DEBUG
        if ( m_pListenSocket ) {
                globalOutputStream() << "ERROR: m_pListenSocket != NULL in CWatchBSP::SetupListening\n";
                return false;
@@ -545,13 +546,13 @@ void CWatchBSP::DoEBeginStep(){
 }
 
 
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
 const char *ENGINE_ATTRIBUTE = "engine_win32";
 const char *MP_ENGINE_ATTRIBUTE = "mp_engine_win32";
-#elif defined( __linux__ ) || defined ( __FreeBSD__ )
+#elif GDEF_OS_LINUX || GDEF_OS_BSD
 const char *ENGINE_ATTRIBUTE = "engine_linux";
 const char *MP_ENGINE_ATTRIBUTE = "mp_engine_linux";
-#elif defined( __APPLE__ )
+#elif GDEF_OS_MACOS
 const char *ENGINE_ATTRIBUTE = "engine_macos";
 const char *MP_ENGINE_ATTRIBUTE = "mp_engine_macos";
 #else
@@ -622,7 +623,7 @@ void CWatchBSP::RoutineProcessing(){
 #endif
                        return;
                }
-#ifdef _DEBUG
+#if GDEF_DEBUG
                // some debug checks
                if ( !m_pListenSocket ) {
                        globalErrorStream() << "ERROR: m_pListenSocket == NULL in CWatchBSP::RoutineProcessing EBeginStep state\n";
@@ -642,7 +643,7 @@ void CWatchBSP::RoutineProcessing(){
                break;
        case EWatching:
        {
-#ifdef _DEBUG
+#if GDEF_DEBUG
                // some debug checks
                if ( !m_pInSocket ) {
                        globalErrorStream() << "ERROR: m_pInSocket == NULL in CWatchBSP::RoutineProcessing EWatching state\n";
index db6e2418fb55fdafd44654c8ce098e712c0a3a00..a2eaaf15d65f9969ebdffaf9213b08557adcb707 100644 (file)
 // Nurail: Swiped from quake3/common
 
 #include "cmdlib.h"
+#include "globaldefs.h"
+
 #include "mathlib.h"
 #include "inout.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 #include <windows.h>
 #endif
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #include <unistd.h>
 #endif
 
@@ -93,7 +95,7 @@ char archivedir[1024];
 #define MAX_EX_ARGC 1024
 int ex_argc;
 char    *ex_argv[MAX_EX_ARGC];
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void ExpandWildcards( int *argc, char ***argv ){
        struct _finddata_t fileinfo;
@@ -328,7 +330,7 @@ double I_FloatTime( void ){
 void Q_getwd( char *out ){
        int i = 0;
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        _getcwd( out, 256 );
        strcat( out, "\\" );
 #else
@@ -347,7 +349,7 @@ void Q_getwd( char *out ){
 
 
 void Q_mkdir( const char *path ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        if ( _mkdir( path ) != -1 ) {
                return;
        }
@@ -952,11 +954,7 @@ int ParseNum( const char *str ){
    ============================================================================
  */
 
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 short   LittleShort( short l ){
        byte b1,b2;
@@ -1128,7 +1126,7 @@ void    CreatePath( const char *path ){
        char c;
        char dir[1024];
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        int olddrive = -1;
 
        if ( path[1] == ':' ) {
@@ -1151,7 +1149,7 @@ void    CreatePath( const char *path ){
                }
        }
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        if ( olddrive != -1 ) {
                _chdrive( olddrive );
        }
@@ -1177,10 +1175,10 @@ void QCopyFile( const char *from, const char *to ){
 }
 
 void Sys_Sleep( int n ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        Sleep( n );
 #endif
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        usleep( n * 1000 );
 #endif
 }
index 2955d53f2a966aaa962cb9be569240b89c5b1328..25860c7777ad3277b7407e68a3b4ced015f1f490 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __CMDLIB__
 #define __CMDLIB__
 
+#include "globaldefs.h"
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -32,7 +34,7 @@
 #include <time.h>
 #include <stdarg.h>
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
        #ifdef NDEBUG                           // Don't show in a Release build
                #pragma warning(disable : 4305)     // truncate from double to float
                #pragma warning(disable : 4244)     // conversion from double to float
@@ -40,7 +42,7 @@
        #endif
 #endif
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
        #pragma intrinsic( memset, memcpy )
 #endif
 
index 30ae39df7ee9026ae3cae5d94afff7083691c9de..165390de54f9630cd37642948ebafc9eff9bb3c4 100644 (file)
@@ -26,6 +26,7 @@
 // deal with in/out tasks, for either stdin/stdout or network/XML stream
 //
 
+#include "globaldefs.h"
 #include "cmdlib.h"
 #include "mathlib.h"
 #include "polylib.h"
@@ -33,7 +34,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 #include <windows.h>
 #endif
@@ -42,7 +43,7 @@
 #include "l_net/l_net.h"
 #include "libxml/tree.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 HWND hwndOut = NULL;
 qboolean lookedForServer = false;
 UINT wm_BroadcastCommand = -1;
index be0bd9a4a596a6c626312861879fc2ab64d33b18..80bf1527074fe7b0200f14eeb9a94dc53c2169f0 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef __INOUT__
 #define __INOUT__
 
+#include "globaldefs.h"
 // inout is the only stuff relying on xml, include the headers there
 #include "libxml/tree.h"
 #include "mathlib.h"
@@ -52,7 +53,7 @@ void Sys_Printf( const char *text, ... );
 void Sys_FPrintf( int flag, const char *text, ... );
 void Error( const char *error, ... );
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
 #define DBG_XML 1
 #endif
 
index 5d729f2498edf2fe8cdc6b5b03f25d6f0a618409..71687a03ca139de6e953e742de9be1f20469c835 100644 (file)
 
  */
 
+#include "globaldefs.h"
 
-
-/* marker */
-#define PATH_INIT_C
-
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        #define Q_UNIX
 #endif
 
index d2b6f106be81a9f679d53f7e02ba860f4954d8e5..39b646afb5a67e8b9fc3ad2accbf4bb062843b39 100644 (file)
@@ -32,7 +32,8 @@
    ========================================================================
  */
 
-#ifdef WIN32
+#include "globaldefs.h"
+#if GDEF_COMPILER_MSVC
        #ifdef NDEBUG                           // Don't show in a Release build
                #pragma warning(disable : 4305)     // truncate from double to float
                #pragma warning(disable : 4244)     // conversion from double to float
index 0b5f4ece2ba263f37da9e65d491b957c4a40c444..f45e185551cc48e749780dfeddbe72295cc5f63b 100644 (file)
@@ -19,7 +19,9 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef WIN32
+#include "globaldefs.h"
+
+#if !GDEF_OS_WINDOWS
 // The below define is necessary to use
 // pthreads extensions like pthread_mutexattr_settype
 #define _GNU_SOURCE
@@ -106,7 +108,7 @@ void RunThreadsOnIndividual( int workcnt, qboolean showpacifier, void ( *func )(
 
    ===================================================================
  */
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 #define USED
 
@@ -415,7 +417,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    =======================================================================
  */
 
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #define USED
 
 // Setting default Threads to 1
index 670254605d9a1b07e77d0fae3d3b5bb622ef6f26..5311e8eb04ebe6929b53137a5159b70b095e657e 100644 (file)
@@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 ===========================================================================
 */
 
+#include "globaldefs.h"
 #include "cmdlib.h"
 #include "mathlib.h"
 #include "bspfile.h"
@@ -27,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "threads.h"
 #include "lbmlib.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <windows.h>
 #endif
 
index 60f615a0be05692795716c7c7153798eb68b1c39..792690790530546297e0254c17cc776dd40c8505 100644 (file)
@@ -23,10 +23,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // cmdlib.c
 
 #include "cmdlib.h"
+#include "globaldefs.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 #endif
 
@@ -58,7 +60,7 @@ Mimic unix command line expansion
 #define        MAX_EX_ARGC     1024
 int            ex_argc;
 char   *ex_argv[MAX_EX_ARGC];
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void ExpandWildcards (int *argc, char ***argv)
 {
@@ -305,7 +307,7 @@ double I_FloatTime (void)
 
 void Q_getwd (char *out)
 {
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
    _getcwd (out, 256);
    strcat (out, "\\");
 #else
@@ -317,7 +319,7 @@ void Q_getwd (char *out)
 
 void Q_mkdir (char *path)
 {
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        if (_mkdir (path) != -1)
                return;
 #else
@@ -830,11 +832,7 @@ int ParseNum (char *str)
 ============================================================================
 */
 
-#ifdef _SGI_SOURCE
-#define        __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 short   LittleShort (short l)
 {
index 0045a09d5c5e2e24229035523129e8dbe8c5f6a4..0821ce512f517de8b02ef2d56584fa7679a5e20b 100644 (file)
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #ifndef __CMDLIB__
 #define __CMDLIB__
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4244)     // MIPS
 #pragma warning(disable : 4136)     // X86
 #pragma warning(disable : 4051)     // ALPHA
index 25a87c78e4dbc6b662ec0bb23c88b89e8a2a07dd..24dc5561aa83b9bed89148f2e9a23a8de2097353 100644 (file)
@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "cmdlib.h"
 #include "threads.h"
+#include "globaldefs.h"
 
 #define        MAX_THREADS     64
 
@@ -99,7 +100,7 @@ WIN32
 
 ===================================================================
 */
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 #define        USED
 
index 2f93b728397ab5c24448625d8cab51e061bd02e9..16c65c710c4c3ca2ad3d722a72603a9d5ff0981e 100644 (file)
@@ -211,7 +211,7 @@ PackDirectory_r
 
 ===============
 */
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void PackDirectory_r (char *dir)
 {
index 87565490683498dcc763c804c7616a0e30be68cf..aebd6fb4b2f5f44e2e8879f5041efe995d7148f1 100644 (file)
@@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // cmdlib.c
 
 #include "cmdlib.h"
+#include "globaldefs.h"
 
 #define PATHSEPERATOR   '/'
 
@@ -567,11 +568,7 @@ int ParseNum (char *str)
 ============================================================================
 */
 
-#ifdef _SGI_SOURCE
-#define        __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 short   LittleShort (short l)
 {
index 84a5a3eb4e859a654d6eaea9ec92ff6108586513..d6ac83a5492e3c543778b718283da75311d625cb 100644 (file)
@@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 //*************************************************************
 
+#include "globaldefs.h"
 #include <windows.h>
 #include <windowsx.h>
 #include <string.h>
@@ -505,7 +506,7 @@ WORD i;
   return TRUE;
 }
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 BOOL IsWin395OrHigher(void)
 {
index b78b986ced3add415f5696b8b20351d553e64a0b..052a6e9a3bda8b899a9ae8276ab92ed9c85c045b 100644 (file)
@@ -36,6 +36,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #ifndef __MRU_H__
 #define __MRU_H__
 
+#include "globaldefs.h"
+
 #define NBMRUMENUSHOW   6       // Default number of MRU showed in the menu File
 #define NBMRUMENU       9       // Default number of MRU stored
 #define IDMRU           8000    // Default First ID of MRU
@@ -83,7 +85,7 @@ void            PlaceMenuMRUItem(LPMRUMENU lpMruMenu,HMENU hMenu,UINT uiItem);
 
 BOOL            SaveMruInIni   (LPMRUMENU lpMruMenu,LPSTR lpszSection,LPSTR lpszFile);
 BOOL            LoadMruInIni   (LPMRUMENU lpMruMenu,LPSTR lpszSection,LPSTR lpszFile);
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 BOOL            SaveMruInReg   (LPMRUMENU lpMruMenu,LPSTR lpszKey);
 BOOL            LoadMruInReg   (LPMRUMENU lpMruMenu,LPSTR lpszKey);
 
index 679305991b23eeaee8825145fc63932c3e1f3bb0..538b54e2a598ecc419f03a8e34074f10af52debb 100644 (file)
@@ -24,9 +24,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #define __QE3_H__
 
 // disable data conversion warnings for gl
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4244)     // MIPS
 #pragma warning(disable : 4136)     // X86
 #pragma warning(disable : 4051)     // ALPHA
+#endif
 
 #include <windows.h>
 
index 401e6f740072129a2dae00806a9b28f6c0e8ac7a..8344f3880e0fa2d5f54c1b1fd4d2fa46ba8b6bc9 100644 (file)
  */
 // q2map.h
 
+#include "globaldefs.h"
+
 /* platform-specific */
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        #define Q_UNIX
 #endif
 
@@ -31,7 +33,7 @@
        #include <limits.h>
 #endif
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        #include <windows.h>
 #endif
 
index 56ac1b2fa716b94ef40cda234593521fd88a04d3..d803354c8e9865f5cee54f662b1a0037d664427f 100644 (file)
@@ -38,6 +38,7 @@
 
  */
 
+#include "globaldefs.h"
 #include "cmdlib.h"
 #include "mathlib.h"
 #include "scriplib.h"
@@ -46,7 +47,7 @@
 #include "bspfile.h"
 #include "inout.h"
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
        #ifdef NDEBUG                           // Don't show in a Release build
                #pragma warning(disable : 4305)     // truncate from double to float
                #pragma warning(disable : 4244)     // conversion from double to float
index d8e3791e73767a78174a180a3ec37e209f7139c3..061a2e3feb8b5e07cdf83401f4134915062f2d63 100644 (file)
@@ -27,7 +27,7 @@
 
  */
 
-
+#include "globaldefs.h"
 #include "cmdlib.h"
 #include "mathlib.h"
 #include "bspfile.h"
 #include "lbmlib.h"
 #include "inout.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <windows.h>
 #endif
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
        #ifdef NDEBUG                           // Don't show in a Release build
                #pragma warning(disable : 4305)     // truncate from double to float
                #pragma warning(disable : 4244)     // conversion from double to float
index a509d00978663f96cba9b625a1ddb7bb1b58a131..7ee1e8c79892af987258e4e22cbb4ef4256be6d4 100644 (file)
 
  */
 
+#include "globaldefs.h"
 #include "cmdlib.h"
 #include "mathlib.h"
 #include "bspfile.h"
 #include "inout.h"
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
        #ifdef NDEBUG                           // Don't show in a Release build
                #pragma warning(disable : 4305)     // truncate from double to float
                #pragma warning(disable : 4244)     // conversion from double to float
index 50132690531cfbedc93e898c4e86a18cc477436a..c3923ad34ec0207a0d52563bf6cacdf9565f7e76 100644 (file)
@@ -212,7 +212,7 @@ void Cmd_File( void ){
 
    ===============
  */
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void PackDirectory_r( char *dir ){
        struct _finddata_t fileinfo;
index cb00003a4191515235d8f98073b092bb847fd977..bcb0e5ce25515c4f5888da3f03a899eab1bb7a01 100644 (file)
@@ -19,6 +19,7 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "globaldefs.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
@@ -34,7 +35,7 @@
 #include "l3dslib.h"
 #include "bspfile.h"
 
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
        #ifdef NDEBUG                           // Don't show in a Release build
                #pragma warning(disable : 4305)     // truncate from double to float
                #pragma warning(disable : 4244)     // conversion from double to float
index 514a1c7b16fd02d9f527a3c41bc42d03f20a7f1f..e67106ebe821d09220838e6f2011661e7341a38b 100644 (file)
 // Nurail: Swiped from quake3/common
 
 #include "cmdlib.h"
+#include "globaldefs.h"
 #include "mathlib.h"
 #include "inout.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 #include <windows.h>
 #endif
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #include <unistd.h>
 #endif
 
@@ -84,7 +85,7 @@ void *SafeMalloc( size_t n, char *desc ){
        return p;
 }
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 void strlwr( char *conv_str ){
        int i;
 
@@ -115,7 +116,7 @@ char archivedir[1024];
 #define MAX_EX_ARGC 1024
 int ex_argc;
 char    *ex_argv[MAX_EX_ARGC];
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void ExpandWildcards( int *argc, char ***argv ){
        struct _finddata_t fileinfo;
@@ -342,7 +343,7 @@ double I_FloatTime( void ){
 void Q_getwd( char *out ){
        int i = 0;
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        _getcwd( out, 256 );
        strcat( out, "\\" );
 #else
@@ -361,7 +362,7 @@ void Q_getwd( char *out ){
 
 
 void Q_mkdir( const char *path ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        if ( _mkdir( path ) != -1 ) {
                return;
        }
@@ -964,11 +965,7 @@ int ParseNum( const char *str ){
    ============================================================================
  */
 
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 short   LittleShort( short l ){
        byte b1,b2;
@@ -1140,7 +1137,7 @@ void    CreatePath( const char *path ){
        char c;
        char dir[1024];
 
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
        int olddrive = -1;
 
        if ( path[1] == ':' ) {
@@ -1163,7 +1160,7 @@ void    CreatePath( const char *path ){
                }
        }
 
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
        if ( olddrive != -1 ) {
                _chdrive( olddrive );
        }
@@ -1189,10 +1186,10 @@ void QCopyFile( const char *from, const char *to ){
 }
 
 void Sys_Sleep( int n ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        Sleep( n );
 #endif
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        usleep( n * 1000 );
 #endif
 }
index c94ce37744eb31283c43fee6e491d4fd7000835b..b66ccb77789d73516802da5c0d6d4b18106d48a8 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef __CMDLIB__
 #define __CMDLIB__
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4244)     // MIPS
 #pragma warning(disable : 4136)     // X86
 #pragma warning(disable : 4051)     // ALPHA
@@ -44,7 +44,7 @@
 #include <time.h>
 #include <stdarg.h>
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 
 #pragma intrinsic( memset, memcpy )
 
index 30ae39df7ee9026ae3cae5d94afff7083691c9de..165390de54f9630cd37642948ebafc9eff9bb3c4 100644 (file)
@@ -26,6 +26,7 @@
 // deal with in/out tasks, for either stdin/stdout or network/XML stream
 //
 
+#include "globaldefs.h"
 #include "cmdlib.h"
 #include "mathlib.h"
 #include "polylib.h"
@@ -33,7 +34,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 #include <windows.h>
 #endif
@@ -42,7 +43,7 @@
 #include "l_net/l_net.h"
 #include "libxml/tree.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 HWND hwndOut = NULL;
 qboolean lookedForServer = false;
 UINT wm_BroadcastCommand = -1;
index be0bd9a4a596a6c626312861879fc2ab64d33b18..80bf1527074fe7b0200f14eeb9a94dc53c2169f0 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef __INOUT__
 #define __INOUT__
 
+#include "globaldefs.h"
 // inout is the only stuff relying on xml, include the headers there
 #include "libxml/tree.h"
 #include "mathlib.h"
@@ -52,7 +53,7 @@ void Sys_Printf( const char *text, ... );
 void Sys_FPrintf( int flag, const char *text, ... );
 void Error( const char *error, ... );
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
 #define DBG_XML 1
 #endif
 
index 2fa7eabe710a28dbe3e57790504d7ed10ffe181f..ae61e4b3a9ce0a7364160e3c964153da50c7a33f 100644 (file)
@@ -94,8 +94,10 @@ void _VectorScale( vec3_t v, vec_t scale, vec3_t out ){
        out[2] = v[2] * scale;
 }
 
+#if GDEF_COMPILER_MSVC
 #pragma optimize("g", off)  // went back to turning optimization off,
                             // the bug_fix thing stopped working
+#endif
 
 vec_t VectorNormalize( vec3_t in, vec3_t out ){
        vec_t length, ilength;
@@ -136,7 +138,9 @@ vec_t ColorNormalize( vec3_t in, vec3_t out ){
        return max;
 }
 
+#if GDEF_COMPILER_MSVC
 #pragma optimize("", on)
+#endif
 
 void VectorInverse( vec3_t v ){
        v[0] = -v[0];
index afe5e9f02c5e76b61146213da7f553ec13377f92..ce5ef54019456af1dc830d7fd9bf7e9b3a071f13 100644 (file)
    Nurail: Swiped from Q3Map2
  */
 
+#include "globaldefs.h"
 
-
-/* marker */
-#define PATH_INIT_C
-
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        #define Q_UNIX
 #endif
 
index 3938807d54d1d8c73ea8fda5e4f801080da2e47e..31a6ca9f6faf0357ef387cebc7b40678db2cddf0 100644 (file)
@@ -19,7 +19,9 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef WIN32
+#include "globaldefs.h"
+
+#if !GDEF_OS_WINDOWS
 // The below define is necessary to use
 // pthreads extensions like pthread_mutexattr_settype
 #define _GNU_SOURCE
@@ -106,7 +108,7 @@ void RunThreadsOnIndividual( int workcnt, qboolean showpacifier, void ( *func )(
 
    ===================================================================
  */
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 #define USED
 
@@ -414,7 +416,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    =======================================================================
  */
 
-#ifdef __linux__
+#if GDEF_OS_LINUX
 #define USED
 
 int numthreads = 4;
index a3e06c0b9f29649f91c527accc3728f2767c02e6..e764a63ba33ffd8015e5e90596b33e829affb188 100644 (file)
@@ -148,7 +148,7 @@ void GetOneGroup( trigroup_t *tris, int grp, triangle_t* triangles );
 void ScaleTris( vec3_t min, vec3_t max, int Width, int Height, float* u, float* v, int verts );
 void NewDrawLine( int x1, int y1, int x2, int y2, unsigned char* picture, int width, int height );
 
-#ifndef _WIN32
+#if !GDEF_OS_WINDOWS
 
 void strupr( char *string ){
        int i;
index 3b07715a8abeb2a7f3ab36d672ffd0131b595ce5..6131c5d0c945b30607011eff4387cbf9c98b3e6a 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "qdata.h"
 
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
  #include <windows.h>
 #endif
 
index 074734e9b9b672bdc6508f5456cb0341dc3c42ec..960225f64685bcea46901562182df712a2fe383e 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef JOINTS_H
 #define JOINTS_H
 
+#include "globaldefs.h"
+
 #ifdef _HERETIC2_
 #include "angles.h"
 #endif
@@ -29,7 +31,7 @@
 //typedef float vec3_t[3];
 //typedef unsigned char byte;
 
-#ifndef _WIN32
+#if !GDEF_OS_WINDOWS
 #define stricmp strcasecmp
 #define strcmpi strcasecmp
 #endif
index 8e8934461f3d809cd2607ace5215f4306f71954e..0d095c442ab62ad7200f4e0eed2ab89135105b28 100644 (file)
@@ -71,5 +71,6 @@
 
 #define SHORT_TO_ANGLE  ( 360.0 / 65536 )
 
-
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4305)     // 'initializing' : truncation from 'const double ' to 'float '
+#endif
index 25bf5483ee3c54785cb5a5bea0960332822ff631..9ef9705b4a52a5000dd20d96d729effbe5cd55ee 100644 (file)
@@ -33,13 +33,7 @@ typedef struct ArrayedListNode_s
 
 #define ARRAYEDLISTNODE_NULL -1
 
-static
-#ifdef _WIN32
-_inline
-#else
-inline
-#endif
-int GetFreeNode( ArrayedListNode_t *nodeArray, int max ){
+static GDEF_ATTRIBUTE_INLINE int GetFreeNode( ArrayedListNode_t *nodeArray, int max ){
        int i;
 
        for ( i = 0; i < max; ++i )
@@ -54,13 +48,7 @@ int GetFreeNode( ArrayedListNode_t *nodeArray, int max ){
        return -1;
 }
 
-static
-#ifdef _WIN32
-_inline
-#else
-inline
-#endif
-void FreeNode( ArrayedListNode_t *nodeArray, int index ){
+static GDEF_ATTRIBUTE_INLINE void FreeNode( ArrayedListNode_t *nodeArray, int index ){
        nodeArray[index].inUse = 0;
 }
 
index a715927a3aaf7e1a1a64008755c75f501a929f9d..3e1f8f04c13805dc115ed177a60cd0496fdd6f1c 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "qdata.h"
+#include "globaldefs.h"
 #include "md4.h"
 
 void TK_Init();
@@ -202,7 +203,7 @@ void Cmd_File( void ){
 
    ===============
  */
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void PackDirectory_r( char *dir ){
        struct _finddata_t fileinfo;
index 2ead9751e2c191e3ba0c87e36e3048b77a6de013..67d97547b62baaeed0339f34814f9473d2117e97 100644 (file)
@@ -21,7 +21,7 @@
 
 // qdata.h
 
-
+#include "globaldefs.h"
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
@@ -38,7 +38,7 @@
 #include "l3dslib.h"
 #include "bspfile.h"
 
-#ifndef _WIN32
+#if !GDEF_OS_WINDOWS
 #define stricmp strcasecmp
 #define strcmpi strcasecmp
 #endif
index df9b986a845660b14c98352534b99e6501eea65b..314fdc5e90d1b3e0bea29a660033dcd544172170 100644 (file)
@@ -19,8 +19,8 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-
 #include "aselib.h"
+#include "globaldefs.h"
 #include "inout.h"
 
 #include <assert.h>
@@ -114,7 +114,7 @@ static char gl_filename[1024];
 static void ASE_Process( void );
 static void ASE_FreeGeomObject( int ndx );
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 
 static char* strlwr( char* string ){
        char *cp;
index 103047c029eb85e2542c86d7d199bbdff6fc14ab..6ff815abcb0b9295ea7122a328c21eb427a0714f 100644 (file)
 // replaced qprintf with Sys_Printf
 
 #include "cmdlib.h"
+#include "globaldefs.h"
 #include "mathlib.h"
 #include "inout.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 #include <windows.h>
 #endif
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #include <unistd.h>
 #endif
 
@@ -95,7 +96,7 @@ char archivedir[1024];
 #define MAX_EX_ARGC 1024
 int ex_argc;
 char    *ex_argv[MAX_EX_ARGC];
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void ExpandWildcards( int *argc, char ***argv ){
        struct _finddata_t fileinfo;
@@ -292,7 +293,7 @@ double I_FloatTime( void ){
 void Q_getwd( char *out ){
        int i = 0;
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        _getcwd( out, 256 );
        strcat( out, "\\" );
 #else
@@ -318,7 +319,7 @@ void Q_mkdir( const char *path ){
        int retry = 2;
        while ( retry-- )
        {
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
                const char *q = NULL;
                if ( _mkdir( path ) != -1 ) {
                        return;
@@ -882,11 +883,7 @@ int ParseNum( const char *str ){
    ============================================================================
  */
 
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
 
 short   LittleShort( short l ){
        byte b1,b2;
@@ -1058,7 +1055,7 @@ void    CreatePath( const char *path ){
        char c;
        char dir[1024];
 
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
        int olddrive = -1;
 
        if ( path[1] == ':' ) {
@@ -1081,7 +1078,7 @@ void    CreatePath( const char *path ){
                }
        }
 
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
        if ( olddrive != -1 ) {
                _chdrive( olddrive );
        }
@@ -1107,10 +1104,10 @@ void QCopyFile( const char *from, const char *to ){
 }
 
 void Sys_Sleep( int n ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        Sleep( n );
 #endif
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        usleep( n * 1000 );
 #endif
 }
index 701b30164c1ac840311dafd81873e7d6606a0191..9cbb5e5052385a5851fdadbee2a42d1a007db2e8 100644 (file)
@@ -25,8 +25,9 @@
 #define __CMDLIB__
 
 #include "bytebool.h"
+#include "globaldefs.h"
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 #pragma warning(disable : 4244)     // MIPS
 #pragma warning(disable : 4136)     // X86
 #pragma warning(disable : 4051)     // ALPHA
@@ -46,7 +47,7 @@
 #include <time.h>
 #include <stdarg.h>
 
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
 
 #pragma intrinsic( memset, memcpy )
 
@@ -97,11 +98,7 @@ void ExpandWildcards( int *argc, char ***argv );
 
 double I_FloatTime( void );
 
-void    Error( const char *error, ... )
-#ifdef __GNUC__
-__attribute__( ( noreturn ) )
-#endif
-;
+void    Error( const char *error, ... ) GDEF_ATTRIBUTE_NORETURN;
 int     CheckParm( const char *check );
 
 FILE    *SafeOpenWrite( const char *filename );
index 14e9eaafe5ffff974579c5bdd946a7a6ef46d755..f05b0bc9105e2f2994b0f43436be2d2631461f7b 100644 (file)
@@ -26,6 +26,7 @@
 // deal with in/out tasks, for either stdin/stdout or network/XML stream
 //
 
+#include "globaldefs.h"
 #include "cmdlib.h"
 #include "mathlib.h"
 #include "polylib.h"
@@ -33,7 +34,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <direct.h>
 #include <windows.h>
 #endif
@@ -45,7 +46,7 @@
 // utf8 conversion
 #include <glib.h>
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 HWND hwndOut = NULL;
 qboolean lookedForServer = qfalse;
 UINT wm_BroadcastCommand = -1;
index 4efe0dacb05953cf6b8cfe838ea42f75ba5ffb2e..10d399f7b75fbddce2cb46844fc2a36ae4179d81 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef __INOUT__
 #define __INOUT__
 
+#include "globaldefs.h"
 // inout is the only stuff relying on xml, include the headers there
 #include "libxml/tree.h"
 #include "mathlib.h"
@@ -51,7 +52,7 @@ extern qboolean verbose;
 void Sys_Printf( const char *text, ... );
 void Sys_FPrintf( int flag, const char *text, ... );
 
-#ifdef _DEBUG
+#if GDEF_DEBUG
 #define DBG_XML 1
 #endif
 
index d128a03145a822c5ceb598d10e2233ad2c26020b..1d0a354effbec20b41f4dd4cfc36eb50f15d7fe8 100644 (file)
@@ -19,7 +19,7 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-
+#include "globaldefs.h"
 #include "cmdlib.h"
 #include "qthreads.h"
 #include "mutex.h"
@@ -31,7 +31,7 @@
 
    ===================================================================
  */
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 #define USED
 
index b886cb8721a7c8ce5c4fd2096e4f002ddb5c714e..537732fbd7feb5faaf36658abd408d30f7c58281 100644 (file)
@@ -19,7 +19,8 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifndef WIN32
+#include "globaldefs.h"
+#if !GDEF_OS_WINDOWS
 // The below define is necessary to use
 // pthreads extensions like pthread_mutexattr_settype
 #define _GNU_SOURCE
@@ -116,7 +117,7 @@ void RunThreadsOnIndividual( int workcnt, qboolean showpacifier, void ( *func )(
 
    ===================================================================
  */
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 
 #define USED
 
@@ -424,7 +425,7 @@ void RunThreadsOn( int workcnt, qboolean showpacifier, void ( *func )( int ) ){
    =======================================================================
  */
 
-#if defined( __linux__ ) || ( defined( __APPLE__ ) && !MAC_STATIC_HACK )
+#if GDEF_OS_LINUX || ( GDEF_OS_MACOS && !MAC_STATIC_HACK )
 #define USED
 
 #include <unistd.h>
index d3ec168a18a931ec1f309ba20c7e9e1d72907662..76d35dce70cf878b2eba6be1194bb98017b51d25 100644 (file)
@@ -23,6 +23,7 @@
 // trilib.c: library for loading triangles from an Alias triangle file
 //
 
+#include "globaldefs.h"
 #include <stdio.h>
 #include "cmdlib.h"
 #include "mathlib.h"
@@ -38,7 +39,7 @@
 
 //#define NOISY 1
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #define strlwr strlower
 #endif
 
index bc80d727c2e5f062d5d5cfff1db4eb0c75e5116b..9026a29691506bd782d76dd46ad5bb4af745c7fa 100644 (file)
 #ifndef _VFS_H_
 #define _VFS_H_
 
+#include "globaldefs.h"
+
 // to get PATH_MAX
 #include <stdio.h>
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #include <dirent.h>
 #include <unistd.h>
 #else
index b4c7d93f4e454a56abb5e55fd6d05f6a55fa6bb1..4ad23e49e7274fd8bed13e9da7265102da42c670 100644 (file)
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "globaldefs.h"
 #include <assert.h>
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <io.h>
 #endif
 #include "md3lib.h"
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #define filelength(f) Q_filelength(f)
 #else
 #define filelength(f) filelength(fileno(f))
index 9de836146daac869e3927fc4e1eeb574b157ae1a..2abcea61c909b9bfdcf949011847d0267c610167 100644 (file)
@@ -20,8 +20,9 @@
  */
 
 #include "p3dlib.h"
+#include "globaldefs.h"
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
 #include <io.h>
 #endif
 #include <stdlib.h>
@@ -30,7 +31,7 @@
 
 #define MAX_POLYSETS 64
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        #include "cmdlib.h"
        #define _strcmpi Q_stricmp
        #define strlwr strlower
index f517beb0e47afa2a4749b9ff73a553de2d8f70e3..0544076b6456d9e1a73f73c15d218df026c08eff 100644 (file)
@@ -19,7 +19,8 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#ifdef WIN32
+#include "globaldefs.h"
+#if GDEF_OS_WINDOWS
 #include <io.h>
 #endif
 #include "q3data.h"
@@ -40,7 +41,7 @@ char *moddir = NULL;
 // some old defined that was in cmdlib lost during merge
 char writedir[1024];
 
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
 #define strlwr strlower
 #endif
 
@@ -301,7 +302,7 @@ void Cmd_File( void ){
 
    ===============
  */
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
 #include "io.h"
 void PackDirectory_r( char *dir ){
        struct _finddata_t fileinfo;
@@ -334,7 +335,7 @@ void PackDirectory_r( char *dir ){
 #else
 
 #include <sys/types.h>
-#ifndef WIN32
+#if !GDEF_OS_WINDOWS
 #include <sys/dir.h>
 #else
 #include <sys/dirent.h>
index d3a9432fe11cb0608f99026994c08424dd3a089b..f38d567943a9cb5a99f43af8cf08d26601fd75a9 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef Q3MAP2_H
 #define Q3MAP2_H
 
-
+#include "globaldefs.h"
 
 /* version */
 #ifndef Q3MAP_VERSION
@@ -50,7 +50,7 @@
    ------------------------------------------------------------------------------- */
 
 /* platform-specific */
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
        #define Q_UNIX
 #endif
 
@@ -60,7 +60,7 @@
        #include <limits.h>
 #endif
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        #include <windows.h>
 #endif
 
    ------------------------------------------------------------------------------- */
 
 #define MAC_STATIC_HACK         0
-#if defined( __APPLE__ ) && MAC_STATIC_HACK
+#if GDEF_OS_MACOS && MAC_STATIC_HACK
        #define MAC_STATIC          static
 #else
        #define MAC_STATIC
 #endif
 
 #if 1
-       #ifdef WIN32
+       #if GDEF_OS_WINDOWS
                #define Q_stricmp           stricmp
                #define Q_strncasecmp       strnicmp
        #else