Index: ossp-pkg/l2/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/l2/ChangeLog,v rcsdiff -q -kk '-r1.12' '-r1.13' -u '/v/ossp/cvs/ossp-pkg/l2/ChangeLog,v' 2>/dev/null --- ChangeLog 2004/04/21 12:19:32 1.12 +++ ChangeLog 2004/04/22 10:10:57 1.13 @@ -9,6 +9,13 @@ ChangeLog ========= + Changes between 0.9.6 and 0.9.7 (21-Apr-2003 to 22-Apr-2004) + + *) Replace modf(3) calls in l2_util_format.c with a hand-crafted + inlined l2_util_modf() function to avoid dependency to external libm + on systems (like Tru64, QNX, etc) where modf(3) is not part of libc. + [Ralf S. Engelschall ] + Changes between 0.9.5 and 0.9.6 (10-Nov-2003 to 21-Apr-2004) *) create devtool.conf %import and import OSSP sa 1.2.0 Index: ossp-pkg/l2/l2_ut_format.c RCS File: /v/ossp/cvs/ossp-pkg/l2/l2_ut_format.c,v rcsdiff -q -kk '-r1.8' '-r1.9' -u '/v/ossp/cvs/ossp-pkg/l2/l2_ut_format.c,v' 2>/dev/null --- l2_ut_format.c 2003/01/06 11:41:52 1.8 +++ l2_ut_format.c 2004/04/22 10:10:57 1.9 @@ -162,6 +162,25 @@ #define l2_util_fcvt(arg,ndigits,decpt,sign,buf) \ l2_util_cvt((arg), (ndigits), (decpt), (sign), 0, (buf)) +/* inlined modf(3) to avoid dependency to external libm on systems + (like Tru64, QNX, etc) where modf(3) is not part of libc. */ +static double +l2_util_modf( + double arg, + double *iptr) +{ + double fraction; + double integral; + long trunc; + + trunc = (long)arg; + integral = (double)trunc; + fraction = arg - integral; + if (iptr != NULL) + *iptr = integral; + return fraction; +} + static char * l2_util_cvt( double arg, @@ -184,14 +203,14 @@ *sign = TRUE; arg = -arg; } - arg = modf(arg, &fi); + arg = l2_util_modf(arg, &fi); p1 = &buf[NDIG]; /* Do integer part */ if (fi != 0) { p1 = &buf[NDIG]; while (fi != 0 && p1 > &buf[0]) { - fj = modf(fi / 10, &fi); + fj = l2_util_modf(fi / 10, &fi); *--p1 = (int)((fj + .03) * 10) + '0'; r2++; } @@ -214,7 +233,7 @@ } while (p <= p1 && p < &buf[NDIG]) { arg *= 10; - arg = modf(arg, &fj); + arg = l2_util_modf(arg, &fj); *p++ = (int) fj + '0'; } if (p1 >= &buf[NDIG]) {