From: Benjamin Auder <benjamin.auder@somewhere>
Date: Fri, 17 Mar 2017 16:18:04 +0000 (+0100)
Subject: add some prints in convert_to_CSV.c; almost working. TODO...
X-Git-Url: https://git.auder.net/variants/img/current/assets/css/common.css?a=commitdiff_plain;h=2203730448baaaaa6164729fb1db9cca7a488872;p=epclust.git

add some prints in convert_to_CSV.c; almost working. TODO...
---

diff --git a/data/preprocessing/convert_to_CSV.c b/data/preprocessing/convert_to_CSV.c
index 34cb6e4..df31f71 100644
--- a/data/preprocessing/convert_to_CSV.c
+++ b/data/preprocessing/convert_to_CSV.c
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <math.h>
 #include <float.h>
+#include <stdio.h>
 
 // Read an integer char by char, and position the cursor to next character
 char readInt(FILE* stream, int* integer)
@@ -15,8 +16,13 @@ char readInt(FILE* stream, int* integer)
 		nextChar = fgetc(stream);
 	ungetc(nextChar, stream);
 	while ((nextChar = fgetc(stream)) >= '0' && nextChar <= '9')
-		*integer = 10 * (*integer) + (int) (nextChar - '0');
+	{
+
+	printf("next char: %c\n",nextChar);
+
+		*integer = 10 * (*integer) + (int) (nextChar - '0'); }
 	(*integer) *= sign;
+printf("INTEGER: %i\n",*integer);
 	return nextChar;
 }
 
@@ -113,13 +119,13 @@ int transform(const char* ifileName, int posID, int posValue,
 
 		// Read current line
 		scan_line(ifile, sep, posID, &ID, posValue, &value);
+
+		printf("SCAN: %i %g\n",ID,value);
 		if (ID != lastID)
 		{
 			// Just starting a new time-series: must process the last one (if exists !)
 			if (lastID > 0)
 			{
-				if (refTsLength == 0)
-					refTsLength = tsLength; //first serie is considered clean
 				if (tsLength == refTsLength)
 				{
 					for (int i=0; i<tsLength; i++)
@@ -135,12 +141,14 @@ int transform(const char* ifileName, int posID, int posValue,
 				else
 					mismatchLengthCount++;
 			}
+			else
+				refTsLength = tsLength; //first serie is considered clean
 
 			// reinitialize flags
 			tsLength = 0;
 			lastID = ID;
 		}
-
+printf("LA %i %i\n",tsLength,refTsLength);
 		//We cannot write more than refTsLength values
 		if (tsLength < refTsLength)
 			tsBuffer[tsLength++] = value;