Changeset 1230 for code/branches/console/src/core/TclBind.cc
- Timestamp:
- May 4, 2008, 4:44:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/src/core/TclBind.cc
r1198 r1230 70 70 { 71 71 this->interpreter_ = new Tcl::interpreter(this->tclLibPath_); 72 this->interpreter_->def("puts", TclBind::puts, Tcl::variadic()); 73 this->interpreter_->def("orxonox", TclBind::orxonox, Tcl::variadic()); 74 this->interpreter_->def("execute", TclBind::execute, Tcl::variadic()); 75 this->interpreter_->eval("proc unknown {args} { return [orxonox $args] }"); 72 this->interpreter_->def("orxonox", TclBind::tcl_orxonox, Tcl::variadic()); 73 this->interpreter_->def("execute", TclBind::tcl_execute, Tcl::variadic()); 76 74 this->interpreter_->eval("rename exit tclexit; proc exit {} { orxonox exit }"); 75 this->interpreter_->eval("redef_puts"); 77 76 } 78 77 } … … 89 88 } 90 89 91 void TclBind:: puts(Tcl::object const &args)90 void TclBind::tcl_puts(Tcl::object const &args) 92 91 { 93 92 COUT(0) << args.get() << std::endl; 94 93 } 95 94 96 std::string TclBind:: orxonox(Tcl::object const &args)95 std::string TclBind::tcl_orxonox(Tcl::object const &args) 97 96 { 98 std::cout << "Tcl_ execute: args: " << args.get() << std::endl;97 std::cout << "Tcl_orxonox: args: " << args.get() << std::endl; 99 98 std::string command = args.get(); 100 99 … … 111 110 } 112 111 113 void TclBind:: execute(Tcl::object const &args)112 void TclBind::tcl_execute(Tcl::object const &args) 114 113 { 114 std::cout << "Tcl_execute: args: " << args.get() << std::endl; 115 std::string command = args.get(); 116 117 if (command.size() >= 2 && command[0] == '{' && command[command.size() - 1] == '}') 118 command = command.substr(1, command.size() - 2); 119 120 if (!CommandExecutor::execute(command, false)) 121 COUT(1) << "Error: Can't execute command \"" << command << "\"!" << std::endl; 115 122 } 116 123 … … 145 152 catch (Tcl::tcl_error const &e) 146 153 { 147 COUT(1) << " Error: " << e.what() << std::endl;154 COUT(1) << "Tcl error: " << e.what() << std::endl; 148 155 } 149 156 catch (std::exception const &e)
Note: See TracChangeset
for help on using the changeset viewer.