]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Thu, 2 Oct 2008 07:43:20 +0000 (07:43 +0000)
committerguigues <guigues>
Thu, 2 Oct 2008 07:43:20 +0000 (07:43 +0000)
kernel/src/bbtkExecuter.h
kernel/src/bbtkInterpreter.cxx
kernel/src/bbtkInterpreter.h
kernel/src/bbtkTranscriptor.cxx
kernel/src/bbtkTranscriptor.h
kernel/src/bbtkVirtualExec.h
packages/std/bbs/appli/exampleAdd.bbs

index fc177e254bccff63993aab000714051de0cebccc..34ad0a714b8e50aaec66eb1a3aed6a85784533f4 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkExecuter.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/22 09:40:10 $
-  Version:   $Revision: 1.14 $
+  Date:      $Date: 2008/10/02 07:43:20 $
+  Version:   $Revision: 1.15 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -67,6 +67,9 @@ namespace bbtk
     /// Sets the mode of dialog of the executer for Root inputs 
     void SetDialogMode(DialogModeType t) { mDialogMode = t; }
 
+    void SetNoErrorMode(bool b) { mNoErrorMode = b; }
+
+    bool GetNoErrorMode() const { return mNoErrorMode; }
 
 
     //=================================================================
@@ -242,8 +245,13 @@ namespace bbtk
     /// no exec mode flag
     bool mNoExecMode;
 
+
     /// Dialog mode
     DialogModeType mDialogMode;
+
+    /// no error mode flag
+    bool mNoErrorMode;
+
   };
 }
 #endif
index 12dd24fa7b6770a287030987dd6ed4ed64624f22..febf071291510a71dfc65b7cd4ec84362f512f2b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/09/10 12:01:46 $
-  Version:   $Revision: 1.70 $
+  Date:      $Date: 2008/10/02 07:43:20 $
+  Version:   $Revision: 1.71 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -149,8 +149,8 @@ namespace bbtk
     info.argmin = 1;
     info.argmax = 2;
     info.code = cExec;
-    info.syntax = "exec <box | 'freeze' | 'unfreeze' >";
-    info.help = "Executes the black box of name <box> (and connected boxes if needed). If the special keyword 'freeze' is given then freezes any further execution command. 'unfreeze' reverts to normal execution mode.";
+    info.syntax = "exec <box | 'freeze' | 'unfreeze' | 'freeze_no_error' >";
+    info.help = "Executes the black box of name <box> (and connected boxes if needed). If the special keyword 'freeze' is given then freezes any further execution command. 'unfreeze' reverts to normal execution mode. 'freeze_no_error' is like freeze but also skips any error.";
     mCommandDict[info.keyword] = info;
 
     info.keyword = "package";
@@ -402,6 +402,7 @@ namespace bbtk
       }
     else
       {
+       std::cout << "!!!HERRR bbtk"<<std::endl;
        std::stringstream mess;
        mess << "* ERROR : "<<e.GetMessage()<<std::endl;
        if (mFileName.size()) {
@@ -432,6 +433,7 @@ namespace bbtk
       }
     else
       {
+       std::cout << "!!!HERRR std"<<std::endl;
        std::stringstream mess;
        mess << "* ERROR : "<<e.what()<<std::endl;
        if (mFileName.size()) {
@@ -463,6 +465,7 @@ namespace bbtk
       }
     else
       {
+       std::cout << "!!!HERRRunk "<<std::endl;
        std::stringstream mess;
        mess << "* UNDEFINED ERROR (not a bbtk nor a std exception)" 
             << std::endl;
@@ -531,8 +534,11 @@ namespace bbtk
             {
              str.erase(size-1,1);
             }
-         
-         InterpretLine(str, insideComment);
+         try
+           {
+             InterpretLine(str, insideComment);
+           }
+         CATCH_MACRO;
          
        }//while
        CloseCurrentFile();
@@ -582,11 +588,12 @@ namespace bbtk
             {
              str.erase(size-1,1);
             }
-         
-         InterpretLine(str, insideComment);
-         
+         try
+           {
+             InterpretLine(str, insideComment);
+           }
+         CATCH_MACRO;
        }//while
-       
        CloseCurrentFile();
       }
     }
@@ -744,11 +751,25 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
         
       case cExec :
         if (words[1]=="freeze") 
-          mVirtualExecuter->SetNoExecMode(true);
-        else if (words[1]=="unfreeze") 
-          mVirtualExecuter->SetNoExecMode(false);
-        else
-          mVirtualExecuter->Execute(words[1]);
+         {
+           mVirtualExecuter->SetNoExecMode(true);
+           mThrow = false;
+         }
+       else if (words[1]=="freeze_no_error ") 
+         {
+           mVirtualExecuter->SetNoExecMode(true);
+           mVirtualExecuter->SetNoErrorMode(true);
+           mThrow = false;
+         }
+       else if (words[1]=="unfreeze") 
+         {
+           mVirtualExecuter->SetNoExecMode(false);
+           mVirtualExecuter->SetNoErrorMode(false);
+         }
+       else
+         {
+           mVirtualExecuter->Execute(words[1]);
+         }
         break;
 
       case cInput :
index ee5c86c587bd98c1ca5ecf276c16370892bf14a9..6c294d9dd42ea6b9063accd4170420037f2a85ca 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/07/23 11:46:11 $
-  Version:   $Revision: 1.32 $
+  Date:      $Date: 2008/10/02 07:43:20 $
+  Version:   $Revision: 1.33 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -122,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; }
index 258ad8379d80b3600d3c30508b2b8a9b5b3aa617..57f69134d6ed6db4c9210bb1f1633b197d6f88eb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkTranscriptor.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/21 07:01:52 $
-  Version:   $Revision: 1.12 $
+  Date:      $Date: 2008/10/02 07:43:21 $
+  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
@@ -46,7 +46,6 @@ namespace bbtk
  */
   Transcriptor::Transcriptor(const std::string& filename)
     :
-      mNoExecMode(false),
       mDialogMode(NoDialog)
   {
     //VirtualExec();    
index 35d02e05e20b938ddce7b940d00bf7478af2d68d..60b051b227c2c9c868add8b5cda347e0b939f5ee 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkTranscriptor.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:16 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2008/10/02 07:43:21 $
+  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
@@ -58,7 +58,16 @@ namespace bbtk
           m_Fp << "  e->SetNoExecMode(false);" << std::endl;       
     }
 
-    bool GetNoExecMode() const { return mNoExecMode; }
+    void SetNoErrorMode(bool b)
+    {
+       if (b)
+          m_Fp << "  e->SetNoErrorMode(true);" << std::endl;
+       else
+          m_Fp << "  e->SetNoErrorMode(false);" << std::endl;       
+    }
+
+    bool GetNoExecMode() const { return false; }
+    bool GetNoErrorMode() const { return false; }
 
     /// Sets the mode of dialog of the executer for Root inputs 
     void SetDialogMode(DialogModeType t) { mDialogMode = t; }
@@ -181,9 +190,6 @@ namespace bbtk
     /// The input values of the Root ComplexBlackBox
     std::map<std::string,std::string> mInputs;
     
-    /// no exec mode flag
-    bool mNoExecMode;
-
     /// Dialog mode
     DialogModeType mDialogMode;
     
index 2b57eb0323366ad9365740bd827dc63fb7f16144..1ba529d9f6262bf13997bc83147be6df491a7676 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkVirtualExec.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/05/06 13:45:12 $
-  Version:   $Revision: 1.15 $
+  Date:      $Date: 2008/10/02 07:43:21 $
+  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
@@ -74,6 +74,10 @@ namespace bbtk
     /// Sets the mode of dialog of the executer for Root inputs 
     virtual void SetDialogMode(DialogModeType t) = 0;
 
+    /// Puts the executer in "no error" mode, 
+    /// Errors do not stop execution (but warnings are produced)
+    virtual void SetNoErrorMode(bool b) = 0;
+    virtual bool GetNoErrorMode() const = 0;
     //=================================================================
    /// Loads a package
     virtual void LoadPackage(const std::string &name ) = 0;
index d98b0aa42c02e8d202868a99cbeea0925a859462..c9e7669d0e236a20cc08f1d7bbc32eef38c66190 100644 (file)
@@ -17,3 +17,4 @@ print "The result is : $a.Out$"
 
 print "That's all "
 print "folks"
+