Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 25, 2008, 12:51:29 AM (16 years ago)
Author:
landauf
Message:

some changes in commandexecutor and tclbind, but there's still a bug in the parameter evaluation

File:
1 edited

Legend:

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

    r1151 r1187  
    33
    44#include "ConsoleCommand.h"
     5#include "CommandExecutor.h"
    56#include "Debug.h"
    6 #include "cpptcl/CppTcl.h"
    77#include "TclBind.h"
    88
    99namespace orxonox
    1010{
    11     ConsoleCommandShortcutExtern(test, AccessLevel::None);
    1211    ConsoleCommandShortcutExtern(tcl, AccessLevel::None);
    1312
    14     void hello()
     13    void Tcl_puts(Tcl::object const &args)
    1514    {
    16         std::cout << "Hello C++/Tcl!" << std::endl;
     15        COUT(0) << args.get() << std::endl;
    1716    }
    1817
    19     void test()
     18    std::string Tcl_unknown(Tcl::object const &a)
    2019    {
    21         Tcl::interpreter i;
    22         i.def("hello", hello);
    23 
    24         std::string script = "for {set i 0} {$i != 4} {incr i} { hello }";
    25 
    26         i.eval(script);
     20std::cout << "1\n";
     21std::cout << a.get() << std::endl;
     22        CommandEvaluation evaluation = CommandExecutor::evaluate(std::string(a.get()));
     23std::cout << "2\n";
     24        CommandExecutor::execute(evaluation);
     25std::cout << "3\n";
     26        if (evaluation.hasReturnvalue())
     27        {
     28std::cout << "4\n";
     29            return evaluation.getReturnvalue().toString();
     30        }
     31std::cout << "5\n";
     32        return "";
    2733    }
    2834
     
    3238        {
    3339            static Tcl::interpreter i;
     40            i.def("puts", Tcl_puts, Tcl::variadic());
     41            i.def("blub", Tcl_unknown, Tcl::variadic());
    3442            std::string output = i.eval(tclcode);
    3543            COUT(0) << "tcl> " << output << std::endl;
Note: See TracChangeset for help on using the changeset viewer.