| Summary: | event monitor: rejects syntax that should be accepted | ||
|---|---|---|---|
| Product: | [Applications] kst | Reporter: | Nicolas Brisset <nicolas.brisset> |
| Component: | general | Assignee: | kst |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | 1.x | ||
| Target Milestone: | --- | ||
| Platform: | unspecified | ||
| OS: | Solaris | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Nicolas Brisset
2005-04-07 18:37:57 UTC
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();
|