diff options
Diffstat (limited to 'src/misc.cc')
-rw-r--r-- | src/misc.cc | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/src/misc.cc b/src/misc.cc index ea72572..d79204d 100644 --- a/src/misc.cc +++ b/src/misc.cc @@ -1,66 +1,66 @@ -#include <list> -#include "Handle.h" -#include "String.h" - -void GeneDeroul(Handle * h, String * & l1, String * & l2) { - int count; - list<String> result; - String r1, r2; - - count = 0; - - while (1) { - (*h) >> r1; - (*h) >> r2; - if ((r1 == "") && (r2 == "")) break; - result.push_back(r1); - result.push_back(r2); - count++; - } - - l1 = new String[count + 1]; - l2 = new String[count + 1]; - - for (int i = 0; i < count; i++) { - r1 = result.front(); - result.pop_front(); - r2 = result.front(); - result.pop_front(); - l1[i] = r1; - l2[i] = r2; - } - - l1[count] = ""; - l2[count] = ""; -} - -int GeneList(Handle * h, int nbcol, String * & l) { - int nblig; - list<String> result; - String r; - bool is_null; - - nblig = 0; - while (1) { - is_null = true; - for (int i = 0; i < nbcol; i++) { - (*h) >> r; - result.push_back(r); - if (r != "") is_null = false; - } - if (is_null) break; - nblig++; - } - - l = new String[nbcol * nblig + 1]; - - for (int i = 0; i < (nbcol * nblig); i++) { - r = result.front(); - result.pop_front(); - l[i] = r; - } - - l[nbcol * nblig] = ""; - - return nblig; -} +#include <list>
+#include "Handle.h"
+#include "String.h"
+
+void GeneDeroul(Handle * h, String * & l1, String * & l2) {
+ int count;
+ list<String> result;
+ String r1, r2;
+
+ count = 0;
+
+ while (1) {
+ (*h) >> r1;
+ (*h) >> r2;
+ if ((r1 == "") && (r2 == "")) break;
+ result.push_back(r1);
+ result.push_back(r2);
+ count++;
+ }
+
+ l1 = new String[count + 1];
+ l2 = new String[count + 1];
+
+ for (int i = 0; i < count; i++) {
+ r1 = result.front();
+ result.pop_front();
+ r2 = result.front();
+ result.pop_front();
+ l1[i] = r1;
+ l2[i] = r2;
+ }
+
+ l1[count] = "";
+ l2[count] = "";
+}
+
+int GeneList(Handle * h, int nbcol, String * & l) {
+ int nblig;
+ list<String> result;
+ String r;
+ bool is_null;
+
+ nblig = 0;
+ while (1) {
+ is_null = true;
+ for (int i = 0; i < nbcol; i++) {
+ (*h) >> r;
+ result.push_back(r);
+ if (r != "") is_null = false;
+ }
+ if (is_null) break;
+ nblig++;
+ }
+
+ l = new String[nbcol * nblig + 1];
+
+ for (int i = 0; i < (nbcol * nblig); i++) {
+ r = result.front();
+ result.pop_front();
+ l[i] = r;
+ }
+
+ l[nbcol * nblig] = "";
+
+ return nblig;
+}
|