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
info.category = "include";
info.argmin = 1;
- info.argmax = 1;
+ info.argmax = 2;
info.code = cInclude;
- info.syntax = "include <filename>";
- info.help = "Includes the file <filename>";
+ info.syntax = "include <filename> [source]";
+ info.help = "Includes the file <filename>.\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";
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)
{
{
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:
{
if ((*i).substr((*i).size()-4, 4) != ".bbs")
continue; // ignore non .bbs files
- LoadScript(*i);
+ LoadScript(*i,name);
nbBssFiles++;
}
if (nbBssFiles==0)
if ((*i).substr((*i).size()-4, 4) != ".bbs")
continue; // ignore non .bbs files
- LoadScript(*i);
+ LoadScript(*i,name);
nbBssFiles++;
}
if (nbBssFiles==0)
return;
}
else
- LoadScript(fullPathScriptName);
+ LoadScript(fullPathScriptName,name);
return;
}
//=======================================================================
- void Interpreter::LoadScript( std::string fullPathScriptName)
+ void Interpreter::LoadScript( std::string fullPathScriptName,
+ std::string includeScriptName)
{
if (find(mFileName.begin(),mFileName.end(),fullPathScriptName)
!=mFileName.end())
mFile.push_back(s);
mFileName.push_back(fullPathScriptName);
+ mIncludeFileName.push_back(includeScriptName);
mLine.push_back(0);
return;
}
" Closing file '"<<mFileName.back()<<"'"<<std::endl);
mFileName.pop_back();
+ mIncludeFileName.pop_back();
mLine.pop_back();
bbtkDebugMessage("Interpreter",9," Remains "
<<mFile.size()
bbtkDebugMessage("Interpreter",9,
" Closing file '"<<mFileName.back()<<"'"<<std::endl);
mFileName.pop_back();
+ mIncludeFileName.pop_back();
mLine.pop_back();
}
bbtkDebugMessage("Interpreter",9,"EO Interpreter::CloseAllFiles()"