changeset 606:1415e35881f6

* Some (incomplete) Solaris build bobs
author Chris Cannam
date Thu, 10 Sep 2009 14:17:59 +0000
parents 133418f4e74c
children a67651386253
files base/TempDirectory.cpp data/model/EditableDenseThreeDimensionalModel.cpp data/model/NoteModel.h data/model/SparseModel.h data/model/SparseOneDimensionalModel.h data/model/SparseTimeValueModel.h data/model/SparseValueModel.h system/System.h
diffstat 8 files changed, 36 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/base/TempDirectory.cpp	Tue Sep 08 16:53:32 2009 +0000
+++ b/base/TempDirectory.cpp	Thu Sep 10 14:17:59 2009 +0000
@@ -24,6 +24,7 @@
 
 #include <iostream>
 #include <cassert>
+#include <unistd.h>
 
 TempDirectory *
 TempDirectory::m_instance = new TempDirectory;
--- a/data/model/EditableDenseThreeDimensionalModel.cpp	Tue Sep 08 16:53:32 2009 +0000
+++ b/data/model/EditableDenseThreeDimensionalModel.cpp	Thu Sep 10 14:17:59 2009 +0000
@@ -333,7 +333,7 @@
 
     for (size_t i = 0; i < values.size(); ++i) {
         float value = values[i];
-        if (std::isnan(value) || std::isinf(value)) {
+        if (ISNAN(value) || ISINF(value)) {
             continue;
         }
 	if (!m_haveExtents || value < m_minimum) {
--- a/data/model/NoteModel.h	Tue Sep 08 16:53:32 2009 +0000
+++ b/data/model/NoteModel.h	Thu Sep 10 14:17:59 2009 +0000
@@ -178,7 +178,7 @@
             return IntervalModel<Note>::getData(row, column, role);
         }
 
-        PointListIterator i = getPointListIteratorForRow(row);
+        PointListConstIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return QVariant();
 
         switch (column) {
@@ -196,7 +196,7 @@
         }
 
         if (role != Qt::EditRole) return false;
-        PointListIterator i = getPointListIteratorForRow(row);
+        PointListConstIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return false;
         EditCommand *command = new EditCommand(this, tr("Edit Data"));
 
--- a/data/model/SparseModel.h	Tue Sep 08 16:53:32 2009 +0000
+++ b/data/model/SparseModel.h	Thu Sep 10 14:17:59 2009 +0000
@@ -67,6 +67,7 @@
     typedef std::multiset<PointType,
 			  typename PointType::OrderComparator> PointList;
     typedef typename PointList::iterator PointListIterator;
+    typedef typename PointList::const_iterator PointListConstIterator;
 
     /**
      * Return whether the model is empty or not.
@@ -149,7 +150,7 @@
     virtual QString toDelimitedDataString(QString delimiter) const
     { 
         QString s;
-        for (PointListIterator i = m_points.begin(); i != m_points.end(); ++i) {
+        for (PointListConstIterator i = m_points.begin(); i != m_points.end(); ++i) {
             s += i->toDelimitedDataString(delimiter, m_sampleRate) + "\n";
         }
         return s;
@@ -276,7 +277,7 @@
 
     virtual long getFrameForRow(int row) const
     {
-        PointListIterator i = getPointListIteratorForRow(row);
+        PointListConstIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return 0;
         return i->frame;
     }
@@ -296,7 +297,7 @@
     virtual int getColumnCount() const { return 1; }
     virtual QVariant getData(int row, int column, int role) const
     {
-        PointListIterator i = getPointListIteratorForRow(row);
+        PointListConstIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return QVariant();
 
         switch (column) {
--- a/data/model/SparseOneDimensionalModel.h	Tue Sep 08 16:53:32 2009 +0000
+++ b/data/model/SparseOneDimensionalModel.h	Thu Sep 10 14:17:59 2009 +0000
@@ -138,7 +138,7 @@
                 (row, column, role);
         }
 
-        PointListIterator i = getPointListIteratorForRow(row);
+        PointListConstIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return QVariant();
 
         switch (column) {
@@ -155,7 +155,7 @@
         }
 
         if (role != Qt::EditRole) return false;
-        PointListIterator i = getPointListIteratorForRow(row);
+        PointListConstIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return false;
         EditCommand *command = new EditCommand(this, tr("Edit Data"));
 
--- a/data/model/SparseTimeValueModel.h	Tue Sep 08 16:53:32 2009 +0000
+++ b/data/model/SparseTimeValueModel.h	Thu Sep 10 14:17:59 2009 +0000
@@ -128,7 +128,7 @@
                 (row, column, role);
         }
 
-        PointListIterator i = getPointListIteratorForRow(row);
+        PointListConstIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return QVariant();
 
         switch (column) {
@@ -148,7 +148,7 @@
         }
 
         if (role != Qt::EditRole) return false;
-        PointListIterator i = getPointListIteratorForRow(row);
+        PointListConstIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return false;
         EditCommand *command = new EditCommand(this, tr("Edit Data"));
 
--- a/data/model/SparseValueModel.h	Tue Sep 08 16:53:32 2009 +0000
+++ b/data/model/SparseValueModel.h	Thu Sep 10 14:17:59 2009 +0000
@@ -19,7 +19,7 @@
 #include "SparseModel.h"
 #include "base/UnitDatabase.h"
 
-#include <cmath>
+#include "system/System.h"
 
 /**
  * Model containing sparse data (points with some properties) of which
@@ -68,7 +68,7 @@
     {
 	bool allChange = false;
 
-        if (!std::isnan(point.value) && !std::isinf(point.value)) {
+        if (!ISNAN(point.value) && !ISINF(point.value)) {
             if (!m_haveExtents || point.value < m_valueMinimum) {
                 m_valueMinimum = point.value; allChange = true;
 //                std::cerr << "addPoint: value min = " << m_valueMinimum << std::endl;
--- a/system/System.h	Tue Sep 08 16:53:32 2009 +0000
+++ b/system/System.h	Thu Sep 10 14:17:59 2009 +0000
@@ -21,6 +21,7 @@
 #include <windows.h>
 #include <malloc.h>
 #include <process.h>
+#include <math.h>
 
 #define MLOCK(a,b)   1
 #define MUNLOCK(a,b) 1
@@ -58,11 +59,15 @@
 int gettimeofday(struct timeval *p, void *tz);
 }
 
+#define ISNAN isnan
+#define ISINF isinf
+
 #else
 
 #include <sys/mman.h>
 #include <dlfcn.h>
 #include <stdio.h> // for perror
+#include <cmath>
 
 #define MLOCK(a,b)   ::mlock((a),(b))
 #define MUNLOCK(a,b) (::munlock((a),(b)) ? (::perror("munlock failed"), 0) : 0)
@@ -76,6 +81,10 @@
 #define DLCLOSE(a)   dlclose((a))
 #define DLERROR()    dlerror()
 
+#include <cmath>
+#define ISNAN std::isnan
+#define ISINF std::isinf
+
 #ifdef __APPLE__
 
 #define PLUGIN_GLOB  "*.dylib *.so"
@@ -88,6 +97,19 @@
 
 #else 
 
+#ifdef sun
+#undef MLOCK
+#undef MUNLOCK
+#define MLOCK(a,b) ::mlock((char *)a,b)
+#define MUNLOCK(a,b) ::munlock((char *)a,b)
+#ifdef __SUNPRO_CC
+#undef ISNAN
+#undef ISINF
+#define ISNAN(x) ((x)!=(x))
+#define ISINF(x) 0
+#endif
+#endif
+
 #define PLUGIN_GLOB  "*.so"
 #define PATH_SEPARATOR ':'