Version: 1.1.0_devel (using KDE 3.4.0, compiled sources) Compiler: gcc version 3.4.3 OS: SunOS (sun4u) release 5.8 It seems that something is currently broken in the definition of events (CVS snapshot from April 4th). To reproduce: 1) launch kst 2) plot column 1 vs INDEX from gyrodata.dat 3) open the data manager 4) click "New event monitor" 5) try to input the following expression: "[1] > 0.0". You'll notice that the pull-down menu does not allow to select some operators... 6) click OK: it says "There is a syntax error in the equation you entered. Please fix it." I believe this should work :-)
CVS commit by staikos: add testcase, but it passes without problems CCBUG: 103442 M +5 -0 testeqparser.cpp 1.28 --- kdeextragear-2/kst/tests/testeqparser.cpp #1.27:1.28 @@ -332,4 +332,5 @@ int main(int argc, char **argv) { // Vectors + KstVector::generateVector(0, 1.0, 10, "1"); KstVector::generateVector(0, 1.0, 10, "V1"); KstVector::generateVector(1.0, 2.0, 10, "V2"); @@ -365,4 +366,8 @@ int main(int argc, char **argv) { test("8|2*2", 0.0, 12.0); test("2*2|8", 0.0, 12.0); + test("[V1] > 0.0", 0.0, 0.0); + test("[V1] > -1.0", 0.0, 1.0); + test("[1] > 0.0", 0.0, 0.0); + test("[1] > -1.0", 0.0, 1.0); /* Wrap a testcase with this and run bison with -t in order to get a trace
CVS commit by staikos: parse the equation manually when setting it BUG: 103442 M +2 -0 ksteventmonitor_i.cpp 1.33 M +25 -18 ksteventmonitorentry.cpp 1.42 M +2 -0 ksteventmonitorentry.h 1.24 --- kdeextragear-2/kst/kst/ksteventmonitor_i.cpp #1.32:1.33 @@ -148,4 +148,6 @@ void KstEventMonitorI::fillEvent(EventMo event->setLevel(KstDebug::Error); } + + event->reparse(); } --- kdeextragear-2/kst/kst/ksteventmonitorentry.cpp #1.41:1.42 @@ -113,4 +113,27 @@ void EventMonitorEntry::commonConstructo +bool EventMonitorEntry::reparse() { + _bIsValid = false; + if (!_strEvent.isEmpty()) { + QMutexLocker ml(&Equation::mutex()); + yy_scan_string(_strEvent.latin1()); + int rc = yyparse(); + if (rc == 0) { + _pExpression = static_cast<Equation::Node*>(ParsedEquation); + Equation::Context ctx; + Equation::FoldVisitor vis(&ctx, &_pExpression); + KstStringMap stm; + _pExpression->collectObjects(_vectorsUsed, _inputScalars, stm); + + _bIsValid = true; + } else { + delete (Equation::Node*)ParsedEquation; + } + ParsedEquation = 0L; + } + return _bIsValid; +} + + void EventMonitorEntry::save(QTextStream &ts, const QString& indent) { QString l2 = indent + " "; @@ -151,5 +174,4 @@ KstObject::UpdateType EventMonitorEntry: } - KstObject::UpdateType retVal = NO_CHANGE; KstVectorPtr xv = *_xVector; KstVectorPtr yv = *_yVector; @@ -161,20 +183,5 @@ KstObject::UpdateType EventMonitorEntry: if (!_pExpression) { - if (!_strEvent.isEmpty()) { - QMutexLocker ml(&Equation::mutex()); - yy_scan_string(_strEvent.latin1()); - int rc = yyparse(); - if (rc == 0) { - _pExpression = static_cast<Equation::Node*>(ParsedEquation); - Equation::FoldVisitor vis(&ctx, &_pExpression); - KstStringMap stm; - _pExpression->collectObjects(_vectorsUsed, _inputScalars, stm); - - _bIsValid = true; - } else { - delete (Equation::Node*)ParsedEquation; - } - ParsedEquation = 0L; - } + reparse(); } @@ -236,5 +243,5 @@ KstObject::UpdateType EventMonitorEntry: } - return setLastUpdateResult(retVal); + return setLastUpdateResult(NO_CHANGE); } --- kdeextragear-2/kst/kst/ksteventmonitorentry.h #1.23:1.24 @@ -64,4 +64,6 @@ class EventMonitorEntry : public KstData void logImmediately(); + bool reparse(); + private slots: void slotUpdate();