diff options
author | sobomax <sobomax@FreeBSD.org> | 2001-01-10 07:08:59 +0800 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2001-01-10 07:08:59 +0800 |
commit | a3f7aaf618fc4a65605ef28eb80427b0ddf34267 (patch) | |
tree | 95883db1cd4b4ea1bb01cc8c2ecab4f9b8c70caa /devel/clanlib-devel | |
parent | 2aa26cbcc95abd966a18a9dbcb8f797496ba6d94 (diff) | |
download | freebsd-ports-gnome-a3f7aaf618fc4a65605ef28eb80427b0ddf34267.tar.gz freebsd-ports-gnome-a3f7aaf618fc4a65605ef28eb80427b0ddf34267.tar.zst freebsd-ports-gnome-a3f7aaf618fc4a65605ef28eb80427b0ddf34267.zip |
Add SUSv2 compatible fcvt() function ripped from glibc. fcvt() is required by
some internal Clanlib's function (fortunately rarely used, which allowed several
clanlib-based ports live w/o it).
Prompted by: alex (quite some time ago)
Diffstat (limited to 'devel/clanlib-devel')
-rw-r--r-- | devel/clanlib-devel/Makefile | 1 | ||||
-rw-r--r-- | devel/clanlib-devel/files/patch-Sources_Util_fcvt.c | 145 | ||||
-rw-r--r-- | devel/clanlib-devel/files/patch-ah | 26 |
3 files changed, 169 insertions, 3 deletions
diff --git a/devel/clanlib-devel/Makefile b/devel/clanlib-devel/Makefile index 919b1dbe2362..fbcc11a78a8a 100644 --- a/devel/clanlib-devel/Makefile +++ b/devel/clanlib-devel/Makefile @@ -7,6 +7,7 @@ PORTNAME= clanlib PORTVERSION= 0.4.4 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= http://dark.x.dtu.dk/~mbn/clanlib/download/ DISTNAME= ClanLib-${PORTVERSION} diff --git a/devel/clanlib-devel/files/patch-Sources_Util_fcvt.c b/devel/clanlib-devel/files/patch-Sources_Util_fcvt.c new file mode 100644 index 000000000000..ed8898b293af --- /dev/null +++ b/devel/clanlib-devel/files/patch-Sources_Util_fcvt.c @@ -0,0 +1,145 @@ + +$FreeBSD$ + +--- /dev/null Wed Jan 10 00:32:20 2001 ++++ Sources/Util/fcvt.c Wed Jan 10 00:31:59 2001 +@@ -0,0 +1,139 @@ ++/* Compatibility functions for floating point formatting, reentrant versions. ++ Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Library General Public License as ++ published by the Free Software Foundation; either version 2 of the ++ License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Library General Public License for more details. ++ ++ You should have received a copy of the GNU Library General Public ++ License along with the GNU C Library; see the file COPYING.LIB. If not, ++ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ++ Boston, MA 02111-1307, USA. */ ++ ++#include <ctype.h> ++#include <errno.h> ++#include <float.h> ++#include <math.h> ++#include <stdio.h> ++#include <string.h> ++#include <sys/param.h> ++ ++extern int errno; ++ ++#if DBL_MANT_DIG == 53 ++# define NDIGIT_MAX 17 ++#else ++/* ++ * See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a ++ * compile time constant here, so we cannot use it. ++ */ ++# error "NDIGIT_MAX must be precomputed" ++# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0))) ++#endif ++#define MAXDIG (NDIGIT_MAX + 3) ++#define signbit(x) (((x)<(0))?(1):(0)) ++ ++static char *FCVT_BUFFER[MAXDIG]; ++ ++static int fcvt_r(double value, int ndigit, int *decpt, int *sign, char *buf, \ ++ size_t len) ++{ ++ int n, i; ++ int left; ++ ++ if (buf == NULL) ++ { ++ errno = EINVAL; ++ return -1; ++ } ++ ++ left = 0; ++ if (finite(value)) ++ { ++ *sign = signbit(value) != 0; ++ if (*sign) ++ value = -value; ++ ++ if (ndigit < 0) ++ { ++ ++ while (ndigit < 0) ++ { ++ double new_value = value * 0.1; ++ ++ if (new_value < 1.0) ++ { ++ ndigit = 0; ++ break; ++ } ++ ++ value = new_value; ++ ++left; ++ ++ndigit; ++ } ++ } ++ } ++ else ++ *sign = 0; ++ ++ n = snprintf(buf, len, "%.*f", MIN(ndigit, NDIGIT_MAX), value); ++ ++ if (n >= len) ++ return -1; ++ ++ i = 0; ++ while (i < n && isdigit(buf[i])) ++ ++i; ++ *decpt = i; ++ ++ if (i == 0) ++ return 0; ++ ++ if (i < n) ++ { ++ do ++ ++i; ++ while (i < n && !isdigit(buf[i])); ++ ++ if (*decpt == 1 && buf[0] == '0' && value != 0.0) ++ { ++ --*decpt; ++ ++ while (i < n && buf[i] == '0') ++ { ++ --*decpt; ++ ++i; ++ } ++ } ++ ++ memmove(&buf[MAX(*decpt, 0)], &buf[i], n - i); ++ buf[n - (i - MAX(*decpt, 0))] = '\0'; ++ } ++ ++ if (left) ++ { ++ *decpt += left; ++ if (--len > n) ++ { ++ while (left-- > 0 && n < len) ++ buf[n++] = '0'; ++ buf[n] = '\0'; ++ } ++ } ++ ++ return 0; ++} ++ ++char *fcvt(double value, int ndigit, int *decpt, int *sign) ++{ ++ fcvt_r(value, ndigit, decpt, sign, (char *)FCVT_BUFFER, MAXDIG); ++ return (char *)FCVT_BUFFER; ++} ++ diff --git a/devel/clanlib-devel/files/patch-ah b/devel/clanlib-devel/files/patch-ah index 5b00b0fe629e..33e55013fcde 100644 --- a/devel/clanlib-devel/files/patch-ah +++ b/devel/clanlib-devel/files/patch-ah @@ -1,6 +1,26 @@ --- Makefile.in.orig Sun Apr 9 15:17:58 2000 -+++ Makefile.in Sun Sep 24 15:01:31 2000 -@@ -261,43 +264,43 @@ ++++ Makefile.in Wed Jan 10 00:20:32 2001 +@@ -35,7 +35,8 @@ + Sources/Lua:\ + Sources/Lua/tolua:\ + Sources/MPEG:\ +- Sources/GUI ++ Sources/GUI:\ ++ Sources/Util + + OBJF_GENERIC = Libs/Intermediate/cliprect.o \ + Libs/Intermediate/res_surface_generic.o \ +@@ -131,7 +132,8 @@ + Libs/Intermediate/appconf.o \ + Libs/Intermediate/thread_pthread.o \ + Libs/Intermediate/mutex_pthread.o \ +- Libs/Intermediate/network_delivery_socket.o ++ Libs/Intermediate/network_delivery_socket.o \ ++ Libs/Intermediate/fcvt.o + + OBJF_NETWORK_UNIX = Libs/Intermediate/network_delivery_unix.o \ + Libs/Intermediate/network_delivery_pipe.o \ +@@ -261,43 +263,43 @@ @install -d $(BIN_PREFIX) @install -d $(LIB_PREFIX) @for i in `find Sources/API/* -type d | grep -v CVS | sed "s/Sources\/API\///;"`; do install -d $(INC_PREFIX)/ClanLib/$$i; done @@ -52,7 +72,7 @@ ln -s -f libclanPNG.so.$(D_VERSION_MINOR) $(LIB_PREFIX)/libclanPNG.so.$(D_VERSION_MAJOR); \ ln -s -f libclanPNG.so.$(D_VERSION_MAJOR) $(LIB_PREFIX)/libclanPNG.so; \ fi -@@ -306,10 +309,10 @@ +@@ -306,10 +308,10 @@ install -d $(TARGET_PREFIX); \ all_targets_var="$(ALL_TARGETS)"; \ for curtarget in $$all_targets_var; do \ |