mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Tidyups for ZLIB and GMP
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13688 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
44a8970ada
commit
40c6e08b45
9 changed files with 46 additions and 39 deletions
|
@ -12,6 +12,13 @@
|
|||
Mostly, changes to make methods which were intended to be private
|
||||
really private, and lots of modifications to make mathod names
|
||||
consistent with OpenStep usage ... suggestions made by many people.
|
||||
* configure.ac: Use better names for GMP and ZLIB flags
|
||||
* configure: regenerate
|
||||
* Headers/gnustep/base/GSConfig.h.in: GMP and ZLIB update
|
||||
* Headers/gnustep/base/NSDecimal.h: GMP update
|
||||
* Headers/gnustep/base/UnixFileHandle.h: ZLIB update
|
||||
* Source/NSDecimal.m: GMP update
|
||||
* Source/UnixFileHandle.m: ZLIB update
|
||||
|
||||
2002-05-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -139,13 +139,13 @@ typedef @GS_ADDR@ gsaddr;
|
|||
/*
|
||||
* Do we have zlib for file handle compression?
|
||||
*/
|
||||
#define HAVE_ZLIB @HAVE_ZLIB@
|
||||
#define USE_ZLIB @USE_ZLIB@
|
||||
|
||||
/*
|
||||
* Do we have the GNU Multiple-precision library for NSDecimal?
|
||||
*/
|
||||
//#define HAVE_GMP @HAVE_GMP@
|
||||
#define HAVE_GMP 0
|
||||
//#define USE_GMP @USE_GMP@
|
||||
#define USE_GMP 0
|
||||
|
||||
/*
|
||||
* Macros to deal with hiding an object from the garbage collector
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <GSConfig.h>
|
||||
|
||||
#if HAVE_GMP
|
||||
#if USE_GMP
|
||||
#include <gmp.h>
|
||||
#endif
|
||||
|
||||
|
@ -63,7 +63,7 @@ typedef struct {
|
|||
signed char exponent; /* Signed exponent - -128 to 127 */
|
||||
BOOL isNegative; /* Is this negative? */
|
||||
BOOL validNumber; /* Is this a valid number? */
|
||||
#if HAVE_GMP
|
||||
#if USE_GMP
|
||||
mp_size_t size;
|
||||
mp_limb_t lMantissa[NSDecimalMaxSize];
|
||||
#else
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <GSConfig.h>
|
||||
|
||||
#if HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
|||
NSString *address;
|
||||
NSString *service;
|
||||
NSString *protocol;
|
||||
#if HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
gzFile gzDescriptor;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
/* Define if SO_REUSEADDR is broken on this system */
|
||||
#undef BROKEN_SO_REUSEADDR
|
||||
|
||||
/* Define if your system terminates the final argument in /proc/11416/cmdline */
|
||||
/* Define if your system terminates the final argument in /proc/10983/cmdline */
|
||||
#undef CMDLINE_TERMINATED
|
||||
|
||||
/* Define if constructors are automatically loaded */
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
The mantissa part (I know D. Knuth does not like this term, but it is used
|
||||
in the specification so we stay with it) consists of up to 38 digits, this
|
||||
are stored as an integer (in decimal representation or limps depending on the
|
||||
HAVE_GMP flag). And the exponent is stored in a signed character. As a result
|
||||
USE_GMP flag). And the exponent is stored in a signed character. As a result
|
||||
the numbers that can be represented are the ranges from -9(38 times)*10**127
|
||||
to -1*10**-128, the number 0 and 1*10**-128 to 9(38 times)*10**127.
|
||||
This means we have more big numbers than one would expect (almost up to 10**165)
|
||||
|
@ -62,7 +62,7 @@
|
|||
|
||||
*/
|
||||
|
||||
#if HAVE_GMP
|
||||
#if USE_GMP
|
||||
|
||||
// Define GSDecimal as using a character vector
|
||||
typedef struct {
|
||||
|
@ -1025,7 +1025,7 @@ GSDecimalFromString(GSDecimal *result, NSString *numberValue,
|
|||
GSDecimalCompact(result);
|
||||
}
|
||||
|
||||
#if HAVE_GMP
|
||||
#if USE_GMP
|
||||
|
||||
static void CharvecToDecimal(const GSDecimal *m, NSDecimal *n)
|
||||
{
|
||||
|
|
|
@ -222,7 +222,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
[self ignoreReadDescriptor];
|
||||
[self ignoreWriteDescriptor];
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
/*
|
||||
* The gzDescriptor should always be closed when we have done with it.
|
||||
*/
|
||||
|
@ -750,7 +750,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
d = [NSMutableData dataWithCapacity: 0];
|
||||
if (isStandardFile)
|
||||
{
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
while ((len = gzread(gzDescriptor, buf, sizeof(buf))) > 0)
|
||||
|
@ -767,7 +767,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
if ((len = gzread(gzDescriptor, buf, sizeof(buf))) > 0)
|
||||
|
@ -801,7 +801,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
if (isNonBlocking == YES)
|
||||
[self setNonBlocking: NO];
|
||||
d = [NSMutableData dataWithCapacity: 0];
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
while ((len = gzread(gzDescriptor, buf, sizeof(buf))) > 0)
|
||||
|
@ -838,7 +838,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
|
||||
buf = NSZoneMalloc(NSDefaultMallocZone(), len);
|
||||
d = [NSMutableData dataWithBytesNoCopy: buf length: len];
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
got = gzread(gzDescriptor, [d mutableBytes], len);
|
||||
|
@ -863,7 +863,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
{
|
||||
int chunk = len > sizeof(buf) ? sizeof(buf) : len;
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
got = gzread(gzDescriptor, buf, chunk);
|
||||
|
@ -908,7 +908,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
{
|
||||
toWrite = NETBUF_SIZE;
|
||||
}
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
rval = gzwrite(gzDescriptor, (char*)ptr+pos, toWrite);
|
||||
|
@ -1018,7 +1018,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
|
||||
if (isStandardFile && descriptor >= 0)
|
||||
{
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
result = gzseek(gzDescriptor, 0, SEEK_CUR);
|
||||
|
@ -1042,7 +1042,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
|
||||
if (isStandardFile && descriptor >= 0)
|
||||
{
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
result = gzseek(gzDescriptor, 0, SEEK_END);
|
||||
|
@ -1066,7 +1066,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
|
||||
if (isStandardFile && descriptor >= 0)
|
||||
{
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
result = gzseek(gzDescriptor, (off_t)pos, SEEK_SET);
|
||||
|
@ -1096,7 +1096,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
[self ignoreWriteDescriptor];
|
||||
|
||||
[self setNonBlocking: wasNonBlocking];
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
gzclose(gzDescriptor);
|
||||
|
@ -1435,7 +1435,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
item = [readInfo objectForKey: NSFileHandleNotificationDataItem];
|
||||
length = [item length];
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
received = gzread(gzDescriptor, buf, sizeof(buf));
|
||||
|
@ -1489,7 +1489,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
{
|
||||
int written;
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
if (gzDescriptor != 0)
|
||||
{
|
||||
written = gzwrite(gzDescriptor, (char*)ptr+writePos,
|
||||
|
@ -1608,7 +1608,7 @@ getAddr(NSString* name, NSString* svc, NSString* pcl, struct sockaddr_in *sin)
|
|||
|
||||
- (BOOL) useCompression
|
||||
{
|
||||
#ifdef HAVE_ZLIB
|
||||
#if USE_ZLIB
|
||||
int d;
|
||||
|
||||
if (gzDescriptor != 0)
|
||||
|
|
14
configure
vendored
14
configure
vendored
|
@ -9560,7 +9560,7 @@ _ACEOF
|
|||
fi
|
||||
done
|
||||
|
||||
HAVE_ZLIB=0
|
||||
USE_ZLIB=0
|
||||
|
||||
for ac_header in zlib.h
|
||||
do
|
||||
|
@ -9740,7 +9740,7 @@ fi
|
|||
if test "$zlib_ok" = yes; then
|
||||
base_libs="$LIBS"
|
||||
LIBS="$LIBS -lz"
|
||||
HAVE_ZLIB=1
|
||||
USE_ZLIB=1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -11606,7 +11606,7 @@ if test "$gmp_libdir" != "no"; then
|
|||
LIBS="$LIBS -L$gmp_libdir"
|
||||
fi
|
||||
|
||||
HAVE_GMP=0
|
||||
USE_GMP=0
|
||||
|
||||
for ac_header in gmp.h
|
||||
do
|
||||
|
@ -11849,11 +11849,11 @@ fi
|
|||
if test "$gmp_ok" = yes; then
|
||||
base_libs="$LIBS"
|
||||
LIBS="$LIBS -lgmp"
|
||||
HAVE_GMP=1
|
||||
USE_GMP=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$HAVE_GMP" = "0"; then
|
||||
if test "$USE_GMP" = "0"; then
|
||||
CPPFLAGS="$cppflags_temp";
|
||||
LIBS="$libs_temp";
|
||||
fi
|
||||
|
@ -12733,7 +12733,7 @@ s,@DYNAMIC_LINKER@,$DYNAMIC_LINKER,;t t
|
|||
s,@NX_CONST_STRING_CPPFLAGS@,$NX_CONST_STRING_CPPFLAGS,;t t
|
||||
s,@NX_CONST_STRING_CLASS@,$NX_CONST_STRING_CLASS,;t t
|
||||
s,@HAVE_PTHREAD_H@,$HAVE_PTHREAD_H,;t t
|
||||
s,@HAVE_ZLIB@,$HAVE_ZLIB,;t t
|
||||
s,@USE_ZLIB@,$USE_ZLIB,;t t
|
||||
s,@HAVE_PTS_STREAM_MODULES@,$HAVE_PTS_STREAM_MODULES,;t t
|
||||
s,@GS_PASS_ARGUMENTS@,$GS_PASS_ARGUMENTS,;t t
|
||||
s,@GS_FAKE_MAIN@,$GS_FAKE_MAIN,;t t
|
||||
|
@ -12743,7 +12743,7 @@ s,@XML_CONFIG@,$XML_CONFIG,;t t
|
|||
s,@XML_CFLAGS@,$XML_CFLAGS,;t t
|
||||
s,@XML_LIBS@,$XML_LIBS,;t t
|
||||
s,@HAVE_LIBXML@,$HAVE_LIBXML,;t t
|
||||
s,@HAVE_GMP@,$HAVE_GMP,;t t
|
||||
s,@USE_GMP@,$USE_GMP,;t t
|
||||
s,@SYSTEM_DEFS@,$SYSTEM_DEFS,;t t
|
||||
s,@subdirs@,$subdirs,;t t
|
||||
s,@VERSION@,$VERSION,;t t
|
||||
|
|
14
configure.ac
14
configure.ac
|
@ -607,17 +607,17 @@ AC_CHECK_FUNCS(mmap)
|
|||
# These used by UnixFileHandle.m
|
||||
#--------------------------------------------------------------------
|
||||
AC_CHECK_FUNCS(inet_aton)
|
||||
HAVE_ZLIB=0
|
||||
USE_ZLIB=0
|
||||
AC_CHECK_HEADERS(zlib.h)
|
||||
if test $ac_cv_header_zlib_h = yes; then
|
||||
AC_CHECK_LIB(z, gzseek, zlib_ok=yes, zlib_ok=no)
|
||||
if test "$zlib_ok" = yes; then
|
||||
base_libs="$LIBS"
|
||||
LIBS="$LIBS -lz"
|
||||
HAVE_ZLIB=1
|
||||
USE_ZLIB=1
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(HAVE_ZLIB)
|
||||
AC_SUBST(USE_ZLIB)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# These functions needed by NSTask.m
|
||||
|
@ -929,7 +929,7 @@ if test "$gmp_libdir" != "no"; then
|
|||
LIBS="$LIBS -L$gmp_libdir"
|
||||
fi
|
||||
|
||||
HAVE_GMP=0
|
||||
USE_GMP=0
|
||||
AC_CHECK_HEADERS(gmp.h)
|
||||
if test $ac_cv_header_gmp_h = yes; then
|
||||
AC_CHECK_LIB(gmp, mpf_abs, gmp_ok=yes, gmp_ok=no)
|
||||
|
@ -939,15 +939,15 @@ if test $ac_cv_header_gmp_h = yes; then
|
|||
if test "$gmp_ok" = yes; then
|
||||
base_libs="$LIBS"
|
||||
LIBS="$LIBS -lgmp"
|
||||
HAVE_GMP=1
|
||||
USE_GMP=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$HAVE_GMP" = "0"; then
|
||||
if test "$USE_GMP" = "0"; then
|
||||
CPPFLAGS="$cppflags_temp";
|
||||
LIBS="$libs_temp";
|
||||
fi
|
||||
AC_SUBST(HAVE_GMP)
|
||||
AC_SUBST(USE_GMP)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for iconv support (for Unicode conversion).
|
||||
|
|
Loading…
Reference in a new issue