changeset 23815:4d11ada80395

Restore using gnulib wrapper for frexp until MinGW C library is fixed (bug #51630). Backed out changeset 4c048a2792bc.
author Rik <rik@octave.org>
date Mon, 31 Jul 2017 13:48:13 -0700
parents 3ac5d3d01cad
children d9ca3f15f739
files bootstrap.conf liboctave/numeric/lo-mappers.cc liboctave/numeric/lo-mappers.h liboctave/wrappers/math-wrappers.c liboctave/wrappers/math-wrappers.h liboctave/wrappers/module.mk
diffstat 6 files changed, 117 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/bootstrap.conf	Mon Jul 31 13:55:15 2017 +0200
+++ b/bootstrap.conf	Mon Jul 31 13:48:13 2017 -0700
@@ -38,6 +38,8 @@
   filemode
   fnmatch
   fpucw
+  frexp
+  frexpf
   fseek
   ftell
   ftruncate
--- a/liboctave/numeric/lo-mappers.cc	Mon Jul 31 13:55:15 2017 +0200
+++ b/liboctave/numeric/lo-mappers.cc	Mon Jul 31 13:48:13 2017 -0700
@@ -27,6 +27,7 @@
 
 #include "lo-mappers.h"
 #include "lo-specfun.h"
+#include "math-wrappers.h"
 
 // FIXME: We used to have this situation:
 //
@@ -122,6 +123,16 @@
         return y;
     }
 
+    double frexp (double x, int *expptr)
+    {
+      return octave_frexp_wrapper (x, expptr);
+    }
+
+    float frexp (float x, int *expptr)
+    {
+      return octave_frexpf_wrapper (x, expptr);
+    }
+
     Complex
     log2 (const Complex& x)
     {
@@ -134,6 +145,18 @@
       return std::log (x) / static_cast<float> (M_LN2);
     }
 
+    double
+    log2 (double x, int& exp)
+    {
+      return frexp (x, &exp);
+    }
+
+    float
+    log2 (float x, int& exp)
+    {
+      return frexp (x, &exp);
+    }
+
     Complex
     log2 (const Complex& x, int& exp)
     {
--- a/liboctave/numeric/lo-mappers.h	Mon Jul 31 13:55:15 2017 +0200
+++ b/liboctave/numeric/lo-mappers.h	Mon Jul 31 13:48:13 2017 -0700
@@ -98,14 +98,8 @@
     extern OCTAVE_API Complex log2 (const Complex& x);
     extern OCTAVE_API FloatComplex log2 (const FloatComplex& x);
 
-    inline double log2 (double x, int& exp)
-    {
-      return std::frexp (x, &exp);
-    }
-    inline float log2 (float x, int& exp)
-    {
-      return std::frexp (x, &exp);
-    }
+    extern OCTAVE_API double log2 (double x, int& exp);
+    extern OCTAVE_API float log2 (float x, int& exp);
 
     extern OCTAVE_API Complex log2 (const Complex& x, int& exp);
     extern OCTAVE_API FloatComplex log2 (const FloatComplex& x, int& exp);
@@ -187,15 +181,8 @@
       return std::complex<T> (roundb (std::real (x)), roundb (std::imag (x)));
     }
 
-    inline double frexp (double x, int *expptr)
-    {
-      return std::frexp (x, expptr);
-    }
-
-    inline float frexp (float x, int *expptr)
-    {
-      return std::frexp (x, expptr);
-    }
+    extern OCTAVE_API double frexp (double x, int *expptr);
+    extern OCTAVE_API float frexp (float x, int *expptr);
 
     inline bool isnan (bool) { return false; }
     inline bool isnan (char) { return false; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/wrappers/math-wrappers.c	Mon Jul 31 13:48:13 2017 -0700
@@ -0,0 +1,46 @@
+/*
+
+Copyright (C) 2016-2017 Mike Miller
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+Octave 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+// These functions may be provided by gnulib.  We don't include gnulib
+// headers directly in Octave's C++ source files to avoid problems that
+// may be caused by the way that gnulib overrides standard library
+// functions.
+
+#if defined (HAVE_CONFIG_H)
+#  include "config.h"
+#endif
+
+#include <math.h>
+
+#include "math-wrappers.h"
+
+double
+octave_frexp_wrapper (double x, int *expptr)
+{
+  return frexp (x, expptr);
+}
+
+float
+octave_frexpf_wrapper (float x, int *expptr)
+{
+  return frexpf (x, expptr);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/liboctave/wrappers/math-wrappers.h	Mon Jul 31 13:48:13 2017 -0700
@@ -0,0 +1,40 @@
+/*
+
+Copyright (C) 2016-2017 Mike Miller
+
+This file is part of Octave.
+
+Octave is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+Octave 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Octave; see the file COPYING.  If not, see
+<http://www.gnu.org/licenses/>.
+
+*/
+
+#if ! defined (octave_math_wrappers_h)
+#define octave_math_wrappers_h 1
+
+#if defined __cplusplus
+extern "C" {
+#endif
+
+double
+octave_frexp_wrapper (double x, int *expptr);
+
+float
+octave_frexpf_wrapper (float x, int *expptr);
+
+#if defined __cplusplus
+}
+#endif
+
+#endif
--- a/liboctave/wrappers/module.mk	Mon Jul 31 13:55:15 2017 +0200
+++ b/liboctave/wrappers/module.mk	Mon Jul 31 13:48:13 2017 -0700
@@ -12,6 +12,7 @@
   %reldir%/glob-wrappers.h \
   %reldir%/hash-wrappers.h \
   %reldir%/localcharset-wrapper.h \
+  %reldir%/math-wrappers.h \
   %reldir%/mkostemp-wrapper.h \
   %reldir%/nanosleep-wrapper.h \
   %reldir%/nproc-wrapper.h \
@@ -48,6 +49,7 @@
   %reldir%/glob-wrappers.c \
   %reldir%/hash-wrappers.c \
   %reldir%/localcharset-wrapper.c \
+  %reldir%/math-wrappers.c \
   %reldir%/mkostemp-wrapper.c \
   %reldir%/nanosleep-wrapper.c \
   %reldir%/nproc-wrapper.c \