Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $ $
Language: C++
- Date: $Date: 2008/10/08 10:56:27 $
- Version: $Revision: 1.74 $
+ Date: $Date: 2008/10/08 13:39:33 $
+ Version: $Revision: 1.75 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
/**
*
*/
- Interpreter::ExitStatus Interpreter::InterpretFile( const std::string& filename )
+ Interpreter::ExitStatus Interpreter::InterpretFile( const std::string& filename, bool source )
{
bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
try
{
- SwitchToFile(filename);
+ SwitchToFile(filename,source);
bool insideComment = false; // for multiline comment
while (mFile.size()>0)
case cDefine :
if (mFileName.size()>0)
{
- filename = mIncludeFileName.back(); //Utilities::get_file_name(mFileName.back());
+ filename = mFileName.back(); //mIncludeFileName.back(); //Utilities::get_file_name(mFileName.back());
}
if (words.size()==2)
{
break;
case cInclude :
- if (mCommandLine)
+ // if 'source' was given (words.size()==3) then tell to set the
+ // source file name of the current complex box with the full file name included
+ if (mCommandLine)
{
- InterpretFile(words[1]);
+ InterpretFile(words[1],(words.size()==3));
}
else
{
- SwitchToFile(words[1]);
+ SwitchToFile(words[1],(words.size()==3) );
}
- // if 'source' was given
- if (words.size()==3)
- {
- GetExecuter()->SetCurrentFileName(words[1]);
- }
- break;
+ break;
case cLoad:
GetExecuter()->LoadPackage(words[1]);
*/
// =========================================================================
- void Interpreter::SwitchToFile( const std::string& name )
+ void Interpreter::SwitchToFile( const std::string& name , bool source )
{
// Note : in the following :
// name : the user supplied name
return;
}
else
+ {
LoadScript(fullPathScriptName,name);
+ if (source) GetExecuter()->SetCurrentFileName(fullPathScriptName);
+ }
return;
}
mIncludeFileName.push_back(includeScriptName);
mLine.push_back(0);
- return;
+ return;
}
//=======================================================================