//////////////////////////////////////////////////////////////////////
#include "DBrush.h"
+#include "globaldefs.h"
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4786)
#endif
//////////////////////////////////////////////////////////////////////
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;
}
}
-#ifdef _DEBUG
+#if GDEF_DEBUG
// Sys_Printf("%i points on brush\n", pointList.size());
#endif
//////////////////////////////////////////////////////////////////////
#include "DEntity.h"
+#include "globaldefs.h"
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4786)
#endif
+#include <globaldefs.h>
#include "bsploader.h"
#include "dialogs/dialogs-gtk.h"
#include "cmdlib.h"
}
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;
}
*/
#include "funchandlers.h"
+#include "globaldefs.h"
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4786)
#endif
*/
#include "lists.h"
+#include "globaldefs.h"
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4786)
#endif
*/
#include "misc.h"
+#include "globaldefs.h"
#include <list>
#include "str.h"
#include "funchandlers.h"
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
#include <sys/types.h>
#include <unistd.h>
#endif
char* UnixToDosPath( char* path ){
-#ifndef WIN32
+#if !GDEF_OS_WINDOWS
return path;
#else
for ( char* p = path; *p; p++ )
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() )
// Error ("CreateProcess failed");
break;
case 0:
-#ifdef _DEBUG
+#if GDEF_DEBUG
printf( "Running system...\n" );
printf( "Command: %s\n", pCmd );
#endif
}
#endif
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#include <windows.h>
#include "export.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
#include "ibrush.h"
#include "iscenegraph.h"
// 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
}
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
}
*/
#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"
*/
#include "camera.h"
+#include "globaldefs.h"
void Sys_ERROR( char* text, ... ){
va_list argptr;
}
char* UnixToDosPath( char* path ){
-#ifndef WIN32
+#if !GDEF_OS_WINDOWS
return path;
#else
for ( char* p = path; *p; p++ )
}
void CDECL Com_DPrintf( const char* msg, ... ){
-#ifdef _DEBUG
+#if GDEF_DEBUG
va_list argptr;
char buf[32768];
// Filesystem
//
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4311)
#pragma warning(disable : 4312)
#endif
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 );
// common
#ifndef CDECL
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define CDECL __cdecl
#else
#define CDECL
#ifndef _GENSURF_H_
#define _GENSURF_H_
+#include "globaldefs.h"
#include <string.h>
#include "qertypes.h"
#include <stdio.h>
#define PLUGIN
#define Q3RADIANT
-//#if defined(__linux__) || defined(__APPLE__)
+//#if GDEF_OS_LINUX || GDEF_OS_MACOS
#if 1
#include <algorithm>
#else
*/
#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>
*/
#include "sunplug.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
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
*/
#include "ufoai_filters.h"
+#include "globaldefs.h"
#include "ibrush.h"
#include "ientity.h"
}
void visit( Face& face ) const {
-#if _DEBUG
+#if GDEF_DEBUG
if ( m_surfaceFlagsVis < 0 ) {
m_surfaceFlagsVis = face.getShader().m_flags.m_surfaceFlags;
}
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";
}
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";
}
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";
}
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";
}
#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
return GlobalOpenGLModule::getTable();
}
-#if defined( _DEBUG )
+#if GDEF_DEBUG
#define GlobalOpenGL_debugAssertNoErrors() GlobalOpenGL().assertNoErrors( __FILE__, __LINE__ )
#else
#define GlobalOpenGL_debugAssertNoErrors()
#if !defined( INCLUDED_IPATCH_H )
#define INCLUDED_IPATCH_H
+#include "globaldefs.h"
#include "debugging/debugging.h"
#include "generic/constant.h"
#include "generic/vector.h"
}
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 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];
#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
}
}
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;
}
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;
#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
entityxml.h
fs_filesystem.h
fs_path.h
+ globaldefs.h
imagelib.h
instancelib.h
maplib.h
#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
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>
#ifndef __CMDLIB__
#define __CMDLIB__
+#include "globaldefs.h"
#include <time.h>
// 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;
//
#include "cmdlib.h"
+#include "globaldefs.h"
#include <string.h>
#include <stdio.h>
#include "container/array.h"
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
#include <unistd.h>
#include <sys/types.h>
char fullcmd[2048];
char *pCmd;
pid_t pid;
-#ifdef _DEBUG
+#if GDEF_DEBUG
printf( "Q_Exec damnit\n" );
#endif
switch ( ( pid = fork() ) )
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 );
return true;
}
-#elif defined( WIN32 )
+#elif GDEF_OS_WINDOWS
#include <windows.h>
#if !defined( INCLUDED_CONTAINER_ARRAY_H )
#define INCLUDED_CONTAINER_ARRAY_H
+#include "globaldefs.h"
#include <cstddef>
#include <algorithm>
}
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];
*/
#include "hashtable.h"
+#include "globaldefs.h"
-#if defined( _DEBUG ) || defined( DOXYGEN )
+#if GDEF_DEBUG || defined( DOXYGEN )
#include "hashfunc.h"
/* dependencies */
#include "ddslib.h"
-
-
+#include "globaldefs.h"
/* endian tomfoolery */
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; }
/// \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>
#define STR2( x ) STR( x )
#define FILE_LINE __FILE__ ":" STR2( __LINE__ )
-#if defined( _DEBUG ) || 1
#define DEBUG_ASSERTS
-#endif
class DebugMessageHandler
{
return globalErrorStream();
}
virtual bool handleMessage(){
-#if defined( _DEBUG )
+#if GDEF_DEBUG
return false; // send debug-break
#else
return true;
*/
#include "callback.h"
+#include "globaldefs.h"
-#if defined( _DEBUG ) || defined( DOXYGEN )
+#if GDEF_DEBUG || defined( DOXYGEN )
namespace ExampleMemberCaller
{
*/
#include "constant.h"
+#include "globaldefs.h"
-#if defined( _DEBUG ) || defined( DOXYGEN )
+#if GDEF_DEBUG || defined( DOXYGEN )
namespace ExampleConstant
{
#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
*/
#include "static.h"
+#include "globaldefs.h"
-#if defined( _DEBUG ) || defined( DOXYGEN )
+#if GDEF_DEBUG || defined( DOXYGEN )
namespace ExampleStatic
{
--- /dev/null
+#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
#include "clipboard.h"
+#include "globaldefs.h"
#include "stream/memstream.h"
#include "stream/textstream.h"
/// \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";
*/
#include "glfont.h"
+#include "globaldefs.h"
#include "igl.h"
// generic string printing with call lists
}
};
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
#include <windows.h>
#endif
#include "debugging/debugging.h"
// Notes:
//====================================================================
+#include "globaldefs.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#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];
// 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 );
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;
/// \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;
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 );
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
*/
#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 )
#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 )
#if !defined ( INCLUDED_OS_PATH_H )
#define INCLUDED_OS_PATH_H
+#include "globaldefs.h"
+
/// \file
/// \brief OS file-system path comparison, decomposition and manipulation.
///
#include "string/string.h"
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
#define OS_CASE_INSENSITIVE
#endif
/// \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
}
#include "../picointernal.h"
#include "lwo2.h"
#include <limits.h>
+#include "globaldefs.h"
/*
int get_flen( void ) { return flen; }
-#ifndef __BIG_ENDIAN__
+#if !GDEF_ARCH_ENDIAN_BIG
/*
=====================================================================
revbytes()
#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
#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 ) )
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 )
#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
/* dependencies */
#include <string.h>
#include "picointernal.h"
+#include "globaldefs.h"
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; }
#ifndef PICOINTERNAL_H
#define PICOINTERNAL_H
+#include "globaldefs.h"
+
#ifdef __cplusplus
extern "C"
{
/* os dependent replacements */
-#if WIN32 || _WIN32
+#if GDEF_OS_WINDOWS
#define _pico_stricmp stricmp
#define _pico_strnicmp strnicmp
#else
/* dependencies */
#include "picointernal.h"
+#include "globaldefs.h"
/* disable warnings */
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning( disable:4100 ) /* unref param */
#endif
/* dependencies */
#include "picointernal.h"
+#include "globaldefs.h"
/* disable warnings */
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning( disable:4100 ) /* unref param */
#endif
#if !defined ( INCLUDED_SCENELIB_H )
#define INCLUDED_SCENELIB_H
+#include "globaldefs.h"
#include "iscenegraph.h"
#include "iselection.h"
}
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;
}
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;
#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;
#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
}
B = x;
-#ifdef __GNUC__
+#if GDEF_COMPILER_GNU
asm ( "frsqrte %0,%1" : "=f" ( y0 ) : "f" ( B ) );
#else
y0 = __frsqrte( B );
#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
#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 )
// 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
//======================= 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"
// 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"
#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
strncpy( dst, buffer, size - 1 );
}
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4189) // local variable is initialized but not referenced
#endif
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
#include <string.h>
#include <stdio.h>
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4710) // function 'blah' not inlined
#endif
#ifndef __STR__
#define __STR__
+#include "globaldefs.h"
+
//
// class Str
// loose replacement for CString from MFC
#include <cstdio>
-#ifdef _MSC_VER
+#if GDEF_COMPILER_MSVC
#define strcasecmp strcmpi
#if _MSC_VER < 1400
#define vsnprintf std::vsnprintf
return strcpy( new char[strlen( pStr ) + 1], pStr );
}
-#if !defined( WIN32 )
+#if !GDEF_OS_WINDOWS
#define strcmpi strcasecmp
#define stricmp strcasecmp
#define strnicmp strncasecmp
#if !defined( INCLUDED_STREAM_TEXTSTREAM_H )
#define INCLUDED_STREAM_TEXTSTREAM_H
+#include "globaldefs.h"
+
/// \file
/// \brief Text-output-formatting.
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 )
{
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 ) {
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';
}
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define snprintf _snprintf
#endif
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>
#include "pooledstring.h"
+#include "globaldefs.h"
#include "generic/static.h"
-#if defined( _DEBUG )
+#if GDEF_DEBUG
namespace ExamplePooledString
{
} always;
}
-#endif
\ No newline at end of file
+#endif
#if !defined( INCLUDED_STRING_STRING_H )
#define INCLUDED_STRING_STRING_H
+#include "globaldefs.h"
+
/// \file
/// C-style null-terminated-character-array string library.
/// 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 );
/// 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 );
#if !defined( INCLUDED_MODEL_H )
#define INCLUDED_MODEL_H
+#include "globaldefs.h"
#include "cullable.h"
#include "renderable.h"
#include "selectable.h"
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 )
*/
#include "model.h"
+#include "globaldefs.h"
#include "picomodel.h"
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(
//
#include "shaders.h"
+#include "globaldefs.h"
#include <stdio.h>
#include <stdlib.h>
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
}
// 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"
//
#include "vfs.h"
+#include "globaldefs.h"
#include <stdio.h>
#include <stdlib.h>
const int VFS_MAXDIRS = 64;
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
#define PATH_MAX 260
#endif
#include <uilib/uilib.h>
#include "autosave.h"
+#include "globaldefs.h"
#include "os/file.h"
#include "os/path.h"
#include "preferences.h"
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
#define PATH_MAX 260
#endif
*/
#include "brush_primit.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
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
*/
#include "environment.h"
+#include "globaldefs.h"
#include "stream/textstream.h"
#include "string/string.h"
// 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 ) )
return false;
}
-#if defined( POSIX )
+#if GDEF_OS_POSIX
#include <stdlib.h>
#include <pwd.h>
#include <glib.h>
const char* LINK_NAME =
-#if defined ( __linux__ )
+#if GDEF_OS_LINUX
"/proc/self/exe"
#else // FreeBSD and OSX
"/proc/curproc/file"
gamedetect();
}
-#elif defined( WIN32 )
+#elif GDEF_OS_WINDOWS
#include <windows.h>
*/
#include "error.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
#include "igl.h"
#include "preferences.h"
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define UNICODE
#include <windows.h>
#else
strcat( text, "\n" );
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
if ( GetLastError() != 0 ) {
LPVOID lpMsgBuf;
FormatMessage(
//
#include "groupdialog.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
m_window = window;
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
if ( g_multimon_globals.m_bStartOnPrimMon ) {
WindowPosition pos( m_position_tracker.getPosition() );
PositionWindowOnPrimaryScreen( pos );
//
#include "gtkdlgs.h"
+#include "globaldefs.h"
#include <gtk/gtk.h>
// trying to show later
text_editor.show();
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
ui::process();
#endif
gtk_text_buffer_place_cursor( text_buffer, &text_iter );
}
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
gtk_widget_queue_draw( text_widget );
#endif
-#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
#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 );
#if !defined( INCLUDED_GTKDLGS_H )
#define INCLUDED_GTKDLGS_H
+#include "globaldefs.h"
#include "qerplugin.h"
#include "string/string.h"
void DoAbout();
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
extern bool g_TextEditor_useWin32Editor;
#else
#include "string/stringfwd.h"
*/
#include "main.h"
+#include "globaldefs.h"
#include "version.h"
#include "referencecache.h"
#include "stacktrace.h"
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#include <windows.h>
#endif
}
}
-#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
}
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();
// 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
}
// 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"
}
// 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"
streams_init();
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
HMODULE lib;
lib = LoadLibrary( "dwmapi.dll" );
if ( lib != 0 ) {
//
#include "mainframe.h"
+#include "globaldefs.h"
#include <gtk/gtk.h>
// 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}};
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() ) ) {
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" );
}
#endif
-#if defined( POSIX )
+#if GDEF_OS_POSIX
path.clear();
path << DirectoryCleaned( g_get_home_dir() ) << prefix << "/";
g_qeglobals.m_userEnginePath = path.c_str();
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
;
#endif
}
-#ifdef _DEBUG
+#if GDEF_DEBUG
//#define DBG_SLEEP
#endif
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 ) {
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 );
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
{
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"
#if !defined( INCLUDED_MULTIMON_H )
#define INCLUDED_MULTIMON_H
+#include "globaldefs.h"
+
struct WindowPosition;
void PositionWindowOnPrimaryScreen( WindowPosition& position );
extern multimon_globals_t g_multimon_globals;
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
void MultiMon_Construct();
void MultiMon_Destroy();
#else
/// 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"
}
}
-#if defined( _DEBUG )
+#if GDEF_DEBUG
RenderNormals();
#endif
}
//
#include "preferences.h"
+#include "globaldefs.h"
#include <gtk/gtk.h>
#include "environment.h"
}
void Interface_constructPreferences( PreferencesPage& page ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
page.appendCheckBox( "", "Default Text Editor", g_TextEditor_useWin32Editor );
#else
{
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 ) );
//
#include "qe3.h"
+#include "globaldefs.h"
#include <gtk/gtk.h>
QEGlobals_t g_qeglobals;
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
#define PATH_MAX 260
#endif
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
{
TextFileOutputStream batchFile( batpath );
if ( !batchFile.failed() ) {
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
batchFile << "#!/bin/sh \n\n";
#endif
BatchCommandListener listener( batchFile, junkpath );
}
}
if ( written ) {
-#if defined ( POSIX )
+#if GDEF_OS_POSIX
chmod( batpath, 0744 );
#endif
globalOutputStream() << "Writing the compile script to '" << batpath << "'\n";
#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
-#if defined( _WIN32 )
+#if GDEF_OS_WINDOWS
#include <wtypes.h>
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>
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
}
extensions = GlobalOpenGL().m_glGetString( GL_EXTENSIONS );
-#ifndef __APPLE__
+#if !GDEF_OS_MACOS
if ( !extensions ) {
return false;
}
{
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);
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
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
*/
#include "referencecache.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
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 );
*/
#include "selection.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
}
-#if defined( _DEBUG )
+#if GDEF_DEBUG
class test_quat
{
public:
}
};
-#if defined( _DEBUG )
+#if GDEF_DEBUG
#define DEBUG_SELECTION
#endif
*/
#include "server.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
#include "warnings.h"
};
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
#include <windows.h>
}
};
-#elif defined( POSIX )
+#elif GDEF_OS_POSIX
#include <dlfcn.h>
-
#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;
*/
#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 ){
free( symbol_names );
}
}
-#elif defined ( WIN32 ) && defined ( _MSC_VER )
+#elif GDEF_COMPILER_MSVC
#include "windows.h"
#include "winnt.h"
}
}
-#elif defined ( WIN32 )
+#elif GDEF_OS_WINDOWS
void write_stack_trace( TextOutputStream& outputStream ){
outputStream << "\nStacktrace is disabled on this compiler\n";
}
*/
#include "timer.h"
+#include "globaldefs.h"
-#if defined( WIN32 )
+#if GDEF_OS_WINDOWS
#include <windows.h>
-#elif defined( POSIX )
+#elif GDEF_OS_POSIX
#include <time.h>
#include "sys/time.h"
*/
#include "treemodel.h"
+#include "globaldefs.h"
#include "debugging/debugging.h"
}
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;
*/
#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>
}
#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];
}
#endif
-#ifdef __APPLE__
+#if GDEF_OS_MACOS
#include <stdlib.h>
bool open_url( const char* url ){
char command[2 * PATH_MAX];
#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
// monitoring window for running BSP processes (and possibly various other stuff)
#include "watchbsp.h"
+#include "globaldefs.h"
#include <algorithm>
}
if ( data->recurse == data->stop_depth ) {
message_flush( data );
-#ifdef _DEBUG
+#if GDEF_DEBUG
globalOutputStream() << "Received error msg .. shutting down..\n";
#endif
GetWatchBSP()->EndMonitoringLoop();
}
bool CWatchBSP::SetupListening(){
-#ifdef _DEBUG
+#if GDEF_DEBUG
if ( m_pListenSocket ) {
globalOutputStream() << "ERROR: m_pListenSocket != NULL in CWatchBSP::SetupListening\n";
return false;
}
-#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
#endif
return;
}
-#ifdef _DEBUG
+#if GDEF_DEBUG
// some debug checks
if ( !m_pListenSocket ) {
globalErrorStream() << "ERROR: m_pListenSocket == NULL in CWatchBSP::RoutineProcessing EBeginStep state\n";
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";
// 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
#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;
void Q_getwd( char *out ){
int i = 0;
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
_getcwd( out, 256 );
strcat( out, "\\" );
#else
void Q_mkdir( const char *path ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
if ( _mkdir( path ) != -1 ) {
return;
}
============================================================================
*/
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
short LittleShort( short l ){
byte b1,b2;
char c;
char dir[1024];
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
int olddrive = -1;
if ( path[1] == ':' ) {
}
}
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
if ( olddrive != -1 ) {
_chdrive( olddrive );
}
}
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
}
#ifndef __CMDLIB__
#define __CMDLIB__
+#include "globaldefs.h"
+
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#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
#endif
#endif
-#ifdef WIN32
+#if GDEF_COMPILER_MSVC
#pragma intrinsic( memset, memcpy )
#endif
// 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"
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#include <direct.h>
#include <windows.h>
#endif
#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;
#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"
void Sys_FPrintf( int flag, const char *text, ... );
void Error( const char *error, ... );
-#ifdef _DEBUG
+#if GDEF_DEBUG
#define DBG_XML 1
#endif
*/
+#include "globaldefs.h"
-
-/* marker */
-#define PATH_INIT_C
-
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
#define Q_UNIX
#endif
========================================================================
*/
-#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
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
===================================================================
*/
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define USED
=======================================================================
*/
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
#define USED
// Setting default Threads to 1
===========================================================================
*/
+#include "globaldefs.h"
#include "cmdlib.h"
#include "mathlib.h"
#include "bspfile.h"
#include "threads.h"
#include "lbmlib.h"
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#include <windows.h>
#endif
// 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
#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)
{
void Q_getwd (char *out)
{
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
_getcwd (out, 256);
strcat (out, "\\");
#else
void Q_mkdir (char *path)
{
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
if (_mkdir (path) != -1)
return;
#else
============================================================================
*/
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
short LittleShort (short l)
{
#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
#include "cmdlib.h"
#include "threads.h"
+#include "globaldefs.h"
#define MAX_THREADS 64
===================================================================
*/
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define USED
===============
*/
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
#include "io.h"
void PackDirectory_r (char *dir)
{
// cmdlib.c
#include "cmdlib.h"
+#include "globaldefs.h"
#define PATHSEPERATOR '/'
============================================================================
*/
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
short LittleShort (short l)
{
//
//*************************************************************
+#include "globaldefs.h"
#include <windows.h>
#include <windowsx.h>
#include <string.h>
return TRUE;
}
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
BOOL IsWin395OrHigher(void)
{
#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
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);
#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>
*/
// q2map.h
+#include "globaldefs.h"
+
/* platform-specific */
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
#define Q_UNIX
#endif
#include <limits.h>
#endif
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#include <windows.h>
#endif
*/
+#include "globaldefs.h"
#include "cmdlib.h"
#include "mathlib.h"
#include "scriplib.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
*/
-
+#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
*/
+#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
===============
*/
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
#include "io.h"
void PackDirectory_r( char *dir ){
struct _finddata_t fileinfo;
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "globaldefs.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#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
// 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
return p;
}
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
void strlwr( char *conv_str ){
int i;
#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;
void Q_getwd( char *out ){
int i = 0;
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
_getcwd( out, 256 );
strcat( out, "\\" );
#else
void Q_mkdir( const char *path ){
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
if ( _mkdir( path ) != -1 ) {
return;
}
============================================================================
*/
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
short LittleShort( short l ){
byte b1,b2;
char c;
char dir[1024];
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
int olddrive = -1;
if ( path[1] == ':' ) {
}
}
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
if ( olddrive != -1 ) {
_chdrive( olddrive );
}
}
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
}
#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
#include <time.h>
#include <stdarg.h>
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
#pragma intrinsic( memset, memcpy )
// 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"
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#include <direct.h>
#include <windows.h>
#endif
#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;
#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"
void Sys_FPrintf( int flag, const char *text, ... );
void Error( const char *error, ... );
-#ifdef _DEBUG
+#if GDEF_DEBUG
#define DBG_XML 1
#endif
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;
return max;
}
+#if GDEF_COMPILER_MSVC
#pragma optimize("", on)
+#endif
void VectorInverse( vec3_t v ){
v[0] = -v[0];
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
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
===================================================================
*/
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define USED
=======================================================================
*/
-#ifdef __linux__
+#if GDEF_OS_LINUX
#define USED
int numthreads = 4;
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;
#include "qdata.h"
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
#include <windows.h>
#endif
#ifndef JOINTS_H
#define JOINTS_H
+#include "globaldefs.h"
+
#ifdef _HERETIC2_
#include "angles.h"
#endif
//typedef float vec3_t[3];
//typedef unsigned char byte;
-#ifndef _WIN32
+#if !GDEF_OS_WINDOWS
#define stricmp strcasecmp
#define strcmpi strcasecmp
#endif
#define SHORT_TO_ANGLE ( 360.0 / 65536 )
-
+#if GDEF_COMPILER_MSVC
#pragma warning(disable : 4305) // 'initializing' : truncation from 'const double ' to 'float '
+#endif
#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 )
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;
}
*/
#include "qdata.h"
+#include "globaldefs.h"
#include "md4.h"
void TK_Init();
===============
*/
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
#include "io.h"
void PackDirectory_r( char *dir ){
struct _finddata_t fileinfo;
// qdata.h
-
+#include "globaldefs.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "l3dslib.h"
#include "bspfile.h"
-#ifndef _WIN32
+#if !GDEF_OS_WINDOWS
#define stricmp strcasecmp
#define strcmpi strcasecmp
#endif
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
#include "aselib.h"
+#include "globaldefs.h"
#include "inout.h"
#include <assert.h>
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;
// 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
#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;
void Q_getwd( char *out ){
int i = 0;
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
_getcwd( out, 256 );
strcat( out, "\\" );
#else
int retry = 2;
while ( retry-- )
{
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
const char *q = NULL;
if ( _mkdir( path ) != -1 ) {
return;
============================================================================
*/
-#ifdef _SGI_SOURCE
-#define __BIG_ENDIAN__
-#endif
-
-#ifdef __BIG_ENDIAN__
+#if GDEF_ARCH_ENDIAN_BIG
short LittleShort( short l ){
byte b1,b2;
char c;
char dir[1024];
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
int olddrive = -1;
if ( path[1] == ':' ) {
}
}
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
if ( olddrive != -1 ) {
_chdrive( olddrive );
}
}
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
}
#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
#include <time.h>
#include <stdarg.h>
-#ifdef _WIN32
+#if GDEF_COMPILER_MSVC
#pragma intrinsic( memset, memcpy )
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 );
// 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"
#include <sys/types.h>
#include <sys/stat.h>
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#include <direct.h>
#include <windows.h>
#endif
// utf8 conversion
#include <glib.h>
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
HWND hwndOut = NULL;
qboolean lookedForServer = qfalse;
UINT wm_BroadcastCommand = -1;
#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"
void Sys_Printf( const char *text, ... );
void Sys_FPrintf( int flag, const char *text, ... );
-#ifdef _DEBUG
+#if GDEF_DEBUG
#define DBG_XML 1
#endif
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
+#include "globaldefs.h"
#include "cmdlib.h"
#include "qthreads.h"
#include "mutex.h"
===================================================================
*/
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define USED
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
===================================================================
*/
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#define USED
=======================================================================
*/
-#if defined( __linux__ ) || ( defined( __APPLE__ ) && !MAC_STATIC_HACK )
+#if GDEF_OS_LINUX || ( GDEF_OS_MACOS && !MAC_STATIC_HACK )
#define USED
#include <unistd.h>
// trilib.c: library for loading triangles from an Alias triangle file
//
+#include "globaldefs.h"
#include <stdio.h>
#include "cmdlib.h"
#include "mathlib.h"
//#define NOISY 1
-#if defined ( __linux__ ) || defined ( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
#define strlwr strlower
#endif
#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
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))
*/
#include "p3dlib.h"
+#include "globaldefs.h"
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
#include <io.h>
#endif
#include <stdlib.h>
#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
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"
// 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
===============
*/
-#ifdef _WIN32
+#if GDEF_OS_WINDOWS
#include "io.h"
void PackDirectory_r( char *dir ){
struct _finddata_t fileinfo;
#else
#include <sys/types.h>
-#ifndef WIN32
+#if !GDEF_OS_WINDOWS
#include <sys/dir.h>
#else
#include <sys/dirent.h>
#ifndef Q3MAP2_H
#define Q3MAP2_H
-
+#include "globaldefs.h"
/* version */
#ifndef Q3MAP_VERSION
------------------------------------------------------------------------------- */
/* platform-specific */
-#if defined( __linux__ ) || defined( __APPLE__ )
+#if GDEF_OS_LINUX || GDEF_OS_MACOS
#define Q_UNIX
#endif
#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