Changeset 1230
- Timestamp:
- May 4, 2008, 4:44:24 PM (17 years ago)
- Location:
- code/branches/console
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/console/cmake/FindBoost.cmake
r790 r1230 101 101 # Add in some path suffixes. These will have to be updated whenever a new Boost version comes out. 102 102 SET(SUFFIX_FOR_PATH 103 boost-1_35_0 104 boost-1_35 103 105 boost-1_34_1 104 106 boost-1_34_0 … … 112 114 # 113 115 IF(WIN32) 114 SET(Boost_INCLUDE_DIR ../libs/boost_1_33_1) 116 SET(Boost_INCLUDE_DIR 117 # ../libs/boost_1_33_1 118 ../libs/boost_1_35_0 119 ) 115 120 ELSE(WIN32) 116 121 FIND_PATH(Boost_INCLUDE_DIR NAMES boost/config.hpp PATH_SUFFIXES ${SUFFIX_FOR_PATH} PATHS … … 187 192 gcc-1_33_1 188 193 gcc-mt-1_33_1 194 mgw34-mt-1_35 189 195 ) 190 196 -
code/branches/console/src/core/CMakeLists.txt
r1151 r1230 27 27 Script.cc 28 28 TclBind.cc 29 TclThreadManager.cc 29 30 ) 30 31 … … 37 38 ${Lua_LIBRARIES} 38 39 ${OIS_LIBRARIES} 40 ${Boost_thread_LIBRARIES} 39 41 ) -
code/branches/console/src/core/CommandExecutor.cc
r1198 r1230 50 50 ConsoleCommandShortcutExtern(exec, AccessLevel::None); 51 51 ConsoleCommandShortcutExtern(echo, AccessLevel::None); 52 ConsoleCommandShortcutExtern(puts, AccessLevel::None); 52 53 53 54 ConsoleCommandShortcutExtern(read, AccessLevel::None); … … 92 93 std::string echo(const std::string& text) 93 94 { 95 std::cout << text << std::endl; 94 96 return text; 97 } 98 99 void puts(bool newline, const std::string& text) 100 { 101 if (newline) 102 std::cout << text << std::endl; 103 else 104 std::cout << text; 95 105 } 96 106 … … 384 394 if (useTcl) 385 395 { 386 return TclBind::eval(command);387 }388 else389 {390 if ((CommandExecutor::getEvaluation().processedCommand_ != command) || (CommandExecutor::getEvaluation().state_ == CS_Uninitialized)) 391 CommandExecutor::parse(command);392 393 return CommandExecutor::execute(CommandExecutor::getEvaluation()); 394 }396 std::string temp = getLowercase(removeTrailingWhitespaces(command)); 397 if (!(temp.find("tclthread") == 0 || temp.find("tclthreadmanager") == 0)) 398 return TclBind::eval(command); 399 } 400 401 if ((CommandExecutor::getEvaluation().processedCommand_ != command) || (CommandExecutor::getEvaluation().state_ == CS_Uninitialized)) 402 CommandExecutor::parse(command); 403 404 return CommandExecutor::execute(CommandExecutor::getEvaluation()); 395 405 } 396 406 -
code/branches/console/src/core/CommandExecutor.h
r1198 r1230 65 65 void exec(const std::string& filename); 66 66 std::string echo(const std::string& text); 67 void puts(bool newline, const std::string& test); 67 68 68 69 void write(const std::string& filename, const std::string& text); -
code/branches/console/src/core/InputBuffer.cc
r1151 r1230 39 39 { 40 40 //this->bActivated_ = false; 41 this->allowedChars_ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜ0123456789 \\\"(){}[]<>.:,;_-+*/=!?|$&%^ ";41 this->allowedChars_ = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZäöüÄÖÜ0123456789 \\\"(){}[]<>.:,;_-+*/=!?|$&%^~"; 42 42 this->keyboard_ = InputManager::getSingleton().getKeyboard(); 43 43 this->buffer_ = ""; -
code/branches/console/src/core/OutputHandler.cc
r1062 r1230 38 38 namespace orxonox 39 39 { 40 ConsoleCommandShortcutGeneric(log, createExecutor(createFunctor(&OutputHandler::log), "log", AccessLevel::None)); 40 ConsoleCommandShortcutGeneric(log, createExecutor(createFunctor(&OutputHandler::log), "log", AccessLevel::None)); 41 ConsoleCommandShortcutGeneric(error, createExecutor(createFunctor(&OutputHandler::error), "error", AccessLevel::None)); 42 ConsoleCommandShortcutGeneric(warning, createExecutor(createFunctor(&OutputHandler::warning), "warning", AccessLevel::None)); 43 ConsoleCommandShortcutGeneric(info, createExecutor(createFunctor(&OutputHandler::info), "info", AccessLevel::None)); 44 ConsoleCommandShortcutGeneric(debug, createExecutor(createFunctor(&OutputHandler::debug), "debug", AccessLevel::None)); 41 45 42 46 /** -
code/branches/console/src/core/OutputHandler.h
r1064 r1230 63 63 static inline std::string log(const std::string& text) 64 64 { OutputHandler::getOutStream().setOutputLevel(0); OutputHandler::getOutStream().output(text + "\n"); return text; } 65 66 /** @brief Puts an error on the outstream. @param text The text */ 67 static inline std::string error(const std::string& text) 68 { OutputHandler::getOutStream().setOutputLevel(1); OutputHandler::getOutStream().output(text + "\n"); return text; } 69 70 /** @brief Puts a warning on the outstream. @param text The text */ 71 static inline std::string warning(const std::string& text) 72 { OutputHandler::getOutStream().setOutputLevel(2); OutputHandler::getOutStream().output(text + "\n"); return text; } 73 74 /** @brief Puts an info on the outstream. @param text The text */ 75 static inline std::string info(const std::string& text) 76 { OutputHandler::getOutStream().setOutputLevel(3); OutputHandler::getOutStream().output(text + "\n"); return text; } 77 78 /** @brief Puts some debug output on the outstream. @param text The text */ 79 static inline std::string debug(const std::string& text) 80 { OutputHandler::getOutStream().setOutputLevel(4); OutputHandler::getOutStream().output(text + "\n"); return text; } 65 81 66 82 /** @brief Returns a reference to the logfile. @return The logfile */ -
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) -
code/branches/console/src/core/TclBind.h
r1216 r1230 36 36 namespace orxonox 37 37 { 38 class TclBind38 class _CoreExport TclBind 39 39 { 40 40 public: 41 41 static TclBind& getInstance(); 42 42 43 static std::string tcl(const std::string& tclcode); 44 43 45 void setDataPath(const std::string& datapath); 46 std::string getTclLibPath() const { return this->tclLibPath_; } 44 47 void createTclInterpreter(); 45 48 void createNewTclInterpreter(); 46 49 47 static void puts(Tcl::object const &args); 48 static void execute(Tcl::object const &args); 49 static std::string orxonox(Tcl::object const &args); 50 static std::string tcl(const std::string& tclcode); 50 static void tcl_puts(Tcl::object const &args); 51 52 static void tcl_execute(Tcl::object const &args); 53 static std::string tcl_orxonox(Tcl::object const &args); 54 51 55 static bool eval(const std::string& tclcode); 52 56
Note: See TracChangeset
for help on using the changeset viewer.