- Timestamp:
- Jul 24, 2009, 6:00:36 PM (15 years ago)
- Location:
- code/branches/resource
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/resource/cmake/PackageConfig.cmake
r3309 r3344 42 42 SET(ENV{OGRE_PLUGIN_DIR} ${DEP_BINARY_DIR}) 43 43 SET(ENV{OPENALDIR} ${DEP_INCLUDE_DIR}/openal-1.1) 44 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl-8.5. 2/include)44 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl-8.5.7/include) 45 45 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/zlib-1.2.3/include) 46 47 SET(TCL_LIBRARY_DIR ${DEPENDENCY_PACKAGE_DIR}/tcl) 46 48 47 49 ### INSTALL ### -
code/branches/resource/src/SpecialConfig.h.in
r3196 r3344 88 88 const char ORXONOX_LOG_DEV_PATH[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@"; 89 89 #endif 90 90 91 91 /* OGRE Plugins */ 92 92 #ifdef NDEBUG … … 105 105 # endif 106 106 #endif 107 108 /* Tcl */ 109 #ifdef DEPENDENCY_PACKAGE_ENABLE 110 const char ORXONOX_TCL_LIBRARY_PATH[] = "@TCL_LIBRARY_DIR@"; 111 #endif 107 112 } 108 113 -
code/branches/resource/src/core/TclBind.cc
r3318 r3344 38 38 #include "ConsoleCommand.h" 39 39 #include "TclThreadManager.h" 40 #include "SpecialConfig.h" 40 41 41 42 namespace orxonox … … 51 52 singletonRef_s = this; 52 53 this->interpreter_ = 0; 53 this->bSetTcl LibPath_ = false;54 this->bSetTclDataPath_ = false; 54 55 this->setDataPath(datapath); 55 56 } … … 65 66 { 66 67 // String has POSIX slashes 67 this->tcl LibPath_ = datapath + "tcl" + TCL_VERSION+ '/';68 this->bSetTcl LibPath_ = true;68 this->tclDataPath_ = datapath + "tcl" + '/'; 69 this->bSetTclDataPath_ = true; 69 70 70 this-> createTclInterpreter();71 this->initializeTclInterpreter(); 71 72 } 72 73 73 void TclBind:: createTclInterpreter()74 void TclBind::initializeTclInterpreter() 74 75 { 75 if (this->bSetTcl LibPath_ && !this->interpreter_)76 if (this->bSetTclDataPath_ && !this->interpreter_) 76 77 { 77 this->interpreter_ = new Tcl::interpreter(this->tclLibPath_); 78 this->interpreter_ = this->createTclInterpreter(); 79 78 80 this->interpreter_->def("orxonox::query", TclBind::tcl_query, Tcl::variadic()); 79 81 this->interpreter_->def("orxonox::crossquery", TclThreadManager::tcl_crossquery, Tcl::variadic()); … … 88 90 this->interpreter_->eval("set id 0"); 89 91 this->interpreter_->eval("rename exit tcl::exit; proc exit {} { execute exit }"); 90 this->interpreter_->eval("redef_puts");91 92 } 92 93 catch (Tcl::tcl_error const &e) … … 94 95 catch (std::exception const &e) 95 96 { COUT(1) << "Error while creating Tcl-interpreter: " << e.what() << std::endl; } 97 catch (...) 98 { COUT(1) << "Error while creating Tcl-interpreter." << std::endl; } 96 99 } 97 100 } 98 101 99 void TclBind::createNewTclInterpreter()102 Tcl::interpreter* TclBind::createTclInterpreter() 100 103 { 101 if (this->interpreter_) 104 #ifdef DEPENDENCY_PACKAGE_ENABLE 105 Tcl::interpreter* interpreter = new Tcl::interpreter(ORXONOX_TCL_LIBRARY_PATH); 106 #else 107 Tcl::interpreter* interpreter = new Tcl::interpreter(); 108 #endif 109 try 102 110 { 103 delete this->interpreter_; 104 this->interpreter_ = 0; 111 interpreter->eval("source " + TclBind::getInstance().tclDataPath_ + "/init.tcl"); 105 112 } 113 catch (Tcl::tcl_error const &e) 114 { COUT(1) << "Tcl error while creating Tcl-interpreter: " << e.what() << std::endl; } 115 catch (std::exception const &e) 116 { COUT(1) << "Error while creating Tcl-interpreter: " << e.what() << std::endl; } 117 catch (...) 118 { COUT(1) << "Error while creating Tcl-interpreter." << std::endl; } 106 119 107 this->createTclInterpreter();120 return interpreter; 108 121 } 109 122 -
code/branches/resource/src/core/TclBind.h
r3196 r3344 49 49 50 50 void setDataPath(const std::string& datapath); 51 std::string getTclLibPath() const { return this->tclLibPath_; }52 void createTclInterpreter();53 void createNewTclInterpreter();51 const std::string& getTclDataPath() const { return this->tclDataPath_; } 52 void initializeTclInterpreter(); 53 static Tcl::interpreter* createTclInterpreter(); 54 54 Tcl::interpreter* getTclInterpreter() const { return this->interpreter_; } 55 55 … … 63 63 64 64 Tcl::interpreter* interpreter_; 65 std::string tcl LibPath_;66 bool bSetTcl LibPath_;65 std::string tclDataPath_; 66 bool bSetTclDataPath_; 67 67 68 68 static TclBind* singletonRef_s; -
code/branches/resource/src/core/TclThreadManager.cc
r3326 r3344 240 240 TclInterpreterBundle* newbundle = new TclInterpreterBundle(); 241 241 newbundle->id_ = id; 242 newbundle->interpreter_ = new Tcl::interpreter(TclBind::getInstance().getTclLibPath());242 newbundle->interpreter_ = TclBind::createTclInterpreter(); 243 243 244 244 // Initialize the new interpreter … … 268 268 269 269 // Redefine some native functions 270 newbundle->interpreter_->eval("redef_puts");271 272 270 // newbundle->interpreter_->eval("rename while tcl::while"); 273 271 // newbundle->interpreter_->eval("proc while {test command} { tcl::while {[uplevel 1 expr $test]} {uplevel 1 $command} }"); // (\"$test\" && [orxonox::running " + id + "]])
Note: See TracChangeset
for help on using the changeset viewer.