]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkWxConsole.cxx
*** empty log message ***
[bbtk.git] / kernel / src / bbtkWxConsole.cxx
index 943cfc19ec40f01eb87c4986c55a9c2458d22f87..dc7dc1d337b33b4e321dee8d4b8814fb5bcda257 100644 (file)
@@ -3,8 +3,8 @@
   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
@@ -288,34 +288,28 @@ namespace bbtk
     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))
   {
@@ -411,14 +405,13 @@ printf("EED WxConsole::OnMenuCreatePackage 06 \n");
 //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;
   }
   //================================================================