From 2769d3123cddecf9d220bd5458d9e2855f298006 Mon Sep 17 00:00:00 2001 From: guigues Date: Wed, 6 Feb 2008 09:27:52 +0000 Subject: [PATCH] *** empty log message *** --- kernel/src/bbtkInterpreter.cxx | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/kernel/src/bbtkInterpreter.cxx b/kernel/src/bbtkInterpreter.cxx index 694f97a..dfea3e8 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 13:23:46 $ - Version: $Revision: 1.25 $ + Date: $Date: 2008/02/06 09:27:52 $ + Version: $Revision: 1.26 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -222,10 +222,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 Advanced (used to get the right 'Include' field in doc of packages appli) : If the keyword 'source' is provided then informs bbi that the included file is the source of the current box definition."; mCommandDict[info.category] = info; info.category = "quit"; @@ -463,7 +463,7 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment ) case cDefine : if (mFileName.size()>0) { - filename = Utilities::get_file_name(mFileName.back()); + filename = mIncludeFileName.back(); //Utilities::get_file_name(mFileName.back()); } if (words.size()==2) { @@ -564,6 +564,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: @@ -766,7 +771,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 +821,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 +929,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& return; } else - LoadScript(fullPathScriptName); + LoadScript(fullPathScriptName,name); return; } @@ -932,7 +937,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 +962,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 +989,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector& " Closing file '"<& bbtkDebugMessage("Interpreter",9, " Closing file '"<