From 2d564c78c449d67b1d85511ba9601d3afb57c924 Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Wed, 14 Nov 2012 07:11:59 +0000 Subject: [PATCH] Bug #1754 Package control Version Feature #1755 Type of Script Clean Debug comments --- kernel/cmake/BBTKVersion.cmake | 4 +- kernel/src/bbtkBlackBoxDescriptor.cxx | 30 ++++++- kernel/src/bbtkBlackBoxDescriptor.h | 40 ++++++++- kernel/src/bbtkComplexBlackBoxDescriptor.cxx | 6 +- kernel/src/bbtkComplexBlackBoxDescriptor.h | 13 +-- kernel/src/bbtkExecuter.cxx | 11 ++- kernel/src/bbtkExecuter.h | 9 +- kernel/src/bbtkFactory.cxx | 12 +-- kernel/src/bbtkInterpreter.cxx | 12 ++- kernel/src/bbtkInterpreter.h | 6 +- kernel/src/bbtkInterpreterVirtual.cxx | 15 +++- kernel/src/bbtkInterpreterVirtual.h | 5 +- kernel/src/bbtkPackage.cxx | 83 +++++++++---------- kernel/src/bbtkPackage.h | 8 +- kernel/src/bbtkTranscriptor.cxx | 11 ++- kernel/src/bbtkTranscriptor.h | 6 +- kernel/src/bbtkVirtualExec.h | 8 +- .../vtk/src/bbvtkRescaleSlopeIntercept.cxx | 10 +-- 18 files changed, 190 insertions(+), 99 deletions(-) diff --git a/kernel/cmake/BBTKVersion.cmake b/kernel/cmake/BBTKVersion.cmake index 29a5a93..60dc082 100644 --- a/kernel/cmake/BBTKVersion.cmake +++ b/kernel/cmake/BBTKVersion.cmake @@ -2,8 +2,8 @@ # BBTK version number SET(BBTK_VERSION_DATE "19/03/2010") SET(BBTK_MAJOR_VERSION 0) -SET(BBTK_MINOR_VERSION 9) -SET(BBTK_BUILD_VERSION 7) +SET(BBTK_MINOR_VERSION 10) +SET(BBTK_BUILD_VERSION 1) SET(BBTK_VERSION "${BBTK_MAJOR_VERSION}.${BBTK_MINOR_VERSION}.${BBTK_BUILD_VERSION}") # Now in bbtkConfigure.h file (cf. core/src) diff --git a/kernel/src/bbtkBlackBoxDescriptor.cxx b/kernel/src/bbtkBlackBoxDescriptor.cxx index 18dfcd1..e165e97 100644 --- a/kernel/src/bbtkBlackBoxDescriptor.cxx +++ b/kernel/src/bbtkBlackBoxDescriptor.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBoxDescriptor.cxx,v $ Language: C++ - Date: $Date: 2009/12/08 14:10:36 $ - Version: $Revision: 1.22 $ + Date: $Date: 2012/11/14 07:12:00 $ + Version: $Revision: 1.23 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -59,6 +59,7 @@ namespace bbtk mAuthor(""), mCategory(""), mKind(STANDARD), + mTypeOfScript(TS_BINARY), mPackage() { bbtkDDebugMessage("object",4, @@ -72,6 +73,7 @@ namespace bbtk /// Default ctor BlackBoxDescriptor::BlackBoxDescriptor(const BlackBoxDescriptor&) { + mScriptFileName=""; } //========================================================================= /// Dtor @@ -527,4 +529,28 @@ namespace bbtk } //========================================================================= + + //========================================================================== + void BlackBoxDescriptor::SetTypeOfScript_Application() + { + SetTypeOfScript(TS_SCRIPT_APPLICATION); + } + //========================================================================== + + + //========================================================================== + bool BlackBoxDescriptor::IsTypeOfScript_Application() + { + return (GetTypeOfScript()==TS_SCRIPT_APPLICATION); + } + //========================================================================== + + + //========================================================================== + bool BlackBoxDescriptor::IsTypeOfScript_ComplexBox() + { + return (GetTypeOfScript()==TS_SCRIPT_COMPLEXBOX); + } + //========================================================================== + } diff --git a/kernel/src/bbtkBlackBoxDescriptor.h b/kernel/src/bbtkBlackBoxDescriptor.h index 1de5b8c..97c57b8 100644 --- a/kernel/src/bbtkBlackBoxDescriptor.h +++ b/kernel/src/bbtkBlackBoxDescriptor.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkBlackBoxDescriptor.h,v $ Language: C++ - Date: $Date: 2008/10/17 08:18:12 $ - Version: $Revision: 1.11 $ + Date: $Date: 2012/11/14 07:12:00 $ + Version: $Revision: 1.12 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -79,6 +79,13 @@ namespace bbtk } Kind; + typedef enum + { + TS_BINARY=0, + TS_SCRIPT_COMPLEXBOX=1, + TS_SCRIPT_APPLICATION=2 + } TypeOfScript; + /// Releases a descriptor // static void Release(BlackBoxDescriptor::WeakPointer); @@ -158,6 +165,35 @@ namespace bbtk /// virtual void Check(bool recursive=true) const; + + + /// Sets the name of the script file from which it is defined + void SetScriptFileName(const std::string& n) { mScriptFileName = n; } + /// Gets the name of the script file from which it is defined + std::string GetScriptFileName() const { return mScriptFileName; } + + + + + /// Gets the type of script BINARY, SCRIPT_COMPLEXBOX, SCRIPT_APPLICATION + TypeOfScript GetTypeOfScript() { return mTypeOfScript; }; + void SetTypeOfScript(TypeOfScript type) { mTypeOfScript=type; }; + bool IsTypeOfScript_Application(); + bool IsTypeOfScript_ComplexBox(); + void SetTypeOfScript_Application(); + + + + + private: + + TypeOfScript mTypeOfScript; + + /// The name of the script file from which it was created + std::string mScriptFileName; + + + protected: /// Adds an input descriptor void AddInputDescriptor( BlackBoxInputDescriptor *d ) diff --git a/kernel/src/bbtkComplexBlackBoxDescriptor.cxx b/kernel/src/bbtkComplexBlackBoxDescriptor.cxx index 3037cae..2cc69bb 100644 --- a/kernel/src/bbtkComplexBlackBoxDescriptor.cxx +++ b/kernel/src/bbtkComplexBlackBoxDescriptor.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkComplexBlackBoxDescriptor.cxx,v $ Language: C++ - Date: $Date: 2009/12/08 14:10:36 $ - Version: $Revision: 1.21 $ + Date: $Date: 2012/11/14 07:12:00 $ + Version: $Revision: 1.22 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -64,6 +64,7 @@ namespace bbtk ComplexBlackBoxDescriptor::ComplexBlackBoxDescriptor(const std::string& name) { bbtkDDebugMessage("object",2,"==> ComplexBlackBoxDescriptor(\""<SetTypeOfScript_Application(); + } + + + //======================================================================= void Executer::Clear() { diff --git a/kernel/src/bbtkExecuter.h b/kernel/src/bbtkExecuter.h index 71f92d2..d53e06b 100644 --- a/kernel/src/bbtkExecuter.h +++ b/kernel/src/bbtkExecuter.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkExecuter.h,v $ Language: C++ - Date: $Date: 2009/06/08 14:50:03 $ - Version: $Revision: 1.18 $ + Date: $Date: 2012/11/14 07:12:00 $ + Version: $Revision: 1.19 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -108,6 +108,11 @@ namespace bbtk /// (Used to set it after the Define command) void SetCurrentFileName (const std::string &name ); + //Set type of script + void SetTypeOfScript_Application(); + + + /// End the definition of a ComplexBlackBox void EndDefine (); diff --git a/kernel/src/bbtkFactory.cxx b/kernel/src/bbtkFactory.cxx index 7c55c7f..9989bfc 100644 --- a/kernel/src/bbtkFactory.cxx +++ b/kernel/src/bbtkFactory.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkFactory.cxx,v $ Language: C++ - Date: $Date: 2012/10/16 06:31:04 $ - Version: $Revision: 1.53 $ + Date: $Date: 2012/11/14 07:12:00 $ + Version: $Revision: 1.54 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -173,7 +173,7 @@ namespace bbtk iUnload = mPackageMap.find(pkgname); //EED Debuging message - std::cout << "EED Factory::LoadPackage " << std::endl; +// std::cout << "EED Factory::LoadPackage " << std::endl; // PackageMapType::iterator it; // for ( it=mPackageMap.begin() ; it != mPackageMap.end(); it++ ) // std::cout << (*it).first << " "; @@ -510,12 +510,8 @@ namespace bbtk bbtkDebugMessageInc("kernel",9,"Factory::InsertPackage(\""<< p->GetName()<<"\")"<AddFactory(GetThisPointer()); - -printf("EED Factory::InsertPackage %s\n", p->GetName().c_str() ); - + p->AddFactory(GetThisPointer()); mPackageMap[p->GetName()] = p; - bbtkDebugDecTab("kernel",9); } //=================================================================== diff --git a/kernel/src/bbtkInterpreter.cxx b/kernel/src/bbtkInterpreter.cxx index 5a3fd71..a71ded3 100644 --- a/kernel/src/bbtkInterpreter.cxx +++ b/kernel/src/bbtkInterpreter.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.cxx,v $ Language: C++ - Date: $Date: 2012/10/16 06:31:04 $ - Version: $Revision: 1.93 $ + Date: $Date: 2012/11/14 07:12:00 $ + Version: $Revision: 1.94 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -1286,6 +1286,14 @@ namespace bbtk } //======================================================================= + + void Interpreter::SetTypeOfScript_Application() + { + GetExecuter()->SetTypeOfScript_Application(); + } + + + /*EED Borrame //======================================================================= void Interpreter::SwitchToStream( std::stringstream* stream ) diff --git a/kernel/src/bbtkInterpreter.h b/kernel/src/bbtkInterpreter.h index a402908..39294ed 100644 --- a/kernel/src/bbtkInterpreter.h +++ b/kernel/src/bbtkInterpreter.h @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.h,v $ Language: C++ - Date: $Date: 2010/09/18 22:31:40 $ - Version: $Revision: 1.44 $ + Date: $Date: 2012/11/14 07:12:00 $ + Version: $Revision: 1.45 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -363,8 +363,10 @@ namespace bbtk virtual void commandMessage(); virtual void commandMessage(const std::string &kind,const std::string &levelstr); virtual void SetCurrentFileName(const std::string &fullPathScriptName); + virtual void SetTypeOfScript_Application(); + /// Constructor Interpreter(const std::string& cpp_file = ""); Interpreter(VirtualExec::Pointer); diff --git a/kernel/src/bbtkInterpreterVirtual.cxx b/kernel/src/bbtkInterpreterVirtual.cxx index 35a8746..01d37a8 100644 --- a/kernel/src/bbtkInterpreterVirtual.cxx +++ b/kernel/src/bbtkInterpreterVirtual.cxx @@ -1559,7 +1559,12 @@ printf("EED InterpreterVirtual::SwitchToFile kkkkk >> %s\n", (*j).c_str() ) //EED printf("EED D. SwitchToFile %s\n", fullPathScriptName.c_str() ); LoadScript(fullPathScriptName,name); //EED Borrame if (source) GetExecuter()->SetCurrentFileName(fullPathScriptName); - if (source) SetCurrentFileName(fullPathScriptName); + if (source) + { + // Over writing the fullpath of the bbp file. + SetCurrentFileName( fullPathScriptName ); + SetTypeOfScript_Application(); + } } return; @@ -1572,6 +1577,14 @@ printf("EED InterpreterVirtual::SwitchToFile kkkkk >> %s\n", (*j).c_str() ) } //======================================================================= + + //======================================================================= + void InterpreterVirtual::SetTypeOfScript_Application( ) + { + } + //======================================================================= + + //======================================================================= void InterpreterVirtual::SwitchToStream( std::stringstream* stream ) { diff --git a/kernel/src/bbtkInterpreterVirtual.h b/kernel/src/bbtkInterpreterVirtual.h index a471ba7..29e198c 100644 --- a/kernel/src/bbtkInterpreterVirtual.h +++ b/kernel/src/bbtkInterpreterVirtual.h @@ -182,6 +182,8 @@ namespace bbtk #endif + + /* // For 'break' commands observation typedef boost::signals::trackable BreakObserverType; @@ -323,7 +325,8 @@ namespace bbtk virtual void commandMessage(); virtual void commandMessage(const std::string &kind,const std::string &levelstr); virtual void SetCurrentFileName(const std::string &fullPathScriptName); - + virtual void SetTypeOfScript_Application(); + /// Constructor InterpreterVirtual(); diff --git a/kernel/src/bbtkPackage.cxx b/kernel/src/bbtkPackage.cxx index 66465e9..1aa5a1c 100644 --- a/kernel/src/bbtkPackage.cxx +++ b/kernel/src/bbtkPackage.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkPackage.cxx,v $ Language: C++ - Date: $Date: 2010/09/12 14:52:25 $ - Version: $Revision: 1.35 $ + Date: $Date: 2012/11/14 07:12:00 $ + Version: $Revision: 1.36 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -349,11 +349,8 @@ namespace bbtk /// to test that a dyn lib is a valid bbtk package lib /// NB : The BBTK version exported from the library /// is tested against the current bbtk version - DynamicLibraryHandler Package::OpenDynamicLibrary - ( const std::string& libname, - const std::string& package_name, - DLGetPackageFunction& getpack, - DLDeletePackageFunction& delpack) + DynamicLibraryHandler Package::OpenDynamicLibrary( const std::string& libname,const std::string& package_name, + DLGetPackageFunction& getpack, DLDeletePackageFunction& delpack) { bbtkDebugMessage("package",3,"==> Package::OpenDynamicLibrary(" <