#ifndef OSHEAD_H
#define OSHEAD_H

#if defined(__WIN32__)


/* ========================================================================
 * Win32 - specific system headers
 */

#ifdef	_MSC_VER
#pragma	warning(disable:4201)
#pragma	warning(disable:4214)
#pragma	warning(disable:4115)
#pragma	warning(disable:4514)
#pragma	warning(disable:4005)
#endif	/* _MSC_VER */

/*
 * Limits have to be defined in system headers; these #undef's are
 * really hacks, but I don't know another way to avoid possible conflicts.
 */

#ifdef	MAXCHAR
#undef	MAXCHAR
#endif	/* MAXCHAR */

#ifdef	MINCHAR
#undef	MINCHAR
#endif	/* MINCHAR */

#ifdef	MAXSHORT
#undef	MAXSHORT
#endif	/* MAXSHORT */

#ifdef	MINSHORT
#undef	MINSHORT
#endif	/* MINSHORT */

#ifdef	MAXLONG
#undef	MAXLONG
#endif	/* MAXLONG */

#ifdef	MINLONG
#undef	MINLONG
#endif	/* MINLONG */

#ifdef	MUST_DIE_DEAD
#ifndef	_WIN32_WINNT
#define	_WIN32_WINNT	0x0400
#endif	/* !_WIN32_WINNT */
#endif	/* MUST_DIE_DEAD */

#include <windows.h>

#ifdef	__CYGWIN32__
#include <../source/PAL/win32/cygwin/mmreg.h>
#include <../source/PAL/win32/cygwin/mmsystem.h>
#include <unistd.h>
#include <errno.h>
#include <dirent.h>
#include <io.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>
#else	/* !__CYGWIN32__ */
#include <mmsystem.h>
#include <io.h>
#include <sys/stat.h>
#include <direct.h>
#endif	/* !__CYGWIN32__ */

#ifdef	_MSC_VER
#pragma	warning(default:4201)
#pragma	warning(default:4214)
#pragma	warning(default:4115)
#pragma warning(default:4005)
#endif	/* _MSC_VER */

#if		defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
#pragma	hdrstop
#endif

#if		defined(MUST_DIE_DEAD) && defined(__CYGWIN32__)

/*
 * For broken CYGWIN headers
 */
BOOL __stdcall SwitchToThread(void);
BOOL __stdcall TryEnterCriticalSection(LPCRITICAL_SECTION lpcs);

#endif	/* defined(MUST_DIE_DEAD) && defined(__CYGWIN32__) */

#elif defined(__UNIX__) /* !__WIN32__ */

/* ========================================================================
 * UNIX - specific system headers
 */

/*
 * __LIBV__ is always defined here, so if we under Linux, then
 * pthread.h already included in v_lib.h
 */
#ifndef	__linux
#include <pthread.h>
#endif /* __linux */

#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <signal.h>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include <dlfcn.h>
#include <sys/io.h>
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/mman.h>

#ifdef	__linux
#include <linux/soundcard.h>
#elif	defined(__bsdi__) /* !__linux */
#include <sys/soundcard.h>
#else	/* !__bsdi__ */
#include <machine/soundcard.h>
#endif	/* !__bsdi__ */

#endif		/* defined(__UNIX__) */

#endif		/* OSHEAD_H */
