[Kst] branches/work/kst/1.5/kst/src/datasources/scuba2

Andrew Walker arwalker at sumusltd.com
Tue Aug 28 23:31:41 CEST 2007


SVN commit 705908 by arwalker:

read newly added version number from header

 M  +46 -4     scuba.cpp  
 M  +1 -0      scuba.h  


--- branches/work/kst/1.5/kst/src/datasources/scuba2/scuba.cpp #705907:705908
@@ -200,6 +200,7 @@
   _numHousekeepingFieldsInUse = 0;
   _first = true;
   _numFramesLastReadMatrix = 0;
+  _version = -1;
 
   for (int i=0; i<numHousekeepingFields; i++) {
     if (strlen(housekeepingFields[i]) > 0) {
@@ -353,6 +354,7 @@
     bool foundDataMode = false;
     bool foundNumRows = false;
     bool foundRowLen = false;
+    bool foundVersion = false;
     int index;
     int line = 0;
     int read;
@@ -408,6 +410,16 @@
               _numRows = -1;
             }
             foundNumRows = true;
+          } else if (!foundVersion && s.contains("DAS_VERSION") == 1) {
+            index = s.find(QChar('>'));
+            s.remove(0, index+1);
+            s.stripWhiteSpace();
+            s.remove(5, s.length());
+            _version = s.toInt(&ok, 10);
+            if (!ok) {
+              _version = -1;
+            }
+            foundVersion = true;
           }
           ++line;
         }
@@ -1218,6 +1230,7 @@
   int num_rows = -1;
   int num_cols = -1;
   int row_len = -1;
+  int version = -1;
 
   //
   // check for the presence of a .run file
@@ -1233,6 +1246,7 @@
       bool foundDataMode = false;
       bool foundNumRows = false;
       bool foundRowLen = false;
+      bool foundVersion = false;
       bool done = false;
       bool ok;
       int index;
@@ -1273,6 +1287,16 @@
             num_rows = -1;
           }
           foundNumRows = true;
+        } else if (!foundVersion && s.contains("DAS_VERSION") == 1) {
+          index = s.find(QChar('>'));
+          s.remove(0, index+1);
+          s.stripWhiteSpace();
+          s.remove(5, s.length());
+          version = s.toInt(&ok, 10);
+          if (!ok) {
+            version = -1;
+          }
+          foundVersion = true;
         }
       }
 
@@ -1333,8 +1357,11 @@
     int i;
     int j;
 
-    // FIXME - should be configurable...
-    num_cols = 8;
+    if (version > 111) {
+      num_cols = 32;
+    } else {
+      num_cols = 8;
+    }
 
     rc += "INDEX";
 
@@ -1396,6 +1423,7 @@
   int num_rows = -1;
   int num_cols = -1;
   int row_len = -1;
+  int version = -1;
 
   if (_matrixList.isEmpty()) {
     if (_config->_readMatrices) {
@@ -1414,6 +1442,7 @@
             bool foundDataMode = false;
             bool foundNumRows = false;
             bool foundRowLen = false;
+            bool foundVersion = false;
             bool done = false;
             bool ok;
             int index;
@@ -1454,6 +1483,16 @@
                   num_rows = -1;
                 }
                 foundNumRows = true;
+              } else if (!foundVersion && s.contains("DAS_VERSION") == 1) {
+                index = s.find(QChar('>'));
+                s.remove(0, index+1);
+                s.stripWhiteSpace();
+                s.remove(5, s.length());
+                version = s.toInt(&ok, 10);
+                if (!ok) {
+                  version = -1;
+                }
+                foundVersion = true;
               }
             }
 
@@ -1516,8 +1555,11 @@
   if (populate) {
     int i;
 
-    // FIXME - should be configurable...
-    num_cols = 8;
+    if (version > 111) {
+      num_cols = 32;
+    } else {
+      num_cols = 8;
+    }
 
     for (i=0; i<_numFrames; i++) {
       switch (datamode) {
--- branches/work/kst/1.5/kst/src/datasources/scuba2/scuba.h #705907:705908
@@ -81,6 +81,7 @@
     bool _haveHeader;
     bool _first;
     int _numFramesLastReadMatrix;
+    int _version;
     mutable bool _fieldListComplete;
 };
 


More information about the Kst mailing list