Program: bbtk
Module: $RCSfile: bbtkInterpreter.cxx,v $ $
Language: C++
- Date: $Date: 2008/04/25 07:33:17 $
- Version: $Revision: 1.64 $
+ Date: $Date: 2008/05/15 08:02:36 $
+ Version: $Revision: 1.66 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
//=======================================================================
Interpreter::Pointer Interpreter::New(const std::string& cpp_file)
{
- bbtkDebugMessage("Kernel",9,"Interpreter::New()"<<std::endl);
+ bbtkDebugMessage("Kernel",9,"Interpreter::New('"<<cpp_file<<"')"<<std::endl);
return MakePointer(new Interpreter(cpp_file));
}
//=======================================================================
+ //=======================================================================
+ Interpreter::Pointer Interpreter::New(VirtualExec::Pointer e)
+ {
+ bbtkDebugMessage("Kernel",9,"Interpreter::New(VirtualExec)"<<std::endl);
+ return MakePointer(new Interpreter(e));
+ }
+ //=======================================================================
+
//=======================================================================
Interpreter::Interpreter(const std::string& cpp_file)
- :
- mUser(0),
- mCommandLine(false),
- mThrow(false)
{
+ Init(VirtualExec::Pointer(), cpp_file);
+ }
+ //=======================================================================
+
+ //=======================================================================
+ Interpreter::Interpreter(VirtualExec::Pointer e)
+ {
+ Init(e,"");
+ }
+ //=======================================================================
+ //=======================================================================
+ void Interpreter::Init(VirtualExec::Pointer e, const std::string& cpp_file)
+ {
+ mUser = 0;
+ mCommandLine = false;
+ mThrow = false;
bufferNb =0;
bbtk::MessageManager::RegisterMessageType("echo","Level>0 : Prints the output of the 'print' commands of the user.\n\tLevel>1 : Prints the command being interpreted",1);
bbtk::MessageManager::RegisterMessageType("Interpreter","Messages of the interpreter",0);
bbtkDebugMessageInc("Interpreter",9,"Interpreter::Interpreter()" <<std::endl);
-
- if (cpp_file.size()!=0)
+ if (e)
+ {
+ mVirtualExecuter = e;
+ }
+ else if (cpp_file.size()!=0)
{
mVirtualExecuter = boost::static_pointer_cast<VirtualExec>(bbtk::Transcriptor::New(cpp_file));
}
}
// Lock this pointer or will auto-destruct !!
- mVirtualExecuter->SetInterpreter(MakePointer(this,true));
+ if (!e) mVirtualExecuter->SetInterpreter(MakePointer(this,true));
// For the time being, comment out previous line, and
// uncomment next line to check Transcriptor
info.help = "Shows a graphical view of a bbtk pipeline.\n- BlackBoxName : name of the box to view. Default '.' : current box.\n- BlackBoxNameType : name of the type of box to view, ex : 'workspace')";
mCommandDict[info.keyword] = info;
- info.keyword = "object";
+ info.keyword = "debug";
info.argmin = 0;
info.argmax = 1;
- info.code = cObject;
- info.syntax = "object <object name>";
- info.help = "Provides debug info on object <object name>";
+ info.code = cDebug;
+ info.syntax = "debug [expr|-C|-D]";
+ info.help = "Prints debug info on living bbtk objects containing the string 'expr' (default expr=''). -C checks the factory integrity. -D turns on objects debug info after main ends";
mCommandDict[info.keyword] = info;
/*
throw QuitException();
break;
- case cObject :
- if (words.size()==2) ObjectInfo(words[1]);
- else ObjectInfo("");
+ case cDebug :
+ if (words.size()==2) Debug(words[1]);
+ else Debug("");
break;
/* obsolete
case cWorkspace :
//==========================================================================
- void Interpreter::ObjectInfo(const std::string& name)
+ void Interpreter::Debug(const std::string& name)
{
if ((name.length()==2)&&(name[0]=='-'))
{
- if (name[1]=='S')
+ if (name[1]=='D')
{
bbtk::StaticInitTime::PrintObjectListInfo = true;
}