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

New ACC version.

committer: mfx <mfx> 1054069577 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2003-05-27 21:06:17 +00:00
parent b0748388b2
commit 1752fab911
10 changed files with 111 additions and 38 deletions

View File

@ -23,7 +23,10 @@
*/
#define ACC_VERSION 20030423L
#ifndef __ACC_H_INCLUDED
#define __ACC_H_INCLUDED
#define ACC_VERSION 20030527L
#if !defined(ACC_CONFIG_INCLUDE)
# define ACC_CONFIG_INCLUDE(file) file
@ -69,6 +72,8 @@
# include ACC_CONFIG_INCLUDE("acc_lib.h")
#endif
#endif /* already included */
/*
vi:ts=4:et

View File

@ -125,6 +125,9 @@
#elif (ACC_CC_BORLANDC)
# undef HAVE_UNISTD_H
# undef HAVE_SYS_TIME_H
# if (ACC_OS_WIN32 || ACC_OS_WIN64)
# undef HAVE_DIRENT_H /* pulls in <windows.h>; use <dir.h> instead */
# endif
#elif (ACC_CC_DMC)
# undef HAVE_DIRENT_H /* not working */
# undef HAVE_UNISTD_H /* not working */
@ -163,9 +166,19 @@
# undef HAVE_UTIME_H
# undef HAVE_SYS_TIME_H
# endif
#elif (ACC_CC_TOPSPEEDC)
# undef HAVE_DIRENT_H
# undef HAVE_UNISTD_H
# undef HAVE_UTIME_H
# undef HAVE_SYS_STAT_H
# undef HAVE_SYS_TIME_H
# undef HAVE_SYS_TYPES_H
#elif (ACC_CC_TURBOC)
# undef HAVE_UNISTD_H
# undef HAVE_SYS_TIME_H
# if (ACC_OS_WIN32 || ACC_OS_WIN64)
# undef HAVE_DIRENT_H /* pulls in <windows.h>; use <dir.h> instead */
# endif
# if (__TURBOC__ < 0x0200)
# undef HAVE_SYS_TYPES_H
# endif
@ -222,12 +235,15 @@
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMSET 1
#define HAVE_MKTIME 1
#define HAVE_SNPRINTF 1
#define HAVE_STAT 1
#define HAVE_STRCHR 1
#define HAVE_STRDUP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRRCHR 1
#define HAVE_TIME 1
#define HAVE_UMASK 1
#define HAVE_UTIME 1
#define HAVE_VSNPRINTF 1
@ -314,6 +330,7 @@
# undef HAVE_CHMOD
# undef HAVE_DIFFTIME
# undef HAVE_FSTAT
# undef HAVE_MKTIME
# undef HAVE_SNPRINTF
# undef HAVE_STRFTIME
# undef HAVE_UTIME
@ -324,6 +341,7 @@
# endif
# if (__SC__ < 0x700)
# undef HAVE_DIFFTIME /* difftime() is broken */
# undef HAVE_UTIME /* struct utimbuf is missing */
# endif
# if (__SC__ >= 0x610)
# define snprintf _snprintf
@ -332,11 +350,15 @@
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# endif
#elif (ACC_CC_TOPSPEEDC)
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
#elif (ACC_CC_TURBOC)
# undef HAVE_ALLOCA
# undef HAVE_SNPRINTF
# undef HAVE_VSNPRINTF
# if (__TURBOC__ < 0x0295)
# undef HAVE_MKTIME
# undef HAVE_STRFTIME
# endif
# if (__TURBOC__ < 0x0400)
@ -356,6 +378,7 @@
# endif
# undef HAVE_DIFFTIME /* difftime() is broken */
# undef HAVE_SNPRINTF
# undef HAVE_UTIME /* struct utimbuf is missing */
# undef HAVE_VSNPRINTF
#endif

View File

@ -47,6 +47,10 @@
# define ACC_CC_DECC 1
# define ACC_INFO_CC "DEC C"
# define ACC_INFO_CCVER ACC_MACRO_EXPAND(__DECC)
#elif defined(__IBMC__)
# define ACC_CC_VISUALAGEC 1
# define ACC_INFO_CC "VisualAge C"
# define ACC_INFO_CCVER ACC_MACRO_EXPAND(__IBMC__)
#elif defined(__INTEL_COMPILER)
# define ACC_CC_INTELC 1
# define ACC_INFO_CC "Intel C"
@ -83,6 +87,10 @@
# define ACC_CC_TINYC 1
# define ACC_INFO_CC "Tiny C"
# define ACC_INFO_CCVER ACC_MACRO_EXPAND(__TINYC__)
#elif defined(__TSC__)
# define ACC_CC_TOPSPEEDC 1
# define ACC_INFO_CC "TopSpeed C"
# define ACC_INFO_CCVER ACC_MACRO_EXPAND(__TSC__)
#elif defined(__WATCOMC__)
# define ACC_CC_WATCOMC 1
# define ACC_INFO_CC "Watcom C"

View File

@ -39,10 +39,6 @@
// macros
************************************************************************/
/* workaround for preprocessor bugs in some compilers */
#define ACC_0xffffL 65535ul
#define ACC_0xffffffffL 4294967295ul
#if !defined(__ACC_UINT_MAX)
# define __ACC_INT_MAX(b) ((((1l << ((b)-2)) - 1l) * 2l) + 1l)
# define __ACC_UINT_MAX(b) ((((1ul << ((b)-1)) - 1ul) * 2ul) + 1ul)

View File

@ -68,6 +68,11 @@
# include <share.h>
#endif
/* TOS */
#if defined(__TOS__) && defined(__TURBOC__)
# include <ext.h>
#endif
#endif /* already included */

View File

@ -26,6 +26,9 @@
# endif
# include <windows.h>
# define ACC_H_WINDOWS_H 1
# if (ACC_CC_BORLANDC || ACC_CC_TURBOC)
# include <dir.h>
# endif
#elif (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_WIN16)
# if (ACC_CC_BORLANDC || ACC_CC_TURBOC)
# include <alloc.h>
@ -34,6 +37,7 @@
# include <sys/exceptn.h>
# elif (ACC_CC_PACIFICC)
# include <unixio.h>
# include <stat.h>
# include <sys.h>
# elif (ACC_CC_WATCOMC)
# include <i86.h>

View File

@ -13,15 +13,35 @@
*/
/***********************************************************************
// preprocessor
************************************************************************/
/* workaround for preprocessor bugs in some compilers */
#define ACC_0xffffL 65535ul
#define ACC_0xffffffffL 4294967295ul
/* some things we cannot work around */
#if 0
#if (32767 >= 4294967295ul)
# error "your preprocessor is broken 1"
#endif
#if (65535u >= 4294967295ul)
# error "your preprocessor is broken 2"
#endif
#endif
/***********************************************************************
// try to detect specific compilers
************************************************************************/
#if defined(__ZTC__) && defined(__I86__) && (UINT_MAX == 0xffffL)
#if defined(__ZTC__) && defined(__I86__) && (UINT_MAX == ACC_0xffffL)
# if !defined(__DOS__) && !defined(__OS2__)
# define __DOS__ 1
# endif
#elif defined(__VERSION) && (UINT_MAX == 0xffffL) && defined(MB_LEN_MAX)
#elif defined(__VERSION) && (UINT_MAX == ACC_0xffffL) && defined(MB_LEN_MAX)
# if (__VERSION == 520) && (MB_LEN_MAX == 1)
# if !defined(__AZTEC_C__)
# define __AZTEC_C__ __VERSION
@ -40,11 +60,9 @@
/* Microsoft C does not correctly define ptrdiff_t for
* the 16-bit huge memory model.
*/
#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == 0xffffL)
# if (_MSC_VER < 900)
#if defined(_MSC_VER) && defined(M_I86HM) && (UINT_MAX == ACC_0xffffL)
# define ptrdiff_t long
# define _PTRDIFF_T_DEFINED
# endif
#endif
@ -107,12 +125,10 @@
************************************************************************/
#if defined(__cplusplus)
# if !defined(__STDC_LIMIT_MACROS)
# define __STDC_LIMIT_MACROS 1
# endif
# if !defined(__STDC_CONSTANT_MACROS)
# undef __STDC_CONSTANT_MACROS
# undef __STDC_LIMIT_MACROS
# define __STDC_CONSTANT_MACROS 1
# endif
# define __STDC_LIMIT_MACROS 1
#endif

View File

@ -47,26 +47,40 @@ acc_alloc_t;
ACC_LIBFUNC(acc_hvoid_p, acc_halloc) (acc_alloc_p ap, acc_hsize_t items, size_t size);
ACC_LIBFUNC(int, acc_hfree) (acc_alloc_p ap);
/* stdlib */
/* string */
ACC_LIBFUNC(int, acc_hmemcmp) (const acc_hvoid_p s1, const acc_hvoid_p s2, acc_hsize_t len);
ACC_LIBFUNC(acc_hvoid_p, acc_hmemcpy) (acc_hvoid_p dest, const acc_hvoid_p src, acc_hsize_t len);
ACC_LIBFUNC(acc_hvoid_p, acc_hmemmove) (acc_hvoid_p dest, const acc_hvoid_p src, acc_hsize_t len);
ACC_LIBFUNC(acc_hvoid_p, acc_hmemset) (acc_hvoid_p s, int c, acc_hsize_t len);
/* stdio */
ACC_LIBFUNC(acc_hsize_t, acc_hfread) (FILE *fp, acc_hvoid_p buf, acc_hsize_t size);
ACC_LIBFUNC(acc_hsize_t, acc_hfwrite) (FILE *fp, const acc_hvoid_p buf, acc_hsize_t size);
#if (ACC_HAVE_MM_HUGE_PTR)
ACC_LIBFUNC(long, acc_hread) (int fd, acc_hvoid_p buf, long size);
ACC_LIBFUNC(long, acc_hwrite) (int fd, const acc_hvoid_p buf, long size);
#endif
/*************************************************************************
// wrap <dirent.h>
**************************************************************************/
struct ACC_DIR { acc_hvoid_p dirp; }; /* opaque type */
typedef struct ACC_DIR ACC_DIR;
struct acc_dirent
struct acc_find_t
{
char d_name[255+1];
union { acc_hvoid_p dirp; long h; } u; /* private */
#if (ACC_OS_DOS16 || ACC_OS_WIN16)
char f_name[8+1+3+1];
#elif (ACC_DOS32 || ACC_OS_WIN32 || ACC_OS_WIN64)
char f_name[259+1];
#else
char f_name[1024+1];
#endif
};
ACC_LIBFUNC(int, acc_opendir) (ACC_DIR* dirp, const char* name);
ACC_LIBFUNC(int, acc_readdir) (ACC_DIR* dirp, struct acc_dirent* d);
ACC_LIBFUNC(int, acc_closedir) (ACC_DIR* dirp);
ACC_LIBFUNC(int, acc_findfirst) (struct acc_find_t* f, const char* path);
ACC_LIBFUNC(int, acc_findnext) (struct acc_find_t* f);
ACC_LIBFUNC(int, acc_findclose) (struct acc_find_t* f);
/*************************************************************************
@ -90,6 +104,8 @@ ACC_LIBFUNC(int, acc_closedir) (ACC_DIR* dirp);
#if defined(__CYGWIN__) || defined(__MINGW32__)
# define acc_alloca(x) __builtin_alloca((x))
#elif defined(__BORLANDC__) && defined(__linux__)
/* FIXME: this does not work */
#elif (HAVE_ALLOCA)
# define acc_alloca(x) alloca((x))
#endif

View File

@ -27,7 +27,7 @@
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
#if (UINT_MAX != 0xffffL)
#if (UINT_MAX != ACC_0xffffL)
# error "this should not happen"
#endif
#if defined(__TINY__) || defined(M_I86TM) || defined(_M_I86TM)

View File

@ -55,37 +55,37 @@
# define ACC_OS_WIN32 1
# define ACC_INFO_OS "win32"
#elif defined(__WINDOWS__) || defined(_WINDOWS) || defined(_Windows)
# if (UINT_MAX == 0xffffffffL)
# if (UINT_MAX == ACC_0xffffffffL)
# define ACC_OS_WIN32 1
# define ACC_INFO_OS "win32"
# elif (UINT_MAX == 0xffffL)
# elif (UINT_MAX == ACC_0xffffL)
# define ACC_OS_WIN16 1
# define ACC_INFO_OS "win16"
# else
# error "check your limits.h header"
# endif
#elif defined(__DOS__) || defined(__MSDOS__) || defined(_MSDOS) || defined(MSDOS) || (defined(__PACIFIC__) && defined(DOS))
# if (UINT_MAX == 0xffffffffUL)
# if (UINT_MAX == ACC_0xffffffffL)
# define ACC_OS_DOS32 1
# define ACC_INFO_OS "dos32"
# elif (UINT_MAX == 0xffffUL)
# elif (UINT_MAX == ACC_0xffffL)
# define ACC_OS_DOS16 1
# define ACC_INFO_OS "dos16"
# else
# error "check your limits.h header"
# endif
#elif defined(__OS2__) || defined(__OS2V2__)
# if (UINT_MAX == 0xffffffffL)
# if (UINT_MAX == ACC_0xffffffffL)
# define ACC_OS_OS2 1
# define ACC_INFO_OS "os2"
# elif (UINT_MAX == 0xffffL)
# elif (UINT_MAX == ACC_0xffffL)
# define ACC_OS_OS216 1
# define ACC_INFO_OS "os216"
# else
# error "check your limits.h header"
# endif
#elif defined(__palmos__)
# if (UINT_MAX == 0xffffL)
# if (UINT_MAX == ACC_0xffffL)
# define ACC_OS_PALMOS 1
# define ACC_INFO_OS "palmos"
# else
@ -156,15 +156,15 @@
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
# if (UINT_MAX != 0xffffL)
# if (UINT_MAX != ACC_0xffffL)
# error "this should not happen"
# endif
#endif
#if (ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_WIN32 || ACC_OS_WIN64)
# if (UINT_MAX != 0xffffffffL)
# if (UINT_MAX != ACC_0xffffffffL)
# error "this should not happen"
# endif
# if (ULONG_MAX != 0xffffffffL)
# if (ULONG_MAX != ACC_0xffffffffL)
# error "this should not happen"
# endif
#endif