sci-visualization/spyview: try to fix it for all gcc variants :/

This commit is contained in:
Andreas K. Huettel
2017-04-19 16:44:30 +02:00
committed by Andreas K. Huettel
parent d8167c5254
commit 0f4e787aa9
2 changed files with 143 additions and 0 deletions
@@ -0,0 +1,142 @@
diff --git a/spyview/ImageData.C b/spyview/ImageData.C
index 29decea..eaac7a6 100644
--- a/spyview/ImageData.C
+++ b/spyview/ImageData.C
@@ -9,6 +9,9 @@
#include "mypam.h"
#include "../config.h"
+#include <cmath>
+using std::isnan;
+
#include <algorithm>
// From http://www.redhat.com/docs/manuals/enterprise/RHEL-3-Manual/gcc/variadic-macros.html
@@ -180,12 +183,12 @@ void ImageData::load_int(int *data,
double y1, double y2,
double z1, double z2)
{
- xmin = std::isnan(x1) ? x1 : 0;
- xmax = std::isnan(x2) ? x2 : width-1;
- ymin = std::isnan(y1) ? y1 : 0;
- ymax = std::isnan(y2) ? y2 : height-1;
- qmin = std::isnan(z1) ? z1 : 0;
- qmax = std::isnan(z2) ? z2 : QUANT_MAX;
+ xmin = isnan(x1) ? x1 : 0;
+ xmax = isnan(x2) ? x2 : width-1;
+ ymin = isnan(y1) ? y1 : 0;
+ ymax = isnan(y2) ? y2 : height-1;
+ qmin = isnan(z1) ? z1 : 0;
+ qmax = isnan(z2) ? z2 : QUANT_MAX;
width = w;
height = h;
@@ -214,10 +217,10 @@ void ImageData::load_raw(double *data,
double x1, double x2,
double y1, double y2)
{
- xmin = std::isnan(x1) ? x1 : 0;
- xmax = std::isnan(x2) ? x2 : width-1;
- ymin = std::isnan(y1) ? y1 : 0;
- ymax = std::isnan(y2) ? y2 : height-1;
+ xmin = isnan(x1) ? x1 : 0;
+ xmax = isnan(x2) ? x2 : width-1;
+ ymin = isnan(y1) ? y1 : 0;
+ ymax = isnan(y2) ? y2 : height-1;
width = w;
height = h;
@@ -762,7 +765,7 @@ int ImageData::load_Delft(const char *name)
//if (sscanf(linebuffer, "%*f\t%lf\t%lf", &last_sweep, &last_data) != 2)
last_data = parse_reading(linebuffer, gp_column);
- if (std::isnan(last_data))
+ if (isnan(last_data))
{
//info("line\n%s\ncgp_column %d\nval %e\n", linebuffer, gp_column, last_data);
badfilec("invalid data in delft file at line %d\nline: %s\n", nread, linebuffer);
@@ -1116,7 +1119,7 @@ void ImageData::gamma(double gamma, double epsilon)
v2 = pow(v1, gamma);
//if (!isfinite(v2))
//info("v1 %e v2 %e eps %e\n", v1, v2, epsilon);
- if (std::isnan(v2))
+ if (isnan(v2))
raw_data[i] = 0;
else
raw_data[i] = v2;
@@ -2385,7 +2388,7 @@ int MTX_Data::load_file(const char *name)
float tmp;
if (fread(&tmp, bytes, 1, fp) != 1)
badfilec( "Short read on mtx file: %s", filename.c_str());
- if (std::isnan(tmp)) warn( "nan at %d %d %d", i, j, k);
+ if (isnan(tmp)) warn( "nan at %d %d %d", i, j, k);
getData(i,j,k) = tmp;
}
else if (bytes == 8)
@@ -3419,7 +3422,7 @@ int MTX_Data::load_dat_meta(const char *name, int col)
else // otherwise try to get new data
{
val = nextreading(fp, col, lnum);
- if (std::isnan(val)) // failed to read a point
+ if (isnan(val)) // failed to read a point
{
if (npoints == 0)
{
diff --git a/spyview/ImageWindow.C b/spyview/ImageWindow.C
index e1a8ecb..eeae649 100644
--- a/spyview/ImageWindow.C
+++ b/spyview/ImageWindow.C
@@ -12,6 +12,9 @@
#include "ImageWindow_Module.H"
#include <ctype.h>
+#include <cmath>
+using std::isnan;
+
#include "mypam.h"
#ifdef WIN32
@@ -696,7 +699,7 @@ int ImageWindow::handle(int event)
*/
case FL_PUSH:
- if(std::isnan(lastFocus) && stupid_windows_focus)
+ if(isnan(lastFocus) && stupid_windows_focus)
{
fprintf(stderr,"Ate unfocused click. This apparently never happens.\n");
hungryFocus = true;
diff --git a/spyview/bisector.H b/spyview/bisector.H
index 4326da7..c7e64a6 100644
--- a/spyview/bisector.H
+++ b/spyview/bisector.H
@@ -3,6 +3,8 @@
#include <assert.h>
#include <math.h>
+#include <cmath>
+using std::isnan;
class bisector
{
@@ -105,18 +107,18 @@ public:
}
else
{
- if(fxp < 0 && (std::isnan(x1) || (fxp > fx1)))
+ if(fxp < 0 && (isnan(x1) || (fxp > fx1)))
{
x1 = xp;
fx1 = fxp;
}
- else if(fxp > 0 && (std::isnan(x2) || (fxp < fx2)))
+ else if(fxp > 0 && (isnan(x2) || (fxp < fx2)))
{
x2 = xp;
fx2 = fxp;
}
}
- bisection = !(std::isnan(x1) || std::isnan(x2));
+ bisection = !(isnan(x1) || isnan(x2));
if(bisection)
{
// printf("Bisection step: [%g,%g] {%g,%g}\n", x1,x2,fx1,fx2);
@@ -32,6 +32,7 @@ PATCHES=(
"${FILESDIR}/${P}"-gnuplot_interface_fix.patch
"${FILESDIR}/${P}"-gcc6cxx14.patch
"${FILESDIR}/${P}"-gcc6cxx14-2.patch
"${FILESDIR}/${P}"-gcc6cxx14-3.patch
)
src_unpack() {