From 5e6e754f059d5fb6b25b883f89f76333228ba5c4 Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Mon, 10 Mar 2008 06:24:12 +0000 Subject: [PATCH] BUG slash --- kernel/appli/bbCreatePackage/CMakeLists.txt | 2 + kernel/cmake/BBTKKernelConfig.cmake | 12 ++- kernel/src/bbtkConfigurationFile.cxx | 90 +++++++++++++------- kernel/src/bbtkConfigurationFile.h | 17 +++- kernel/src/bbtkFactory.cxx | 10 ++- kernel/src/bbtkInterpreter.cxx | 56 ++++++++++-- kernel/src/bbtkUtilities.h | 17 ++-- kernel/src/bbtkWxConsole.cxx | 6 +- packages/wx/src/bbwxColourSelectorButton.cxx | 6 +- packages/wx/src/bbwxCommandButton.cxx | 6 +- 10 files changed, 155 insertions(+), 67 deletions(-) diff --git a/kernel/appli/bbCreatePackage/CMakeLists.txt b/kernel/appli/bbCreatePackage/CMakeLists.txt index fb6c6ba..b7e4924 100644 --- a/kernel/appli/bbCreatePackage/CMakeLists.txt +++ b/kernel/appli/bbCreatePackage/CMakeLists.txt @@ -8,6 +8,8 @@ SET(bbCreatePackage_DATA_REL_PATH ../${BBTK_DATA_REL_PATH}/bbCreatePackage) IF(WIN32) +message("EED " ${CMAKE_CURRENT_SOURCE_DIR}) +message("EED " ${CMAKE_CURRENT_BINARY_DIR}) CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/bbCreatePackage.bat.in ${CMAKE_CURRENT_BINARY_DIR}/bbCreatePackage.bat diff --git a/kernel/cmake/BBTKKernelConfig.cmake b/kernel/cmake/BBTKKernelConfig.cmake index cfb63e7..db3014e 100644 --- a/kernel/cmake/BBTKKernelConfig.cmake +++ b/kernel/cmake/BBTKKernelConfig.cmake @@ -15,8 +15,14 @@ SET(BBTK_CORE_PACKAGE TRUE) #----------------------------------------------------------------------------- # Path for binaries -SET (EXECUTABLE_OUTPUT_REL_PATH bin) -SET (LIBRARY_OUTPUT_REL_PATH bin) +IF(WIN32) + SET (EXECUTABLE_OUTPUT_REL_PATH "") + SET (LIBRARY_OUTPUT_REL_PATH "") +ELSE(WIN32) + SET (EXECUTABLE_OUTPUT_REL_PATH bin) + SET (LIBRARY_OUTPUT_REL_PATH bin) +ENDIF(WIN32) + SET (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/${EXECUTABLE_OUTPUT_REL_PATH}) SET (LIBRARY_OUTPUT_PATH @@ -37,7 +43,7 @@ IF(WIN32) IF(CMAKE_GENERATOR STREQUAL "Visual Studio 6") SET(BBTK_BIN_PATH ${EXECUTABLE_OUTPUT_PATH}/$(IntDir)) ELSE(CMAKE_GENERATOR STREQUAL "Visual Studio 6") - SET(BBTK_BIN_PATH $(SolutionDir)/bin/$(OutDir)) + SET(BBTK_BIN_PATH $(SolutionDir)/$(OutDir)) ENDIF(CMAKE_GENERATOR STREQUAL "Visual Studio 6") SET(BBTK_BBI ${BBTK_BIN_PATH}/bbi.exe) SET(BBTK_BBFY ${BBTK_BIN_PATH}/bbfy.exe) diff --git a/kernel/src/bbtkConfigurationFile.cxx b/kernel/src/bbtkConfigurationFile.cxx index 8181a6a..eb2e31f 100644 --- a/kernel/src/bbtkConfigurationFile.cxx +++ b/kernel/src/bbtkConfigurationFile.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkConfigurationFile.cxx,v $ Language: C++ - Date: $Date: 2008/03/03 08:06:36 $ - Version: $Revision: 1.12 $ + Date: $Date: 2008/03/10 06:24:12 $ + Version: $Revision: 1.13 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -29,6 +29,8 @@ #include // for getcwd #endif + + namespace bbtk { @@ -37,25 +39,22 @@ namespace bbtk ConfigurationFile::ConfigurationFile() { - // file separator -#if defined(_WIN32) - mFile_separator = "\\"; -#else - mFile_separator = "/"; -#endif + mFile_separator = VALID_FILE_SEPARATOR; // ==> Set system paths mBin_path = GetExecutablePath(); - mInstall_path = mBin_path + mFile_separator + ".."; +//EED mInstall_path = mBin_path + mFile_separator + ".."; + mInstall_path = mBin_path + "/.."; // The relative path to the doc folder (=BBTK_DOC_REL_PATH) mDoc_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_DOC_REL_PATH); -//EED mDoc_rel_path = BBTK_STRINGIFY_SYMBOL(doc); // The path to the doc folder (=mInstall_path+"/"+mDoc_rel_path) - mDoc_path = mInstall_path + mFile_separator + mDoc_rel_path; +//EED mDoc_path = mInstall_path + mFile_separator + mDoc_rel_path; + mDoc_path = mInstall_path + "/" + mDoc_rel_path; // The relative path to the doc folder (=BBTK_BBS_REL_PATH) mBbs_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_BBS_REL_PATH); // The path to the bbs folder (=mInstall_path+"/"+mBbs_rel_path) - mBbs_path = mInstall_path + mFile_separator + mBbs_rel_path; +//EED mBbs_path = mInstall_path + mFile_separator + mBbs_rel_path; + mBbs_path = mInstall_path + "/" + mBbs_rel_path; // The relative path to the rsc folder (=BBTK_RSC_REL_PATH) // mRsc_rel_path = BBTK_STRINGIFY_SYMBOL(BBTK_RSC_REL_PATH); // The path to the rsc folder (=mInstall_path+"/"+mRsc_rel_path) @@ -63,46 +62,67 @@ namespace bbtk // The path to the bbtk data folder // Initialized to mInstall_path+"/"+BBTK_DATA_REL_PATH // But can be overriden by value read from bbtk_config.xml - mData_path = mInstall_path + mFile_separator + BBTK_STRINGIFY_SYMBOL(BBTK_DATA_REL_PATH); +//EED mData_path = mInstall_path + mFile_separator + BBTK_STRINGIFY_SYMBOL(BBTK_DATA_REL_PATH); + mData_path = mInstall_path + "/" + BBTK_STRINGIFY_SYMBOL(BBTK_DATA_REL_PATH); + + Utilities::replace( mBin_path , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + Utilities::replace( mInstall_path , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + Utilities::replace( mDoc_rel_path , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + Utilities::replace( mDoc_path , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + Utilities::replace( mBbs_path , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + Utilities::replace( mData_path , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); bbtkMessage("Config",1," ==> bin : '"< prefix : '"< doc : '"< bbs : '"< data : '"< First we look for bbtk_config.xml in "." @@ -117,8 +137,11 @@ namespace bbtk // LG : throw an exception } - std::string configXmlFullPathName = currentDir + mFile_separator + "bbtk_config.xml"; - +// std::string configXmlFullPathName = currentDir + mFile_separator + "bbtk_config.xml"; + std::string configXmlFullPathName = currentDir ; + configXmlFullPathName += "/bbtk_config.xml"; + Utilities::replace( configXmlFullPathName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + if ( Utilities::FileExists( configXmlFullPathName )) { bbtkMessage("Config",1, "ConfigurationFile : [" << configXmlFullPathName << @@ -135,7 +158,10 @@ namespace bbtk #elif defined(_WIN32) std::string str_home(getenv("USERPROFILE")); #endif - configXmlFullPathName = str_home + mFile_separator + ".bbtk/bbtk_config.xml"; +//EED configXmlFullPathName = str_home + mFile_separator + ".bbtk/bbtk_config.xml"; + configXmlFullPathName = str_home + "/.bbtk/bbtk_config.xml"; + Utilities::replace( configXmlFullPathName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + if (!Utilities::FileExists( configXmlFullPathName )) { // ==> Nothing found, we create bbtk_config.xml in ".bbtk" diff --git a/kernel/src/bbtkConfigurationFile.h b/kernel/src/bbtkConfigurationFile.h index 8f15528..3d2f92a 100644 --- a/kernel/src/bbtkConfigurationFile.h +++ b/kernel/src/bbtkConfigurationFile.h @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkConfigurationFile.h,v $ Language: C++ - Date: $Date: 2008/02/14 10:47:51 $ - Version: $Revision: 1.5 $ + Date: $Date: 2008/03/10 06:24:12 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See doc/license.txt or @@ -43,6 +43,17 @@ #include + // file separator +#if defined(_WIN32) +#define VALID_FILE_SEPARATOR "\\" +#define INVALID_FILE_SEPARATOR "/" +#else +#define INVALID_FILE_SEPARATOR "\\" +#define VALID_FILE_SEPARATOR "/" +#endif + + + namespace bbtk { //========================================================================== @@ -82,7 +93,7 @@ namespace bbtk inline const std::string& Get_data_path() const { return mData_path;} inline const std::string& Get_file_separator() const - { return mFile_separator;} + { return mFile_separator;} inline const std::string& Get_bin_path() const { return mBin_path;} diff --git a/kernel/src/bbtkFactory.cxx b/kernel/src/bbtkFactory.cxx index 85e92b0..9a6010b 100644 --- a/kernel/src/bbtkFactory.cxx +++ b/kernel/src/bbtkFactory.cxx @@ -4,8 +4,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.cxx,v $ Language: C++ -Date: $Date: 2008/03/07 10:21:30 $ -Version: $Revision: 1.28 $ +Date: $Date: 2008/03/10 06:24:12 $ +Version: $Revision: 1.29 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de @@ -80,6 +80,12 @@ namespace bbtk //=================================================================== void Factory::Reset() { +printf("EED kkkkkkkkkkkkkkkkkkkkkkkk Factory::Reset() \n"); +printf("EED kkkkkkkkkkkkkkkkkkkkkkkk Factory::Reset() \n"); +printf("EED kkkkkkkkkkkkkkkkkkkkkkkk Factory::Reset() \n"); +printf("EED kkkkkkkkkkkkkkkkkkkkkkkk Factory::Reset() \n"); +printf("EED kkkkkkkkkkkkkkkkkkkkkkkk Factory::Reset() \n"); +printf("EED kkkkkkkkkkkkkkkkkkkkkkkk Factory::Reset() \n"); bbtkDebugMessageInc("Kernel",7,"Factory::Reset()"<0) { +printf("EED --- %s --- Interpreter::InterpretFile \n", mFileName[0].c_str() ); while ((mFile.size()>0) && (!mFile.back()->eof())) +//EED3 (!mFile[0]->eof())) { mLine.back()++; char buf[500]; mFile.back()->getline(buf,500); +//EED3 mFile[0]->getline(buf,500); std::string str(buf); int size=str.length(); @@ -331,6 +342,7 @@ std::cout << "=========================================~Interpreter()" << std::e } InterpretLine(str, insideComment); +printf("EED Interpreter::InterpretFile %s\n", str.c_str() ); } //if (mFile.size()>0) CloseCurrentFile(); @@ -842,12 +854,13 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& } foundFile = true; - + Filenames.clear(); int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames); nbBssFiles = 0; for (std::vector::iterator i = Filenames.begin(); i!= Filenames.end(); ++i) { +//EEDprintf("EED Interpreter::SwitchToFile %s\n",(*i).c_str() ); if ((*i).substr((*i).size()-4, 4) != ".bbs") continue; // ignore non .bbs files std::string command("include "); @@ -972,9 +985,25 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& void Interpreter::LoadScript( std::string fullPathScriptName, std::string includeScriptName) { - if (find(mFileName.begin(),mFileName.end(),fullPathScriptName) - !=mFileName.end()) +//EED printf("EED Interpreter::LoadScript >>01\n"); + Utilities::replace( fullPathScriptName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR); + + bool okScriptExist=false; + int iStrScript,sizeVecStricpt=mFileName.size(); + for ( iStrScript=0;iStrScript>__ %s\n", iStrScript,mFileName[iStrScript].c_str(),fullPathScriptName.c_str() ); + if (mFileName[iStrScript] == fullPathScriptName ) + { + printf(" EED %d Interpreter::LoadScript iguales\n",iStrScript ); + okScriptExist=true; + } // if + } // for + + if (find(mFileName.begin(),mFileName.end(),fullPathScriptName)!=mFileName.end()) +// if (okScriptExist==true) { +//EED printf("EED Interpreter::LoadScript Exit method\n"); bbtkMessage("Interpreter",1,"file '"<& mFileName.push_back(fullPathScriptName); mIncludeFileName.push_back(includeScriptName); mLine.push_back(0); +//EED printf("EED Interpreter::LoadScript >>02\n"); return; } @@ -1014,15 +1044,23 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& return; } + bbtkDebugMessage("Interpreter",9," Closing file '"<close(); delete mFile.back(); mFile.pop_back(); - bbtkDebugMessage("Interpreter",9, - " Closing file '"<close(); + delete mFile[0]; + mFile.erase( mFile.begin() ); + mFileName.erase( mFileName.begin() ); + mIncludeFileName.erase( mIncludeFileName.begin() ); + mLine.erase( mLine.begin() ); +*/ + bbtkDebugMessage("Interpreter",9," Remains " <