2001-10-06 18:13:28 +04:00
|
|
|
#ifndef COMMON_H
|
|
|
|
#define COMMON_H
|
|
|
|
|
2002-07-26 22:28:18 +04:00
|
|
|
// this file should be included, directly or indirectly by every other.
|
|
|
|
|
2002-06-19 15:23:49 +04:00
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
2002-06-14 22:08:20 +04:00
|
|
|
#endif
|
|
|
|
|
2002-06-19 15:23:49 +04:00
|
|
|
// check if win32 platform
|
|
|
|
#if defined(_WIN32) || HAVE_WINDOWS_H
|
|
|
|
# define WINDOWS_LIKE 1
|
|
|
|
|
|
|
|
// VC++ specific
|
|
|
|
# if (_MSC_VER >= 1200)
|
|
|
|
// work around for statement scoping bug
|
|
|
|
# define for if (false) { } else for
|
|
|
|
|
|
|
|
// turn off bonehead warnings
|
|
|
|
# pragma warning(disable: 4786) // identifier truncated in debug info
|
|
|
|
# pragma warning(disable: 4514) // unreferenced inline function removed
|
|
|
|
|
|
|
|
// this one's a little too aggressive
|
|
|
|
# pragma warning(disable: 4127) // conditional expression is constant
|
|
|
|
|
|
|
|
// emitted incorrectly under release build in some circumstances
|
|
|
|
# if defined(NDEBUG)
|
|
|
|
# pragma warning(disable: 4702) // unreachable code
|
|
|
|
# pragma warning(disable: 4701) // variable maybe used uninitialized
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# endif // (_MSC_VER >= 1200)
|
|
|
|
|
|
|
|
// VC++ has built-in sized types
|
|
|
|
# if defined(_MSC_VER)
|
|
|
|
# define TYPE_OF_SIZE_1 __int8
|
|
|
|
# define TYPE_OF_SIZE_2 __int16
|
|
|
|
# define TYPE_OF_SIZE_4 __int32
|
|
|
|
# else
|
|
|
|
# define SIZE_OF_CHAR 1
|
|
|
|
# define SIZE_OF_SHORT 2
|
|
|
|
# define SIZE_OF_INT 4
|
|
|
|
# define SIZE_OF_LONG 4
|
|
|
|
# endif
|
|
|
|
#endif // defined(_WIN32) || HAVE_WINDOWS_H
|
|
|
|
|
|
|
|
// unix-like if not like anything else
|
|
|
|
#if (!defined(WINDOWS_LIKE) || WINDOWS_LIKE == 0)
|
|
|
|
# define UNIX_LIKE 1
|
2001-10-06 18:13:28 +04:00
|
|
|
#endif
|
|
|
|
|
2002-06-19 15:23:49 +04:00
|
|
|
// define NULL
|
2001-10-06 18:13:28 +04:00
|
|
|
#ifndef NULL
|
|
|
|
#define NULL 0
|
|
|
|
#endif
|
|
|
|
|
2002-06-19 15:23:49 +04:00
|
|
|
// make assert available since we use it a lot
|
|
|
|
#include <assert.h>
|
2002-06-11 02:06:45 +04:00
|
|
|
|
2001-10-06 18:13:28 +04:00
|
|
|
#endif
|