X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fsrc%2FbbtkInterpreter.cxx;h=5b0c26e81faa4f9e18fe6f8c0ed279241de2b0e2;hb=150d84b9895d0948aa71182b8719768a9172cb0e;hp=c5a69ca1a5f6f44060f4f38c71161d7a32730e2f;hpb=998354bb81a4f450cae3a2263838d7d3b6024bac;p=bbtk.git diff --git a/kernel/src/bbtkInterpreter.cxx b/kernel/src/bbtkInterpreter.cxx index c5a69ca..5b0c26e 100644 --- a/kernel/src/bbtkInterpreter.cxx +++ b/kernel/src/bbtkInterpreter.cxx @@ -3,8 +3,8 @@ Program: bbtk Module: $RCSfile: bbtkInterpreter.cxx,v $ $ Language: C++ - Date: $Date: 2008/02/05 12:16:55 $ - Version: $Revision: 1.24 $ + Date: $Date: 2008/02/06 10:53:02 $ + Version: $Revision: 1.28 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -54,6 +54,7 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL; // mFactory = new bbtk::Factory(); mExecuter = new bbtk::Executer(); + //mExecuter = new bbtk::Transcriptor("GeneratedProgram.txt"); //mExecuter->SetFactory(mFactory); // Builds the commands dict @@ -170,7 +171,7 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL; info.syntax = "index [ ['Initials'(default)|'Packages'|'Categories']]"; info.help = "Creates an html index of known boxes. If filename is provided then save it to the file 'filename'. The default index entries are the initial letters of the names of the boxes. If 'Packages' or 'Categories' is provided then the entries are either the packages names or the categories"; - mCommandDict[info.keyword] = info; + mCommandDict[info.category] = info; info.category = "reset"; //EED info.argmin = 0; @@ -222,10 +223,10 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL; info.category = "include"; info.argmin = 1; - info.argmax = 1; + info.argmax = 2; info.code = cInclude; - info.syntax = "include "; - info.help = "Includes the file "; + info.syntax = "include [source]"; + info.help = "Includes the file .\n 'source' : If the keyword 'source' is provided then informs bbi that the included file is the source of the current box definition (Advanced; used to get the right 'Include' field in html doc of packages 'appli' scripts)."; mCommandDict[info.category] = info; info.category = "quit"; @@ -297,7 +298,7 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL; * */ void Interpreter::InterpretFile( const std::string& filename, - bool use_configuration_file) + bool use_configuration_file) { bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<0) { - filename = Utilities::get_file_name(mFileName.back()); + filename = mIncludeFileName.back(); //Utilities::get_file_name(mFileName.back()); } if (words.size()==2) { @@ -564,6 +565,11 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment ) { SwitchToFile(words[1], true ); // true : better pass use_config_file } + // if 'source' was given + if (words.size()==3) + { + this->mExecuter->SetCurrentFileName(words[1]); + } break; case cLoad: @@ -744,7 +750,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& // It's a user intended message. // Please don't remove it. bbtkMessage("Interpreter",1, - "look for : [" << name + "look for : [" << name << "] (use_configuration_file == TRUE)" << std::endl); script_paths = ConfigurationFile::GetInstance().Get_bbs_paths(); } @@ -766,7 +772,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& { if ((*i).substr((*i).size()-4, 4) != ".bbs") continue; // ignore non .bbs files - LoadScript(*i); + LoadScript(*i,name); nbBssFiles++; } if (nbBssFiles==0) @@ -816,7 +822,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& if ((*i).substr((*i).size()-4, 4) != ".bbs") continue; // ignore non .bbs files - LoadScript(*i); + LoadScript(*i,name); nbBssFiles++; } if (nbBssFiles==0) @@ -924,7 +930,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& return; } else - LoadScript(fullPathScriptName); + LoadScript(fullPathScriptName,name); return; } @@ -932,7 +938,8 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& //======================================================================= - void Interpreter::LoadScript( std::string fullPathScriptName) + void Interpreter::LoadScript( std::string fullPathScriptName, + std::string includeScriptName) { if (find(mFileName.begin(),mFileName.end(),fullPathScriptName) !=mFileName.end()) @@ -956,6 +963,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& mFile.push_back(s); mFileName.push_back(fullPathScriptName); + mIncludeFileName.push_back(includeScriptName); mLine.push_back(0); return; } @@ -982,6 +990,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& " Closing file '"<& bbtkDebugMessage("Interpreter",9, " Closing file '"<& words) /// Displays the Configuration void Interpreter::Config() const { - bbtkDebugMessageInc("Core",9,"Factory::Config"<& words) const std::string description = cf.Get_description(); const std::string url = cf.Get_url(); const std::string data_path = cf.Get_data_path(); - const std::string default_doc_tmp = cf.Get_default_doc_tmp(); + const std::string default_temp_dir = cf.Get_default_temp_dir(); const std::string file_separator = cf.Get_file_separator(); const std::vectorbbs_paths = cf.Get_bbs_paths(); const std::vectorpackage_paths = cf.Get_package_paths(); @@ -1147,7 +1157,7 @@ void Interpreter::Help(const std::vector& words) bbtkMessage("Help",1, "bbtk_config.xml : [" << config_xml_full_path << "]" << std::endl); bbtkMessage("Help",1, "Documentation Url : [" << url << "]" << std::endl); bbtkMessage("Help",1, "Data Path : [" << data_path << "]" << std::endl); - bbtkMessage("Help",1, "Default Doc_tmp : [" << default_doc_tmp << "]" << std::endl); + bbtkMessage("Help",1, "Default Temp-Dir : [" << default_temp_dir << "]" << std::endl); bbtkMessage("Help",1, "File Separator : [" << file_separator << "]" << std::endl); std::vector::const_iterator i; @@ -1164,7 +1174,7 @@ void Interpreter::Help(const std::vector& words) bbtkMessage("Help",1,"--- ["<<*i<<"]"<