// For MSC, change the precompiled header mode to automatic (/YX)
#if defined(_WIN32) && defined(_MSC_VER)
#define XP_WIN
#define __MSC__
#endif

#if defined( __MWERKS__ ) /* probably win32 or macintosh */
 #ifdef _Windows
  #define XP_WIN
  #undef __MSC__
 #endif
 #ifdef macintosh
  #define XP_MAC
 #endif
#endif

#if defined(__WIN32__) || defined (__WIN64__) || defined(WIN32) || defined(WIN64) || defined(_Windows)
 #ifndef XP_WIN
  #define XP_WIN
 #endif
#endif

#ifdef __MSC__
  #define MAXPATH 1024
#endif

#ifdef __GNUC__
  #define MAXPATH 1024
#endif

#ifdef __MWERKS__
  #define MAXPATH 1024
#endif

#define __import
#define __far
#if !defined(FAR) && !defined(__MSC__)
  #define FAR far
#endif
#ifndef HUGE
  #define HUGE
#endif
#define NOT_FOUND ULONG_MAX
#define NO_COUNT ULONG_MAX

/* Microsoft VC */
#if defined (XP_WIN) && defined(__MSC__) && !defined(__MWERKS__)
  #pragma warning (disable: 4800 )
  #pragma warning (disable: 4068 )
  #if _MSC_VER >= 1000
  #pragma once
  #endif
  #define VC_EXTRALEAN
  #include <afxwin.h>
  #include <afxext.h>
  #ifndef _AFX_NO_AFXCMN_SUPPORT
  #include <afxcmn.h>
  #endif
  #include <windows.h>
  #include <winnt.h>
  #include <winbase.h>
  #include <direct.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <new.h>

  #if _MSC_VER >= 1200 /* MSVC version 6 */
   #define _HAS_INT64
  #endif
#endif

/* CodeWarrior for Windows */
#if defined(__MWERKS__) && defined(XP_WIN)
  #include <size_t.h>
  #include <null.h>
  #include <windows.h>
  #include <winnt.h>
  #include <winbase.h>
  #include <direct.h>
#endif

#ifdef __MWERKS__
#define random(x) (rand() % x)
#define strncasecmp strnicmp
#define strcasecmp stricmp
#define FRIEND friend class
#endif

/* Borland C++ */
#if defined(__BORLANDC__) && defined (XP_WIN)
/* we don't trust strcmp or stricmp */
  #if (__BORLANDC__ < 0x550)
    #include <winsys/defs.h>
    #include <services/wsysinc.h>
  #endif
  #include <windows.h>
  #include <winbase.h>
  #include <winnt.h>
  #if (__BORLANDC__ < 0x550)
    #include <services/memory.h>
  #endif
  #include <fcntl.h>
  #include <sys/stat.h>
  #define strncasecmp strnicmp
  #define strcasecmp stricmp
  #if defined (_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS >= 64)
    #define _HAS_INT64
  #endif
#endif

#ifdef __GNUC__
#ifdef XP_WIN
  #include <windows.h>
  #include <winbase.h>
  #include <winnt.h>
  #include <objbase.h>
  #define strncasecmp strnicmp
  #define strcasecmp stricmp
#endif
  #include <fcntl.h>
  #include <sys/stat.h>
  #define FRIEND friend class
#endif

#ifndef FRIEND
  #define FRIEND friend
#endif

#if !defined(XP_WIN) && !defined(XP_MAC) && !defined(XP_UNIX)
#define XP_UNIX
#endif

#if !defined(_HAS_INT64) && defined(XP_UNIX)
 #define _HAS_INT64
 typedef unsigned long long uint64;
 typedef long long int64;
#else
#ifdef _HAS_INT64
#ifdef XP_WIN
typedef unsigned __int64 uint64;
typedef __int64 int64;
#else
typedef unsigned long long uint64;
typedef long long int64;
#endif
#endif
#endif

#ifdef XP_WIN
typedef signed long int32;
typedef unsigned long uint32;
#else
typedef signed int int32;
typedef unsigned int uint32;
#endif
typedef signed short int16 ;
typedef unsigned short uint16;
typedef signed char int8 ;
typedef unsigned char uint8;
#ifndef _SIZE_T
typedef unsigned int size_t;
#endif
typedef unsigned long count_t;

#ifndef NULL
#define NULL 0
#endif
