Newer
Older
snipet / kyscript / trunk / lib / nstdc / include / nstdc_os.h
/**
 * @file nstdc_os.h
 * @brief  OS判定マクロを扱うヘッダーファイル
 * @author    Nomura Kei
 * @copyright 2003 - 2017  Nomura Kei
 *
 * 本ヘッダーファイルでは, OS 判定用のマクロを定義しています.
 * また, それぞれのOSにて(ほぼ)必須のヘッダーファイルを include します.
 */
#ifndef NSTDC_OS_H
#define NSTDC_OS_H

#include <nstdc.h>


/** OSが Windows か否かを示します.	*/
#if defined(_WIN32) || defined(__WIN32__) \
 || defined(_WIN64) || defined(__WIN64__)
#	define nstdc_is_windows()		(1)
/* DMC にて winsock2.h を使用する場合 _WINSOCKAPI_ が必要
 * @see http://www.digitalmars.com/d/archives/c++/idde/326.html
 */
#	ifdef __DMC__
#		define _WINSOCKAPI_
#		include <sys/types.h>
#	endif
#	include <winsock2.h>
#	include <windows.h>
#else
#	define nstdc_is_windows()		(0)
#endif


/** OSが Linux か否かを示します.	*/
#if defined(linux) || defined(__linux) || defined(__linux__)
#	define nstdc_is_linux()		(1)
#else
#	define nstdc_is_linux()		(0)
#endif


/** OSが UNIX互換 か否かを示します.	*/
#if defined(unix) || defined(__unix) || defined(__unix__)
#	define nstdc_is_unix()		(1)
#else
#	define nstdc_is_unix()		(0)
#endif


/** OSが BSD系 か否かを示します.	*/
#if defined(BSD) || defined(_BSD) || defined(__BSD)
#	define nstdc_is_bsd()		(1)
#else
#	define nstdc_is_bsd()		(0)
#endif


/** OSが Mac か否かを示します.	*/
#if defined(mac) || defined(MAC) || defined(_MAC)
#	define nstdc_is_mac()		(1)
#else
#	define nstdc_is_mac()		(0)
#endif


/** OSが VxWorks か否かを示します.	*/
#if defined(VXWORKS) || defined(VxWorks)
#	define nstdc_is_vxworks()	(1)
#else
#	define nstdc_is_vxworks()	(0)
#endif



#endif	/* NSTDC_OS_H	*/