]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkInterpreter.cxx
- Finished the Transcriptor
[bbtk.git] / kernel / src / bbtkInterpreter.cxx
index ab0075d2e84030d01bd0ac1bd3c5a16b0adf3d46..d112dba1115b4a16ee23b9b0e056b90aa26b0b42 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/03/26 08:51:43 $
-  Version:   $Revision: 1.56 $
+  Date:      $Date: 2008/03/26 14:47:36 $
+  Version:   $Revision: 1.57 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -21,6 +21,8 @@
  */
 
 #include "bbtkInterpreter.h"
+#include "bbtkExecuter.h"
+#include "bbtkTranscriptor.h"
 #include "bbtkMessageManager.h"
 #include "bbtkConfigurationFile.h"
 #include "bbtkUtilities.h"
@@ -42,7 +44,7 @@ namespace bbtk
  /**
    *
    */
-  Interpreter::Interpreter() 
+  Interpreter::Interpreter(const std::string& cpp_file
     :
     mUser(0),
     mCommandLine(false),
@@ -53,7 +55,14 @@ bufferNb =0;
     bbtk::MessageManager::RegisterMessageType("Interpreter","Messages of the interpreter",0);
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::Interpreter()" <<std::endl);
  
-    mExecuter = new bbtk::Executer();
+    if (cpp_file.size()!=0)
+      {
+       mExecuter = new bbtk::Transcriptor(cpp_file);
+      }
+    else 
+      {
+       mExecuter = new bbtk::Executer();
+      }
     mExecuter->SetInterpreter(this);
     
     // For the time being, comment out previous line, and
@@ -1003,7 +1012,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
              }
            else 
              {
-               bbtkError("'"<<upath<<"' : not a valid folder"); 
+               bbtkError("'"<<upath<<"' : directory does not exist"); 
              }
          }
        // ==== relative path provided : search all bbs path appended with 
@@ -1032,13 +1041,14 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
                     script_paths.push_back(full_path);
                   }
               } 
+            if (script_paths.empty())
+              {
+                bbtkError("no '"<<upath<<"' subdir found in search paths" 
+                          << std::endl);
+              }
+
          }
        // === search paths list complete : now explore it
-       if (script_paths.empty())
-         {
-           bbtkMessage("Interpreter",1,
-                       "'"<<upath<<"' : No matching folder" << std::endl);
-         }
 
 
        std::vector<std::string>::iterator i;