diff --git a/src/acc/acc.h b/src/acc/acc.h index bdd99616..0d2f6bb0 100644 --- a/src/acc/acc.h +++ b/src/acc/acc.h @@ -26,7 +26,7 @@ #ifndef __ACC_H_INCLUDED #define __ACC_H_INCLUDED -#define ACC_VERSION 20030708L +#define ACC_VERSION 20030712L #if !defined(ACC_CONFIG_INCLUDE) # define ACC_CONFIG_INCLUDE(file) file @@ -36,12 +36,12 @@ #if defined(__CYGWIN32__) && !defined(__CYGWIN__) # define __CYGWIN__ __CYGWIN32__ #endif -#if defined(__ICL) && !defined(__INTEL_COMPILER) -# define __INTEL_COMPILER __ICL -#endif #if defined(__IBMCPP__) && !defined(__IBMC__) # define __IBMC__ __IBMCPP__ #endif +#if defined(__ICL) && !defined(__INTEL_COMPILER) +# define __INTEL_COMPILER __ICL +#endif /* disable pedantic warnings */ #if defined(__INTEL_COMPILER) && defined(__linux__) diff --git a/src/acc/acc_auto.h b/src/acc/acc_auto.h index 4dde1d7d..d8e9bdbb 100644 --- a/src/acc/acc_auto.h +++ b/src/acc/acc_auto.h @@ -191,6 +191,7 @@ # undef HAVE_DIRENT_H /* pulls in ; use instead */ # endif # if (__TURBOC__ < 0x0200) +# undef HAVE_SIGNAL_H /* not working */ # undef HAVE_SYS_TYPES_H # endif # if (__TURBOC__ < 0x0400) @@ -230,6 +231,7 @@ #define HAVE_ACCESS 1 #define HAVE_ALLOCA 1 +#define HAVE_ATEXIT 1 #define HAVE_ATOI 1 #define HAVE_ATOL 1 #define HAVE_CHMOD 1 @@ -247,6 +249,9 @@ #define HAVE_MEMMOVE 1 #define HAVE_MEMSET 1 #define HAVE_MKTIME 1 +#define HAVE_QSORT 1 +#define HAVE_RAISE 1 +#define HAVE_SIGNAL 1 #define HAVE_SNPRINTF 1 #define HAVE_STAT 1 #define HAVE_STRCHR 1 @@ -254,12 +259,13 @@ #define HAVE_STRERROR 1 #define HAVE_STRFTIME 1 #define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 #define HAVE_TIME 1 #define HAVE_UMASK 1 #define HAVE_UTIME 1 #define HAVE_VSNPRINTF 1 -#if (ACC_OS_POSIX || ACC_OS_CYGWIN) +#if (ACC_OS_BEOS || ACC_OS_CYGWIN || ACC_OS_MACOSX || ACC_OS_POSIX) # define HAVE_STRCASECMP 1 # define HAVE_STRNCASECMP 1 #else @@ -360,6 +366,7 @@ # undef HAVE_DIFFTIME # undef HAVE_FSTAT # undef HAVE_MKTIME +# undef HAVE_RAISE # undef HAVE_SNPRINTF # undef HAVE_STRFTIME # undef HAVE_UTIME @@ -386,6 +393,9 @@ # undef HAVE_ALLOCA # undef HAVE_SNPRINTF # undef HAVE_VSNPRINTF +# if (__TURBOC__ < 0x0200) +# undef HAVE_SIGNAL +# endif # if (__TURBOC__ < 0x0295) # undef HAVE_MKTIME # undef HAVE_STRFTIME @@ -478,12 +488,21 @@ #elif (ACC_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) # define SIZEOF___INT64 8 # define SIZEOF_UNSIGNED___INT64 8 -#elif (ACC_ARCH_M68K && (ACC_CC_GNUC)) +#elif (ACC_CC_GNUC && (SIZEOF_LONG < 8)) # define SIZEOF_LONG_LONG 8 # define SIZEOF_UNSIGNED_LONG_LONG 8 #endif +/************************************************************************* +// misc +**************************************************************************/ + +#if defined(HAVE_SIGNAL) && !defined(RETSIGTYPE) +# define RETSIGTYPE void +#endif + + /* vi:ts=4:et */ diff --git a/src/acc/acc_defs.h b/src/acc/acc_defs.h index c3db562e..fe8faf94 100644 --- a/src/acc/acc_defs.h +++ b/src/acc/acc_defs.h @@ -94,6 +94,7 @@ + /* vi:ts=4:et */ diff --git a/src/acc/acc_inci.h b/src/acc/acc_inci.h index f906a551..66e8b53b 100644 --- a/src/acc/acc_inci.h +++ b/src/acc/acc_inci.h @@ -52,6 +52,9 @@ # include # endif #elif (ACC_OS_OS216) +# if (ACC_CC_WATCOMC) +# include +# endif # if 0 # include # else diff --git a/src/acc/acc_init.h b/src/acc/acc_init.h index 91e5f638..5e879821 100644 --- a/src/acc/acc_init.h +++ b/src/acc/acc_init.h @@ -19,12 +19,12 @@ ************************************************************************/ /* workaround for preprocessor bugs in some compilers */ -#if 0 -#define ACC_0xffffL 65535ul -#define ACC_0xffffffffL 4294967295ul -#else +#if defined(_MSC_VER) #define ACC_0xffffL 0xfffful #define ACC_0xffffffffL 0xfffffffful +#else +#define ACC_0xffffL 65535ul +#define ACC_0xffffffffL 4294967295ul #endif /* some things we cannot work around */ @@ -45,11 +45,12 @@ // try to detect specific compilers ************************************************************************/ -#if defined(__ZTC__) && defined(__I86__) && (UINT_MAX == ACC_0xffffL) +#if (UINT_MAX == ACC_0xffffL) +#if defined(__ZTC__) && defined(__I86__) # if !defined(__DOS__) && !defined(__OS2__) # define __DOS__ 1 # endif -#elif defined(__VERSION) && (UINT_MAX == ACC_0xffffL) && defined(MB_LEN_MAX) +#elif defined(__VERSION) && defined(MB_LEN_MAX) # if (__VERSION == 520) && (MB_LEN_MAX == 1) # if !defined(__AZTEC_C__) # define __AZTEC_C__ __VERSION @@ -59,6 +60,7 @@ # endif # endif #endif +#endif /*********************************************************************** @@ -76,18 +78,29 @@ /* Fix old compiler versions. */ #if (UINT_MAX == ACC_0xffffL) -#if defined(__PACIFIC__) && defined(DOS) -# if !defined(__far) -# define __far far +# undef __ACC_RENAME_A +# undef __ACC_RENAME_B +# if defined(__AZTEC_C__) && defined(__DOS__) +# define __ACC_RENAME_A 1 +# elif defined(_MSC_VER) && defined(MSDOS) +# if (_MSC_VER < 600) +# define __ACC_RENAME_A 1 +# elif (_MSC_VER < 700) +# define __ACC_RENAME_B 1 +# endif +# elif defined(__TSC__) && defined(__OS2__) +# define __ACC_RENAME_A 1 +# elif defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0410) +# define __ACC_RENAME_A 1 +# elif defined(__PACIFIC__) && defined(DOS) +# if !defined(__far) +# define __far far +# endif +# if !defined(__near) +# define __near near +# endif # endif -# if !defined(__near) -# define __near near -# endif -#elif defined(__AZTEC_C__) && defined(__DOS__) -# if !defined(__huge) -# define __huge huge -# endif -#elif defined(__TSC__) && defined(__OS2__) +# if defined(__ACC_RENAME_A) # if !defined(__cdecl) # define __cdecl cdecl # endif @@ -103,24 +116,10 @@ # if !defined(__pascal) # define __pascal pascal # endif -#elif defined(_MSC_VER) && defined(MSDOS) -# if (_MSC_VER < 600) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif # if !defined(__huge) # define __huge huge # endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# elif (_MSC_VER < 700) +# elif defined(__ACC_RENAME_B) # if !defined(__cdecl) # define __cdecl _cdecl # endif @@ -137,28 +136,12 @@ # define __pascal _pascal # endif # endif -#elif defined(__TURBOC__) && defined(__MSDOS__) -# if (__TURBOC__ < 0x0410) -# if !defined(__cdecl) -# define __cdecl cdecl -# endif -# if !defined(__far) -# define __far far -# endif -# if !defined(__huge) -# define __huge huge -# endif -# if !defined(__near) -# define __near near -# endif -# if !defined(__pascal) -# define __pascal pascal -# endif -# endif -#endif +# undef __ACC_RENAME_A +# undef __ACC_RENAME_B #endif +#if (UINT_MAX == ACC_0xffffL) #if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0200) # define ACC_BROKEN_SIZEOF 1 # if (__TURBOC__ < 0x0150) @@ -170,6 +153,15 @@ #elif defined(__TOS__) && (defined(__PUREC__) || defined(__TURBOC__)) # define ACC_BROKEN_SIZEOF 1 #endif +#endif + + +/*********************************************************************** +// preprocessor macros +************************************************************************/ + +#define ACC_STRINGIZE(x) #x +#define ACC_MACRO_EXPAND(x) ACC_STRINGIZE(x) /*********************************************************************** @@ -185,11 +177,15 @@ /*********************************************************************** -// preprocessor macros +// misc macros ************************************************************************/ -#define ACC_STRINGIZE(x) #x -#define ACC_MACRO_EXPAND(x) ACC_STRINGIZE(x) +#if defined(__cplusplus) +# define ACC_EXTERN_C extern "C" +#else +# define ACC_EXTERN_C extern +#endif + /* diff --git a/src/acc/acc_lib.ch b/src/acc/acc_lib.ch index 2ea2c8ec..5d39a9bb 100644 --- a/src/acc/acc_lib.ch +++ b/src/acc/acc_lib.ch @@ -797,7 +797,7 @@ ACC_LIBFUNC(int, acc_isatty) (int fd) ACC_LIBFUNC(int, acc_mkdir) (const char* name, unsigned mode) { -#if (ACC_OS_POSIX || ACC_OS_CYGWIN || ACC_OS_EMX) +#if (ACC_OS_BEOS || ACC_OS_CYGWIN || ACC_OS_EMX || ACC_OS_MACOSX || ACC_OS_POSIX) return mkdir(name, mode); #elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC)) ACC_UNUSED(mode); diff --git a/src/acc/acc_mm.h b/src/acc/acc_mm.h index 036b1d54..768b7a52 100644 --- a/src/acc/acc_mm.h +++ b/src/acc/acc_mm.h @@ -86,17 +86,19 @@ # undef ACC_HAVE_MM_HUGE_ARRAY #endif +#if defined(__cplusplus) +#endif #if (ACC_CC_BORLANDC && __BORLANDC__ >= 0x0200) - extern void __near _AHSHIFT(void); + ACC_EXTERN_C void __near __cdecl _AHSHIFT(void); # define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT) #elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC) - extern void __near _AHSHIFT(void); + ACC_EXTERN_C void __near __cdecl _AHSHIFT(void); # define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT) #elif (ACC_CC_MSC || ACC_CC_TOPSPEEDC) - extern void __near _AHSHIFT(void); + ACC_EXTERN_C void __near __cdecl _AHSHIFT(void); # define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT) #elif (ACC_CC_TURBOC && __TURBOC__ >= 0x0295) - extern void __near _AHSHIFT(void); + ACC_EXTERN_C void __near __cdecl _AHSHIFT(void); # define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT) #elif ((ACC_CC_AZTECC || ACC_CC_PACIFICC || ACC_CC_TURBOC) && ACC_OS_DOS16) # define ACC_MM_AHSHIFT 12 diff --git a/src/acc/acc_type.h b/src/acc/acc_type.h index 05aca18a..6640997a 100644 --- a/src/acc/acc_type.h +++ b/src/acc/acc_type.h @@ -23,18 +23,23 @@ # define __acc_gnuc_extension__ #endif - #if (SIZEOF_LONG_LONG > 0) __acc_gnuc_extension__ typedef long long acc_llong_t; #endif #if (SIZEOF_UNSIGNED_LONG_LONG > 0) __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t; #endif -#if (SIZEOF___INT64 > 0) -__acc_gnuc_extension__ typedef __int64 acc_int64_t; -#endif -#if (SIZEOF_UNSIGNED___INT64 > 0) -__acc_gnuc_extension__ typedef unsigned __int64 acc_uint64_t; + +/* acc_int64l_t is int_least64_t in terminology */ +#if (SIZEOF_LONG >= 8) +# define acc_int64l_t long int +# define acc_uint64l_t unsigned long int +#elif (SIZEOF_LONG_LONG >= 8 && SIZEOF_UNSIGNED_LONG_LONG >= 8) +# define acc_int64l_t acc_llong_t +# define acc_uint64l_t acc_ullong_t +#elif (SIZEOF___INT64 >= 8 && SIZEOF_UNSIGNED___INT64 >= 8) +# define acc_int64l_t __int64 +# define acc_uint64l_t unsigned __int64 #endif @@ -50,6 +55,51 @@ __acc_gnuc_extension__ typedef unsigned __int64 acc_uint64_t; #endif +/*********************************************************************** +// calling conventions +************************************************************************/ + +#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64) +# if (ACC_CC_GNUC || ACC_CC_PACIFICC || ACC_CC_WATCOMC) +# else +# define __acc_cdecl_atexit __cdecl +# define __acc_cdecl_main __cdecl +# define __acc_cdecl_qsort __cdecl +# endif +# if (ACC_CC_GNUC || ACC_CC_PACIFICC || ACC_CC_WATCOMC) +# elif (ACC_CC_MSC && (_MSC_VER >= 600 && _MSC_VER < 700)) +# if defined(_DLL) +# define __acc_cdecl_sighandler _far _cdecl _loadds +# elif defined(_MT) +# define __acc_cdecl_sighandler _far _cdecl +# else +# define __acc_cdecl_sighandler _cdecl +# endif +# else +# define __acc_cdecl_sighandler __cdecl +# endif +#endif + +#if !defined(__acc_cdecl_atexit) +# define __acc_cdecl_atexit +#endif +#if !defined(__acc_cdecl_main) +# define __acc_cdecl_main +#endif +#if !defined(__acc_cdecl_qsort) +# define __acc_cdecl_qsort +#endif +#if !defined(__acc_cdecl_sighandler) +# define __acc_cdecl_sighandler +#endif + +#if (ACC_CC_AZTECC) || (ACC_CC_TURBOC && __TURBOC__ < 0x150) +typedef void __acc_cdecl_sighandler (*acc_sighandler_t)(int); +#else +typedef void (__acc_cdecl_sighandler *acc_sighandler_t)(int); +#endif + + /* vi:ts=4:et