Index: code/branches/core2/src/orxonox/core/CommandExecutor.cc
===================================================================
--- code/branches/core2/src/orxonox/core/CommandExecutor.cc	(revision 951)
+++ code/branches/core2/src/orxonox/core/CommandExecutor.cc	(revision 952)
@@ -51,4 +51,9 @@
     }
 
+    CommandEvaluation& CommandExecutor::getEvaluation()
+    {
+        return CommandExecutor::getInstance().evaluation_;
+    }
+
     bool CommandExecutor::addConsoleCommandShortcut(ExecutorStatic* executor)
     {
@@ -88,10 +93,16 @@
     bool CommandExecutor::execute(const std::string& command)
     {
-        if (CommandExecutor::getInstance().lastProcessedCommand_ != command)
+        if (CommandExecutor::getEvaluation().processedCommand_ != command)
             CommandExecutor::parse(command);
 
-        CommandExecutor::getInstance().tokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
-
-        switch (CommandExecutor::getInstance().state_)
+        return CommandExecutor::execute(CommandExecutor::getEvaluation());
+    }
+
+
+    bool CommandExecutor::execute(const CommandEvaluation& evaluation)
+    {
+        SubString tokens(evaluation.processedCommand_, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
+
+        switch (evaluation.state_)
         {
             case CS_Empty:
@@ -104,6 +115,6 @@
             case CS_Shortcut_Finished:
                 // call the shortcut
-                if (CommandExecutor::getInstance().shortcut_ != 0)
-                    return CommandExecutor::getInstance().shortcut_->parse(CommandExecutor::getInstance().tokens_.subSet(1).join());
+                if (evaluation.shortcut_ != 0)
+                    return evaluation.shortcut_->parse(tokens.subSet(1).join());
                 break;
             case CS_Function:
@@ -114,6 +125,6 @@
             case CS_Function_Finished:
                 // call the shortcut
-                if (CommandExecutor::getInstance().function_ != 0)
-                    return CommandExecutor::getInstance().function_->parse(CommandExecutor::getInstance().tokens_.subSet(2).join());
+                if (evaluation.function_ != 0)
+                    return evaluation.function_->parse(tokens.subSet(2).join());
                 break;
             case CS_ConfigValueClass:
@@ -126,6 +137,6 @@
             case CS_ConfigValueFinished:
                 // set the config value
-                if (CommandExecutor::getInstance().configvalue_ != 0)
-                    return CommandExecutor::getInstance().configvalue_->parseString(CommandExecutor::getInstance().tokens_.subSet(3).join());
+                if (evaluation.configvalue_ != 0)
+                    return evaluation.configvalue_->parseString(tokens.subSet(3).join());
                 break;
             case CS_KeybindKey:
@@ -147,56 +158,61 @@
     std::string CommandExecutor::complete(const std::string& command)
     {
-        if (CommandExecutor::getInstance().lastProcessedCommand_ != command)
+        if (CommandExecutor::getEvaluation().processedCommand_ != command)
             CommandExecutor::parse(command);
 
-        CommandExecutor::getInstance().tokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
+        return CommandExecutor::complete(CommandExecutor::getEvaluation());
+    }
+
+    std::string CommandExecutor::complete(const CommandEvaluation& evaluation)
+    {
+        SubString tokens(evaluation.processedCommand_, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
 
         std::list<const std::string*> temp;
-        if (CommandExecutor::getInstance().state_ == CS_Empty)
-        {
-            temp.insert(temp.end(), CommandExecutor::getInstance().listOfPossibleShortcuts_.begin(), CommandExecutor::getInstance().listOfPossibleShortcuts_.end());
-            temp.insert(temp.end(), CommandExecutor::getInstance().listOfPossibleFunctionClasses_.begin(), CommandExecutor::getInstance().listOfPossibleFunctionClasses_.end());
-        }
-
-        switch (CommandExecutor::getInstance().state_)
+        if (evaluation.state_ == CS_Empty)
+        {
+            temp.insert(temp.end(), evaluation.listOfPossibleShortcuts_.begin(), evaluation.listOfPossibleShortcuts_.end());
+            temp.insert(temp.end(), evaluation.listOfPossibleFunctionClasses_.begin(), evaluation.listOfPossibleFunctionClasses_.end());
+        }
+
+        switch (evaluation.state_)
         {
             case CS_Empty:
-                return (CommandExecutor::getInstance().tokens_.subSet(0, CommandExecutor::getInstance().tokens_.size() - 1).join() + " " + CommandExecutor::getCommonBegin(temp));
+                return (tokens.subSet(0, tokens.size() - 1).join() + " " + CommandExecutor::getCommonBegin(temp));
                 break;
             case CS_FunctionClass_Or_Shortcut_Or_Keyword:
                 break;
             case CS_Shortcut_Params:
-                if (command[command.size() - 1] != ' ')
-                    return (command + " ");
+                if ((evaluation.processedCommand_.size() >= 1) && (evaluation.processedCommand_[evaluation.processedCommand_.size() - 1] != ' '))
+                    return (evaluation.processedCommand_ + " ");
                 break;
             case CS_Shortcut_Finished:
                 break;
             case CS_Function:
-                return (CommandExecutor::getInstance().tokens_.subSet(0, CommandExecutor::getInstance().tokens_.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getInstance().listOfPossibleFunctions_));
+                return (tokens.subSet(0, tokens.size() - 1).join() + " " + CommandExecutor::getCommonBegin(evaluation.listOfPossibleFunctions_));
                 break;
             case CS_Function_Params:
-                if (command[command.size() - 1] != ' ')
-                    return (command + " ");
+                if ((evaluation.processedCommand_.size() >= 1) && (evaluation.processedCommand_[evaluation.processedCommand_.size() - 1] != ' '))
+                    return (evaluation.processedCommand_ + " ");
                 break;
             case CS_Function_Finished:
                 break;
             case CS_ConfigValueClass:
-                return (CommandExecutor::getInstance().tokens_.subSet(0, CommandExecutor::getInstance().tokens_.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getInstance().listOfPossibleConfigValueClasses_));
+                return (tokens.subSet(0, tokens.size() - 1).join() + " " + CommandExecutor::getCommonBegin(evaluation.listOfPossibleConfigValueClasses_));
                 break;
             case CS_ConfigValue:
-                return (CommandExecutor::getInstance().tokens_.subSet(0, CommandExecutor::getInstance().tokens_.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getInstance().listOfPossibleConfigValues_));
+                return (tokens.subSet(0, tokens.size() - 1).join() + " " + CommandExecutor::getCommonBegin(evaluation.listOfPossibleConfigValues_));
                 break;
             case CS_ConfigValueType:
-                if (command[command.size() - 1] != ' ')
-                    return (command + " ");
+                if ((evaluation.processedCommand_.size() >= 1) && (evaluation.processedCommand_[evaluation.processedCommand_.size() - 1] != ' '))
+                    return (evaluation.processedCommand_ + " ");
                 break;
             case CS_ConfigValueFinished:
                 break;
             case CS_KeybindKey:
-                return (CommandExecutor::getInstance().tokens_.subSet(0, CommandExecutor::getInstance().tokens_.size() - 1).join() + " " + CommandExecutor::getCommonBegin(CommandExecutor::getInstance().listOfPossibleKeys_));
+                return (tokens.subSet(0, tokens.size() - 1).join() + " " + CommandExecutor::getCommonBegin(evaluation.listOfPossibleKeys_));
                 break;
             case CS_KeybindCommand:
-                if (command[command.size() - 1] != ' ')
-                    return (command + " ");
+                if ((evaluation.processedCommand_.size() >= 1) && (evaluation.processedCommand_[evaluation.processedCommand_.size() - 1] != ' '))
+                    return (evaluation.processedCommand_ + " ");
                 break;
             case CS_KeybindFinished:
@@ -206,64 +222,69 @@
         }
 
-        return CommandExecutor::getInstance().lastProcessedCommand_;
+        return evaluation.processedCommand_;
     }
 
     std::string CommandExecutor::hint(const std::string& command)
     {
-        if (CommandExecutor::getInstance().lastProcessedCommand_ != command)
+        if (CommandExecutor::getEvaluation().processedCommand_ != command)
             CommandExecutor::parse(command);
 
-        CommandExecutor::getInstance().tokens_.split(command, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
-
-        switch (CommandExecutor::getInstance().state_)
+        return CommandExecutor::hint(CommandExecutor::getEvaluation());
+    }
+
+    std::string CommandExecutor::hint(const CommandEvaluation& evaluation)
+    {
+        SubString tokens(evaluation.processedCommand_, " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
+
+        switch (evaluation.state_)
         {
             case CS_Empty:
-                return (CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleShortcuts_) + "\n" + CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleFunctionClasses_));
+                return (CommandExecutor::dump(evaluation.listOfPossibleShortcuts_) + "\n" + CommandExecutor::dump(evaluation.listOfPossibleFunctionClasses_));
                 break;
             case CS_FunctionClass_Or_Shortcut_Or_Keyword:
                 break;
             case CS_Shortcut_Params:
-                if (CommandExecutor::getInstance().shortcut_ != 0)
-                    return CommandExecutor::dump(CommandExecutor::getInstance().shortcut_);
+                if (evaluation.shortcut_ != 0)
+                    return CommandExecutor::dump(evaluation.shortcut_);
                 break;
             case CS_Shortcut_Finished:
-                if (CommandExecutor::getInstance().shortcut_ != 0)
-                    return CommandExecutor::dump(CommandExecutor::getInstance().shortcut_);
+                if (evaluation.shortcut_ != 0)
+                    return CommandExecutor::dump(evaluation.shortcut_);
                 break;
             case CS_Function:
-                return CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleFunctions_);
+                return CommandExecutor::dump(evaluation.listOfPossibleFunctions_);
                 break;
             case CS_Function_Params:
-                if (CommandExecutor::getInstance().function_ != 0)
-                    return CommandExecutor::dump(CommandExecutor::getInstance().function_);
+                if (evaluation.function_ != 0)
+                    return CommandExecutor::dump(evaluation.function_);
                 break;
             case CS_Function_Finished:
-                if (CommandExecutor::getInstance().function_ != 0)
-                    return CommandExecutor::dump(CommandExecutor::getInstance().function_);
+                if (evaluation.function_ != 0)
+                    return CommandExecutor::dump(evaluation.function_);
                 break;
             case CS_ConfigValueClass:
-                return CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleConfigValueClasses_);
+                return CommandExecutor::dump(evaluation.listOfPossibleConfigValueClasses_);
                 break;
             case CS_ConfigValue:
-                return CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleConfigValues_);
+                return CommandExecutor::dump(evaluation.listOfPossibleConfigValues_);
                 break;
             case CS_ConfigValueType:
-                if (CommandExecutor::getInstance().configvalue_ != 0)
-                    return CommandExecutor::dump(CommandExecutor::getInstance().configvalue_);
+                if (evaluation.configvalue_ != 0)
+                    return CommandExecutor::dump(evaluation.configvalue_);
                 break;
             case CS_ConfigValueFinished:
-                if (CommandExecutor::getInstance().configvalue_ != 0)
-                    return CommandExecutor::dump(CommandExecutor::getInstance().configvalue_);
+                if (evaluation.configvalue_ != 0)
+                    return CommandExecutor::dump(evaluation.configvalue_);
                 break;
             case CS_KeybindKey:
-                return CommandExecutor::dump(CommandExecutor::getInstance().listOfPossibleKeys_);
+                return CommandExecutor::dump(evaluation.listOfPossibleKeys_);
                 break;
             case CS_KeybindCommand:
-                if (CommandExecutor::getInstance().key_ != 0)
-                    return CommandExecutor::dump(CommandExecutor::getInstance().key_);
+                if (evaluation.key_ != 0)
+                    return CommandExecutor::dump(evaluation.key_);
                 break;
             case CS_KeybindFinished:
-                if (CommandExecutor::getInstance().key_ != 0)
-                    return CommandExecutor::dump(CommandExecutor::getInstance().key_);
+                if (evaluation.key_ != 0)
+                    return CommandExecutor::dump(evaluation.key_);
                 break;
             case CS_Error:
@@ -275,13 +296,19 @@
     }
 
+    const CommandEvaluation& CommandExecutor::evaluate(const std::string& command)
+    {
+        CommandExecutor::parse(command, true);
+        return CommandExecutor::getEvaluation();
+    }
+
     void CommandExecutor::parse(const std::string& command, bool bInitialize)
     {
-        CommandExecutor::getInstance().tokens_.split((command + COMMAND_EXECUTOR_CURSOR), " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
-        CommandExecutor::getInstance().lastProcessedCommand_ = command;
+        CommandExecutor::getEvaluation().tokens_.split((command + COMMAND_EXECUTOR_CURSOR), " ", SubString::WhiteSpaces, false, '\\', '"', '(', ')', '\0');
+        CommandExecutor::getEvaluation().processedCommand_ = command;
 
         if (bInitialize)
             CommandExecutor::initialize();
 
-        switch (CommandExecutor::getInstance().state_)
+        switch (CommandExecutor::getEvaluation().state_)
         {
             case CS_Empty:
@@ -290,12 +317,12 @@
                     // We want a hint for the first token
                     // Check if there is already a perfect match
-                    CommandExecutor::getInstance().functionclass_ = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
-                    CommandExecutor::getInstance().shortcut_ = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
-
-                    if ((CommandExecutor::getInstance().functionclass_ != 0) || (CommandExecutor::getInstance().shortcut_ != 0))
+                    CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
+                    CommandExecutor::getEvaluation().shortcut_ = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
+
+                    if ((CommandExecutor::getEvaluation().functionclass_ != 0) || (CommandExecutor::getEvaluation().shortcut_ != 0))
                     {
                         // Yes, there is a class or a shortcut with the searched name
                         // Add a whitespace and continue parsing
-                        CommandExecutor::getInstance().state_ = CS_FunctionClass_Or_Shortcut_Or_Keyword;
+                        CommandExecutor::getEvaluation().state_ = CS_FunctionClass_Or_Shortcut_Or_Keyword;
                         CommandExecutor::parse(command + " ", false);
                         return;
@@ -310,5 +337,5 @@
                 {
                     // There is at least one argument: Check if it's a shortcut, a classname or a special keyword
-                    CommandExecutor::getInstance().state_ = CS_FunctionClass_Or_Shortcut_Or_Keyword;
+                    CommandExecutor::getEvaluation().state_ = CS_FunctionClass_Or_Shortcut_Or_Keyword;
                     CommandExecutor::parse(command, false);
                     return;
@@ -321,5 +348,5 @@
                     {
                         // We want to set a config value
-                        CommandExecutor::getInstance().state_ = CS_ConfigValueClass;
+                        CommandExecutor::getEvaluation().state_ = CS_ConfigValueClass;
                         CommandExecutor::parse(command, false);
                         return;
@@ -328,26 +355,26 @@
                     {
                         // We want to set a keybinding
-                        CommandExecutor::getInstance().state_ = CS_KeybindKey;
+                        CommandExecutor::getEvaluation().state_ = CS_KeybindKey;
                         CommandExecutor::parse(command, false);
                         return;
                     }
 
-                    if (CommandExecutor::getInstance().functionclass_ == 0)
-                        CommandExecutor::getInstance().functionclass_ = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
-                    if (CommandExecutor::getInstance().shortcut_ == 0)
-                        CommandExecutor::getInstance().shortcut_ = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
-
-                    if ((CommandExecutor::getInstance().functionclass_ == 0) && (CommandExecutor::getInstance().shortcut_ == 0))
+                    if (CommandExecutor::getEvaluation().functionclass_ == 0)
+                        CommandExecutor::getEvaluation().functionclass_ = CommandExecutor::getIdentifierOfPossibleFunctionClass(CommandExecutor::getToken(0));
+                    if (CommandExecutor::getEvaluation().shortcut_ == 0)
+                        CommandExecutor::getEvaluation().shortcut_ = CommandExecutor::getExecutorOfPossibleShortcut(CommandExecutor::getToken(0));
+
+                    if ((CommandExecutor::getEvaluation().functionclass_ == 0) && (CommandExecutor::getEvaluation().shortcut_ == 0))
                     {
                         // Argument 1 seems to be wrong
                         AddLanguageEntry("CommandExecutor::NoSuchCommandOrClassName", "No such command or classname");
-                        CommandExecutor::getInstance().errorMessage_ = (CommandExecutor::getToken(0) + ": " + GetLocalisation("CommandExecutor::NoSuchCommandOrClassName"));
-                        CommandExecutor::getInstance().state_ = CS_Error;
-                        return;
-                    }
-                    else if (CommandExecutor::getInstance().shortcut_ != 0)
+                        CommandExecutor::getEvaluation().errorMessage_ = (CommandExecutor::getToken(0) + ": " + GetLocalisation("CommandExecutor::NoSuchCommandOrClassName"));
+                        CommandExecutor::getEvaluation().state_ = CS_Error;
+                        return;
+                    }
+                    else if (CommandExecutor::getEvaluation().shortcut_ != 0)
                     {
                         // Argument 1 is a shortcut: Return the needed parameter types
-                        CommandExecutor::getInstance().state_ = CS_Shortcut_Params;
+                        CommandExecutor::getEvaluation().state_ = CS_Shortcut_Params;
                         CommandExecutor::parse(command, false);
                         return;
@@ -356,5 +383,5 @@
                     {
                         // Argument 1 is a classname: Return the possible functions
-                        CommandExecutor::getInstance().state_ = CS_Function;
+                        CommandExecutor::getEvaluation().state_ = CS_Function;
                         CommandExecutor::parse(command, false);
                         return;
@@ -363,16 +390,16 @@
                 else
                 {
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
                 break;
             case CS_Shortcut_Params:
-                if (CommandExecutor::getInstance().shortcut_ != 0)
+                if (CommandExecutor::getEvaluation().shortcut_ != 0)
                 {
                     // Valid command
                     // Check if there are enough parameters
-                    if (CommandExecutor::enoughParametersGiven(1, CommandExecutor::getInstance().shortcut_))
-                    {
-                        CommandExecutor::getInstance().state_ = CS_Shortcut_Finished;
+                    if (CommandExecutor::enoughParametersGiven(1, CommandExecutor::getEvaluation().shortcut_))
+                    {
+                        CommandExecutor::getEvaluation().state_ = CS_Shortcut_Finished;
                         return;
                     }
@@ -381,10 +408,10 @@
                 {
                     // Something is wrong
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
                 break;
             case CS_Function:
-                if (CommandExecutor::getInstance().functionclass_ != 0)
+                if (CommandExecutor::getEvaluation().functionclass_ != 0)
                 {
                     // We have a valid classname
@@ -393,11 +420,11 @@
                     {
                         // There is a second argument: Check if it's a valid functionname
-                        CommandExecutor::getInstance().function_ = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::getInstance().functionclass_);
-                        if (CommandExecutor::getInstance().function_ == 0)
+                        CommandExecutor::getEvaluation().function_ = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::getEvaluation().functionclass_);
+                        if (CommandExecutor::getEvaluation().function_ == 0)
                         {
                             // Argument 2 seems to be wrong
                             AddLanguageEntry("CommandExecutor::NoSuchFunctionnameIn", "No such functionname in");
-                            CommandExecutor::getInstance().errorMessage_ = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchFunctionnameIn") + " " + CommandExecutor::getInstance().functionclass_->getName());
-                            CommandExecutor::getInstance().state_ = CS_Error;
+                            CommandExecutor::getEvaluation().errorMessage_ = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchFunctionnameIn") + " " + CommandExecutor::getEvaluation().functionclass_->getName());
+                            CommandExecutor::getEvaluation().state_ = CS_Error;
                             return;
                         }
@@ -405,5 +432,5 @@
                         {
                             // Argument 2 seems to be a valid functionname: Get the parameters
-                            CommandExecutor::getInstance().state_ = CS_Function_Params;
+                            CommandExecutor::getEvaluation().state_ = CS_Function_Params;
                             CommandExecutor::parse(command, false);
                             return;
@@ -414,11 +441,11 @@
                         // There is no finished second argument
                         // Check if there's already a perfect match
-                        if (CommandExecutor::getInstance().tokens_.size() >= 2)
-                        {
-                            CommandExecutor::getInstance().function_ = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::getInstance().functionclass_);
-                            if (CommandExecutor::getInstance().function_ != 0)
+                        if (CommandExecutor::getEvaluation().tokens_.size() >= 2)
+                        {
+                            CommandExecutor::getEvaluation().function_ = CommandExecutor::getExecutorOfPossibleFunction(CommandExecutor::getToken(1), CommandExecutor::getEvaluation().functionclass_);
+                            if (CommandExecutor::getEvaluation().function_ != 0)
                             {
                                 // There is a perfect match: Add a whitespace and continue parsing
-                                CommandExecutor::getInstance().state_ = CS_Function_Params;
+                                CommandExecutor::getEvaluation().state_ = CS_Function_Params;
                                 CommandExecutor::parse(command + " ", false);
                                 return;
@@ -427,5 +454,5 @@
 
                         // No perfect match: Create the list of all possible functions and return
-                        CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getToken(1), CommandExecutor::getInstance().functionclass_);
+                        CommandExecutor::createListOfPossibleFunctions(CommandExecutor::getToken(1), CommandExecutor::getEvaluation().functionclass_);
                         return;
                     }
@@ -433,16 +460,16 @@
                 else
                 {
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
                 break;
             case CS_Function_Params:
-                if ((CommandExecutor::getInstance().functionclass_ != 0) && (CommandExecutor::getInstance().function_ != 0))
+                if ((CommandExecutor::getEvaluation().functionclass_ != 0) && (CommandExecutor::getEvaluation().function_ != 0))
                 {
                     // Valid command
                     // Check if there are enough parameters
-                    if (CommandExecutor::enoughParametersGiven(2, CommandExecutor::getInstance().function_))
-                    {
-                        CommandExecutor::getInstance().state_ = CS_Function_Finished;
+                    if (CommandExecutor::enoughParametersGiven(2, CommandExecutor::getEvaluation().function_))
+                    {
+                        CommandExecutor::getEvaluation().state_ = CS_Function_Finished;
                         return;
                     }
@@ -451,5 +478,5 @@
                 {
                     // Something is wrong
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
@@ -463,11 +490,11 @@
                     {
                         // There is a second argument: Check if it's a valid classname
-                        CommandExecutor::getInstance().configvalueclass_ = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
-                        if (CommandExecutor::getInstance().configvalueclass_ == 0)
+                        CommandExecutor::getEvaluation().configvalueclass_ = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
+                        if (CommandExecutor::getEvaluation().configvalueclass_ == 0)
                         {
                             // Argument 2 seems to be wrong
                             AddLanguageEntry("CommandExecutor::NoSuchClassWithConfigValues", "No such class with config values");
-                            CommandExecutor::getInstance().errorMessage_ = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchClassWithConfigValues"));
-                            CommandExecutor::getInstance().state_ = CS_Error;
+                            CommandExecutor::getEvaluation().errorMessage_ = (CommandExecutor::getToken(1) + ": " + GetLocalisation("CommandExecutor::NoSuchClassWithConfigValues"));
+                            CommandExecutor::getEvaluation().state_ = CS_Error;
                             return;
                         }
@@ -475,5 +502,5 @@
                         {
                             // Argument 2 seems to be a valid classname: Search for possible config values
-                            CommandExecutor::getInstance().state_ = CS_ConfigValue;
+                            CommandExecutor::getEvaluation().state_ = CS_ConfigValue;
                             CommandExecutor::parse(command, false);
                             return;
@@ -484,11 +511,11 @@
                         // There's no finished second argument
                         // Check if there's already a perfect match
-                        if (CommandExecutor::getInstance().tokens_.size() >= 2)
-                        {
-                            CommandExecutor::getInstance().configvalueclass_ = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
-                            if (CommandExecutor::getInstance().configvalueclass_ != 0)
+                        if (CommandExecutor::getEvaluation().tokens_.size() >= 2)
+                        {
+                            CommandExecutor::getEvaluation().configvalueclass_ = CommandExecutor::getIdentifierOfPossibleConfigValueClass(CommandExecutor::getToken(1));
+                            if (CommandExecutor::getEvaluation().configvalueclass_ != 0)
                             {
                                 // There is a perfect match: Add a whitespace and continue parsing
-                                CommandExecutor::getInstance().state_ = CS_ConfigValue;
+                                CommandExecutor::getEvaluation().state_ = CS_ConfigValue;
                                 CommandExecutor::parse(command + " ", false);
                                 return;
@@ -504,10 +531,10 @@
                 {
                     // Something is wrong
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
                 break;
             case CS_ConfigValue:
-                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::getInstance().configvalueclass_ != 0))
+                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::getEvaluation().configvalueclass_ != 0))
                 {
                     // Check if there is a third argument
@@ -515,11 +542,11 @@
                     {
                         // There is a third argument: Check if it's a valid config value
-                        CommandExecutor::getInstance().configvalue_ = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::getInstance().configvalueclass_);
-                        if (CommandExecutor::getInstance().configvalue_ == 0)
+                        CommandExecutor::getEvaluation().configvalue_ = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::getEvaluation().configvalueclass_);
+                        if (CommandExecutor::getEvaluation().configvalue_ == 0)
                         {
                             // Argument 3 seems to be wrong
                             AddLanguageEntry("CommandExecutor::NoSuchConfigValueIn", "No such config value in");
-                            CommandExecutor::getInstance().errorMessage_ = (CommandExecutor::getToken(2) + ": " + GetLocalisation("CommandExecutor::NoSuchConfigValueIn") + " " + CommandExecutor::getInstance().configvalueclass_->getName());
-                            CommandExecutor::getInstance().state_ = CS_Error;
+                            CommandExecutor::getEvaluation().errorMessage_ = (CommandExecutor::getToken(2) + ": " + GetLocalisation("CommandExecutor::NoSuchConfigValueIn") + " " + CommandExecutor::getEvaluation().configvalueclass_->getName());
+                            CommandExecutor::getEvaluation().state_ = CS_Error;
                             return;
                         }
@@ -527,5 +554,5 @@
                         {
                             // Argument 3 seems to be a valid config value: Get the type
-                            CommandExecutor::getInstance().state_ = CS_ConfigValueType;
+                            CommandExecutor::getEvaluation().state_ = CS_ConfigValueType;
                             CommandExecutor::parse(command, false);
                             return;
@@ -536,11 +563,11 @@
                         // There is no finished third argument
                         // Check if there's already a perfect match
-                        if (CommandExecutor::getInstance().tokens_.size() >= 3)
-                        {
-                            CommandExecutor::getInstance().configvalue_ = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::getInstance().configvalueclass_);
-                            if (CommandExecutor::getInstance().configvalueclass_ != 0)
+                        if (CommandExecutor::getEvaluation().tokens_.size() >= 3)
+                        {
+                            CommandExecutor::getEvaluation().configvalue_ = CommandExecutor::getContainerOfPossibleConfigValue(CommandExecutor::getToken(2), CommandExecutor::getEvaluation().configvalueclass_);
+                            if (CommandExecutor::getEvaluation().configvalueclass_ != 0)
                             {
                                 // There is a perfect match: Add a whitespace and continue parsing
-                                CommandExecutor::getInstance().state_ = CS_ConfigValueType;
+                                CommandExecutor::getEvaluation().state_ = CS_ConfigValueType;
                                 CommandExecutor::parse(command + " ", false);
                                 return;
@@ -549,5 +576,5 @@
 
                         // No perfect match: Create the list of all possible config values
-                        CommandExecutor::createListOfPossibleConfigValues(CommandExecutor::getToken(2), CommandExecutor::getInstance().configvalueclass_);
+                        CommandExecutor::createListOfPossibleConfigValues(CommandExecutor::getToken(2), CommandExecutor::getEvaluation().configvalueclass_);
                         return;
                     }
@@ -556,16 +583,16 @@
                 {
                     // Something is wrong
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
                 break;
             case CS_ConfigValueType:
-                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::getInstance().configvalueclass_ != 0) && (CommandExecutor::getInstance().configvalue_ != 0))
+                if (((CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE) || (CommandExecutor::getToken(0) == COMMAND_EXECUTOR_KEYWORD_SET_CONFIG_VALUE_TEMPORARY)) && (CommandExecutor::getEvaluation().configvalueclass_ != 0) && (CommandExecutor::getEvaluation().configvalue_ != 0))
                 {
                     // Valid command
                     // Check if there are enough parameters
-                    if (CommandExecutor::getInstance().tokens_.size() >= 4)
-                    {
-                        CommandExecutor::getInstance().state_ = CS_ConfigValueFinished;
+                    if (CommandExecutor::getEvaluation().tokens_.size() >= 4)
+                    {
+                        CommandExecutor::getEvaluation().state_ = CS_ConfigValueFinished;
                         return;
                     }
@@ -574,5 +601,5 @@
                 {
                     // Something is wrong
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
@@ -586,5 +613,5 @@
                 {
                     // Something is wrong
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
@@ -595,7 +622,7 @@
                     // Valid command
                     // Check if there are enough parameters
-                    if (CommandExecutor::getInstance().tokens_.size() >= 3)
-                    {
-                        CommandExecutor::getInstance().state_ = CS_KeybindFinished;
+                    if (CommandExecutor::getEvaluation().tokens_.size() >= 3)
+                    {
+                        CommandExecutor::getEvaluation().state_ = CS_KeybindFinished;
                         return;
                     }
@@ -605,5 +632,5 @@
                 {
                     // Something is wrong
-                    CommandExecutor::getInstance().state_ = CS_Error;
+                    CommandExecutor::getEvaluation().state_ = CS_Error;
                     return;
                 }
@@ -629,20 +656,20 @@
     void CommandExecutor::initialize()
     {
-        CommandExecutor::getInstance().listOfPossibleFunctionClasses_.clear();
-        CommandExecutor::getInstance().listOfPossibleShortcuts_.clear();
-        CommandExecutor::getInstance().listOfPossibleFunctions_.clear();
-        CommandExecutor::getInstance().listOfPossibleConfigValueClasses_.clear();
-        CommandExecutor::getInstance().listOfPossibleConfigValues_.clear();
-        CommandExecutor::getInstance().listOfPossibleKeys_.clear();
-
-        CommandExecutor::getInstance().functionclass_ = 0;
-        CommandExecutor::getInstance().configvalueclass_ = 0;
-        CommandExecutor::getInstance().shortcut_ = 0;
-        CommandExecutor::getInstance().function_ = 0;
-        CommandExecutor::getInstance().configvalue_ = 0;
-        CommandExecutor::getInstance().key_ = 0;
-
-        CommandExecutor::getInstance().errorMessage_ = "";
-        CommandExecutor::getInstance().state_ = CS_Empty;
+        CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleShortcuts_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleFunctions_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleConfigValues_.clear();
+        CommandExecutor::getEvaluation().listOfPossibleKeys_.clear();
+
+        CommandExecutor::getEvaluation().functionclass_ = 0;
+        CommandExecutor::getEvaluation().configvalueclass_ = 0;
+        CommandExecutor::getEvaluation().shortcut_ = 0;
+        CommandExecutor::getEvaluation().function_ = 0;
+        CommandExecutor::getEvaluation().configvalue_ = 0;
+        CommandExecutor::getEvaluation().key_ = 0;
+
+        CommandExecutor::getEvaluation().errorMessage_ = "";
+        CommandExecutor::getEvaluation().state_ = CS_Empty;
     }
 
@@ -651,5 +678,5 @@
         // Because we added a cursor we have +1 arguments
         // There are num arguments given if there are at least num arguments + one cursor
-        return (CommandExecutor::getInstance().tokens_.size() >= (num + 1));
+        return (CommandExecutor::getEvaluation().tokens_.size() >= (num + 1));
     }
 
@@ -657,6 +684,6 @@
     {
         // Because we added a cursor we have +1 arguments
-        if (CommandExecutor::getInstance().tokens_.size() >= 1)
-            return (CommandExecutor::getInstance().tokens_.size() - 1);
+        if (CommandExecutor::getEvaluation().tokens_.size() >= 1)
+            return (CommandExecutor::getEvaluation().tokens_.size() - 1);
         else
             return 0;
@@ -665,8 +692,8 @@
     std::string CommandExecutor::getToken(unsigned int index)
     {
-        if ((index >= 0) && (index < (CommandExecutor::getInstance().tokens_.size() - 1)))
-            return CommandExecutor::getInstance().tokens_[index];
-        else if (index == (CommandExecutor::getInstance().tokens_.size() - 1))
-            return CommandExecutor::getInstance().tokens_[index].substr(0, CommandExecutor::getInstance().tokens_[index].size() - 1);
+        if ((index >= 0) && (index < (CommandExecutor::getEvaluation().tokens_.size() - 1)))
+            return CommandExecutor::getEvaluation().tokens_[index];
+        else if (index == (CommandExecutor::getEvaluation().tokens_.size() - 1))
+            return CommandExecutor::getEvaluation().tokens_[index].substr(0, CommandExecutor::getEvaluation().tokens_[index].size() - 1);
         else
             return "";
@@ -683,5 +710,5 @@
                 break;
         }
-        return (CommandExecutor::getInstance().tokens_.size() >= neededParams);
+        return (CommandExecutor::getEvaluation().tokens_.size() >= neededParams);
     }
 
@@ -694,10 +721,10 @@
                 if ((*it).first.find(getLowercase(fragment)) == 0)
                 {
-                    CommandExecutor::getInstance().listOfPossibleFunctionClasses_.push_back(&(*it).first);
+                    CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.push_back(&(*it).first);
                 }
             }
         }
 
-        CommandExecutor::getInstance().listOfPossibleFunctionClasses_.sort(CommandExecutor::compareStringsInList);
+        CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.sort(CommandExecutor::compareStringsInList);
     }
 
@@ -708,9 +735,9 @@
             if ((*it).first.find(getLowercase(fragment)) == 0)
             {
-                CommandExecutor::getInstance().listOfPossibleShortcuts_.push_back(&(*it).first);
+                CommandExecutor::getEvaluation().listOfPossibleShortcuts_.push_back(&(*it).first);
             }
         }
 
-        CommandExecutor::getInstance().listOfPossibleShortcuts_.sort(CommandExecutor::compareStringsInList);
+        CommandExecutor::getEvaluation().listOfPossibleShortcuts_.sort(CommandExecutor::compareStringsInList);
     }
 
@@ -721,9 +748,9 @@
             if ((*it).first.find(getLowercase(fragment)) == 0)
             {
-                CommandExecutor::getInstance().listOfPossibleFunctions_.push_back(&(*it).first);
+                CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(&(*it).first);
             }
         }
 
-        CommandExecutor::getInstance().listOfPossibleFunctions_.sort(CommandExecutor::compareStringsInList);
+        CommandExecutor::getEvaluation().listOfPossibleFunctions_.sort(CommandExecutor::compareStringsInList);
     }
 
@@ -736,10 +763,10 @@
                 if ((*it).first.find(getLowercase(fragment)) == 0)
                 {
-                    CommandExecutor::getInstance().listOfPossibleConfigValueClasses_.push_back(&(*it).first);
+                    CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.push_back(&(*it).first);
                 }
             }
         }
 
-        CommandExecutor::getInstance().listOfPossibleConfigValueClasses_.sort(CommandExecutor::compareStringsInList);
+        CommandExecutor::getEvaluation().listOfPossibleConfigValueClasses_.sort(CommandExecutor::compareStringsInList);
     }
 
@@ -750,9 +777,9 @@
             if ((*it).first.find(getLowercase(fragment)) == 0)
             {
-                CommandExecutor::getInstance().listOfPossibleConfigValues_.push_back(&(*it).first);
+                CommandExecutor::getEvaluation().listOfPossibleConfigValues_.push_back(&(*it).first);
             }
         }
 
-        CommandExecutor::getInstance().listOfPossibleConfigValues_.sort(CommandExecutor::compareStringsInList);
+        CommandExecutor::getEvaluation().listOfPossibleConfigValues_.sort(CommandExecutor::compareStringsInList);
     }
 
@@ -761,5 +788,5 @@
         // todo
 
-        CommandExecutor::getInstance().listOfPossibleKeys_.sort(CommandExecutor::compareStringsInList);
+        CommandExecutor::getEvaluation().listOfPossibleKeys_.sort(CommandExecutor::compareStringsInList);
     }
 
Index: code/branches/core2/src/orxonox/core/CommandExecutor.h
===================================================================
--- code/branches/core2/src/orxonox/core/CommandExecutor.h	(revision 951)
+++ code/branches/core2/src/orxonox/core/CommandExecutor.h	(revision 952)
@@ -40,29 +40,59 @@
 namespace orxonox
 {
+    enum CommandState
+    {
+        CS_Empty,
+        CS_FunctionClass_Or_Shortcut_Or_Keyword,
+        CS_Shortcut_Params,
+        CS_Shortcut_Finished,
+        CS_Function,
+        CS_Function_Params,
+        CS_Function_Finished,
+        CS_ConfigValueClass,
+        CS_ConfigValue,
+        CS_ConfigValueType,
+        CS_ConfigValueFinished,
+        CS_KeybindKey,
+        CS_KeybindCommand,
+        CS_KeybindFinished,
+        CS_Error
+    };
+
+    class _CoreExport CommandEvaluation
+    {
+        public:
+            std::string processedCommand_;
+            SubString tokens_;
+            std::list<const std::string*> listOfPossibleFunctionClasses_;
+            std::list<const std::string*> listOfPossibleShortcuts_;
+            std::list<const std::string*> listOfPossibleFunctions_;
+            std::list<const std::string*> listOfPossibleConfigValueClasses_;
+            std::list<const std::string*> listOfPossibleConfigValues_;
+            std::list<const std::string*> listOfPossibleKeys_;
+
+            Identifier* functionclass_;
+            Identifier* configvalueclass_;
+            ExecutorStatic* shortcut_;
+            ExecutorStatic* function_;
+            ConfigValueContainer* configvalue_;
+            ConfigValueContainer* key_;
+
+            std::string errorMessage_;
+            CommandState state_;
+    };
+
     class _CoreExport CommandExecutor
     {
-        enum CommandState
-        {
-            CS_Empty,
-            CS_FunctionClass_Or_Shortcut_Or_Keyword,
-            CS_Shortcut_Params,
-            CS_Shortcut_Finished,
-            CS_Function,
-            CS_Function_Params,
-            CS_Function_Finished,
-            CS_ConfigValueClass,
-            CS_ConfigValue,
-            CS_ConfigValueType,
-            CS_ConfigValueFinished,
-            CS_KeybindKey,
-            CS_KeybindCommand,
-            CS_KeybindFinished,
-            CS_Error
-        };
-
         public:
             static bool execute(const std::string& command);
+            static bool execute(const CommandEvaluation& evaluation);
+
             static std::string complete(const std::string& command);
+            static std::string complete(const CommandEvaluation& evaluation);
+
             static std::string hint(const std::string& command);
+            static std::string hint(const CommandEvaluation& evaluation);
+
+            static const CommandEvaluation& evaluate(const std::string& command);
 
             static bool addConsoleCommandShortcut(ExecutorStatic* executor);
@@ -90,4 +120,5 @@
 
             static CommandExecutor& getInstance();
+            static CommandEvaluation& getEvaluation();
 
             static void parse(const std::string& command, bool bInitialize = true);
@@ -123,22 +154,5 @@
             static ConfigValueContainer* getContainerOfPossibleKey(const std::string& name);
 
-            std::string lastProcessedCommand_;
-            SubString tokens_;
-            std::list<const std::string*> listOfPossibleFunctionClasses_;
-            std::list<const std::string*> listOfPossibleShortcuts_;
-            std::list<const std::string*> listOfPossibleFunctions_;
-            std::list<const std::string*> listOfPossibleConfigValueClasses_;
-            std::list<const std::string*> listOfPossibleConfigValues_;
-            std::list<const std::string*> listOfPossibleKeys_;
-
-            Identifier* functionclass_;
-            Identifier* configvalueclass_;
-            ExecutorStatic* shortcut_;
-            ExecutorStatic* function_;
-            ConfigValueContainer* configvalue_;
-            ConfigValueContainer* key_;
-
-            std::string errorMessage_;
-            CommandState state_;
+            CommandEvaluation evaluation_;
 
             std::map<std::string, ExecutorStatic*> consoleCommandShortcuts_;
Index: code/branches/core2/src/orxonox/core/CorePrereqs.h
===================================================================
--- code/branches/core2/src/orxonox/core/CorePrereqs.h	(revision 951)
+++ code/branches/core2/src/orxonox/core/CorePrereqs.h	(revision 952)
@@ -91,4 +91,5 @@
   class ClassTreeMaskIterator;
   class ClassTreeMaskNode;
+  class CommandEvaluation;
   class CommandExecutor;
   class ConfigValueContainer;
@@ -106,4 +107,6 @@
   class Identifier;
   class IdentifierDistributor;
+  class InputBuffer;
+  class InputBufferListener;
   template <class T>
   class Iterator;
@@ -123,4 +126,5 @@
   class OrxonoxClass;
   class OutputHandler;
+  class Shell;
   template <class T>
   class SubclassIdentifier;
