Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 27, 2010, 2:41:03 PM (14 years ago)
Author:
landauf
Message:

re-implemented CommandExecutor and CommandEvaluation. parameter evaluation is currently not implemented, will come soon.

File:
1 edited

Legend:

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

    r7219 r7228  
    134134        const std::string& command = stripEnclosingBraces(args.get());
    135135
    136         bool success;
    137         const std::string& result = CommandExecutor::query(command, &success, false);
    138         if (!success)
    139         {
    140             COUT(1) << "Error: Can't execute command \"" << command << "\"!" << std::endl;
     136        int error;
     137        const std::string& result = CommandExecutor::query(command, &error, false);
     138        switch (error)
     139        {
     140            case CommandExecutor::Error:       COUT(1) << "Error: Can't execute command \"" << command << "\", command doesn't exist. (B)" << std::endl; break;
     141            case CommandExecutor::Incomplete:  COUT(1) << "Error: Can't execute command \"" << command << "\", not enough arguments given. (B)" << std::endl; break;
     142            case CommandExecutor::Deactivated: COUT(1) << "Error: Can't execute command \"" << command << "\", command is not active. (B)" << std::endl; break;
     143            case CommandExecutor::Denied:      COUT(1) << "Error: Can't execute command \"" << command << "\", access denied. (B)" << std::endl; break;
    141144        }
    142145
     
    149152        const std::string& command = stripEnclosingBraces(args.get());
    150153
    151         if (!CommandExecutor::execute(command, false))
     154        if (CommandExecutor::execute(command, false))
    152155        {
    153156            COUT(1) << "Error: Can't execute command \"" << command << "\"!" << std::endl;
     
    180183    }
    181184
    182     std::string TclBind::eval(const std::string& tclcode, bool* success)
    183     {
    184         if (success)
    185             *success = true;
     185    std::string TclBind::eval(const std::string& tclcode, int* error)
     186    {
     187        if (error)
     188            *error = CommandExecutor::Success;
    186189
    187190        try
     
    192195        {   COUT(1) << "Tcl error: " << e.what() << std::endl;   }
    193196
    194         if (success)
    195             *success = false;
     197        if (error)
     198            *error = CommandExecutor::Error;
    196199        return "";
    197200    }
Note: See TracChangeset for help on using the changeset viewer.