⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 osconfig.h

📁 mini http server,可以集成嵌入到程序中,实现简单的web功能
💻 H
字号:
/*____________________________________________________________________________*\
 *

 Copyright (c) 1997-2003 John Roy, Holger Zimmermann. All rights reserved.

 These sources, libraries and applications are
 FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
 as long as the following conditions are adhered to.

 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
 are met:

 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer. 

 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in
    the documentation and/or other materials provided with the
    distribution.

 3. The name of the author may not be used to endorse or promote products
    derived from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 OF THE POSSIBILITY OF SUCH DAMAGE.

 *____________________________________________________________________________*|
 *
 * $Source: /cvsroot/pi3web/Pi3Web_200/Source/Platform/OSConfig.h,v $
 * $Date: 2003/05/13 18:42:14 $
 *
 Description:
	Configure various macros to turn on and off compilation of
	platform specific features depending on the operating system machine.
\*____________________________________________________________________________*/
//$HeaderTop:$

#ifndef OSCONFIG_H_
#define OSCONFIG_H_

/* --- include the generated sysspec.hh file --- */
#include "../sysspec.hh"

/*____________________________________________________________________________*\
 *
 Flags which depend on the operating system 

 Macros:
	CONFIG_OS_POSIX		  	essentially a POSIX compliant os
	CONFIG_OS_WIN32			use microsoft Win32 API
	CONFIG_MULTITHREADED	os supports threading
	CONFIG_MT_WIN32			os supports Win32 threading interface.
	CONFIG_MT_SOLARIS		os supports solaris threads interface.
	CONFIG_MT_PTHREAD			os supports POSIX threads (pthreads).
	CONFIG_MT_USER			os supports threading via user context switches
	CONFIG_CPP_EXCEPTIONS	use C++ exceptions (over setjmp) 
	CONFIG_DLL				os supports dynamic library loading 
	CONFIG_DLL_DL			os supports dll's via libdl 
	CONFIG_DLL_GNU_DLD		os supports dll's via GNU dld 
	CONFIG_DLL_WIN32		os supports dll's via MS Win32 API
	CONFIG_SEMAPHORES		os supports system semaphores
	CONFIG_SEMA_SEMIPC		use sys/sem.h facilities for system semaphores
	CONFIG_SEMA_FLOCK		use flock facilities for system semaphores
	CONFIG_SEMA_SYNC		use synch.h for system semaphores
	CONFIG_NO_SEMUN			defined if struct semun must be explicity defined
	CONFIG_NO_THR_DELETE	threads library doesn't implement thr_delete()
	CONFIG_LOCK_FLOCK		use ::flock() instead of lockf() on POSIX
	CONFIG_USE_BSTRING		include 'bstring.h' for some functions
	CONFIG_POSIXISH		in general use posix semantics for OS operations
	CONFIG_USE_WINSOCK			winsock is used
	PLATFORM_OS				textual name of the operating system (range)

 Additionally
	CONFIG_HAS_*			facilility is available
	CONFIG_NEEDS_*			facilility not available, must be custom provided
	CONFIG_NO_*				facilility not available and not needed
\*____________________________________________________________________________*/
#if defined(CONFIG_OS_LINUX)
#	define CONFIG_OS_POSIX
#	define	CONFIG_MULTITHREADED	
#	define	CONFIG_MT_PTHREAD
// #	define	CONFIG_MT_USER
#	define	CONFIG_DLL
/* ---
	This flag CONFIG_DLL_GNU_DLD, might be necessary instead of CONFIG_DLL_DL
	for aout builds of the Linux kernel.
--- */
/* #	define	CONFIG_DLL_GNU_DLD */
#	define	CONFIG_DLL_DL
#	define	CONFIG_SEMAPHORES
#	define	CONFIG_SEMA_SEMIPC
#	define	CONFIG_NO_SEMUN
#	define	CONFIG_LOCK_FLOCK
#	define	CONFIG_NO_YIELD
#	define	CONFIG_POSIXISH
#	define	PLATFORM_OS				"Linux"

#elif defined(CONFIG_OS_SOLARIS)
#	define CONFIG_OS_POSIX
#	define	CONFIG_MULTITHREADED	
/*
** Change the comments in the following two lines to change between
** user context and kernel threads
*/
/* # 	define	CONFIG_MT_USER */
#	define	CONFIG_MT_SOLARIS
/* #	define	CONFIG_CPP_EXCEPTIONS */
#	define	CONFIG_DLL
#	define	CONFIG_DLL_DL
#	define	CONFIG_SEMAPHORES
/* #	define	CONFIG_SEMA_SYNC */
#	define	CONFIG_SEMA_SEMIPC
#	define	CONFIG_NO_SEMUN
#	define	CONFIG_NO_THR_DELETE
#	define	CONFIG_HAS_ECANCELED
#	define	CONFIG_POSIXISH
#	define	PLATFORM_OS				"Solaris 2.x"

#elif defined(CONFIG_OS_IRIX5)
#	define	CONFIG_LOCK_FLOCK
#	define CONFIG_OS_POSIX
#	define	CONFIG_MULTITHREADED	
# 	define	CONFIG_MT_USER
/* #	define	CONFIG_MT_PTHREAD */
/* #	define	CONFIG_CPP_EXCEPTIONS */
#	define	CONFIG_DLL
#	define	CONFIG_DLL_DL
#	define	CONFIG_SEMAPHORES
/* #	define	CONFIG_SEMA_SYNC */
#	define	CONFIG_SEMA_SEMIPC
/* #	define	CONFIG_NO_SEMUN */
/* # 	define	CONFIG_NO_THR_DELETE */
/* #	define	CONFIG_HAS_ECANCELED */
#	define	CONFIG_USE_BSTRING
#	define	CONFIG_NO_YIELD
#	define	CONFIG_POSIXISH
#	define	PLATFORM_OS				"IRIX 5.x"

#elif defined(CONFIG_OS_WIN32)
#	define	CONFIG_OS_WIN32
#	define	CONFIG_MULTITHREADED	
/* #	define	CONFIG_MT_USER */
#	define	CONFIG_MT_WIN32
/* #	define	CONFIG_CPP_EXCEPTIONS */
#	define	CONFIG_DLL
#	define	CONFIG_DLL_WIN32
/* #	define	CONFIG_SEMAPHORES
#	define	CONFIG_SEMA_SYNC
#	define	CONFIG_SEMA_SEMIPC */
#	define	CONFIG_USE_BSTRING
#	define	CONFIG_USE_WINSOCK
#	define	PLATFORM_OS				"Windows 32-Bit"

#elif defined(CONFIG_OS_HP)
#	define CONFIG_OS_POSIX
#	define	CONFIG_MULTITHREADED	
# 	define	CONFIG_MT_USER
/* #	define	CONFIG_MT_PTHREAD */
/* #	define	CONFIG_CPP_EXCEPTIONS */
/* #	define	CONFIG_DLL */
/* #	define	CONFIG_DLL_DL */
/* #	define	CONFIG_DLL_GNU_DLD */
#	define	CONFIG_SEMAPHORES
/* #	define	CONFIG_SEMA_SYNC */
#	define	CONFIG_SEMA_SEMIPC
#	define	CONFIG_NO_SEMUN
/* # 	define	CONFIG_NO_THR_DELETE */
# 	define	CONFIG_NO_ERESTART
/* #	define	CONFIG_HAS_ECANCELED */
#	define	CONFIG_NO_YIELD
#	define	CONFIG_POSIXISH
#	define	PLATFORM_OS				"HP 9000"

#elif defined(CONFIG_OS_WIN16)
#	define	CONFIG_OS_WIN16
#	define	CONFIG_MULTITHREADED
#	define	CONFIG_MT_USER
/* #	define	CONFIG_CPP_EXCEPTIONS */
#	define	CONFIG_DLL
#	define	CONFIG_DLL_WIN32
/* #	define	CONFIG_SEMAPHORES
#	define	CONFIG_SEMA_SYNC
#	define	CONFIG_SEMA_SEMIPC */
#	define	CONFIG_USE_BSTRING
#	define	CONFIG_POSIXISH
#	define	CONFIG_USE_WINSOCK
#	define	PLATFORM_OS				"Windows 16-Bit"

#else
#	error Unsupported operating system!

#endif

/*____________________________________________________________________________*\
 *
 Flags which depend on the machine/processor type

 Declarations:
	CONFIG_ASM_I386			intel 386 or greater processor
	CONFIG_ASM_SPARC		sun sparc chip
	CONFIG_ASM_HP			HP 9000
	PLATFORM_MACHINE		textual description of machine/processor
\*____________________________________________________________________________*/
#if defined(CONFIG_MACHINE_I386)
# 	define	CONFIG_ASM_I386
#	if defined(CONFIG_OS_WIN32)
#	 	define	CONFIG_ASM_I386_WIN32
#	elif defined(CONFIG_OS_WIN16)
#	 	define	CONFIG_ASM_I386_WIN16
#	endif
#	define	PLATFORM_MACHINE		"Intel x86"

#elif defined(CONFIG_MACHINE_SPARC)
# 	define	CONFIG_ASM_SPARC
#	define	PLATFORM_MACHINE		"SPARC"

#elif defined(CONFIG_MACHINE_IP)
# 	define	CONFIG_ASM_MIPS
#	define	PLATFORM_MACHINE		"Silicon Graphics"

#elif defined(CONFIG_MACHINE_HP)
# 	define	CONFIG_ASM_HP
#	define	PLATFORM_MACHINE		"HP 9000"

#else
#	error Unsupported machine/processor

#endif

/*____________________________________________________________________________*\
 *
 Some quick sanity checks
\*____________________________________________________________________________*/

#if defined(CONFIG_MT_USER)
#	if defined(CONFIG_MT_SOLARIS) || defined(CONFIG_MT_WIN32) || defined(CONFIG_MT_PTHREAD)
#	error Cannot use both Kernel and User threads
#	endif
#endif

#if defined(CONFIG_DLL_DL) && defined(CONFIG_DLL_GNU_DLD)
#	error Cannot use both dlfcn.h and GNU DLD dynamic linking facilities 
#endif

#if ( defined(CONFIG_SEMA_SEMIPC) && defined(CONFIG_SEMA_FLOCK) ) || \
	( defined(CONFIG_SEMA_SEMIPC) && defined(CONFIG_SEMA_SYNC) ) || \
	( defined(CONFIG_SEMA_FLOCK) && defined(CONFIG_SEMA_SYNC) )
#	error Only one system semaphore implementation may be used
#endif

#endif	/* OSCONFIG_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -