[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Oct 20 05:11:01 CEST 2004


CVS commit by staikos: 

load the plugin referenced


  M +4 -0      Makefile.am   1.152
  M +14 -4     enodes.cpp   1.17
  M +4 -2      enodes.h   1.12


--- kdeextragear-2/kst/kst/Makefile.am  #1.151:1.152
@@ -39,4 +39,8 @@
         enodes.cpp \
         enodefactory.cpp \
+        plugincollection.cpp \
+        plugin.cpp \
+        pluginxmlparser.cpp \
+        pluginloader.cpp \
         eparse.c \
         escan.c

--- kdeextragear-2/kst/kst/enodes.cpp  #1.16:1.17
@@ -22,6 +22,7 @@
 #include <string.h>
 
-#include "kstdatacollection.h"
 #include "enodes.h"
+#include "kstdatacollection.h"
+#include "plugincollection.h"
 
 using namespace Equation;
@@ -249,8 +250,11 @@ static struct {
 
 Function::Function(char *name, ArgumentList *args)
-: Node(), _name(name), _args(args), _f(0L), _plugin(false) {
+: Node(), _name(name), _args(args), _f(0L), _plugin(0L) {
   //printf("%p: New Function: %s - %p\n", (void*)this, name, (void*)args);
   if (strcasecmp("plugin", name) == 0) {
-    _plugin = true;
+    Identifier *pn = dynamic_cast<Identifier*>(_args->node(0));
+    if (pn) {
+      _plugin = PluginCollection::self()->plugin(pn->name());
+    }
   } else {
     for (int i = 0; FTable[i].name; ++i) {
@@ -270,4 +274,5 @@ Function::~Function() {
   _args = 0L;
   _f = 0L;
+  _plugin = 0L;
 }
 
@@ -294,5 +299,5 @@ bool Function::isConst() {
 
 bool Function::isPlugin() const {
-  return _plugin;
+  return _plugin != 0L;
 }
 
@@ -378,4 +383,9 @@ Identifier::~Identifier() {
 
 
+const char *Identifier::name() const {
+  return _name;
+}
+
+
 double Identifier::value(Context *ctx) {
   if (_const) {

--- kdeextragear-2/kst/kst/enodes.h  #1.11:1.12
@@ -22,4 +21,6 @@
 #include "kstvector.h"
 
+class Plugin;
+
 #define EQ_FALSE 0.0
 #define EQ_TRUE  1.0
@@ -102,5 +103,5 @@ namespace Equation {
       ArgumentList *_args;
       void *_f;
-      bool _plugin;
+      KstSharedPtr<Plugin> _plugin;
   };
  
@@ -126,4 +127,5 @@ namespace Equation {
       virtual bool isConst();
       virtual double value(Context*);
+      virtual const char *name() const;
 
     protected:





More information about the Kst mailing list