-TO DO : Write license ...
+TO DO : Write...
\ No newline at end of file
SUBDIRS(bbs2cpp)
SUBDIRS(bbc)
+
+SUBDIRS(bbRegenerateBoxesLists)
+
+SUBDIRS(bbRegeneratePackageDoc)
\ No newline at end of file
+++ /dev/null
-# Installs bbCreateBox.bat/.sh
-# used to create a new user black box
-
-
-# Relative path to the data used by bbCreateBox from data root folder
-SET(bbCreateBox_DATA_REL_PATH_FROM_DATA kernel/bbCreateBox)
-
-# Configure / Install the template xml files used by bbCreateBox
-FILE(GLOB LST_XML_FILE_CREATE_BOX RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.xml )
-FOREACH( iLST ${LST_XML_FILE_CREATE_BOX})
- CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${iLST}
- ${BBTK_DATA_BUILD_PATH}/${bbCreateBox_DATA_REL_PATH_FROM_DATA}/${iLST}
- COPYONLY )
- INSTALL(FILE ${CMAKE_CURRENT_SOURCE_DIR}/${iLST}
- DESTINATION ${BBTK_DATA_INSTALL_PATH}/${bbCreateBox_DATA_REL_PATH_FROM_DATA}
- )
-ENDFOREACH(iLST)
-
-# Configure / Install the script bbCreateBox
-SET(bbCreatePackage_DATA_REL_PATH_FROM_BIN ../${BBTK_DATA_REL_PATH}/${bbCreateBox_DATA_REL_PATH_FROM_DATA})
-FILE(TO_NATIVE_PATH ${bbCreateBox_DATA_REL_PATH_FROM_BIN} bbCreateBox_DATA_REL_PATH_FROM_BIN)
-IF(WIN32)
- # Build tree
- CONFIGURE_FILE(
- ${CMAKE_CURRENT_SOURCE_DIR}/bbCreateBox.bat.in
- ${BBTK_BINARY_DIR}/Debug/bbCreateBox.bat
- @ONLY IMMEDIATE
- )
- CONFIGURE_FILE(
- ${CMAKE_CURRENT_SOURCE_DIR}/bbCreateBox.bat.in
- ${BBTK_BINARY_DIR}/Release/bbCreateBox.bat
- @ONLY IMMEDIATE
- )
- # install tree
- INSTALL(
- PROGRAMS ${BBTK_BINARY_DIR}/Debug/bbCreateBox.bat
- DESTINATION bin
- )
-ENDIF(WIN32)
-
-
-IF(UNIX)
- # Build tree
- CONFIGURE_FILE(
- ${CMAKE_CURRENT_SOURCE_DIR}/bbCreateBox.sh.in
- ${BBTK_BINARY_DIR}/bin/bbCreateBox
- @ONLY IMMEDIATE
- )
- # Install tree
- INSTALL(
- PROGRAMS ${BBTK_BINARY_DIR}/bin/bbCreateBox
- DESTINATION bin
- )
-ENDIF(UNIX)
-
-
-
-
+++ /dev/null
-#!/bin/bash
-# creates the file architecture for a new user package
-
-if [ $# -lt 3 ]
- then
- echo "usage : bbCreateBox <template-xml-file-name> <box-name> <package-name> [author] [description] [category]"
- exit
-fi
-
-# bbCreatePackage path
-TMP=$(which $0|rev)
-BINPATH=$(echo ${TMP#*/}|rev)
-# Input data path
-#INPUT=${BINPATH}/@bbCreateBox_DATA_REL_PATH_FROM_BIN@/$1
-INPUT=$1
-
-BBCB_BOX_NAME=$2
-BBCB_PACKAGE_NAME=$3
-BBCB_AUTHOR=$4
-BBCB_DESCRIPTION=$5
-BBCB_CATEGORY=$6
-
-echo "input = " $INPUT
-echo "box name = " $BBCB_BOX_NAME
-echo "package = " $BBCB_PACKAGE_NAME
-echo "author = " $BBCB_AUTHOR
-echo "description = " $BBCB_DESCRIPTION
-echo "category = " $BBCB_CATEGORY
-
-sed s,BBCB_BOX_NAME,"${BBCB_BOX_NAME}", < $INPUT | sed s/BBCB_AUTHOR/"${BBCB_AUTHOR}"/ | sed s{BBCB_DESCRIPTION{"${BBCB_DESCRIPTION}"{ | sed s/BBCB_CATEGORY/"${BBCB_CATEGORY}"/ > bb${BBCB_PACKAGE_NAME}${BBCB_BOX_NAME}.xml
-
-
+++ /dev/null
-#============================================================================
-# STARTS THE DESCRIPTION OF THE BLACK BOX
-<blackbox name="BBCB_BOX_NAME">
-#============================================================================
-
- #============================================================================
- # THE BOX DOCUMENTATION
- <author>BBCB_AUTHOR</author>
- <description>BBCB_DESCRIPTION</description>
- <category>BBCB_CATEGORY</category>
- #============================================================================
-
- #============================================================================
- # #include directives to be put in the .h generated
- # There must be one tag per file to include
- # Here we include the standard header iostream.h
- <include><PRE>
- iostream.h
- </PRE></include>
- #============================================================================
-
- #============================================================================
- # INPUTS/OUTPUTS DECLARATION
- # Declares an input with name 'In', type 'double' and description 'First input'
- <input name="In" type="double" description="First input"/>
- # Declares an output with name 'Out', type 'double' and description 'First output'
- <output name="Out" type="double" description="First output"/>
- #============================================================================
-
- #============================================================================
- # THE PROCESSING METHOD BODY :
- # Here simpy copies the value of the input 'In' to the output 'Out'
- # INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
- # void bbSet{Input|Output}NAME(const TYPE&)
- # const TYPE& bbGet{Input|Output}NAME() const
- # Where :
- # * NAME is the name of the input/output
- # (the one provided in the attribute 'name' of the tag <input>)
- # * TYPE is the C++ type of the input/output
- # (the one provided in the attribute 'type' of the tag <input>)
- <process>
- <PRE>
- bbSetOutputOut( bbGetInputIn() );
- std::cout << "Here I am !" << std::endl;
- </PRE>
- </process>
- #============================================================================
-
- #============================================================================
- # CONSTRUCTORS / DESTRUCTORS (OPTIONAL)
- # THE CONSTRUCTION METHOD BODY :
- # Here initializes the input 'In' to 0
- # This is also where you should allocate the output pointers
- <constructor><PRE>
- bbSetInputIn(0);
- </PRE>
- </constructor>
- # THE COPY-CONSTRUCTION METHOD BODY :
- # Here does nothing
- # But this is where you should allocate the output pointers if any
- # and copy the pointed values (to avoid bug caused by multiple references)
- <copyconstructor>
- <PRE>
-
- </PRE>
- </copyconstructor>
- # THE DESTRUCTION METHOD BODY :
- # Here does nothing
- # but this is where you should desallocate the output pointers if any
-
- <destructor>
- <PRE>
- </PRE>
- </destructor>
- #============================================================================
-
-#============================================================================
-# END OF BLACK BOX DESCRIPTION
-</blackbox>
-#============================================================================
--- /dev/null
+
+
+SET(SOURCES
+ bbRegenerateBoxesLists
+ )
+
+ADD_EXECUTABLE(bbRegenerateBoxesLists ${SOURCES})
+TARGET_LINK_LIBRARIES(bbRegenerateBoxesLists bbtk)
+INSTALL_TARGETS(/bin/ bbRegenerateBoxesLists)
--- /dev/null
+
+#include <bbtkInterpreter.h>
+#include <bbtkConfigurationFile.h>
+
+//==========================================================================
+int main(int argc, char **argv)
+{
+
+ bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
+ I->SetCommandLine(true);
+ I->SetThrow(false);
+
+
+ std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
+ doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
+ doc_path += "bbdoc";
+ doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
+
+ I->InterpretLine( "exec freeze");
+ I->InterpretLine( "include *");
+ I->GetExecuter()->GetFactory()->CreateHtmlIndex(bbtk::Factory::Initials,doc_path + "index-alpha.html");
+ I->GetExecuter()->GetFactory()->CreateHtmlIndex(bbtk::Factory::Packages,doc_path + "index-package.html");
+ I->GetExecuter()->GetFactory()->CreateHtmlIndex(bbtk::Factory::Categories,doc_path + "index-category.html");
+ I->GetExecuter()->GetFactory()->CreateHtmlIndex(bbtk::Factory::Adaptors,doc_path + "index-adaptors.html");
+
+ return 0;
+}
+//==========================================================================
+
+
--- /dev/null
+
+
+SET(SOURCES
+ bbRegeneratePackageDoc
+ )
+
+ADD_EXECUTABLE(bbRegeneratePackageDoc ${SOURCES})
+TARGET_LINK_LIBRARIES(bbRegeneratePackageDoc bbtk)
+INSTALL_TARGETS(/bin/ bbRegeneratePackageDoc)
--- /dev/null
+
+#include <bbtkWx.h>
+#include <bbtkInterpreter.h>
+#include <bbtkConfigurationFile.h>
+#include <bbtkUtilities.h>
+
+//==========================================================================
+void RegenerateDoc ( bbtk::Package::Pointer p, std::string& doc_path )
+{
+ std::string pack_name(p->GetName());
+ std::string pack_path = doc_path + pack_name;
+ // Creating directory
+ if ( ! bbtk::Utilities::FileExists(pack_path) )
+ {
+ std::string command("mkdir \"" +pack_path+ "\"");
+ system( command.c_str() );
+ }
+ std::string pack_index(pack_path);
+ pack_index += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
+ pack_index += "index.html";
+
+ std::cout << "* Generating doc for '"<<pack_name<<"' in "
+ << pack_index << std::endl;
+
+ p->SetDocURL(pack_index);
+ p->SetDocRelativeURL("index.html");
+ p->CreateHtmlPage(pack_index,"bbtk",pack_name,"","",0,0,true);
+}
+
+//==========================================================================
+int main(int argc, char **argv)
+{
+ std::string pack("*");
+ if (argc==1)
+ {
+ /*
+ // TO DO : make a Wx app
+ wxString name = wxGetTextFromUser(_T("Enter package name (* for all)"),
+ _T("Regenerate package doc"),
+ _T(""));
+ if (name.IsEmpty()) return 0;
+ pack = bbtk::wx2std(name);
+ */
+ }
+ else if (argc==2)
+ {
+ pack = std::string(argv[1]);
+ }
+ else
+ {
+ std::cout << "usage : bbRegeneratePackageDoc [package-name]" << std::endl;
+ return 0;
+ }
+
+ try
+ {
+ std::string doc_path = bbtk::ConfigurationFile::GetInstance().Get_doc_path();
+ doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
+ doc_path += "bbdoc";
+ doc_path += bbtk::ConfigurationFile::GetInstance().Get_file_separator();
+
+ bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
+ I->SetCommandLine(true);
+ I->SetThrow(false);
+ I->InterpretLine( "exec freeze");
+ I->InterpretLine( "include "+pack);
+ if (pack != "*")
+ {
+ I->InterpretLine( "include "+pack+"-appli");
+ RegenerateDoc(I->GetExecuter()->GetFactory()->GetPackage(pack),doc_path);
+ }
+ else
+ {
+ bbtk::Factory::PackageMapType::const_iterator i;
+ for (i = I->GetExecuter()->GetFactory()->GetPackageMap().begin();
+ i != I->GetExecuter()->GetFactory()->GetPackageMap().end();
+ ++i)
+ {
+ RegenerateDoc(i->second,doc_path);
+ }
+ }
+ }
+ catch (bbtk::Exception e)
+ {
+ std::cout << "* ERROR : "<<e.GetErrorMessage()<<std::endl;
+ return 1;
+ }
+ return 0;
+}
+//==========================================================================
+
+
cd ${EXECUTABLE_OUTPUT_PATH} && export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} && ${BBTK_BBI} -N -q ${OUTPUT_FILE} ${BBTK_MAKE_INDEX}
DEPENDS bb${PACKAGE_NAME}
)
+
+
ENDIF(WIN32)
ADD_CUSTOM_TARGET(bbdoc_${PACKAGE_NAME} ALL
DEPENDS ${DOC_OUTPUT}
DESTINATION ${BBTK_BBDOC_INSTALL_PATH}
)
- # runs bbtk-make-index as a post install step
- IF(NOT BBTK_CORE_PACKAGE)
- INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${BBTK_BIN_PATH}/bbtk-make-index)")
- ENDIF(NOT BBTK_CORE_PACKAGE)
-
+ IF(NOT WIN32)
+ # runs bbtk-make-index as a post install step
+ # does not work on windaube
+ IF(NOT BBTK_CORE_PACKAGE)
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${BBTK_BIN_PATH}/bbtk-make-index)")
+ ENDIF(NOT BBTK_CORE_PACKAGE)
+ ENDIF(NOT WIN32)
ENDMACRO(BBTK_CREATE_PACKAGE_BBDOC NAME)
MACRO(BBTK_CREATE_PACKAGE_INCLUDE_SCRIPT BBTK_PACKAGE_NAME BBTK_PACKAGE_BBS_BOXES BBTK_PACKAGE_BBS_APPLI )
- # Creates the file ${BBTK_PACKAGE_NAME}.bbs
- SET(OUTPUT_FILE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}.bbs)
+ # Creates the file ${BBTK_PACKAGE_NAME}.bbp
+ SET(OUTPUT_FILE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}.bbp)
FILE(WRITE
"${OUTPUT_FILE}"
"#-----------------------------------------\n"
DESTINATION ${BBTK_BBS_INSTALL_PATH}
)
- # Creates the file ${BBTK_PACKAGE_NAME}-appli.bbs
- SET(OUTPUT_FILE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}-appli.bbs)
+ # Creates the file ${BBTK_PACKAGE_NAME}-appli.bbp
+ SET(OUTPUT_FILE ${BBTK_BBS_BUILD_PATH}/${BBTK_PACKAGE_NAME}-appli.bbp)
FILE(WRITE
"${OUTPUT_FILE}"
"#-----------------------------------------\n"
DESTINATION ${BBTK_BBS_INSTALL_PATH}
)
-# ADD_CUSTOM_TARGET(${BBTK_PACKAGE_NAME}.bbs ALL
+# ADD_CUSTOM_TARGET(${BBTK_PACKAGE_NAME}.bbp ALL
# DEPENDS ${OUTPUT_FILE}
# )
#========================================================================
MACRO(MAKE_DLL_PATH)
IF(WIN32)
- IF(NOT DLL_PATH)
IF(USE_DOT)
- FIND_PATH(DOT_DIR dot.exe PATHS $ENV{PATH} )
- IF(NOT DOT_DIR)
- MESSAGE(FATAL_ERROR "Dot not found : set DOT_DIR to the folder containing dot.exe")
- ELSE(NOT DOT_DIR)
- MESSAGE(STATUS "Looking for dot... - found in ${DOT_DIR}")
+ IF (NOT DOT_DIR)
+ FIND_PATH(DOT_DIR dot.exe PATHS $ENV{PATH} )
+ IF(NOT DOT_DIR)
+ MESSAGE(FATAL_ERROR "Dot not found : set DOT_DIR to the folder containing dot.exe")
+ ELSE(NOT DOT_DIR)
+ MESSAGE(STATUS "Looking for dot... - found in ${DOT_DIR}")
+ ENDIF(NOT DOT_DIR)
ENDIF(NOT DOT_DIR)
ENDIF(USE_DOT)
- SET(DLL_PATH0 Path=${ADDITIONAL_DLL_PATH}__RR__%WXWIN%/lib/vc_dll/__RR__%VTK_DIR%__RR__%ITK_DIR%/../../bin/__RR__%PATH%__RR__${DOT_DIR})
- STRING(REPLACE "__RR__" "\;" DLL_PATH ${DLL_PATH0} )
- ENDIF(NOT DLL_PATH)
+# SET(DLL_PATHA Path=${ADDITIONAL_DLL_PATH}__RR__%WXWIN%/lib/vc_dll/__RR__%VTK_DIR%__RR__%ITK_DIR%/../../bin/__RR__%PATH%__RR__${DOT_DIR})
+ SET(DLL_PATHA Path=${ADDITIONAL_DLL_PATH}__RR__)
+ FOREACH(APATH $ENV{PATH})
+ SET(DLL_PATHA ${DLL_PATHA}__RR__${APATH})
+ ENDFOREACH(APATH)
+ STRING(REPLACE "__RR__" "\;" DLL_PATH ${DLL_PATHA} )
ENDIF(WIN32)
ENDMACRO(MAKE_DLL_PATH)
#========================================================================
SET(CPACK_PACKAGE_VERSION_MAJOR ${BBTK_MAJOR_VERSION})
SET(CPACK_PACKAGE_VERSION_MINOR ${BBTK_MINOR_VERSION})
SET(CPACK_PACKAGE_VERSION_PATCH ${BBTK_BUILD_VERSION})
-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "bbtk ${BBTK_MAJOR_VERSION}.${BBTK_MINOR_VERSION}.${BBTK_BUILD_VERSION}")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CreaTools\\\\bbtk-${BBTK_MAJOR_VERSION}.${BBTK_MINOR_VERSION}.${BBTK_BUILD_VERSION}")
IF(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
Program: bbtk
Module: $RCSfile: bbtkExecuter.cxx,v $ $
Language: C++
- Date: $Date: 2008/07/01 07:58:28 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2008/10/08 10:56:27 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// No output provided : automatic generation
if (output_html.length() == 0)
{
- // Don't pollute the file store with "temp_dir" directories ...
- std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
+ // Don't pollute the file store with "temp_dir" directories ...
+ std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
- char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
+ char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
- std::string directory = default_doc_dir;
- if (c != '/' && c !='\\') directory = directory + "/";
- directory = directory + "temp_dir";
+ std::string directory = default_doc_dir;
+ if (c != '/' && c !='\\') directory = directory + "/";
+ directory = directory + "temp_dir";
- filename_rootHtml = directory + "/" + "User.html";
- simplefilename_rootHtml = "User.html" ;
+ filename_rootHtml = directory + "/" + "User.html";
+ simplefilename_rootHtml = "User.html" ;
- // Creating directory
- std::string command0("mkdir \"" +directory + "\"");
- system( command0.c_str() );
+ // Creating directory
+ std::string command0("mkdir \"" +directory + "\"");
+ system( command0.c_str() );
- relative_link = false;
+ relative_link = false;
}
Package::Pointer p;
Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $ $
Language: C++
- Date: $Date: 2008/10/06 09:11:21 $
- Version: $Revision: 1.73 $
+ Date: $Date: 2008/10/08 10:56:27 $
+ Version: $Revision: 1.74 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
CATCH_MACRO;
- }//while
+ }//while !eof
CloseCurrentFile();
- }
- }
+ }//while >0
+ } // try
CATCH_MACRO;
CloseAllFiles();
// ==== "*" provided : load all scripts in given path
// relative (e.g. std/boxes/*) or absolute
if (pkgname == "*")
- {
- int nbBssFiles;
+ {
+ int nbBssFiles;
- std::stringstream* stream = new std::stringstream;
- //if (upath.size()!=0) // avoid troubles for "*"
+ std::stringstream* stream = new std::stringstream;
+ //if (upath.size()!=0) // avoid troubles for "*"
- // ==== no path provided : look in root bbs path
- if (upath.size()==0)
- {
- // bbtkMessage("Interpreter",1,
- script_paths.push_back( ConfigurationFile::GetInstance().Get_root_bbs_path() );
- }
- // ==== absolute path provided
- else if (upath[0]=='/' || upath[1] == ':' )
- {
- if ( Utilities::IsDirectory( upath ) )
- {
- script_paths.push_back(upath);
- }
- else
- {
- bbtkError("'"<<upath<<"' : directory does not exist");
- }
- }
- // ==== relative path provided : search all bbs path appended with
- // the relative path provided
- else
- {
- std::vector<std::string>::const_iterator i;
- for (i=ConfigurationFile::GetInstance().Get_bbs_paths().begin();
- i!=ConfigurationFile::GetInstance().Get_bbs_paths().end();
- i++)
- {
- std::string full_path(*i);
- // we *really* want '.' to be the current working directory
- if (full_path == ".") {
- char buf[2048]; // for getcwd
- char * currentDir = getcwd(buf, 2048);
- std::string cwd(currentDir);
- full_path = currentDir;
- } // if full_path
-
- full_path += ConfigurationFile::GetInstance().Get_file_separator();
- full_path += upath;
-
- if ( Utilities::IsDirectory( full_path ) )
- {
- script_paths.push_back(full_path);
- }
- }
- if (script_paths.empty())
- {
- bbtkError("no '"<<upath<<"' subdir found in search paths"
- << std::endl);
- }
+ // ==== no path provided : look in root bbs path
+ if (upath.size()==0)
+ {
+ // bbtkMessage("Interpreter",1,
+ // LG : add all bbs path
+ // script_paths.push_back( ConfigurationFile::GetInstance().Get_root_bbs_path() );
+ std::vector<std::string>::const_iterator i;
+ for (i=ConfigurationFile::GetInstance().Get_bbs_paths().begin();
+ i!=ConfigurationFile::GetInstance().Get_bbs_paths().end();
+ i++)
+ {
+ script_paths.push_back(*i);
+ }
+ }
+ // ==== absolute path provided
+ else if (upath[0]=='/' || upath[1] == ':' )
+ {
+ if ( Utilities::IsDirectory( upath ) )
+ {
+ script_paths.push_back(upath);
+ }
+ else
+ {
+ bbtkError("'"<<upath<<"' : directory does not exist");
+ }
+ }
+ // ==== relative path provided : search all bbs path appended with
+ // the relative path provided
+ else
+ {
+ std::vector<std::string>::const_iterator i;
+ for (i=ConfigurationFile::GetInstance().Get_bbs_paths().begin();
+ i!=ConfigurationFile::GetInstance().Get_bbs_paths().end();
+ i++)
+ {
+ std::string full_path(*i);
+ // we *really* want '.' to be the current working directory
+ if (full_path == ".")
+ {
+ char buf[2048]; // for getcwd
+ char * currentDir = getcwd(buf, 2048);
+ std::string cwd(currentDir);
+ full_path = currentDir;
+ } // if full_path
+
+ full_path += ConfigurationFile::GetInstance().Get_file_separator();
+ full_path += upath;
- }
- // === search paths list complete : now explore it
+ if ( Utilities::IsDirectory( full_path ) )
+ {
+ script_paths.push_back(full_path);
+ }
+ }
+ if (script_paths.empty())
+ {
+ bbtkError("no '"<<upath<<"' subdir found in search paths"
+ << std::endl);
+ }
+ }
- std::vector<std::string>::iterator i;
- for (i=script_paths.begin();i!=script_paths.end();i++)// ==== relative name, iterate + load all .bbs files
- {
- bbtkMessage("Interpreter",1,
+ // === search paths list complete : now explore it
+
+ // ==== relative name, iterate + load all .bbs/.bbp files
+ std::vector<std::string>::iterator i;
+ for (i=script_paths.begin();i!=script_paths.end();i++)
+ {
+ bbtkMessage("Interpreter",1,
"--> Looking in '" << *i << "'" << std::endl);
-
+
+ Filenames.clear();
+ //int nbFiles =
+ Utilities::Explore(*i, false, Filenames);
- Filenames.clear();
- //int nbFiles =
- Utilities::Explore(*i, false, Filenames);
-
- nbBssFiles = 0;
- for (std::vector<std::string>::iterator j = Filenames.begin();
- j!= Filenames.end(); ++j)
- {
- int lgr = (*j).size();
- if (lgr < 5)
- continue; // ignore non .bbs file
- if ((*j).substr(lgr-4, 4) != ".bbs")
- continue;
+ nbBssFiles = 0;
+ for (std::vector<std::string>::iterator j = Filenames.begin();
+ j!= Filenames.end(); ++j)
+ {
+ int lgr = (*j).size();
+ if (lgr < 5) continue;
+ // ignore non .bbp file
+ if ( (*j).substr(lgr-4, 4) != ".bbp") continue;
+
+ (*stream) << "include \"" << *j << "\"\n";
+ bbtkMessage("Interpreter",2," --> Found '" << *j << "'" << std::endl);
- (*stream) << "include \"" << *j << "\"\n";
- bbtkMessage("Interpreter",2,
- " --> Found '" << *j << "'" << std::endl);
-
- nbBssFiles++;
- } // for vector
-
- if (nbBssFiles==0)
- {
- bbtkMessage("Interpreter",1,
- " --> No .bbs found"<< std::endl);
- }
- else
- {
- bbtkMessage("Interpreter",1,
- " --> "<<nbBssFiles<<" .bbs found"<< std::endl);
- SwitchToStream(stream);
- }
-
- //break; // a directory was found; we stop iterating
- // LG : No! We want all files included !
- } // for vector
- return;
- }
+ nbBssFiles++;
+ } // for (std::vector...
+ } // for (i=script_...
+ if (nbBssFiles==0)
+ {
+ bbtkMessage("Interpreter",1,
+ " --> No .bbp found"<< std::endl);
+ }
+ else
+ {
+ bbtkMessage("Interpreter",1,
+ " --> "<<nbBssFiles<<" .bbp found"<< std::endl);
+ SwitchToStream(stream);
+ }
+ return;
+ }
//=============== end pkgname=="*" ===========
// allow user to always forget ".bbs"
int l = fullPathScriptName.size();
- if (l!=0) {
-
- if (l>4)
- {
- if (fullPathScriptName.substr(l-4, 4) != ".bbs")
+ if (l!=0)
+ {
+ if ((fullPathScriptName.substr(l-4, 4) != ".bbs")&&
+ (fullPathScriptName.substr(l-4, 4) != ".bbp"))
{
- fullPathScriptName = fullPathScriptName + ".bbs";
- }
- }
- else
- {
- fullPathScriptName = fullPathScriptName + ".bbs";
- }
-
- if ( Utilities::FileExists(fullPathScriptName))
- {
- foundFile = true;
- }
- } // endif l != 0
+ std::string tfullPathScriptName = fullPathScriptName + ".bbs";
+ if ( Utilities::FileExists(tfullPathScriptName) )
+ {
+ fullPathScriptName = tfullPathScriptName;
+ foundFile = true;
+ }
+ else
+ {
+ tfullPathScriptName = fullPathScriptName + ".bbp";
+ if ( Utilities::FileExists(tfullPathScriptName) )
+ {
+ fullPathScriptName = tfullPathScriptName;
+ foundFile = true;
+ }
+ }
+ }
+ else
+ {
+ if ( Utilities::FileExists(fullPathScriptName) )
+ {
+ foundFile = true;
+ }
+ }
+ } // endif l != 0
}
else
- // =============================== iterate on the paths
- {
+ // =============================== iterate on the paths
+ {
script_paths = ConfigurationFile::GetInstance().Get_bbs_paths();
std::string path;
std::vector<std::string>::iterator i;
for (i=script_paths.begin();i!=script_paths.end();++i)
- {
- path = *i;
- // we *really* want '.' to be the current working directory
- if (path == ".") {
- char buf[2048]; // for getcwd
- char * currentDir = getcwd(buf, 2048);
- std::string cwd(currentDir);
- path = currentDir;
- }
-
- fullPathScriptName = Utilities::MakePkgnameFromPath(path, name, true);
+ {
+ path = *i;
+ // we *really* want '.' to be the current working directory
+ if (path == ".")
+ {
+ char buf[2048]; // for getcwd
+ char * currentDir = getcwd(buf, 2048);
+ std::string cwd(currentDir);
+ path = currentDir;
+ }
- // Check if library exists
- if ( ! Utilities::FileExists(fullPathScriptName) )
- {
- // The following is *NOT* a debug time message :
- // It's a user intended message.
- // Please don't remove it.
- bbtkMessage("Interpreter",2,
- " [" <<fullPathScriptName <<"] : doesn't exist"
+ std::string tfullPathScriptName = Utilities::MakePkgnameFromPath(path, name, false);
+ if (tfullPathScriptName.substr(tfullPathScriptName.size()-4, 3)==".bb")
+ {
+ fullPathScriptName = tfullPathScriptName;
+ if ( ! Utilities::FileExists(fullPathScriptName) )
+ {
+ // The following is *NOT* a debug time message :
+ // It's a user intended message.
+ // Please don't remove it.
+ bbtkMessage("Interpreter",2,
+ " [" <<fullPathScriptName <<"] : does not exist"
<<std::endl);
- continue; // try next path
- }
- bbtkMessage("Interpreter",2,
+ continue; // try next path
+ }
+ bbtkMessage("Interpreter",2,
+ " [" <<fullPathScriptName
+ <<"] : found" <<std::endl);
+ foundFile = true;
+ break; // a script was found; we stop iterating
+ }
+ else
+ {
+ fullPathScriptName = tfullPathScriptName + ".bbs";
+ // Check if library exists
+ if ( ! Utilities::FileExists(fullPathScriptName) )
+ {
+ fullPathScriptName = tfullPathScriptName + ".bbp";
+ if ( ! Utilities::FileExists(fullPathScriptName) )
+ {
+ // The following is *NOT* a debug time message :
+ // It's a user intended message.
+ // Please don't remove it.
+ bbtkMessage("Interpreter",2,
+ " [" <<tfullPathScriptName <<".bbs/.bbp] : do not exist"
+ <<std::endl);
+ continue; // try next path
+ }
+ }
+ bbtkMessage("Interpreter",2,
" [" <<fullPathScriptName
<<"] : found" <<std::endl);
- foundFile = true;
- break; // a script was found; we stop iterating
-
+ foundFile = true;
+ break; // a script was found; we stop iterating
+ }
} //------------------ // end for ( package_paths.begin();i!=package_paths.end() )
- }
-
+ }
+
if (!foundFile)
{
if (fullnameGiven)
else
bbtkError("Script ["<<fullPathScriptName<<"] not found");
else
- bbtkError("No ["<<pkgname<<".bbs] script found");
+ bbtkError("No ["<<pkgname<<".bbs/.bbp] script found");
return;
}
else
Program: bbtk
Module: $RCSfile: bbtkWxGUIScriptingInterface.cxx,v $
Language: C++
- Date: $Date: 2008/10/06 10:30:10 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2008/10/08 10:56:27 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
ID_Menu_CreatePackage,
ID_Menu_CreateBlackBox,
ID_Menu_ShowImageGraph,
- ID_Menu_CreateIndex,
+ ID_Menu_RegeneratePackageDoc,
+ ID_Menu_RegenerateBoxesLists,
+ ID_Menu_RegenerateAll,
ID_Menu_Windows_Files,
ID_Menu_Windows_Help,
ID_Menu_Windows_Messages,
menuTools->Append( ID_Menu_CreatePackage, _T("Create &package") );
menuTools->Append( ID_Menu_CreateBlackBox, _T("Create &black box") );
menuTools->Append( ID_Menu_ShowImageGraph, _T("&Show last image graph") );
- menuTools->Append( ID_Menu_CreateIndex, _T("&Generate index") );
+ menuTools->AppendSeparator();
+ menuTools->Append( ID_Menu_RegeneratePackageDoc,_T("&Regenerate package doc") );
+ menuTools->Append( ID_Menu_RegenerateBoxesLists,_T("&Regenerate boxes lists") );
+ menuTools->Append( ID_Menu_RegenerateAll,_T("&Regenerate all") );
+
wxMenu *menuWindows = new wxMenu;
menuWindows->AppendCheckItem(ID_Menu_Windows_Files,
}
//================================================================
+ //================================================================
+ void WxGUIScriptingInterface::OnMenuRegeneratePackageDoc(wxCommandEvent& WXUNUSED(event))
+ {
+ wxString name = wxGetTextFromUser(_T("Enter package name (* for all)"),
+ _T("Regenerate package doc"),
+ _T(""));
+ if (name.IsEmpty()) return;
+ std::string pack = bbtk::wx2std(name);
+
+ std::string command("cd \"");
+ command += ConfigurationFile::GetInstance().Get_bin_path();
+ command += "\" && bbRegeneratePackageDoc " + pack;
+ bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
+
+ if ( ! system ( command.c_str() ) )
+ {
+ wxMessageBox(_T("Done !"),_T("Regenerate package '")+name+_T("' doc"),
+ wxOK | wxICON_INFORMATION);
+ }
+ else
+ {
+ wxString err("An error occured while running '");
+ err += bbtk::std2wx(command) + _T("'");
+ wxMessageBox(err,_T("Regenerate package doc"),wxOK | wxICON_ERROR);
+ }
+ }
+ //================================================================
//================================================================
- void WxGUIScriptingInterface::OnMenuCreateIndex(wxCommandEvent& WXUNUSED(event))
+ void WxGUIScriptingInterface::OnMenuRegenerateBoxesLists(wxCommandEvent& WXUNUSED(event))
{
- /*
- std::string doc_path = ConfigurationFile::GetInstance().Get_doc_path();
- std::string filepath = doc_path+"/bbdoc/make-index.bbs";
+ std::string command("cd \"");
+ command += ConfigurationFile::GetInstance().Get_bin_path();
+ command += "\" && bbRegenerateBoxesLists";
+ bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
- Interpreter::Pointer I = Interpreter::New();
+ if ( ! system ( command.c_str() ) )
+ {
+ wxMessageBox(_T("Done !"),_T("Regenerate boxes lists"),
+ wxOK | wxICON_INFORMATION);
+ }
+ else
+ {
+ wxString err("An error occured while running '");
+ err += bbtk::std2wx(command) + _T("'");
+ wxMessageBox(err,_T("Regenerate boxes lists"),wxOK | wxICON_ERROR);
+ }
+ }
+ //================================================================
- I->InterpretLine( "config");
- I->InterpretLine( "message echo 2");
- I->InterpretLine( "exec freeze");
- I->InterpretLine( "include *");
- I->InterpretLine( "help packages");
- I->InterpretLine( "index "+doc_path+"/bbdoc/index-alpha.html Initials");
- I->InterpretLine( "index "+doc_path+"/bbdoc/index-package.html Packages");
- I->InterpretLine( "index "+doc_path+"/bbdoc/index-category.html Categories");
- I->InterpretLine( "index "+doc_path+"/bbdoc/index-adaptors.html Adaptors");
- */
+ //================================================================
+ void WxGUIScriptingInterface::OnMenuRegenerateAll(wxCommandEvent& WXUNUSED(event))
+ {
std::string command("cd \"");
- command += ConfigurationFile::GetInstance().Get_doc_path();
- command += ConfigurationFile::GetInstance().Get_file_separator() + "bbdoc\" && \"";
command += ConfigurationFile::GetInstance().Get_bin_path();
- command += ConfigurationFile::GetInstance().Get_file_separator() + "bbi\" -N -q .";
- command += ConfigurationFile::GetInstance().Get_file_separator() + "make-index.bbs";
+ command += "\" && bbRegeneratePackageDoc * && bbRegenerateBoxesLists";
bbtkMessage("debug",1,"Executing system command '"<<command<<"'"<<std::endl);
- system(command.c_str());
+
+ if ( ! system ( command.c_str() ) )
+ {
+ wxMessageBox(_T("Done !"),_T("Regenerate all"),
+ wxOK | wxICON_INFORMATION);
+ }
+ else
+ {
+ wxString err("An error occured while running '");
+ err += bbtk::std2wx(command) + _T("'");
+ wxMessageBox(err,_T("Regenerate all"),wxOK | wxICON_ERROR);
+ }
}
//================================================================
+
//================================================================
void WxGUIScriptingInterface::InterpreterUserViewHtmlPage(const std::string& page)
EVT_MENU(ID_Menu_CreatePackage, WxGUIScriptingInterface::OnMenuCreatePackage)
EVT_MENU(ID_Menu_CreateBlackBox, WxGUIScriptingInterface::OnMenuCreateBlackBox)
EVT_MENU(ID_Menu_ShowImageGraph, WxGUIScriptingInterface::OnMenuShowImageGraph)
- EVT_MENU(ID_Menu_CreateIndex, WxGUIScriptingInterface::OnMenuCreateIndex)
+ EVT_MENU(ID_Menu_RegeneratePackageDoc, WxGUIScriptingInterface::OnMenuRegeneratePackageDoc)
+ EVT_MENU(ID_Menu_RegenerateBoxesLists, WxGUIScriptingInterface::OnMenuRegenerateBoxesLists)
+ EVT_MENU(ID_Menu_RegenerateAll, WxGUIScriptingInterface::OnMenuRegenerateAll)
EVT_MENU(ID_Menu_Windows_Files, WxGUIScriptingInterface::OnMenuWindowsFiles)
EVT_MENU(ID_Menu_Windows_Help, WxGUIScriptingInterface::OnMenuWindowsHelp)
EVT_MENU(ID_Menu_Windows_Messages, WxGUIScriptingInterface::OnMenuWindowsMessages)
Program: bbtk
Module: $RCSfile: bbtkWxGUIScriptingInterface.h,v $
Language: C++
- Date: $Date: 2008/09/10 09:25:19 $
- Version: $Revision: 1.10 $
+ Date: $Date: 2008/10/08 10:56:27 $
+ Version: $Revision: 1.11 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
void OnMenuCreatePackage(wxCommandEvent& WXUNUSED(event));
void OnMenuCreateBlackBox(wxCommandEvent& WXUNUSED(event));
void OnMenuShowImageGraph(wxCommandEvent& WXUNUSED(event));
- void OnMenuCreateIndex(wxCommandEvent& WXUNUSED(event));
+ void OnMenuRegeneratePackageDoc(wxCommandEvent& WXUNUSED(event));
+ void OnMenuRegenerateBoxesLists(wxCommandEvent& WXUNUSED(event));
+ void OnMenuRegenerateAll(wxCommandEvent& WXUNUSED(event));
void OnMenuWindowsFiles(wxCommandEvent& event);
void OnMenuWindowsHelp(wxCommandEvent& event);
void OnMenuWindowsPackageBrowser(wxCommandEvent& event);
load wx
load wxvtk
-define DoubleSlicer
+define DoubleSlicer wxvtk
description "Simple viewer displaying the same slice of two images. The slice is controlled by a slider. See <a href='#ExampleDoubleSlicer'>ExampleDoubleSlicer.bbs</a>."
author "laurent.guigues at creatis.insa-lyon.fr"
load vtk
load std
-define IsoSurfaceWithControls
+define IsoSurfaceWithControls wxvtk
author "laurent.guigues@creatis.insa-lyon.fr"
description "Image iso-surface extractor (vtk::IsoSurfaceExtractor) with associated control panel (isovalue, opacity and colour)"
category "image;mesh;widget;viewer"
load vtk
load std
-define MIPWithControls
+define MIPWithControls wxvtk
author "laurent.guigues@creatis.insa-lyon.fr"
description "Maximum Intensity Projection (MIP) creator (vtk::MIPCreator) with associated control panel (shift and scale)"
category "image;mesh;widget;viewer"
include wxvtk/boxes/bbIsoSurfaceWithControls
-define SimpleIsoSurfaceViewer
+define SimpleIsoSurfaceViewer wxvtk
description "Simple viewer of an iso-surface of an image"
author "laurent.guigues@creatis.insa-lyon.fr"