[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Thu Apr 7 19:38:51 CEST 2005
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();
More information about the Kst
mailing list