From: <dhu...@us...> - 2006-11-30 16:51:39
|
Revision: 39 http://svn.sourceforge.net/qcell/?rev=39&view=rev Author: dhubleizh Date: 2006-11-30 08:51:37 -0800 (Thu, 30 Nov 2006) Log Message: ----------- - better header parsing - some more sanity checks - resolved todo with double adding possibility Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2006-11-30 16:33:24 UTC (rev 38) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2006-11-30 16:51:37 UTC (rev 39) @@ -90,10 +90,12 @@ format = QRegExp("^([0-9a-Z] ){2}[0-9a-Z]$"); if(format.exactMatch(lines[0])) { - arguments_nr = lines[0][0].toAscii() - '0'; - values_nr = lines[0][2].toAscii() - '0'; - return_values_nr = lines[0][4].toAscii() - '0'; + QString tmp_split = lines[0].split(' '); + arguments_nr = tmp_split[0].toLong(); + values_nr = tmp_split[1].toLong(); + return_values_nr = tmp_split[2].toLong(); + max_sum = arguments_nr * (values_nr - 1); if((arguments_nr == 0) || (values_nr == 0) || (return_values_nr == 0)) @@ -106,6 +108,18 @@ return QString(); } + int max_value = 'Z' - '0'; + if((arguments_nr > max_value) || (values_nr > max_value) || (return_values_nr) > max_value) + { + qDebug(tr("None of the numbers in line %1 cannot exceed the maximum possible value of %2") + .arg(line_nr) + .arg(max_value) + .toAscii() + ); + + return QString(); + } + lines.removeFirst(); line_nr++; } @@ -217,8 +231,18 @@ value_index++; } + if(results.contains(tmp_sum)) + { + qDebug(tr("The sum %1 in line %2 already added.") + .arg(tmp_sum) + .arg(line_nr) + .toAscii() + ); + + return QString(); + } + results[tmp_sum] == new QVector<int>(tmp_values); - // @todo A way of checking double sums occurence line_nr++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2006-11-30 17:01:55
|
Revision: 41 http://svn.sourceforge.net/qcell/?rev=41&view=rev Author: dhubleizh Date: 2006-11-30 09:01:48 -0800 (Thu, 30 Nov 2006) Log Message: ----------- - random docs added during recheck Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2006-11-30 16:53:48 UTC (rev 40) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2006-11-30 17:01:48 UTC (rev 41) @@ -7,6 +7,7 @@ */ #include "FQTParserPlugin.h" + QStringList FQTParserPlugin::parserTypes() const { return QStringList(FQT_PARSER_TYPE); @@ -29,6 +30,7 @@ } } +/// @todo Incorporate genreal Function file to output resulting XML QString FQTParserPlugin::parse(const QByteArray content, const QString type) { QStringList lines; @@ -174,7 +176,7 @@ ); } - // @todo Is there a way of determining the number of lines left for sanity check? + /// @todo Is there a way of determining the number of lines left for sanity check? // Main function parsing lines[0] = lines[0].trimmed(); @@ -197,6 +199,7 @@ // First splitting by ':' and parsing the left side tmp = line.split(':'); tmp_sum = tmp[0].toLong(); + // Sanity check if(tmp_sum > max_sum) { qDebug(tr("The sum in line %1 is bigger then the maximum possible according th the header.") @@ -228,9 +231,11 @@ // Collecting this lines values tmp_values.append(value.toAscii() - '0'); + // Keep track of current parsed value value_index++; } + // Double adding sanity check if(results.contains(tmp_sum)) { qDebug(tr("The sum %1 in line %2 already added.") @@ -242,8 +247,10 @@ return QString(); } + // Finally adding the parsed values results[tmp_sum] == new QVector<int>(tmp_values); + // To keep count of current line nr line_nr++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-18 16:27:19
|
Revision: 195 http://svn.sourceforge.net/qcell/?rev=195&view=rev Author: dhubleizh Date: 2007-01-18 08:20:23 -0800 (Thu, 18 Jan 2007) Log Message: ----------- - debug on screen to find the FQT bug Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-18 16:19:48 UTC (rev 194) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-18 16:20:23 UTC (rev 195) @@ -6,6 +6,7 @@ * Last Update: czw lis 30 14:19:22 CET 2006 */ #include "FQTParserPlugin.h" +#include <QDebug> FQTParserPlugin::FQTParserPlugin() { @@ -113,6 +114,8 @@ .arg(format.pattern()) .toAscii() ); + + return QString(); } // Index of arguments getting summed up @@ -126,7 +129,7 @@ } default: { - format = QRegExp("^((\\d)+,){1," + QString::number(arguments_nr-2) + "}(\\d)+$"); + format = QRegExp("^((\\d)+,){0," + QString::number(arguments_nr-2) + "}(\\d)+$"); } } if(format.exactMatch(lines[0])) @@ -190,6 +193,7 @@ .toAscii() ); + return QString(); } // First splitting by ':' and parsing the left side @@ -275,14 +279,28 @@ /// @todo How the fuck set FQT function parameters eh? + QString test; + foreach(int sum, results.keys()) + { + test.clear(); + foreach(int value, results[sum]) + { + test.append(QString::number(value)); + test.append(','); + } + + qDebug() << sum << " : " << test; + + } + switch(lf.getFunctonType()) { case LocalFunction::SUM_AND_SWITCH: lf.setDefaultValue(0); foreach(int sum, results.keys()) { - for(int i=0;i<results.value(sum).size();++i) - lf.setFunctionValue((results.value(sum))[results.value(sum).size() - i - 1], sum, i); + for(int i=0; i < results[sum].size(); ++i) + lf.setFunctionValue(results[sum][results[sum].size() - i - 1], sum, i); } break; } @@ -302,6 +320,8 @@ if(!lf.fromXmlString(&content)); { qDebug(tr("Unable to parse out internal data!").toAscii()); + + return QByteArray(); } // Header This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-02-16 22:06:59
|
Revision: 336 http://svn.sourceforge.net/qcell/?rev=336&view=rev Author: dhubleizh Date: 2007-02-16 14:06:58 -0800 (Fri, 16 Feb 2007) Log Message: ----------- - FQT block against REAK functions saving Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-02-16 21:53:26 UTC (rev 335) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-02-16 22:06:58 UTC (rev 336) @@ -320,13 +320,21 @@ lf.fromXmlString(&content); // Check if we can use the generic type from the XML string -// if(!lf.fromXmlString(&content)); -// { -// qDebug(tr("Unable to parse out internal data!").toAscii()); -// -// return QByteArray(); -// } + if(!lf.fromXmlString(&content)); + { + qDebug(tr("Unable to parse out internal data!").toAscii()); + return QByteArray(); + } + else if (lf.getFunctonType() == LocalFunction::SUM_AND_SWITCH) + { + qDebug(tr("This format cannot store this function type.") + .toAscii() + ); + + return QByteArray(); + } + // Header result.append("FQT\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2006-11-30 20:27:37
|
Revision: 42 http://svn.sourceforge.net/qcell/?rev=42&view=rev Author: dhubleizh Date: 2006-11-30 12:27:13 -0800 (Thu, 30 Nov 2006) Log Message: ----------- - no changes - just to check some outside SF script Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2006-11-30 17:01:48 UTC (rev 41) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2006-11-30 20:27:13 UTC (rev 42) @@ -1,6 +1,6 @@ /**@file FQTParserPlugin.c * @author czarny - * @version 0.3 + * @version 0.4 * @date * Created: czw lis 30 14:19:22 CET 2006 \n * Last Update: czw lis 30 14:19:22 CET 2006 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-12 17:40:53
|
Revision: 154 http://svn.sourceforge.net/qcell/?rev=154&view=rev Author: dhubleizh Date: 2007-01-12 09:40:46 -0800 (Fri, 12 Jan 2007) Log Message: ----------- - maximum value check bug Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-12 16:51:11 UTC (rev 153) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-12 17:40:46 UTC (rev 154) @@ -230,7 +230,7 @@ // Keep track of current parsed value value_index++; // Sanity check for value - if(value.toAscii() >= ('0'+values_nr)) + if((int)value.toAscii() >= ((int)'0'+return_values_nr)) { qDebug(tr("The value number %1 in line %2 is larger then the maximum declared in the header.") .arg(value_index) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-12 18:35:31
|
Revision: 157 http://svn.sourceforge.net/qcell/?rev=157&view=rev Author: dhubleizh Date: 2007-01-12 10:35:18 -0800 (Fri, 12 Jan 2007) Log Message: ----------- - removed QDebug include - all toLong changed to toInt - proper parsing values > 9 Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-12 18:32:47 UTC (rev 156) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-12 18:35:18 UTC (rev 157) @@ -6,7 +6,6 @@ * Last Update: czw lis 30 14:19:22 CET 2006 */ #include "FQTParserPlugin.h" -#include <QDebug> FQTParserPlugin::FQTParserPlugin() { @@ -92,7 +91,7 @@ return QString(); } - int max_value = 'Z' - '0'; + int max_value = ('9' - '0') + ('z' - 'A'); if((arguments_nr > max_value) || (values_nr > max_value) || (return_values_nr) > max_value) { qDebug(tr("None of the numbers in line %1 cannot exceed the maximum possible value of %2") @@ -131,7 +130,6 @@ } } if(format.exactMatch(lines[0])) - /// @todo Absolutely change that!!!! { int arg_index, arg_nr; arg_nr = 0; @@ -139,7 +137,7 @@ foreach(QString argument, lines[0].split(',')) { arg_nr++; - arg_index = argument.toLong(); + arg_index = argument.toInt(); // Sanity check if(arg_index > arguments_nr) @@ -178,7 +176,7 @@ // Main function parsing lines[0] = lines[0].trimmed(); - format = QRegExp("^(\\d)+: [0-9a-Z]{" + QString::number(free_args_columns-1) + "}[0-9a-Z]$"); + format = QRegExp("^(\\d)+: [0-9A-z]{" + QString::number(free_args_columns-1) + "}[0-9A-z]$"); QStringList tmp; int tmp_sum,value_index; QVector<int> tmp_values; @@ -196,7 +194,7 @@ // First splitting by ':' and parsing the left side tmp = line.split(':'); - tmp_sum = tmp[0].toLong(); + tmp_sum = tmp[0].toInt(); // Sanity check if(tmp_sum > max_sum) { @@ -223,6 +221,7 @@ // First clearing tmp values tmp_values.clear(); value_index = 0; + int tmp_sign; // Remove space after seperator ':' tmp[1].remove(0, 1); foreach(QChar value, tmp[1]) @@ -230,7 +229,7 @@ // Keep track of current parsed value value_index++; // Sanity check for value - if((int)value.toAscii() >= ((int)'0'+return_values_nr)) + if((int)value.toAscii() >= ((int)'A' + (return_values_nr-10))) { qDebug(tr("The value number %1 in line %2 is larger then the maximum declared in the header.") .arg(value_index) @@ -242,8 +241,16 @@ } // Collecting this lines values - tmp_values.append(value.toAscii() - '0'); + tmp_sign = (int)value.toAscii(); + if(tmp_sign >= (int)'A') + { + tmp_values.append(tmp_sign - (int)'A' + 10); + } + else + { + tmp_values.append(tmp_sign - (int)'0'); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-01-20 13:38:41
|
Revision: 206 http://svn.sourceforge.net/qcell/?rev=206&view=rev Author: dhubleizh Date: 2007-01-20 05:38:36 -0800 (Sat, 20 Jan 2007) Log Message: ----------- - last line bug Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-20 13:00:59 UTC (rev 205) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-01-20 13:38:36 UTC (rev 206) @@ -39,7 +39,7 @@ // Basic sanity check lines = QString(content).split('\n'); // Check if there is pending '\n' to chop - if(lines.last().count() == 0) + if(lines.last().isEmpty()) { lines.removeLast(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-02-14 17:44:01
|
Revision: 322 http://svn.sourceforge.net/qcell/?rev=322&view=rev Author: dhubleizh Date: 2007-02-14 09:43:57 -0800 (Wed, 14 Feb 2007) Log Message: ----------- - FQT doesn't allow to big values to get loaded Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-02-14 17:13:48 UTC (rev 321) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-02-14 17:43:57 UTC (rev 322) @@ -158,7 +158,7 @@ } // Now we can calculate the maximal sum value max_sum = arg_nr * (values_nr - 1); - free_args_columns = pow(values_nr, (arguments_nr - arg_nr)); + free_args_columns = pow(return_values_nr, (arguments_nr - arg_nr)); lines.removeFirst(); line_nr++; @@ -231,18 +231,7 @@ { // Keep track of current parsed value value_index++; - // Sanity check for value - if((int)value.toAscii() >= ((int)'A' + (return_values_nr-10))) - { - qDebug(tr("The value number %1 in line %2 is larger then the maximum declared in the header.") - .arg(value_index) - .arg(line_nr) - .toAscii() - ); - return QString(); - } - // Collecting this lines values tmp_sign = (int)value.toAscii(); if(tmp_sign >= (int)'A') @@ -254,9 +243,20 @@ { tmp_values.append(tmp_sign - (int)'0'); } + + // Sanity check for value + if(tmp_values.last()>= return_values_nr) + { + qDebug(tr("The value number %1 in line %2 is larger then the maximum declared in the header.") + .arg(value_index) + .arg(line_nr) + .toAscii() + ); + + return QString(); + } } - // Finally adding the parsed values results[tmp_sum] = QVector<int>(tmp_values); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dhu...@us...> - 2007-02-15 10:31:29
|
Revision: 330 http://svn.sourceforge.net/qcell/?rev=330&view=rev Author: dhubleizh Date: 2007-02-15 02:31:26 -0800 (Thu, 15 Feb 2007) Log Message: ----------- - FQT parsing bug Modified Paths: -------------- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp Modified: trunk/qcell/parsers/FQT/FQTParserPlugin.cpp =================================================================== --- trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-02-15 09:27:18 UTC (rev 329) +++ trunk/qcell/parsers/FQT/FQTParserPlugin.cpp 2007-02-15 10:31:26 UTC (rev 330) @@ -1,4 +1,4 @@ -/**@file FQTParserPlugin.c +/**@file FQTParserPlugin.cpp * @author czarny * @version 0.4 * @date @@ -159,7 +159,7 @@ } // Now we can calculate the maximal sum value max_sum = arg_nr * (values_nr - 1); - free_args_columns = pow(return_values_nr, (arguments_nr - arg_nr)); + free_args_columns = pow(values_nr, (arguments_nr - arg_nr)); lines.removeFirst(); line_nr++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |