[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Thu Feb 5 07:05:01 CET 2004


CVS commit by staikos: 

add an XML option for plugins and filters to request that they be provided a
local data pointer.


  M +17 -5     plugin.cpp   1.14
  M +2 -1      plugin.h   1.14
  M +3 -0      pluginxmlparser.cpp   1.13


--- kdeextragear-2/kst/kst/plugin.cpp  #1.13:1.14
@@ -61,8 +61,15 @@ int Plugin::call(const double *const inA
   }
 
+  if (_data._localdata) {
+    return ((int(*)(const double *const[], const int[],
+            const double[], double *[], int[],
+            double[], void**))_symbol)
+      (inArrays, inArrayLens, inScalars, outArrays, outArrayLens, outScalars, 0L /*FIXME*/);
+  } else {
   return ((int(*)(const double *const[], const int[],
                   const double[], double *[], int[],
                   double[]))_symbol)
     (inArrays, inArrayLens, inScalars, outArrays, outArrayLens, outScalars);
+  }
 }
 
@@ -75,5 +82,9 @@ int Plugin::filter(const double *const i
   }
 
+  if (_data._localdata) {
+    return ((int(*)(const double *const, int, const double[], double*[], int*, void**))_symbol) (inArray, inArrayLen, inScalars, outArray, outArrayLen, 0L /*FIXME*/);
+  } else {
   return ((int(*)(const double *const, int, const double[], double*[], int*))_symbol) (inArray, inArrayLen, inScalars, outArray, outArrayLen);
+  }
 }
 
@@ -87,4 +98,5 @@ const Plugin::Data& Plugin::data() const
 void Plugin::Data::clear() {
   _filter = false;
+  _localdata = false;
   _name = QString::null;
   _author = QString::null;

--- kdeextragear-2/kst/kst/plugin.h  #1.13:1.14
@@ -53,5 +53,5 @@ public:
   class Data {
     public:
-      Data() : _filter(false) {}
+      Data() : _filter(false), _localdata(false) {}
 
       /**
@@ -90,4 +90,5 @@ public:
       // Intro
       bool _filter;
+      bool _localdata;
       QString _name;
       QString _author;

--- kdeextragear-2/kst/kst/pluginxmlparser.cpp  #1.12:1.13
@@ -91,4 +91,5 @@ static const QString QS_any = QString::f
 static const QString QS_integer = QString::fromLatin1("integer");
 static const QString QS_filter = QString::fromLatin1("filter");
+static const QString QS_localdata = QString::fromLatin1("localdata");
 
 
@@ -144,4 +145,6 @@ QDomNode n = element.firstChild();
     if (tn == QS_modulename) {
       _pluginData._name = e.attribute(QS_name);
+    } else if (tn == QS_localdata) {
+      _pluginData._localdata = true;
     } else if (tn == QS_filter) {
       _pluginData._filter = true;





More information about the Kst mailing list