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

New ACC version.

committer: mfx <mfx> 1062472636 +0000
This commit is contained in:
Markus F.X.J. Oberhumer 2003-09-02 03:17:16 +00:00
parent 919a899c39
commit b0e961b90b
7 changed files with 74 additions and 14 deletions

View File

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

View File

@ -319,9 +319,6 @@
# undef HAVE_UTIME /* struct utimbuf is missing */
# undef HAVE_VSNPRINTF
#elif (ACC_CC_BORLANDC)
# if defined(ACC_MM_TINY)
# undef HAVE_DIFFTIME /* difftime() is in the math library */
# endif
# if (__BORLANDC__ < 0x0400)
# undef HAVE_ALLOCA
# undef HAVE_UTIME
@ -473,8 +470,6 @@
#endif
/* FIXME: add more sizes */
#if ((SIZEOF_LONG) > 0 && (SIZEOF_LONG) < 8)
#if (ACC_CC_GNUC)
# define SIZEOF_LONG_LONG 8

View File

@ -41,6 +41,7 @@
#include ACC_CONFIG_INCLUDE("acclib/bele.ch")
#include ACC_CONFIG_INCLUDE("acclib/hmemcpy.ch")
#include ACC_CONFIG_INCLUDE("acclib/hstring.ch")
#include ACC_CONFIG_INCLUDE("acclib/halloc.ch")
#include ACC_CONFIG_INCLUDE("acclib/dosalloc.ch")
#include ACC_CONFIG_INCLUDE("acclib/hfread.ch")

View File

@ -43,20 +43,27 @@
// huge pointer layer
**************************************************************************/
#if !defined(acc_hsize_t)
#if (ACC_HAVE_MM_HUGE_PTR)
# define acc_hsize_t unsigned long
# define acc_hvoid_p void __huge *
# define acc_hchar_p char __huge *
# define acc_hchar_pp char __huge * __huge *
# define acc_hbyte_p unsigned char __huge *
#else
# define acc_hsize_t size_t
# define acc_hvoid_p void *
# define acc_hchar_p char *
# define acc_hchar_pp char **
# define acc_hbyte_p unsigned char *
#endif
#endif
/* halloc */
ACCLIB_EXTERN(acc_hvoid_p, acc_halloc) (acc_hsize_t size);
ACCLIB_EXTERN(void, acc_hfree) (acc_hvoid_p p);
/* dos_alloc */
#if (ACC_OS_DOS16 || ACC_OS_OS216)
ACCLIB_EXTERN(void __far*, acc_dos_alloc) (unsigned long size);
ACCLIB_EXTERN(int, acc_dos_free) (void __far* p);
@ -68,10 +75,15 @@ ACCLIB_EXTERN(acc_hvoid_p, acc_hmemcpy) (acc_hvoid_p dest, const acc_hvoid_p src
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemmove) (acc_hvoid_p dest, const acc_hvoid_p src, acc_hsize_t len);
ACCLIB_EXTERN(acc_hvoid_p, acc_hmemset) (acc_hvoid_p s, int c, acc_hsize_t len);
/* string */
ACCLIB_EXTERN(acc_hchar_p, acc_hstrpbrk) (const acc_hchar_p, const acc_hchar_p);
ACCLIB_EXTERN(acc_hchar_p, acc_hstrsep) (acc_hchar_pp, const acc_hchar_p);
/* stdio */
ACCLIB_EXTERN(acc_hsize_t, acc_hfread) (FILE* fp, acc_hvoid_p buf, acc_hsize_t size);
ACCLIB_EXTERN(acc_hsize_t, acc_hfwrite) (FILE* fp, const acc_hvoid_p buf, acc_hsize_t size);
/* io */
#if (ACC_HAVE_MM_HUGE_PTR)
ACCLIB_EXTERN(long, acc_hread) (int fd, acc_hvoid_p buf, long size);
ACCLIB_EXTERN(long, acc_hwrite) (int fd, const acc_hvoid_p buf, long size);
@ -173,11 +185,6 @@ ACCLIB_EXTERN(int, acc_closedir) (acc_dir_t* d);
**************************************************************************/
/*************************************************************************
// wrap <string.h>
**************************************************************************/
/*************************************************************************
// wrap misc
**************************************************************************/

58
src/acc/acclib/hstring.ch Normal file
View File

@ -0,0 +1,58 @@
/* ACC -- Automatic Compiler Configuration
Copyright (C) 1996-2003 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
This software is a copyrighted work licensed under the terms of
the GNU General Public License. Please consult the file "ACC_LICENSE"
for details.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/
*/
#if !defined(ACCLIB_PUBLIC)
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
#endif
/***********************************************************************
//
************************************************************************/
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrpbrk) (const acc_hchar_p s, const acc_hchar_p accept)
{
for ( ; *s; ++s) {
const acc_hchar_p a = accept;
for ( ; *a; ++a) {
if (*s == *a) {
#if (ACC_CC_GNUC)
union { acc_hchar_p p; const acc_hchar_p c; } u;
u.c = s; return u.p; /* UNCONST */
#else
return (acc_hchar_p)s; /* UNCONST */
#endif
}
}
}
return (acc_hchar_p)0;
}
ACCLIB_PUBLIC(acc_hchar_p, acc_hstrsep) (acc_hchar_pp ss, const acc_hchar_p delim)
{
acc_hchar_p s = *ss;
if (s) {
acc_hchar_p p = __ACCLIB_FUNCNAME(acc_hstrpbrk)(s, delim);
if (p) *p++ = 0;
*ss = p;
}
return s;
}
/*
vi:ts=4:et
*/

View File

@ -128,8 +128,7 @@ ACCLIB_PUBLIC(int, acc_isatty) (int fd)
if ((HANDLE)h != INVALID_HANDLE_VALUE)
{
DWORD d = 0;
int r = GetConsoleMode((HANDLE)h, &d);
if (!r)
if (GetConsoleMode((HANDLE)h, &d) == 0)
return 0; /* GetConsoleMode failed -> not a tty */
}
}

View File

@ -85,7 +85,7 @@ ACCLIB_PUBLIC(acc_uint32l_t, acc_rand64_r32) (acc_rand64_t* r)
/*************************************************************************
// mersenne twister
// mersenne twister PRNG
**************************************************************************/
ACCLIB_PUBLIC(void, acc_srandmt) (acc_randmt_t* r, acc_uint32l_t seed)