]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkInterpreter.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkInterpreter.cxx
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 :