Index: trunk/src/util/shell_command.cc
===================================================================
--- trunk/src/util/shell_command.cc	(revision 5141)
+++ trunk/src/util/shell_command.cc	(revision 5142)
@@ -45,9 +45,41 @@
 
   // handling parameters, and storing them:
+  if (paramCount > FUNCTOR_MAX_ARGUMENTS)
+    paramCount = FUNCTOR_MAX_ARGUMENTS;
   this->paramCount = paramCount;
   this->parameters = new ParameterType[paramCount];
 
   for (unsigned int i = 0; i < paramCount; i++)
+  {
     parameters[i] = va_arg(parameters, long);
+
+    switch (parameters[i])
+    {
+      case ParameterBool:
+        this->defaultBools[i] = va_arg(parameters, int);
+        break;
+      case ParameterChar:
+        this->defaultStrings[i] = new char[2];
+        sprintf(this->defaultStrings[0], "%c",  va_arg(parameters, int));
+        break;
+      case ParameterString:
+        this->defaultStrings[i] = va_arg(parameters, char*);
+        break;
+      case ParameterInt:
+        this->defaultInts[i] = va_arg(parameters, int);
+        break;
+      case ParameterUInt:
+        this->defaultInts[i] = va_arg(parameters, unsigned int);
+        break;
+      case ParameterFloat:
+        this->defaultFloats[i] = va_arg(parameters, double);
+        break;
+      case ParameterLong:
+        this->defaultInts[i] = va_arg(parameters, long);
+        break;
+      default:
+        break;
+    }
+  }
 
   // adding this ShellCommand to the list of known Commands
@@ -65,5 +97,4 @@
 bool ShellCommandBase::isRegistered(const char* commandName, ClassID classID, unsigned int paramCount, ...)
 {
-
   va_list parameters;
   va_start(parameters, paramCount);
@@ -97,8 +128,4 @@
     return false;
 
-  const char* commandEnd = strchr(executionString, ' ');
-  if (commandEnd == NULL)
-    commandEnd = executionString + strlen(executionString);
-
   tIterator<ShellCommandBase>* iterator = ShellCommandBase::commandList->getIterator();
   ShellCommandBase* elem = iterator->firstElement();
@@ -106,7 +133,30 @@
   {
     printf("%s\n", elem->getName());
-    if (!strncmp(executionString, elem->getName(), strlen(elem->getName())))
+    if (!strncasecmp (executionString, elem->className, strlen(elem->className)) &&
+         (*(executionString+strlen(elem->className)) == ' ' ||
+          *(executionString+strlen(elem->className)) == ':' ))
     {
-      elem->executeCommand(commandEnd);
+      const char* commandBegin = executionString + strlen(elem->className);
+
+      PRINTF(4)("Class %s matches\n", elem->className);
+      BaseObject* objectPointer = NULL;
+      if (elem->isSingleton)
+      {
+        while(*commandBegin == ' ')
+          commandBegin++;
+        if (strncmp (commandBegin, elem->getName(), strlen(elem->getName())))
+            continue;
+        objectPointer = ClassList::getList(elem->classID)->firstElement();
+      }
+      else
+      {
+
+      }
+      const char* commandEnd = strchr(commandBegin, ' ');
+      if (commandEnd == NULL)
+        commandEnd = executionString + strlen(executionString);
+
+      if (objectPointer != NULL)
+        elem->executeCommand(objectPointer, commandEnd);
       delete iterator;
       return true;
Index: trunk/src/util/shell_command.h
===================================================================
--- trunk/src/util/shell_command.h	(revision 5141)
+++ trunk/src/util/shell_command.h	(revision 5142)
@@ -26,23 +26,46 @@
 ///////////////////////
 
+// COMMAND REGISTRATION
+// NO ARGUMENTS
+#define ShellCommandRegister0 \
+  static void registerCommand(const char* commandName, ClassID classID, void (T::*functionPointer)()) \
+  { \
+    if (isRegistered(commandName, classID, 0)== true) \
+      return; \
+    new ShellCommand<T>(commandName, classID, functionPointer); \
+  }
 
-#define ShellCommand2(type1, type2) \
- public: \
-  static void registerCommand(const char* commandName, ClassID classID, T* object, void (T::*function)(type1##_TYPE, type2##_TYPE) \
-                              type1##_TYPE default1 = type1##_DEFAULT, type2##_TYPE default2 = type2##_DEFAULT) \
+
+#define ShellCommandConstructor0 \
+  void (T::*functionPointer_NULL)(); \
+  ShellCommand(const char* commandName, ClassID classID, void (T::*functionPointer)()) \
+  : ShellCommandBase (commandName, classID, 0) \
   { \
-     if (isRegistered(commandName, classID, 2, type1##_PARAM, type2##_PARAM) == true) \
+    this->functionPointer_NULL = functionPointer; \
+  }
+
+
+
+
+#define ShellCommandRegister2(t1, t2) \
+  static void registerCommand(const char* commandName, ClassID classID, T* object, void (T::*function)(t1##_TYPE, t2##_TYPE) \
+                              t1##_TYPE default1 = t1##_DEFAULT, t2##_TYPE default2 = t2##_DEFAULT) \
+  { \
+     if (isRegistered(commandName, classID, 2, t1##_PARAM, t2##_PARAM) == true) \
        return; \
      else \
        ShellCommand<T>* newCommand = new ShellCommand<T>(commandName, classID, object, function); \
-  } \
- private: \
-  void (T::*functionPointer_##type1_##type2)(type1##_TYPE, type2##_TYPE); \
-  ShellCommand(const char* commandName, ClassID classID, T* object, void (T::*function)(type1##_TYPE, type2##_TYPE) \
-                              type1##_TYPE default1 = type1##_DEFAULT, type2##_TYPE default2 = type2##_DEFAULT) \
-  { \
-    this->functionPointer_##type1_##type2 = function; \
   }
 
+// CONSTRUCTORS AND POINTERS
+#define ShellCommandConstructor2(t1, t2) \
+  void (T::*functionPointer_##t1_##t2)(t1##_TYPE, t2##_TYPE); \
+  ShellCommand(const char* commandName, ClassID classID, T* object, void (T::*function)(t1##_TYPE, t2##_TYPE) \
+                              t1##_TYPE default1 = t1##_DEFAULT, t2##_TYPE default2 = t2##_DEFAULT) \
+  { \
+    this->functionPointer_##t1_##t2 = function; \
+  }
+
+//#define ShellCommand
 
 
@@ -66,5 +89,5 @@
 
   private:
-    virtual void executeCommand (const char* parameters) = NULL;
+    virtual void executeCommand (BaseObject* object, const char* parameters) = NULL;
 
   protected:
@@ -78,4 +101,10 @@
     const char*                      className;           //!< The Name of the Class associated to this Command
 
+    char*                            defaultStrings[FUNCTOR_MAX_ARGUMENTS];
+    int                              defaultInts[FUNCTOR_MAX_ARGUMENTS];
+    float                            defaultFloats[FUNCTOR_MAX_ARGUMENTS];
+    bool                             defaultBools[FUNCTOR_MAX_ARGUMENTS];
+
+
     // STATIC MEMBERS
     static tList<ShellCommandBase>*  commandList;         //!< A list of availiable commands.
@@ -83,5 +112,5 @@
 
 template<class T> class ShellCommand;
-
+/*
 template<class T> class ShellCommandSingleton : public ShellCommandBase
 {
@@ -92,7 +121,7 @@
     {
       this->functionPointer_NULL = functionPointer;
-
     }
     void (T::*functionPointer_NULL)();
+
     virtual void executeCommand (const char* parameters)
     {
@@ -100,5 +129,5 @@
         (T::getInstance()->*functionPointer_NULL)();
     }
-};
+};*/
 
 
@@ -109,29 +138,21 @@
     static void unregisterCommand(const char* commandNaame, ClassID classID);
 
-    static void registerCommand(const char* commandName, ClassID classID, void (T::*functionPointer)())
-    {
-      if (isRegistered(commandName, classID, 0)== true)
-        return;
-      else
-      {
-        if (classID & CL_MASK_SINGLETON == CL_MASK_SINGLETON)
-          new ShellCommandSingleton<T>(commandName, classID, functionPointer);
-        else
-          new ShellCommand<T>(commandName, classID, functionPointer);
-      }
-    }
+#define FUNCTOR_LIST(x) ShellCommandRegister ## x
+//#include "functor_list.h"
+FUNCTOR_LIST(0);
+#undef FUNCTOR_LIST
+
 
   private:
-    void (T::*functionPointer_NULL)();
-    ShellCommand(const char* commandName, ClassID classID, void (T::*functionPointer)())
-      : ShellCommandBase (commandName, classID, 0)
+#define FUNCTOR_LIST(x) ShellCommandConstructor ## x
+//#include "functor_list.h"
+  FUNCTOR_LIST(0);
+#undef FUNCTOR_LIST
+
+    virtual void executeCommand (BaseObject* object, const char* parameters)
     {
-      this->functionPointer_NULL = functionPointer;
-    }
-    virtual void executeCommand (const char* parameters)
-    {
-      printf("not implemented yet\n");
-/*      if (this->paramCount == 0)
-        (objectPointer->*functionPointer_NULL)();*/
+     printf("not implemented yet\n");
+     if (this->paramCount == 0)
+       (dynamic_cast<T*>(object)->*functionPointer_NULL)();
     }
 
