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

New ACC version.

committer: mfx <mfx> 1059510824 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2003-07-29 20:33:44 +00:00
parent f513373693
commit 2163231401
5 changed files with 45 additions and 27 deletions

View File

@ -25,7 +25,7 @@
#ifndef __ACC_H_INCLUDED
#define __ACC_H_INCLUDED
#define ACC_VERSION 20030722L
#define ACC_VERSION 20030723L
#if !defined(ACC_CONFIG_INCLUDE)
# define ACC_CONFIG_INCLUDE(file) file

View File

@ -203,7 +203,6 @@
ACCCHK_ASSERT(sizeof(acc_int32e_t) == 4)
ACCCHK_ASSERT(sizeof(acc_int32e_t) == SIZEOF_ACC_INT32E_T)
ACCCHK_ASSERT(sizeof(acc_uint32e_t) == 4)
ACCCHK_ASSERT(sizeof(acc_uint32e_t) == SIZEOF_ACC_UINT32E_T)
ACCCHK_ASSERT(sizeof(acc_int32e_t) == sizeof(acc_uint32e_t))
ACCCHK_ASSERT_IS_SIGNED(acc_int32e_t)
@ -232,7 +231,6 @@
ACCCHK_ASSERT(sizeof(acc_int32l_t) >= 4)
ACCCHK_ASSERT(sizeof(acc_int32l_t) == SIZEOF_ACC_INT32L_T)
ACCCHK_ASSERT(sizeof(acc_uint32l_t) >= 4)
ACCCHK_ASSERT(sizeof(acc_uint32l_t) == SIZEOF_ACC_UINT32L_T)
ACCCHK_ASSERT(sizeof(acc_int32l_t) == sizeof(acc_uint32l_t))
ACCCHK_ASSERT_IS_SIGNED(acc_int32l_t)
@ -256,7 +254,6 @@
ACCCHK_ASSERT(sizeof(acc_int32f_t) == SIZEOF_ACC_INT32F_T)
ACCCHK_ASSERT(sizeof(acc_uint32f_t) >= 4)
ACCCHK_ASSERT(sizeof(acc_uint32f_t) >= sizeof(acc_uint32l_t))
ACCCHK_ASSERT(sizeof(acc_uint32f_t) == SIZEOF_ACC_UINT32F_T)
ACCCHK_ASSERT(sizeof(acc_int32f_t) == sizeof(acc_uint32f_t))
ACCCHK_ASSERT_IS_SIGNED(acc_int32f_t)
@ -279,7 +276,6 @@
ACCCHK_ASSERT(sizeof(acc_int64l_t) >= 8)
ACCCHK_ASSERT(sizeof(acc_int64l_t) == SIZEOF_ACC_INT64L_T)
ACCCHK_ASSERT(sizeof(acc_uint64l_t) >= 8)
ACCCHK_ASSERT(sizeof(acc_uint64l_t) == SIZEOF_ACC_UINT64L_T)
ACCCHK_ASSERT(sizeof(acc_int64l_t) == sizeof(acc_uint64l_t))
ACCCHK_ASSERT_IS_SIGNED(acc_int64l_t)
@ -306,6 +302,13 @@
#endif
ACCCHK_ASSERT_IS_SIGNED(acc_intptr_t)
ACCCHK_ASSERT_IS_UNSIGNED(acc_uintptr_t)
ACCCHK_ASSERT(sizeof(acc_intptr_t) >= sizeof(void *))
ACCCHK_ASSERT(sizeof(acc_intptr_t) == SIZEOF_ACC_INTPTR_T)
ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(acc_uintptr_t))
/*************************************************************************
// check memory model ACC_MM
**************************************************************************/

View File

@ -36,7 +36,7 @@
#if !defined(ACCLIB_PUBLIC)
# define ACCLIB_PUBLIC(a,b) __ACCLIB_FUNC(a,b)
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
#endif
@ -454,7 +454,7 @@ ACCLIB_PUBLIC(long, acc_hwrite) (int fd, const acc_hvoid_p buf, long size)
#if !defined(__ACCLIB_USE_OPENDIR)
#if (ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_TOS || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
static int acc_opendir_init(acc_dir_t* f, const char* path, char* buf, size_t bufsize)
static int __ACCLIB_FUNCNAME(acc_opendir_init)(acc_dir_t* f, const char* path, char* buf, size_t bufsize)
{
size_t l; char* p;
f->f_name[0] = 0; buf[0] = 0;
@ -480,7 +480,7 @@ ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_t* f, const char* path)
f->u_dirp = opendir(path);
if (!f->u_dirp)
return -2;
return acc_readdir(f);
return __ACCLIB_FUNCNAME(acc_readdir)(f);
}
ACCLIB_PUBLIC(int, acc_readdir) (acc_dir_t* f)
@ -489,7 +489,7 @@ ACCLIB_PUBLIC(int, acc_readdir) (acc_dir_t* f)
f->f_name[0] = 0;
if (!f->u_dirp)
return -1;
dp = readdir((DIR*) f->u_dirp);
dp = (const struct dirent*) readdir((DIR*) f->u_dirp);
if (!dp)
return -1;
if (!dp->d_name[0] || strlen(dp->d_name) >= sizeof(f->f_name))
@ -520,7 +520,7 @@ ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_t* f, const char* path)
{
WIN32_FIND_DATAA d;
HANDLE h;
if (acc_opendir_init(f, path, f->f_name, sizeof(f->f_name)) != 0)
if (__ACCLIB_FUNCNAME(acc_opendir_init)(f, path, f->f_name, sizeof(f->f_name)) != 0)
return -1;
h = FindFirstFileA(f->f_name, &d);
f->f_name[0] = 0;
@ -567,7 +567,7 @@ ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_t* f, const char* path)
char tmp[ACC_FN_PATH_MAX+1];
int r;
f->u_dirp = 0;
if (acc_opendir_init(f, path, tmp, sizeof(tmp)) != 0)
if (__ACCLIB_FUNCNAME(acc_opendir_init)(f, path, tmp, sizeof(tmp)) != 0)
return -1;
#if (ACC_CC_AZTECC || ACC_CC_PACIFICC)
r = -1;
@ -617,7 +617,7 @@ ACCLIB_PUBLIC(int, acc_opendir) (acc_dir_t* f, const char* path)
int r;
DTA* olddta;
f->u_dirp = 0;
if (acc_opendir_init(f, path, tmp, sizeof(tmp)) != 0)
if (__ACCLIB_FUNCNAME(acc_opendir_init)(f, path, tmp, sizeof(tmp)) != 0)
return -1;
olddta = Fgetdta();
Fsetdta((DTA*) f->u_dta);
@ -786,7 +786,7 @@ ACCLIB_PUBLIC(int, acc_isatty) (int fd)
}
#elif (ACC_H_WINDOWS_H)
{
long h = acc_get_osfhandle(fd);
long h = __ACCLIB_FUNCNAME(acc_get_osfhandle)(fd);
if (h != -1)
{
DWORD d = 0;

View File

@ -17,11 +17,11 @@
#define __ACC_LIB_H_INCLUDED
#if !defined(__ACCLIB_FUNC)
# define __ACCLIB_FUNC(a,b) a b
#if !defined(__ACCLIB_FUNCNAME)
# define __ACCLIB_FUNCNAME(f) f
#endif
#if !defined(ACCLIB_EXTERN)
# define ACCLIB_EXTERN(a,b) extern __ACCLIB_FUNC(a,b)
# define ACCLIB_EXTERN(r,f) extern r __ACCLIB_FUNCNAME(f)
#endif

View File

@ -30,6 +30,13 @@ __acc_gnuc_extension__ typedef long long acc_llong_t;
__acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
#endif
#if (!(SIZEOF_SHORT > 0 && SIZEOF_INT > 0 && SIZEOF_LONG > 0))
# error
#endif
#if (!(SIZEOF_PTRDIFF_T > 0 && SIZEOF_SIZE_T > 0 && SIZEOF_VOID_P > 0 && SIZEOF_CHAR_P > 0))
# error
#endif
/***********************************************************************
// some <stdint.h> types:
@ -79,7 +86,6 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
#endif
#if defined(acc_int32e_t)
# define SIZEOF_ACC_INT32E_T 4
# define SIZEOF_ACC_UINT32E_T 4
#endif
@ -91,21 +97,18 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
# define ACC_INT32L_C ACC_INT32E_C
# define ACC_UINT32L_C ACC_UINT32E_C
# define SIZEOF_ACC_INT32L_T SIZEOF_ACC_INT32E_T
# define SIZEOF_ACC_UINT32L_T SIZEOF_ACC_UINT32E_T
#elif (SIZEOF_INT > 4)
# define acc_int32l_t int
# define acc_uint32l_t unsigned int
# define ACC_INT32L_C(c) c
# define ACC_UINT32L_C(c) c##U
# define SIZEOF_ACC_INT32L_T SIZEOF_INT
# define SIZEOF_ACC_UINT32L_T SIZEOF_INT
#elif (SIZEOF_LONG > 4)
# define acc_int32l_t long int
# define acc_uint32l_t unsigned long int
# define ACC_INT32L_C(c) c##L
# define ACC_UINT32L_C(c) c##UL
# define SIZEOF_ACC_INT32L_T SIZEOF_LONG
# define SIZEOF_ACC_UINT32L_T SIZEOF_LONG
#else
# error "acc_int32l_t"
#endif
@ -120,21 +123,18 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
# define ACC_INT32F_C(c) c
# define ACC_UINT32F_C(c) c##U
# define SIZEOF_ACC_INT32F_T SIZEOF_INT
# define SIZEOF_ACC_UINT32F_T SIZEOF_INT
#elif (SIZEOF_LONG >= 4)
# define acc_int32f_t long int
# define acc_uint32f_t unsigned long int
# define ACC_INT32F_C(c) c##L
# define ACC_UINT32F_C(c) c##UL
# define SIZEOF_ACC_INT32F_T SIZEOF_LONG
# define SIZEOF_ACC_UINT32F_T SIZEOF_LONG
#elif defined(acc_int32e_t)
# define acc_int32f_t acc_int32e_t
# define acc_uint32f_t acc_uint32e_t
# define ACC_INT32F_C ACC_INT32E_C
# define ACC_UINT32F_C ACC_UINT32E_C
# define SIZEOF_ACC_INT32F_T SIZEOF_ACC_INT32E_T
# define SIZEOF_ACC_UINT32F_T SIZEOF_ACC_UINT32E_T
#else
# error "acc_int32f_t"
#endif
@ -155,14 +155,12 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
# define ACC_INT64L_C(c) c
# define ACC_UINT64L_C(c) c##U
# define SIZEOF_ACC_INT64L_T SIZEOF_INT
# define SIZEOF_ACC_UINT64L_T SIZEOF_INT
#elif (SIZEOF_LONG >= 8)
# define acc_int64l_t long int
# define acc_uint64l_t unsigned long int
# define ACC_INT64L_C(c) c##L
# define ACC_UINT64L_C(c) c##UL
# define SIZEOF_ACC_INT64L_T SIZEOF_LONG
# define SIZEOF_ACC_UINT64L_T SIZEOF_LONG
#elif (SIZEOF_LONG_LONG >= 8 && SIZEOF_UNSIGNED_LONG_LONG >= 8) && !defined(__ACC_PREFER___INT64)
# define acc_int64l_t acc_llong_t
# define acc_uint64l_t acc_ullong_t
@ -174,7 +172,6 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
# define ACC_UINT64L_C(c) c##ULL
# endif
# define SIZEOF_ACC_INT64L_T SIZEOF_LONG_LONG
# define SIZEOF_ACC_UINT64L_T SIZEOF_LONG_LONG
#elif (SIZEOF___INT64 >= 8 && SIZEOF_UNSIGNED___INT64 >= 8)
# define acc_int64l_t __int64
# define acc_uint64l_t unsigned __int64
@ -186,13 +183,31 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
# define ACC_UINT64L_C(c) c##ui64
# endif
# define SIZEOF_ACC_INT64L_T SIZEOF___INT64
# define SIZEOF_ACC_UINT64L_T SIZEOF___INT64
#else
/* no least 64-bit integral type on this machine */
#endif
#endif
#if !defined(acc_intptr_t)
#if (SIZEOF_INT >= SIZEOF_VOID_P)
# define acc_intptr_t int
# define acc_uintptr_t unsigned int
# define SIZEOF_ACC_INTPTR_T SIZEOF_INT
#elif (SIZEOF_LONG >= SIZEOF_VOID_P)
# define acc_intptr_t long
# define acc_uintptr_t unsigned long
# define SIZEOF_ACC_INTPTR_T SIZEOF_LONG
#elif (SIZEOF_ACC_INT64L_T >= SIZEOF_VOID_P)
# define acc_intptr_t acc_int64l_t
# define acc_uintptr_t acc_uint64l_t
# define SIZEOF_ACC_INTPTR_T SIZEOF_ACC_INT64L_T
#else
# error "acc_intptr_t"
#endif
#endif
/* workaround for broken compilers */
#if (ACC_BROKEN_INTEGRAL_CONSTANTS)
# undef ACC_INT32E_C