]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkInterpreter.h
*** empty log message ***
[bbtk.git] / kernel / src / bbtkInterpreter.h
index 2e7ba4df6f2c0462179108c1bcf6e910f3e2d277..bdf3da926af354a865cba6be74955ae784853a0d 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/05/06 13:45:12 $
-  Version:   $Revision: 1.30 $
+  Date:      $Date: 2008/10/08 13:39:33 $
+  Version:   $Revision: 1.34 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -45,7 +45,7 @@ namespace bbtk
   {
   public: 
     InterpreterUser() {}
-    ~InterpreterUser() {}
+    virtual ~InterpreterUser() {}
 
     virtual bool InterpreterUserHasOwnHtmlPageViewer() { return false; }
     virtual void InterpreterUserViewHtmlPage(const std::string&) {}
@@ -90,6 +90,7 @@ namespace bbtk
     typedef Object Superclass;
   public:
     static Pointer New(const std::string& cpp_file = "");
+    static Pointer New(VirtualExec::Pointer);
 
     typedef enum 
       {
@@ -100,7 +101,7 @@ namespace bbtk
       ExitStatus;
 
     /// Runs the interpretation of a file
-    ExitStatus InterpretFile( const std::string& filename);
+    ExitStatus InterpretFile( const std::string& filename, bool source = false);
 
     /// Runs the interpretation of a buffer and deletes it !
     ExitStatus InterpretBuffer( std::stringstream* buffer );
@@ -121,14 +122,16 @@ namespace bbtk
 
     /// Puts the executer in "no exec" mode,
     /// which creates but does not execute pipelines.
-    void SetNoExecMode(bool b) { mVirtualExecuter->SetNoExecMode(b); }
+    void SetNoExecMode(bool m) { mVirtualExecuter->SetNoExecMode(m); }
 
+    /// Puts the executer in "no error" mode, 
+    /// Errors do not stop execution (but warnings are produced)
+    void SetNoErrorMode(bool m) { mVirtualExecuter->SetNoErrorMode(m);}
     ///
     //typedef Executer::DialogModeType DialogModeType;
     typedef VirtualExec::DialogModeType DialogModeType;
 
-    void SetDialogMode(DialogModeType t) 
-    { mVirtualExecuter->SetDialogMode(t); }
+    void SetDialogMode(DialogModeType t) { mVirtualExecuter->SetDialogMode(t);}
 
     /// Sets the bool that indicates wether we are in command line context
     void SetCommandLine(bool v = true) { mCommandLine = v; }
@@ -214,7 +217,7 @@ namespace bbtk
                            CommandInfoType& info );
 
     /// Switch to the interpretation of a file
-    void SwitchToFile( const std::string& filename );
+    void SwitchToFile( const std::string& filename, bool source = false );
 
    /// Switch to the interpretation of a stringstream
     void SwitchToStream( std::stringstream* stream );
@@ -267,6 +270,10 @@ namespace bbtk
     /// Constructor
     Interpreter(const std::string& cpp_file = "");
 
+    Interpreter(VirtualExec::Pointer);
+
+    void Init(VirtualExec::Pointer, const std::string& cpp_file);
+
     /// Opens the file fullPathScriptName 
     /// includeScriptName is the name as given to the include command 
     void LoadScript( std::string fullPathScriptName,