INSTALL( FILES ${WXWIDGETS_ROOT_DIR}/lib/vc_dll/wxbase28d_vc_custom.dll DESTINATION bin/ )
INSTALL( FILES ${WXWIDGETS_ROOT_DIR}/lib/vc_dll/wxbase28d_odbc_vc_custom.dll DESTINATION bin/ )
INSTALL( FILES ${WXWIDGETS_ROOT_DIR}/lib/vc_dll/wxbase28d_net_vc_custom.dll DESTINATION bin/ )
-ENDIF(WIN32)
+
)
ENDFOREACH(iLST)
+ENDIF(WIN32)
INSTALL(
DIRECTORY ${BBTK_BINARY_DIR}/${BBTK_DOC_REL_PATH}
Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $ $
Language: C++
- Date: $Date: 2008/03/18 12:51:26 $
- Version: $Revision: 1.46 $
+ Date: $Date: 2008/03/19 14:58:13 $
+ Version: $Revision: 1.47 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
*
*/
- void Interpreter::InterpretFile( const std::string& filename )
+ Interpreter::ExitStatus Interpreter::InterpretFile( const std::string& filename )
{
bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
- // std::cout << "==========================================Entree InterpretFile ["<<filename<<"] try SwitchToFile "<<std::endl;
+
bool exm = mCommandLine;
mCommandLine = false;
+ ExitStatus status = OK;
+
try
{
SwitchToFile(filename);
-
-/*
- for( std::vector<std::string>::iterator it =mFileName.begin(); it!=mFileName.end(); ++it)
- {
- std::cout << "A=== [" << (*it) << "]" << std::endl;
- }
-*/
bool insideComment = false; // for multiline comment
while (mFile.size()>0)
{
-/*
- for( std::vector<std::string>::iterator it =mFileName.begin(); it!=mFileName.end(); ++it)
- {
- std::cout << "B=== [" << (*it) << "]" << std::endl;
- }
-*/
-
- //while ((mFile.size()>0) && !mFile.back()->eof() )
- //{
-// std::cout << "mFile.size() "<< mFile.size() << " mFileName.back() [" << mFileName.back() << "]" << std::endl;
- while (!mFile.back()->eof()) {
- mLine.back()++;
- char buf[500];
- mFile.back()->getline(buf,500);
- std::string str(buf);
-// std::cout << " in InterpretFile mFile.back()->getline [" << str << "]" << std::endl;
- int size=str.length();
- if ( str[ size-1 ]==13 )
+ while (!mFile.back()->eof()) {
+ mLine.back()++;
+ char buf[500];
+ mFile.back()->getline(buf,500);
+ std::string str(buf);
+ int size=str.length();
+ if ( str[ size-1 ]==13 )
{
- str.erase(size-1,1);
+ str.erase(size-1,1);
}
-
- InterpretLine(str, insideComment);
-
+
+ InterpretLine(str, insideComment);
+
}//while
- //if (mFile.size()>0)
CloseCurrentFile();
}
}
catch (QuitException e)
{
+ status = QUIT;
}
catch (bbtk::Exception e)
{
std::cerr << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
std::cerr << "* LINE : "<<mLine.back()<<std::endl;
}
+ status = ERROR;
}
catch (std::exception& e)
{
if (mFileName.size()) {
std::cerr << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
std::cerr << "* LINE : "<<mLine.back()<<std::endl;
- }
+ }
+ status = ERROR;
}
catch (...)
{
- std::cout << "* UNDEFINED ERROR (not a bbtk nor a std exception)"<<std::endl;
+ std::cerr << "* UNDEFINED ERROR (not a bbtk nor a std exception)"<<std::endl;
if (mFileName.size()) {
- std::cout << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
- std::cout << "* LINE : "<<mLine.back()<<std::endl;
+ std::cerr << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
+ std::cerr << "* LINE : "<<mLine.back()<<std::endl;
}
+ status = ERROR;
}
CloseAllFiles();
bbtkDecTab("Interpreter",9);
mCommandLine = exm;
+
+ return status;
}
//=======================================================================
/**
*
*/
- void Interpreter::InterpretBuffer( std::stringstream* buffer )
+ Interpreter::ExitStatus
+ Interpreter::InterpretBuffer( std::stringstream* buffer )
{
bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretBuffer()"<<std::endl);
- // std::cout << "==========================================Entree InterpretFile ["<<filename<<"] try SwitchToFile "<<std::endl;
+
bool exm = mCommandLine;
mCommandLine = false;
+ ExitStatus status = OK;
+
try
{
SwitchToStream(buffer);
-
-/*
- for( std::vector<std::string>::iterator it =mFileName.begin(); it!=mFileName.end(); ++it)
- {
- std::cout << "A=== [" << (*it) << "]" << std::endl;
- }
-*/
bool insideComment = false; // for multiline comment
while (mFile.size()>0)
{
-/*
- for( std::vector<std::string>::iterator it =mFileName.begin(); it!=mFileName.end(); ++it)
- {
- std::cout << "B=== [" << (*it) << "]" << std::endl;
- }
-*/
-
- //while ((mFile.size()>0) && !mFile.back()->eof() )
- //{
-// std::cout << "mFile.size() "<< mFile.size() << " mFileName.back() [" << mFileName.back() << "]" << std::endl;
- while (!mFile.back()->eof()) {
- mLine.back()++;
- char buf[500];
- mFile.back()->getline(buf,500);
- std::string str(buf);
-// std::cout << " in InterpretFile mFile.back()->getline [" << str << "]" << std::endl;
- int size=str.length();
- if ( str[ size-1 ]==13 )
+ while (!mFile.back()->eof()) {
+ mLine.back()++;
+ char buf[500];
+ mFile.back()->getline(buf,500);
+ std::string str(buf);
+
+ int size=str.length();
+ if ( str[ size-1 ]==13 )
{
- str.erase(size-1,1);
+ str.erase(size-1,1);
}
-
- InterpretLine(str, insideComment);
-
- }//while
- //if (mFile.size()>0)
- CloseCurrentFile();
+
+ InterpretLine(str, insideComment);
+
+ }//while
+
+ CloseCurrentFile();
}
}
catch (QuitException e)
- {
- // std::cout << "**QuitException caught**"<<std::endl;
- }
+ {
+ status = QUIT;
+ }
catch (bbtk::Exception e)
- {
- std::cerr << "* ERROR : "<<e.GetMessage()<<std::endl;
- if (mFileName.size()) {
- std::cerr << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
- std::cerr << "* LINE : "<<mLine.back()<<std::endl;
- }
- }
+ {
+ std::cerr << "* ERROR : "<<e.GetMessage()<<std::endl;
+ if (mFileName.size())
+ {
+ std::cerr << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
+ std::cerr << "* LINE : "<<mLine.back()<<std::endl;
+ }
+ status = ERROR;
+ }
catch (std::exception& e)
- {
- std::cerr << "* ERROR : "<<e.what()<<" (not in bbtk)"<<std::endl;
- if (mFileName.size()) {
- std::cerr << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
- std::cerr << "* LINE : "<<mLine.back()<<std::endl;
- }
+ {
+ std::cerr << "* ERROR : "<<e.what()<<" (not in bbtk)"<<std::endl;
+ if (mFileName.size())
+ {
+ std::cerr << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
+ std::cerr << "* LINE : "<<mLine.back()<<std::endl;
+ }
+ status = ERROR;
}
catch (...)
- {
- std::cout << "* UNDEFINED ERROR (not a bbtk nor a std exception)"<<std::endl;
- if (mFileName.size()) {
- std::cout << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
- std::cout << "* LINE : "<<mLine.back()<<std::endl;
- }
- }
-
+ {
+ std::cerr
+ << "* UNDEFINED ERROR (not a bbtk nor a std exception)"<<std::endl;
+ if (mFileName.size())
+ {
+ std::cerr << "* FILE : \""<<mFileName.back()<<"\""<<std::endl;
+ std::cerr << "* LINE : "<<mLine.back()<<std::endl;
+ }
+ status = ERROR;
+ }
+
CloseAllFiles();
bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretBuffer()"<<std::endl);
bbtkDecTab("Interpreter",9);
-
+
mCommandLine = exm;
+ return status;
}
//=======================================================================
+ //=======================================================================
+ /// Runs the interpretation of a command
+ Interpreter::ExitStatus Interpreter::InterpretLine( const std::string& line )
+ {
+ bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine('"<<line<<"')"<<std::endl);
+
+ ExitStatus status = OK;
+ try
+ {
+ bool insideComment = false;
+ InterpretLine(line, insideComment);
+ }
+ catch (QuitException e)
+ {
+ status = QUIT;
+ }
+ catch (bbtk::Exception e)
+ {
+ std::cerr << "* ERROR : "<<e.GetMessage()<<std::endl;
+ status = ERROR;
+ }
+ catch (std::exception& e)
+ {
+ std::cerr << "* ERROR : "<<e.what()<<" (not in bbtk)"<<std::endl;
+ status = ERROR;
+ }
+ catch (...)
+ {
+ std::cerr
+ << "* UNDEFINED ERROR (not a bbtk nor a std exception)"<<std::endl;
+ status = ERROR;
+ }
+
+
+ bbtkDebugMessage("Interpreter",9,"EO Interpreter::InterpretLine()"
+ <<std::endl);
+ bbtkDecTab("Interpreter",9);
+
+ return status;
+ }
+
//=======================================================================
/**
}
catch (QuitException e)
{
+ bbtkMessage("Interpreter",1,"Interpreter : Quit"<<std::endl);
again = false;
}
catch (bbtk::Exception e)
Program: bbtk
Module: $RCSfile: bbtkInterpreter.h,v $ $
Language: C++
- Date: $Date: 2008/03/18 12:51:26 $
- Version: $Revision: 1.15 $
+ Date: $Date: 2008/03/19 14:58:13 $
+ Version: $Revision: 1.16 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/// Destructor
~Interpreter();
+
+ typedef enum
+ {
+ OK,
+ ERROR,
+ QUIT
+ }
+ ExitStatus;
+
+ /// Runs the interpretation of a file
+ ExitStatus InterpretFile( const std::string& filename);
+
+ /// Runs the interpretation of a buffer and deletes it !
+ ExitStatus InterpretBuffer( std::stringstream* buffer );
+
+ /// Runs the interpretation of a command
+ ExitStatus InterpretLine( const std::string& line );
+
+
/// Launches a command line interpreter (with a prompt)
void CommandLineInterpreter();
+
+
/// Sets the inputs of the workspace :
/// the map is passed as is to the Executer
void SetInputs(const std::map<std::string,std::string>& m)
void SetDialogMode(DialogModeType t) { mExecuter->SetDialogMode(t); }
- /// Runs the interpretation of a file
- void InterpretFile( const std::string& filename);
+ /// Sets the bool that indicates wether we are in command line context
+ void SetCommandLine(bool v = true) { mCommandLine = v; }
- /// Runs the interpretation of a buffer and deletes it !
- void InterpretBuffer( std::stringstream* buffer );
- /// Interprets a line (either from a file or typed interactively)
+
+#ifdef _USE_WXWIDGETS_
+ /// Sets the WxConsole that created the interpreter (if any)
+ void SetWxConsole(WxConsole* c) { mWxConsole = c; }
+ /// Gets the WxConsole that created the interpreter (if any)
+ WxConsole* GetWxConsole() { return mWxConsole; }
+ /// Gets the WxConsole that created the interpreter (if any) - const
+ const WxConsole* GetWxConsole() const { return mWxConsole; }
+#endif
+
+ /// Gets the Executer
+ VirtualExec* GetExecuter() { return mExecuter; }
+ /// Gets the Executer (const)
+ const VirtualExec* GetExecuter() const { return mExecuter; }
+
+
+ protected:
+ /// Interprets a line
void InterpretLine( const std::string& line, bool &insideComment );
/// Reads a line from prompt
int n,
std::vector<std::string>& commands );
- /// Sets the bool that indicates wether we are in command line context
- void SetCommandLine(bool v = true) { mCommandLine = v; }
-
-#ifdef _USE_WXWIDGETS_
- /// Sets the WxConsole that created the interpreter (if any)
- void SetWxConsole(WxConsole* c) { mWxConsole = c; }
- /// Gets the WxConsole that created the interpreter (if any)
- WxConsole* GetWxConsole() { return mWxConsole; }
- /// Gets the WxConsole that created the interpreter (if any) - const
- const WxConsole* GetWxConsole() const { return mWxConsole; }
-#endif
- /// Gets the Executer
- VirtualExec* GetExecuter() { return mExecuter; }
- /// Gets the Executer (const)
- const VirtualExec* GetExecuter() const { return mExecuter; }
private:
Program: bbtk
Module: $RCSfile: bbtkWxConsole.cxx,v $
Language: C++
- Date: $Date: 2008/03/19 12:26:07 $
- Version: $Revision: 1.17 $
+ Date: $Date: 2008/03/19 14:58:13 $
+ Version: $Revision: 1.18 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
mwxTextHistory->SetDefaultStyle(*mwxTextHistoryAttr);
//printf("WxConsole::CommandString 03 \n");
- try
- {
- bool insideComment = false;
-
- mInterpreter->InterpretLine( wx2std(line), insideComment );
- }
- catch (bbtk::QuitException)
- {
- Close(true);
- }
- catch (bbtk::Exception e)
- {
- e.Print();
- }
- catch (std::exception& e)
- {
- std::cout << "* ERROR : "<<e.what()<<" (not in bbtk)"<<std::endl;
- }
- catch (...)
- {
- std::cout << "* UNDEFINED ERROR (not a bbtk nor a std exception)"
- << std::endl;
- }
+ if ( mInterpreter->InterpretLine( wx2std(line) ) ==
+ Interpreter::QUIT )
+ {
+ Close(true);
+ }
+
//printf("WxConsole::CommandString 06 \n");
}
//================================================================
-
+ //================================================================
+ /// Runs the interpretation of a file
+ void WxConsole::InterpretFile( const std::string& filename)
+ {
+ if ( mInterpreter->InterpretFile(filename) ==
+ Interpreter::ERROR )
+ {
+ Show();
+ }
+ }
+ //================================================================
+
//================================================================
void WxConsole::OnMenuQuit(wxCommandEvent& WXUNUSED(event))
{
//EED std::cout << "bbi: include "<<filepath<<std::endl;
//EED I->InterpretFile( filepath );
- bool insideComment = false; // for multiline comment
- I->InterpretLine( "exec freeze" ,insideComment );
- I->InterpretLine( "include *" ,insideComment );
- I->InterpretLine( "index "+doc_path+"/bbdoc/index-alpha.html Initials" ,insideComment );
- I->InterpretLine( "index "+doc_path+"/bbdoc/index-package.html Packages" ,insideComment );
- I->InterpretLine( "index "+doc_path+"/bbdoc/index-category.html Categories" ,insideComment );
- I->InterpretLine( "index "+doc_path+"/bbdoc/index-adaptors.html Adaptors",insideComment );
-
+ I->InterpretLine( "exec freeze");
+ I->InterpretLine( "include *");
+ 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");
+
delete I;
}
//================================================================
Program: bbtk
Module: $RCSfile: bbtkWxConsole.h,v $
Language: C++
- Date: $Date: 2008/03/18 12:51:26 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2008/03/19 14:58:13 $
+ Version: $Revision: 1.10 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{ mInterpreter->SetDialogMode(t); }
/// Runs the interpretation of a file
- void InterpretFile( const std::string& filename)
- { mInterpreter->InterpretFile(filename); }
+ void InterpretFile( const std::string& filename);
+
void OnMenuQuit(wxCommandEvent& event);
void OnMenuAbout(wxCommandEvent& event);
Program: bbtk
Module: $RCSfile: bbtkWxEditor.cxx,v $
Language: C++
- Date: $Date: 2008/03/19 08:03:59 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/03/19 14:58:13 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
}
std::stringstream* buffer = new std::stringstream(bbtk::wx2std(mwxInputText->GetValue()));
- bool com = false;
- mInterpreter->InterpretLine("reset",com);
+ mInterpreter->InterpretLine("reset");
try
{
mInterpreter->InterpretBuffer(buffer);
ccommand[i]=34;
}
}
- bool insideComment = false; // for multiline comment
- I->InterpretLine( ccommand, insideComment);
+
+ I->InterpretLine( ccommand );
pos1=pos2+1;
pos2 = bbGetInputIn().find(";",pos2+1);
Program: bbtk
Module: $RCSfile: bbwxCommandButton.cxx,v $
Language: C++
- Date: $Date: 2008/03/19 12:26:09 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2008/03/19 14:58:14 $
+ Version: $Revision: 1.5 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
ccommand[i]=34; // "
}
}
- bool insideComment = false; // for multiline comment
- I->InterpretLine( ccommand, insideComment );
+ I->InterpretLine( ccommand );
pos1=pos2+1;
pos2 = commandstr.find(";",pos2+1);
#set MIP.Colour "0.5 0 0"
set MIP.Title "MIP Controls"
-set main.title "ExampleMIPWithControls"
+set main.WinTitle "ExampleMIPWithControls"
exec main