C程式常用公共符号定义头文件,也包括十种C编译环境的检测:DOS(MSC、BC)、VMS、AS/400、四种UNIX等
/*
CMNDEF.H--Common#definesymbolsforCfunctions
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 - AddASCII_MODE/EBCDIC_MODE
M.L.Y 2000.07.19- AddOS_CODE,EBCDIC_CODE/ASCII_CODE
M.L.Y 2000.12.03- AddCCOS
*/
#ifndef CMNDEF_H_INCLUDE
#defineCMNDEF_H_INCLUDE
#ifndef USG_TYPE
#defineUSG_TYPE
typedefunsignedchar USGC;
typedefunsignedshortUSGS;
typedefunsignedint USGI;
typedefunsignedlong USGL;
#endif
#ifndef YES
#defineYES 1
#defineNO 0
#endif
#ifndef TRUE
#defineTRUE 1
#defineFALSE 0
#endif
#ifndef ON
#defineON 1
#defineOFF 0
#endif
#ifndef NUL
#defineNUL ’\0’
#endif
#ifndef ASCII_MODE
#defineASCII_MODE 1
#defineEBCDIC_MODE 2
#endif
#ifndef ASCII_CODE
#defineASCII_CODE 1
#defineEBCDIC_CODE 2
#if__OS400__ /*AS/400*/
# defineOS_CODE EBCDIC_CODE
#else
# defineOS_CODE ASCII_CODE /*DOS,UNIX,...*/
#endif
#endif
#if__OS400__ /*AS/400*/
# definemax(a,b) (((a)>(b))?(a):(b))
# definemin(a,b) (((a)<(b))?(a):(b))
#endif
#ifndefCCOS
#defineCCOS_UNKNOWN 0
#defineCCOS_MSDOS_MSC 1
#defineCCOS_MSDOS_TC_BC 2
#defineCCOS_HP3000_MPE 3
#defineCCOS_HP9000_UX 4
#defineCCOS_DEC_VAX_VMS 5
#defineCCOS_DEC_ALPHA_VMS 6
#defineCCOS_IBM_OS400 7
#defineCCOS_TANDEM_NONSTOPUX 8
#defineCCOS_SCO_UNIX 9
#defineCCOS_NCR_UNIX 10
#ifdefined(MSDOS)&defined(_MSC_VER) /*MicrosoftC*/
#defineCCOSCCOS_MSDOS_MSC
#endif
#ifdefined(__MSDOS__)& /*TurboC/BC*/ \
(defined(__TURBOC__)|defined(__BORLANDC__))
#defineCCOSCCOS_MSDOS_TC_BC
#endif
#if__hppa&__hp3000s900&__mpexl /*HP3000*/
#defineCCOSCCOS_HP3000_MPE
#endif
#ifvax&VAX&vms&VMS /*DECVAX*/ \
&vaxc&VAXC&vax11c&VAX11C \
&defined(vms_version)&defined(VMS_VERSION)
#defineCCOSCCOS_DEC_VAX_VMS
#endif
#if__vms&__VMS /*DECAlpha*/ \
&__vaxc&__VAXC&__vax11c&__VAX11C \
&__DECC&defined(__vms_version)&defined(__VMS_VERSION) \
&__Alpha_AXP&__Alpha&__ALPHA&__32BITS
#defineCCOSCCOS_DEC_ALPHA_VMS
#endif
#if__OS400__ /*AS/400*/
#defineCCOSCCOS_IBM_OS400
#endif
#ifmips&__mips&host_mips&__host_mips /*Tandem*/ \
&unix&__unix&__nonstopux \
&SYSTYPE_SVR4&_SYSTYPE_SVR4&LANGUAGE_C&_LANGUAGE_C
#defineCCOSCCOS_TANDEM_NONSTOPUX
#endif
#if(hp9000s200|hp9000s300|__hp9000s300 /*HP9000*/ \
|hp9000s500|hp9000s800|__hp9000s800|hp9000ipc) \
&(hppa|__hppa)&(_PA_RISC1_0|_PA_RISC1_1) \
&(unix|__unix)&(hpux|__hpux)
#defineCCOSCCOS_HP9000_UX
#endif
#ifi386&M_I386&unix&__unix&M_UNIX /*SCOUNIX*/ \
&(_SCO_COFF|_SCO_ELF)
#defineCCOSCCOS_SCO_UNIX
#endif
#ifi386&_I386&unix&__HIGHC__&_ATT4 /*NCRUNIX*/
#defineCCOSCCOS_NCR_UNIX
#endif
#endif /*CCOS*/
#ifndefCCOS
#error"Unknownmachine,OS,andCcompiler!"
#endif /*CCOS*/
#endif /*CMNDEF_H_INCLUDE*/
/*Endoffile*/
3COME考试频道为您精心整理,希望对您有所帮助,更多信息在http://www.reader8.com/exam/