1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

New ACC version.

committer: mfx <mfx> 1058045717 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2003-07-12 21:35:17 +00:00
parent ad8648f668
commit 48846c7226
8 changed files with 142 additions and 71 deletions

View File

@ -26,7 +26,7 @@
#ifndef __ACC_H_INCLUDED #ifndef __ACC_H_INCLUDED
#define __ACC_H_INCLUDED #define __ACC_H_INCLUDED
#define ACC_VERSION 20030708L #define ACC_VERSION 20030712L
#if !defined(ACC_CONFIG_INCLUDE) #if !defined(ACC_CONFIG_INCLUDE)
# define ACC_CONFIG_INCLUDE(file) file # define ACC_CONFIG_INCLUDE(file) file
@ -36,12 +36,12 @@
#if defined(__CYGWIN32__) && !defined(__CYGWIN__) #if defined(__CYGWIN32__) && !defined(__CYGWIN__)
# define __CYGWIN__ __CYGWIN32__ # define __CYGWIN__ __CYGWIN32__
#endif #endif
#if defined(__ICL) && !defined(__INTEL_COMPILER)
# define __INTEL_COMPILER __ICL
#endif
#if defined(__IBMCPP__) && !defined(__IBMC__) #if defined(__IBMCPP__) && !defined(__IBMC__)
# define __IBMC__ __IBMCPP__ # define __IBMC__ __IBMCPP__
#endif #endif
#if defined(__ICL) && !defined(__INTEL_COMPILER)
# define __INTEL_COMPILER __ICL
#endif
/* disable pedantic warnings */ /* disable pedantic warnings */
#if defined(__INTEL_COMPILER) && defined(__linux__) #if defined(__INTEL_COMPILER) && defined(__linux__)

View File

@ -191,6 +191,7 @@
# undef HAVE_DIRENT_H /* pulls in <windows.h>; use <dir.h> instead */ # undef HAVE_DIRENT_H /* pulls in <windows.h>; use <dir.h> instead */
# endif # endif
# if (__TURBOC__ < 0x0200) # if (__TURBOC__ < 0x0200)
# undef HAVE_SIGNAL_H /* not working */
# undef HAVE_SYS_TYPES_H # undef HAVE_SYS_TYPES_H
# endif # endif
# if (__TURBOC__ < 0x0400) # if (__TURBOC__ < 0x0400)
@ -230,6 +231,7 @@
#define HAVE_ACCESS 1 #define HAVE_ACCESS 1
#define HAVE_ALLOCA 1 #define HAVE_ALLOCA 1
#define HAVE_ATEXIT 1
#define HAVE_ATOI 1 #define HAVE_ATOI 1
#define HAVE_ATOL 1 #define HAVE_ATOL 1
#define HAVE_CHMOD 1 #define HAVE_CHMOD 1
@ -247,6 +249,9 @@
#define HAVE_MEMMOVE 1 #define HAVE_MEMMOVE 1
#define HAVE_MEMSET 1 #define HAVE_MEMSET 1
#define HAVE_MKTIME 1 #define HAVE_MKTIME 1
#define HAVE_QSORT 1
#define HAVE_RAISE 1
#define HAVE_SIGNAL 1
#define HAVE_SNPRINTF 1 #define HAVE_SNPRINTF 1
#define HAVE_STAT 1 #define HAVE_STAT 1
#define HAVE_STRCHR 1 #define HAVE_STRCHR 1
@ -254,12 +259,13 @@
#define HAVE_STRERROR 1 #define HAVE_STRERROR 1
#define HAVE_STRFTIME 1 #define HAVE_STRFTIME 1
#define HAVE_STRRCHR 1 #define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_TIME 1 #define HAVE_TIME 1
#define HAVE_UMASK 1 #define HAVE_UMASK 1
#define HAVE_UTIME 1 #define HAVE_UTIME 1
#define HAVE_VSNPRINTF 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_STRCASECMP 1
# define HAVE_STRNCASECMP 1 # define HAVE_STRNCASECMP 1
#else #else
@ -360,6 +366,7 @@
# undef HAVE_DIFFTIME # undef HAVE_DIFFTIME
# undef HAVE_FSTAT # undef HAVE_FSTAT
# undef HAVE_MKTIME # undef HAVE_MKTIME
# undef HAVE_RAISE
# undef HAVE_SNPRINTF # undef HAVE_SNPRINTF
# undef HAVE_STRFTIME # undef HAVE_STRFTIME
# undef HAVE_UTIME # undef HAVE_UTIME
@ -386,6 +393,9 @@
# undef HAVE_ALLOCA # undef HAVE_ALLOCA
# undef HAVE_SNPRINTF # undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF # undef HAVE_VSNPRINTF
# if (__TURBOC__ < 0x0200)
# undef HAVE_SIGNAL
# endif
# if (__TURBOC__ < 0x0295) # if (__TURBOC__ < 0x0295)
# undef HAVE_MKTIME # undef HAVE_MKTIME
# undef HAVE_STRFTIME # undef HAVE_STRFTIME
@ -478,12 +488,21 @@
#elif (ACC_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64)) #elif (ACC_CC_WATCOMC && defined(_INTEGRAL_MAX_BITS) && (_INTEGRAL_MAX_BITS == 64))
# define SIZEOF___INT64 8 # define SIZEOF___INT64 8
# define SIZEOF_UNSIGNED___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_LONG_LONG 8
# define SIZEOF_UNSIGNED_LONG_LONG 8 # define SIZEOF_UNSIGNED_LONG_LONG 8
#endif #endif
/*************************************************************************
// misc
**************************************************************************/
#if defined(HAVE_SIGNAL) && !defined(RETSIGTYPE)
# define RETSIGTYPE void
#endif
/* /*
vi:ts=4:et vi:ts=4:et
*/ */

View File

@ -94,6 +94,7 @@
/* /*
vi:ts=4:et vi:ts=4:et
*/ */

View File

@ -52,6 +52,9 @@
# include <i86.h> # include <i86.h>
# endif # endif
#elif (ACC_OS_OS216) #elif (ACC_OS_OS216)
# if (ACC_CC_WATCOMC)
# include <i86.h>
# endif
# if 0 # if 0
# include <os2.h> # include <os2.h>
# else # else

View File

@ -19,12 +19,12 @@
************************************************************************/ ************************************************************************/
/* workaround for preprocessor bugs in some compilers */ /* workaround for preprocessor bugs in some compilers */
#if 0 #if defined(_MSC_VER)
#define ACC_0xffffL 65535ul
#define ACC_0xffffffffL 4294967295ul
#else
#define ACC_0xffffL 0xfffful #define ACC_0xffffL 0xfffful
#define ACC_0xffffffffL 0xfffffffful #define ACC_0xffffffffL 0xfffffffful
#else
#define ACC_0xffffL 65535ul
#define ACC_0xffffffffL 4294967295ul
#endif #endif
/* some things we cannot work around */ /* some things we cannot work around */
@ -45,11 +45,12 @@
// try to detect specific compilers // 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__) # if !defined(__DOS__) && !defined(__OS2__)
# define __DOS__ 1 # define __DOS__ 1
# endif # 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 (__VERSION == 520) && (MB_LEN_MAX == 1)
# if !defined(__AZTEC_C__) # if !defined(__AZTEC_C__)
# define __AZTEC_C__ __VERSION # define __AZTEC_C__ __VERSION
@ -59,6 +60,7 @@
# endif # endif
# endif # endif
#endif #endif
#endif
/*********************************************************************** /***********************************************************************
@ -76,35 +78,29 @@
/* Fix old compiler versions. */ /* Fix old compiler versions. */
#if (UINT_MAX == ACC_0xffffL) #if (UINT_MAX == ACC_0xffffL)
#if defined(__PACIFIC__) && defined(DOS) # undef __ACC_RENAME_A
# if !defined(__far) # undef __ACC_RENAME_B
# define __far far # if defined(__AZTEC_C__) && defined(__DOS__)
# endif # define __ACC_RENAME_A 1
# 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(__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 defined(_MSC_VER) && defined(MSDOS) # elif defined(_MSC_VER) && defined(MSDOS)
# if (_MSC_VER < 600) # 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(__ACC_RENAME_A)
# if !defined(__cdecl) # if !defined(__cdecl)
# define __cdecl cdecl # define __cdecl cdecl
# endif # endif
@ -120,7 +116,10 @@
# if !defined(__pascal) # if !defined(__pascal)
# define __pascal pascal # define __pascal pascal
# endif # endif
# elif (_MSC_VER < 700) # if !defined(__huge)
# define __huge huge
# endif
# elif defined(__ACC_RENAME_B)
# if !defined(__cdecl) # if !defined(__cdecl)
# define __cdecl _cdecl # define __cdecl _cdecl
# endif # endif
@ -137,28 +136,12 @@
# define __pascal _pascal # define __pascal _pascal
# endif # endif
# endif # endif
#elif defined(__TURBOC__) && defined(__MSDOS__) # undef __ACC_RENAME_A
# if (__TURBOC__ < 0x0410) # undef __ACC_RENAME_B
# 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
#endif #endif
#if (UINT_MAX == ACC_0xffffL)
#if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0200) #if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0200)
# define ACC_BROKEN_SIZEOF 1 # define ACC_BROKEN_SIZEOF 1
# if (__TURBOC__ < 0x0150) # if (__TURBOC__ < 0x0150)
@ -170,6 +153,15 @@
#elif defined(__TOS__) && (defined(__PUREC__) || defined(__TURBOC__)) #elif defined(__TOS__) && (defined(__PUREC__) || defined(__TURBOC__))
# define ACC_BROKEN_SIZEOF 1 # define ACC_BROKEN_SIZEOF 1
#endif #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 #if defined(__cplusplus)
#define ACC_MACRO_EXPAND(x) ACC_STRINGIZE(x) # define ACC_EXTERN_C extern "C"
#else
# define ACC_EXTERN_C extern
#endif
/* /*

View File

@ -797,7 +797,7 @@ ACC_LIBFUNC(int, acc_isatty) (int fd)
ACC_LIBFUNC(int, acc_mkdir) (const char* name, unsigned mode) 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); return mkdir(name, mode);
#elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC)) #elif (ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
ACC_UNUSED(mode); ACC_UNUSED(mode);

View File

@ -86,17 +86,19 @@
# undef ACC_HAVE_MM_HUGE_ARRAY # undef ACC_HAVE_MM_HUGE_ARRAY
#endif #endif
#if defined(__cplusplus)
#endif
#if (ACC_CC_BORLANDC && __BORLANDC__ >= 0x0200) #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) # define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT)
#elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC) #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) # define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT)
#elif (ACC_CC_MSC || ACC_CC_TOPSPEEDC) #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) # define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT)
#elif (ACC_CC_TURBOC && __TURBOC__ >= 0x0295) #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) # define ACC_MM_AHSHIFT ((unsigned) _AHSHIFT)
#elif ((ACC_CC_AZTECC || ACC_CC_PACIFICC || ACC_CC_TURBOC) && ACC_OS_DOS16) #elif ((ACC_CC_AZTECC || ACC_CC_PACIFICC || ACC_CC_TURBOC) && ACC_OS_DOS16)
# define ACC_MM_AHSHIFT 12 # define ACC_MM_AHSHIFT 12

View File

@ -23,18 +23,23 @@
# define __acc_gnuc_extension__ # define __acc_gnuc_extension__
#endif #endif
#if (SIZEOF_LONG_LONG > 0) #if (SIZEOF_LONG_LONG > 0)
__acc_gnuc_extension__ typedef long long acc_llong_t; __acc_gnuc_extension__ typedef long long acc_llong_t;
#endif #endif
#if (SIZEOF_UNSIGNED_LONG_LONG > 0) #if (SIZEOF_UNSIGNED_LONG_LONG > 0)
__acc_gnuc_extension__ typedef unsigned long long acc_ullong_t; __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
#endif #endif
#if (SIZEOF___INT64 > 0)
__acc_gnuc_extension__ typedef __int64 acc_int64_t; /* acc_int64l_t is int_least64_t in <stdint.h> terminology */
#endif #if (SIZEOF_LONG >= 8)
#if (SIZEOF_UNSIGNED___INT64 > 0) # define acc_int64l_t long int
__acc_gnuc_extension__ typedef unsigned __int64 acc_uint64_t; # 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 #endif
@ -50,6 +55,51 @@ __acc_gnuc_extension__ typedef unsigned __int64 acc_uint64_t;
#endif #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 vi:ts=4:et