Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 26, 2008, 2:50:04 AM (16 years ago)
Author:
landauf
Message:

removed some bugs
tcl knows now orxonox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/console/src/core/CommandExecutor.cc

    r1187 r1188  
    236236            if (this->shortcut_)
    237237            {
    238                 if (this->shortcut_->evaluate(this->processedCommand_ + this->getAdditionalParameter(), this->param_, " "))
    239                 {
    240                     this->bEvaluatedParams_ = true;
    241                     this->evaluatedExecutor_ = this->shortcut_;
     238                if (this->tokens_.size() <= 1)
     239                {
     240                    if (this->shortcut_->evaluate(this->getAdditionalParameter(), this->param_, " "))
     241                    {
     242                        this->bEvaluatedParams_ = true;
     243                        this->evaluatedExecutor_ = this->shortcut_;
     244                    }
     245                }
     246                else if (this->tokens_.size() > 1)
     247                {
     248                    if (this->shortcut_->evaluate(this->tokens_.subSet(1).join() + this->getAdditionalParameter(), this->param_, " "))
     249                    {
     250                        this->bEvaluatedParams_ = true;
     251                        this->evaluatedExecutor_ = this->shortcut_;
     252                    }
    242253                }
    243254            }
     
    247258            if (this->function_)
    248259            {
    249                 if (this->function_->evaluate(this->processedCommand_ + this->getAdditionalParameter(), this->param_, " "))
    250                 {
    251                     this->bEvaluatedParams_ = true;
    252                     this->evaluatedExecutor_ = this->function_;
     260                if (this->tokens_.size() <= 2)
     261                {
     262                    if (this->function_->evaluate(this->getAdditionalParameter(), this->param_, " "))
     263                    {
     264                        this->bEvaluatedParams_ = true;
     265                        this->evaluatedExecutor_ = this->function_;
     266                    }
     267                }
     268                else if (this->tokens_.size() > 2)
     269                {
     270                    if (this->function_->evaluate(this->tokens_.subSet(2).join() + this->getAdditionalParameter(), this->param_, " "))
     271                    {
     272                        this->bEvaluatedParams_ = true;
     273                        this->evaluatedExecutor_ = this->function_;
     274                    }
    253275                }
    254276            }
     
    354376    bool CommandExecutor::execute(const std::string& command)
    355377    {
     378std::cout << "CE_execute: " << command << "\n";
    356379        if ((CommandExecutor::getEvaluation().processedCommand_ != command) || (CommandExecutor::getEvaluation().state_ == CS_Uninitialized))
    357             CommandExecutor::parse(command);
     380{std::cout << "CE_execute->parse\n";
     381            CommandExecutor::parse(command);}
    358382
    359383        return CommandExecutor::execute(CommandExecutor::getEvaluation());
     
    368392        {
    369393            (*evaluation.evaluatedExecutor_)(evaluation.param_[0], evaluation.param_[1], evaluation.param_[2], evaluation.param_[3], evaluation.param_[4]);
     394            return true;
    370395        }
    371396
     
    612637    {
    613638        CommandExecutor::parse(command, true);
     639std::cout << "1_1: " << command << std::endl;
     640        if (CommandExecutor::getEvaluation().tokens_.size() > 0)
     641        {
     642            std::string lastToken;
     643            lastToken = CommandExecutor::getEvaluation().tokens_[CommandExecutor::getEvaluation().tokens_.size() - 1];
     644            lastToken = lastToken.substr(0, lastToken.size() - 1);
     645            CommandExecutor::getEvaluation().tokens_.pop_back();
     646            CommandExecutor::getEvaluation().tokens_.append(SubString(lastToken, " "));
     647        }
     648std::cout << "1_2: " << CommandExecutor::getEvaluation().tokens_[CommandExecutor::getEvaluation().tokens_.size() - 1] << std::endl;
    614649        CommandExecutor::getEvaluation().evaluateParams();
    615650        return CommandExecutor::getEvaluation();
     
    10491084        CommandExecutor::getEvaluation().additionalParameter_ = "";
    10501085
     1086        CommandExecutor::getEvaluation().bEvaluatedParams_ = false;
     1087        CommandExecutor::getEvaluation().evaluatedExecutor_ = 0;
     1088
    10511089        CommandExecutor::getEvaluation().listOfPossibleFunctionClasses_.clear();
    10521090        CommandExecutor::getEvaluation().listOfPossibleShortcuts_.clear();
Note: See TracChangeset for help on using the changeset viewer.