diff --git a/src/acc/acc.h b/src/acc/acc.h index 8be2ee4a..90e8185c 100644 --- a/src/acc/acc.h +++ b/src/acc/acc.h @@ -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 diff --git a/src/acc/acc_auto.h b/src/acc/acc_auto.h index a7d329f2..c4d3c23d 100644 --- a/src/acc/acc_auto.h +++ b/src/acc/acc_auto.h @@ -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 diff --git a/src/acc/acc_lib.ch b/src/acc/acc_lib.ch index bb3e4342..f80b4e51 100644 --- a/src/acc/acc_lib.ch +++ b/src/acc/acc_lib.ch @@ -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") diff --git a/src/acc/acc_lib.h b/src/acc/acc_lib.h index 3a4e351c..ac69c208 100644 --- a/src/acc/acc_lib.h +++ b/src/acc/acc_lib.h @@ -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 -**************************************************************************/ - - /************************************************************************* // wrap misc **************************************************************************/ diff --git a/src/acc/acclib/hstring.ch b/src/acc/acclib/hstring.ch new file mode 100644 index 00000000..333ef67c --- /dev/null +++ b/src/acc/acclib/hstring.ch @@ -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 + + 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 +*/ diff --git a/src/acc/acclib/misc.ch b/src/acc/acclib/misc.ch index fbc52367..dddc0584 100644 --- a/src/acc/acclib/misc.ch +++ b/src/acc/acclib/misc.ch @@ -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 */ } } diff --git a/src/acc/acclib/rand.ch b/src/acc/acclib/rand.ch index 924e4014..c447fe09 100644 --- a/src/acc/acclib/rand.ch +++ b/src/acc/acclib/rand.ch @@ -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)