Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 26, 2010, 2:06:16 AM (14 years ago)
Author:
landauf
Message:

adapted CommandExecutor and CommandEvaluation to make it compile again, but it doesn't run yet. ready for refactoring.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/consolecommands3/src/libraries/core/command/CommandExecutor.cc

    r7216 r7221  
    4949    }
    5050
    51     const CommandEvaluation& CommandExecutor::getLastEvaluation()
    52     {
    53         return CommandExecutor::getInstance().evaluation_;
    54     }
    55 
    5651    bool CommandExecutor::execute(const std::string& command, bool useTcl)
    5752    {
     
    216211                        CommandExecutor::getEvaluation().functionclass_ = 0;
    217212                        CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().function_->getName();
    218                         if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
     213                        if (CommandExecutor::getEvaluation().function_->getExecutor()->getParamCount() > 0)
    219214                        {
    220215                            CommandExecutor::getEvaluation().command_ += ' ';
     
    303298                            CommandExecutor::getEvaluation().state_ = CommandState::ParamPreparation;
    304299                            CommandExecutor::getEvaluation().command_ = CommandExecutor::getEvaluation().functionclass_->getName() + ' ' + CommandExecutor::getEvaluation().function_->getName();
    305                             if (CommandExecutor::getEvaluation().function_->getParamCount() > 0)
     300                            if (CommandExecutor::getEvaluation().function_->getExecutor()->getParamCount() > 0)
    306301                            {
    307302                                CommandExecutor::getEvaluation().command_ += ' ';
     
    335330            case CommandState::ParamPreparation:
    336331            {
    337                 if (CommandExecutor::getEvaluation().function_->getParamCount() == 0 || CommandExecutor::enoughArgumentsGiven(CommandExecutor::getEvaluation().function_))
     332                if (CommandExecutor::getEvaluation().function_->getExecutor()->getParamCount() == 0 || CommandExecutor::enoughArgumentsGiven(CommandExecutor::getEvaluation().function_))
    338333                {
    339334                    CommandExecutor::getEvaluation().state_ = CommandState::Finished;
     
    418413    }
    419414
    420     bool CommandExecutor::enoughArgumentsGiven(ConsoleCommand* command)
     415    bool CommandExecutor::enoughArgumentsGiven(_ConsoleCommand* command)
    421416    {
    422417        if (CommandExecutor::getEvaluation().functionclass_)
    423             return (CommandExecutor::argumentsGiven() > (2 + command->getParamCount()));
    424         else
    425             return (CommandExecutor::argumentsGiven() > (1 + command->getParamCount()));
     418            return (CommandExecutor::argumentsGiven() > (2 + command->getExecutor()->getParamCount()));
     419        else
     420            return (CommandExecutor::argumentsGiven() > (1 + command->getExecutor()->getParamCount()));
    426421    }
    427422
     
    441436    void CommandExecutor::createListOfPossibleIdentifiers(const std::string& fragment)
    442437    {
     438/*
    443439        CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.clear();
    444440        const std::string& lowercase = getLowercase(fragment);
     
    447443                if (it->first.find(lowercase) == 0 || fragment.empty())
    448444                    CommandExecutor::getEvaluation().listOfPossibleIdentifiers_.push_back(std::pair<const std::string*, const std::string*>(&it->first, &it->second->getName()));
     445*/
    449446    }
    450447
    451448    void CommandExecutor::createListOfPossibleFunctions(const std::string& fragment, Identifier* identifier)
    452449    {
     450/*
    453451        CommandExecutor::getEvaluation().listOfPossibleFunctions_.clear();
    454452        const std::string& lowercase = getLowercase(fragment);
    455453        if (!identifier)
    456454        {
    457             for (std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMapBegin(); it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd(); ++it)
     455            for (std::map<std::string, _ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMapBegin(); it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd(); ++it)
    458456                if (it->first.find(lowercase) == 0 || fragment.empty())
    459457                    CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&it->first, &it->second->getName()));
     
    461459        else
    462460        {
    463             for (std::map<std::string, ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMapBegin(); it != identifier->getLowercaseConsoleCommandMapEnd(); ++it)
     461            for (std::map<std::string, _ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMapBegin(); it != identifier->getLowercaseConsoleCommandMapEnd(); ++it)
    464462                if (it->first.find(lowercase) == 0 || fragment.empty())
    465463                    CommandExecutor::getEvaluation().listOfPossibleFunctions_.push_back(std::pair<const std::string*, const std::string*>(&it->first, &it->second->getName()));
    466464        }
    467     }
    468 
    469     void CommandExecutor::createListOfPossibleArguments(const std::string& fragment, ConsoleCommand* command, unsigned int param)
    470     {
     465*/
     466    }
     467
     468    void CommandExecutor::createListOfPossibleArguments(const std::string& fragment, _ConsoleCommand* command, unsigned int param)
     469    {
     470/*
    471471        CommandExecutor::createArgumentCompletionList(command, param);
    472472
     
    486486            }
    487487        }
     488*/
    488489    }
    489490
    490491    Identifier* CommandExecutor::getPossibleIdentifier(const std::string& name)
    491492    {
     493/*
    492494        const std::string& lowercase = getLowercase(name);
    493495        std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMap().find(lowercase);
    494496        if ((it != Identifier::getLowercaseStringIdentifierMapEnd()) && it->second->hasConsoleCommands())
    495497            return it->second;
    496 
     498*/
    497499        return 0;
    498500    }
    499501
    500     ConsoleCommand* CommandExecutor::getPossibleCommand(const std::string& name, Identifier* identifier)
    501     {
     502    _ConsoleCommand* CommandExecutor::getPossibleCommand(const std::string& name, Identifier* identifier)
     503    {
     504/*
    502505        const std::string& lowercase = getLowercase(name);
    503506        if (!identifier)
    504507        {
    505             std::map<std::string, ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMap().find(lowercase);
     508            std::map<std::string, _ConsoleCommand*>::const_iterator it = CommandExecutor::getLowercaseConsoleCommandShortcutMap().find(lowercase);
    506509            if (it != CommandExecutor::getLowercaseConsoleCommandShortcutMapEnd())
    507510                return it->second;
     
    509512        else
    510513        {
    511             std::map<std::string, ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMap().find(lowercase);
     514            std::map<std::string, _ConsoleCommand*>::const_iterator it = identifier->getLowercaseConsoleCommandMap().find(lowercase);
    512515            if (it != identifier->getLowercaseConsoleCommandMapEnd())
    513516                return it->second;
    514517        }
     518*/
    515519        return 0;
    516520    }
    517521
    518     const std::string& CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param)
    519     {
     522    const std::string& CommandExecutor::getPossibleArgument(const std::string& name, _ConsoleCommand* command, unsigned int param)
     523    {
     524/*
    520525        CommandExecutor::createArgumentCompletionList(command, param);
    521526
     
    534539            }
    535540        }
    536 
     541*/
    537542        return BLANKSTRING;
    538543    }
    539544
    540     void CommandExecutor::createArgumentCompletionList(ConsoleCommand* command, unsigned int param)
    541     {
     545    void CommandExecutor::createArgumentCompletionList(_ConsoleCommand* command, unsigned int param)
     546    {
     547/*
    542548        std::string params[5];
    543549
     
    554560
    555561        command->createArgumentCompletionList(param, params[0], params[1], params[2], params[3], params[4]);
     562*/
    556563    }
    557564
     
    643650        }
    644651    }
    645 
    646     void CommandExecutor::destroyExternalCommands()
    647     {
    648         for (std::set<ConsoleCommand*>::const_iterator it = CommandExecutor::getInstance().consoleCommandExternals_.begin();
    649             it != CommandExecutor::getInstance().consoleCommandExternals_.end(); ++it)
    650             delete *it;
    651     }
    652652}
Note: See TracChangeset for help on using the changeset viewer.