C程序常用公共符号定义头文件,也包括十种C编译环境的检测:DOS(MSC、BC)、VMS、AS/400、四种UNIX等
/*
CMNDEF.H -- Common #define symbols for C functions
M.L.Y 1996.08, 1999.06, 2000.07.19, 2000.12.03
MODIFIED (YYYY.MM.DD)
M.L.Y 1996.08 - Creation
M.L.Y 1999.06 - Add ASCII_MODE/EBCDIC_MODE
M.L.Y 2000.07.19 - Add OS_CODE, EBCDIC_CODE/ASCII_CODE
M.L.Y 2000.12.03 - Add CCOS
*/
#ifndef CMNDEF_H_INCLUDE
# define CMNDEF_H_INCLUDE
#ifndef USG_TYPE
# define USG_TYPE
typedef unsigned char USGC;
typedef unsigned short USGS;
typedef unsigned int USGI;
typedef unsigned long USGL;
#endif
#ifndef YES
# define YES 1
# define NO 0
#endif
#ifndef TRUE
# define TRUE 1
# define FALSE 0
#endif
#ifndef ON
# define ON 1
# define OFF 0
#endif
#ifndef NUL
# define NUL '\0'
#endif
#ifndef ASCII_MODE
# define ASCII_MODE 1
# define EBCDIC_MODE 2
#endif
#ifndef ASCII_CODE
# define ASCII_CODE 1
# define EBCDIC_CODE 2
# if __OS400__ /* AS/400 */
# define OS_CODE EBCDIC_CODE
# else
# define OS_CODE ASCII_CODE /* DOS, UNIX, ... */
# endif
#endif
# if __OS400__ /* AS/400 */
# define max(a,b) (((a) > (b)) ? (a) : (b))
# define min(a,b) (((a) < (b)) ? (a) : (b))
# endif
#ifndef CCOS
#define CCOS_UNKNOWN 0
#define CCOS_MSDOS_MSC 1
#define CCOS_MSDOS_TC_BC 2
#define CCOS_HP3000_MPE 3
#define CCOS_HP9000_UX 4
#define CCOS_DEC_VAX_VMS 5
#define CCOS_DEC_ALPHA_VMS 6
#define CCOS_IBM_OS400 7
#define CCOS_TANDEM_NONSTOPUX 8
#define CCOS_SCO_UNIX 9
#define CCOS_NCR_UNIX 10
#if defined(MSDOS) & defined(_MSC_VER) /* Microsoft C */
# define CCOS CCOS_MSDOS_MSC
#endif
#if defined(__MSDOS__) & /* Turbo C/BC */ \
(defined(__TURBOC__) | defined(__BORLANDC__))
# define CCOS CCOS_MSDOS_TC_BC
#endif
#if __hppa & __hp3000s900 & __mpexl /* HP 3000 */
# define CCOS CCOS_HP3000_MPE
#endif
#if vax & VAX & vms & VMS /* DEC VAX */ \
& vaxc & VAXC & vax11c & VAX11C \
& defined(vms_version) & defined(VMS_VERSION)
# define CCOS CCOS_DEC_VAX_VMS
#endif
#if __vms & __VMS /* DEC Alpha */ \
& __vaxc & __VAXC & __vax11c & __VAX11C \
& __DECC & defined(__vms_version) & defined(__VMS_VERSION) \
& __Alpha_AXP & __Alpha & __ALPHA & __32BITS
# define CCOS CCOS_DEC_ALPHA_VMS
#endif
#if __OS400__ /* AS/400 */
# define CCOS CCOS_IBM_OS400
#endif
#if mips & __mips & host_mips & __host_mips /* Tandem */ \
& unix & __unix & __nonstopux \
& SYSTYPE_SVR4 & _SYSTYPE_SVR4 & LANGUAGE_C & _LANGUAGE_C
# define CCOS CCOS_TANDEM_NONSTOPUX
#endif
#if (hp9000s200 | hp9000s300 | __hp9000s300 /* HP 9000 */ \
| hp9000s500 | hp9000s800 | __hp9000s800 | hp9000ipc) \
& (hppa | __hppa) & (_PA_RISC1_0 | _PA_RISC1_1) \
& (unix | __unix) & (hpux | __hpux)
# define CCOS CCOS_HP9000_UX
#endif
#if i386 & M_I386 & unix & __unix & M_UNIX /* SCO UNIX */ \
& (_SCO_COFF | _SCO_ELF)
# define CCOS CCOS_SCO_UNIX
#endif
#if i386 & _I386 & unix & __HIGHC__ & _ATT4 /* NCR UNIX */
# define CCOS CCOS_NCR_UNIX
#endif
#endif /* CCOS */
#ifndef CCOS
# error "Unknown machine, OS, and C compiler!"
#endif /* CCOS */
#endif /* CMNDEF_H_INCLUDE */
/* End of file */