]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkInterpreterVirtual.cxx
no message
[bbtk.git] / kernel / src / bbtkInterpreterVirtual.cxx
index 85354e69d2162611b35f6ec9442831a19ed26ed4..e3ce34b0450383baa9e671cdb6db17e4c7f563a8 100644 (file)
@@ -578,7 +578,7 @@ namespace bbtk
   //=======================================================================
   InterpreterVirtual::ExitStatus InterpreterVirtual::InterpretFile( const std::string& filename, bool source )
   {
-    bbtkDebugMessage("interpreter",4,"==> InterpreterVirtual::InterpretFile(\""<<filename<<"\")"<<std::endl);
+         bbtkDebugMessage("interpreter",4,"==> InterpreterVirtual::InterpretFile(\""<<filename<<"\")"<<std::endl);
 
     bool exm = mCommandLine;
     mCommandLine = false;
@@ -598,7 +598,7 @@ namespace bbtk
 
 
     mCommandLine = exm;
-    
+
     return mStatus;
   }
   //=======================================================================
@@ -691,19 +691,19 @@ namespace bbtk
   }
   //=======================================================================  
   
-       void InterpreterVirtual::commandNew(std::string boxType, std::string boxName)
+       void InterpreterVirtual::commandNew(const std::string &boxType, const std::string &boxName) // virtual 
     {
     }
        
-       void InterpreterVirtual::commandDelete(std::string boxName)
+       void InterpreterVirtual::commandDelete(const std::string &boxName)
     {
     }
 
-       void InterpreterVirtual::commandConnection(std::string nodeFrom, std::string outputLabel, std::string nodeTo, std::string inputLabel)
+       void InterpreterVirtual::commandConnection(const std::string &nodeFrom,const std::string &outputLabel,const std::string &nodeTo,const std::string &inputLabel)
     {
     }
                
-       void InterpreterVirtual::commandPackage(std::string packageName)
+       void InterpreterVirtual::commandPackage(const std::string &packageName)
     {
     }
        
@@ -711,7 +711,7 @@ namespace bbtk
     {
     }
        
-       void InterpreterVirtual::commandDefine(std::string name, std::string pack, std::string scriptfilename)
+       void InterpreterVirtual::commandDefine(const std::string &name,const std::string &pack,const std::string &scriptfilename)
     {
     }
 
@@ -719,43 +719,43 @@ namespace bbtk
     {
     }
 
-       void InterpreterVirtual::commandKind(std::string kind)
+       void InterpreterVirtual::commandKind(const std::string &kind)
     {
     }
        
-       void InterpreterVirtual::commandPrint(std::string value)
+       void InterpreterVirtual::commandPrint(const std::string &value)
     {
     }
        
        
-       void InterpreterVirtual::commandExec(std::string word)
+       void InterpreterVirtual::commandExec(const std::string &word)
     {
     }
        
        
-       void InterpreterVirtual::commandInput(std::string name, std::string box, std::string input,std::string  help)
+       void InterpreterVirtual::commandInput(const std::string &name,const std::string &box,const std::string &input,const std::string  &help)
     {
     }
        
-       void InterpreterVirtual::commandOutput(std::string name, std::string box, std::string output,std::string  help)
+       void InterpreterVirtual::commandOutput(const std::string &name,const std::string &box,const std::string &output,const std::string  &help)
     {
     }
        
-       void InterpreterVirtual::commandSet(std::string box, std::string input, std::string value)
+       void InterpreterVirtual::commandSet(const std::string &box,const std::string &input,const std::string &value)
     {
     }
 
-       void InterpreterVirtual::commandAuthor(std::string author)
+       void InterpreterVirtual::commandAuthor(const std::string &author)
     {
     }
 
-       void InterpreterVirtual::commandCategory(std::string categorytype)
+       void InterpreterVirtual::commandCategory(const std::string &categorytype)
     {
     }
        
        
        
-       void InterpreterVirtual::commandDescription(std::string description)
+       void InterpreterVirtual::commandDescription(const std::string &description)
     {
     }
 
@@ -764,16 +764,16 @@ namespace bbtk
     {
     }
        
-       void InterpreterVirtual::commandInclude(std::string word, bool ok)
+       void InterpreterVirtual::commandInclude(const std::string &word, bool ok)
     {
     }
        
        
-       void InterpreterVirtual::commandLoad(std::string packageName)
+       void InterpreterVirtual::commandLoad(const std::string &packageName)
     {
     }
 
-       void InterpreterVirtual::commandUnload(std::string packageName)
+       void InterpreterVirtual::commandUnload(const std::string &packageName)
     {
     }
        
@@ -789,8 +789,7 @@ namespace bbtk
     {
     }
        
-//ups2 EED Borrame     
-       void InterpreterVirtual::commandMessage(std::string kind, std::string levelstr)
+       void InterpreterVirtual::commandMessage(const std::string &kind,const std::string &levelstr)
     {
     }
        
@@ -799,11 +798,14 @@ namespace bbtk
   //=======================================================================  
   void InterpreterVirtual::DoInterpretLine( const std::string& line )
   {
+         
     bbtkDebugMessage("interpreter",6,"==> InterpreterVirtual::DoInterpretLine(\""
                     <<line<<"\")"<<std::endl);
     std::vector<std::string> words;
     SplitLine(line,words);
 
+         
+         
     // Empty line
     if (words.size()<1) 
     {
@@ -847,6 +849,7 @@ namespace bbtk
        bbtkMessage("interpreter",9,"Multiline Comment"<<std::endl);
        return;
     }
+         
 
     // Command 
     CommandInfoType command;
@@ -859,7 +862,6 @@ namespace bbtk
     std::string left,right,left2,right2;
     std::string filename;
 
-//ups1 EED borrame       
     // message command
     if (command.code==cMessage)
       {
@@ -918,6 +920,7 @@ namespace bbtk
 //std::cout<<" mVirtualExecuter->Create(words[1],words[2]); "<<line<<std::endl;
     // other cammands
 
+         
     switch (command.code) 
       {
       case cNew :
@@ -955,7 +958,8 @@ namespace bbtk
         }
         if (words.size()==2) 
         {
-                       commandDefine(words[1],"",filename);
+                       std::string packTmp = "";
+                       commandDefine(words[1],packTmp,filename);
 //EED Borrame           mVirtualExecuter->Define(words[1],"",filename);
         }
         else
@@ -1119,7 +1123,7 @@ namespace bbtk
 
     bbtkDebugMessage("interpreter",6,"<== InterpreterVirtual::DoInterpretLine(\""
                     <<line<<"\")"<<std::endl);
-    
+         
   }
   //=======================================================================  
 
@@ -1291,7 +1295,7 @@ namespace bbtk
 
        std::stringstream* stream = new std::stringstream;
        //if (upath.size()!=0) // avoid troubles for "*"
-       
+                 
        // ==== no path provided : look in root bbs path
        if (upath.size()==0)
          {
@@ -1328,6 +1332,7 @@ namespace bbtk
                 i++)
              {
                std::string full_path(*i);
+printf("EED InterpreterVirtual::SwitchToFile 1. >>%s\n", full_path.c_str() );
                // we *really* want '.' to be the current working directory
                if (full_path == ".") 
                  {
@@ -1352,23 +1357,28 @@ namespace bbtk
              }
          }
        
-       
        // === search paths list complete : now explore it
        int nbBssFiles = 0;     
        // ==== relative name, iterate + load all .bbs/.bbp files
        std::vector<std::string>::iterator i;
        for (i=script_paths.begin();i!=script_paths.end();i++)
          {
+
+printf("EED InterpreterVirtual::SwitchToFile jaja >>  %s\n", (*i).c_str() );
+                 
            bbtkMessage("interpreter",1,
                        "--> Looking in '" << *i << "'" << std::endl);
            
            Filenames.clear();
            //int nbFiles = 
            Utilities::Explore(*i, false, Filenames);
-           
+
            for (std::vector<std::string>::iterator j = Filenames.begin(); 
                 j!= Filenames.end(); ++j)
              {
+                         
+printf("EED InterpreterVirtual::SwitchToFile kkkkk     >>  %s\n", (*j).c_str() );
+                         
                int lgr = (*j).size();
                if (lgr < 5) continue;  
                // ignore non .bbp file
@@ -1463,6 +1473,7 @@ namespace bbtk
                }
          
                std::string tfullPathScriptName = Utilities::MakePkgnameFromPath(path, name, false);
+                 
 //Addition JCP tfullPathScriptName.size()>=4 
                if(tfullPathScriptName.size()>=4){
                        if (tfullPathScriptName.substr(tfullPathScriptName.size()-4, 3)==".bb")
@@ -1523,16 +1534,18 @@ namespace bbtk
           bbtkError("No ["<<pkgname<<".bbs/.bbp] script found");
        return;
       } else {
+//EED printf("EED D. SwitchToFile %s\n", fullPathScriptName.c_str() );   
                LoadScript(fullPathScriptName,name);
 //EED Borrame    if (source) GetExecuter()->SetCurrentFileName(fullPathScriptName);
                if (source) SetCurrentFileName(fullPathScriptName);
        }    
+                 
     return;
   }
   //=======================================================================
 
        //=======================================================================
-       void InterpreterVirtual::SetCurrentFileName(std::string fullPathScriptName)  // virtual 
+       void InterpreterVirtual::SetCurrentFileName(const std::string &fullPathScriptName)  // virtual 
        {
        }       
        //=======================================================================
@@ -1650,6 +1663,7 @@ void InterpreterVirtual::SwitchToStream( std::stringstream* stream )
   void InterpreterVirtual::InterpretCommand( const std::vector<std::string>& words,
                                       CommandInfoType& info )
   {
+         
     bbtkDebugMessage("interpreter",9,"==> InterpreterVirtual::InterpretCommand(...)"<<std::endl);
 
     // searches the command keyword
@@ -1666,12 +1680,10 @@ void InterpreterVirtual::SwitchToStream( std::stringstream* stream )
                
 //EED       HelpCommand(words[0]);
                commandHelp(words[0]);
-               
        bbtkError(words[0]<<" : wrong number of arguments");
     }
 //std::cout<<"InterpreterVirtual::InterpretCommand( const std::vector<std::string>& words,"<<std::endl;
     info = c->second;
-
     bbtkDebugMessage("interpreter",9,"<== InterpreterVirtual::InterpretCommand(...)"<<std::endl);
 
   }
@@ -1684,7 +1696,7 @@ void InterpreterVirtual::SwitchToStream( std::stringstream* stream )
   { 
   }
   //=======================================================================
-  void InterpreterVirtual::commandHelp(const std::string words) 
+  void InterpreterVirtual::commandHelp(const std::string &words) 
   {  
   }
        //=======================================================================
@@ -1953,7 +1965,7 @@ void InterpreterVirtual::SwitchToStream( std::stringstream* stream )
     ter.c_cc[VTIME]=0;
     tcsetattr(0,TCSANOW,&ter);
 #endif
-    
+
     mCommandLine = true;
     bool again = true;
     // bool insideComment = false; // for multiline comment