]> Creatis software - bbtk.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Tue, 22 Apr 2008 09:40:10 +0000 (09:40 +0000)
committerguigues <guigues>
Tue, 22 Apr 2008 09:40:10 +0000 (09:40 +0000)
kernel/src/bbtkExecuter.cxx
kernel/src/bbtkExecuter.h
kernel/src/bbtkInterpreter.cxx
kernel/src/bbtkInterpreter.h
packages/wx/bbs/appli/ExampleGUI1.bbs [new file with mode: 0644]

index ee60d2e992e98ea035c9615581be167c7e39777b..9fa297fef97255169453154daae0800cf02c359c 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkExecuter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/22 06:59:31 $
-  Version:   $Revision: 1.19 $
+  Date:      $Date: 2008/04/22 09:40:10 $
+  Version:   $Revision: 1.20 $
 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -206,7 +206,7 @@ namespace bbtk
   void Executer::EndDefine ()
   {
     bbtkDebugMessageInc("Kernel",9,"Executer::EndDefine(\""
-                        <<Current()->GetTypeName()<<"\")" 
+                        <<GetCurrentDescriptor()->GetTypeName()<<"\")" 
                         <<std::endl);
     // Does current package exist ?
     Package::Pointer p;
@@ -231,7 +231,7 @@ namespace bbtk
       {
        p = mOpenPackage.back().lock();
       }
-    p->RegisterBlackBox(Current());
+    p->RegisterBlackBox(GetCurrentDescriptor());
     
     mOpenDefinition.pop_back();
   }
@@ -242,23 +242,23 @@ namespace bbtk
   {
     if (kind=="ADAPTOR")
       {
-       Current()->AddToCategory("adaptor");
-       Current()->SetKind(bbtk::BlackBoxDescriptor::ADAPTOR);
+       GetCurrentDescriptor()->AddToCategory("adaptor");
+       GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::ADAPTOR);
       }
     else if (kind=="DEFAULT_ADAPTOR")
       {
-       Current()->AddToCategory("adaptor");
-       Current()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR);
+       GetCurrentDescriptor()->AddToCategory("adaptor");
+       GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_ADAPTOR);
       }
     if (kind=="GUI")
       {
-       Current()->AddToCategory("gui");
-       Current()->SetKind(bbtk::BlackBoxDescriptor::GUI);
+       GetCurrentDescriptor()->AddToCategory("gui");
+       GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::GUI);
       }
     else if (kind=="DEFAULT_GUI")
       {
-       Current()->AddToCategory("gui");
-       Current()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_GUI);
+       GetCurrentDescriptor()->AddToCategory("gui");
+       GetCurrentDescriptor()->SetKind(bbtk::BlackBoxDescriptor::DEFAULT_GUI);
       }
     else
       {
@@ -273,14 +273,14 @@ namespace bbtk
   void Executer::Create ( const std::string& nodeType, 
                           const std::string& nodeName)
   {
-     Current()->Add(nodeType,nodeName);
+     GetCurrentDescriptor()->Add(nodeType,nodeName);
   }
   //=======================================================================
 
   //=======================================================================
   void Executer::Destroy(const std::string &boxName)
   {
-    Current()->Remove(boxName,true);
+    GetCurrentDescriptor()->Remove(boxName,true);
   }
   //=======================================================================
 
@@ -290,7 +290,7 @@ namespace bbtk
                           const std::string &nodeTo, 
                           const std::string &inputLabel)
   {
-    Current()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
+    GetCurrentDescriptor()->Connect(nodeFrom, outputLabel, nodeTo, inputLabel);
   }
   //=======================================================================
 
@@ -298,16 +298,16 @@ namespace bbtk
   void Executer::Execute (const std::string &nodeName) 
   {
     // if in root
-    if (Current()==GetWorkspace()) 
+    if (GetCurrentDescriptor()==GetWorkspace()) 
      {
         if (!mNoExecMode) 
         {
-           Current()->GetPrototype()->bbGetBlackBox(nodeName)->bbExecute(true);
+           GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(nodeName)->bbExecute(true);
         }
      }
      else 
      {
-        Current()->AddToExecutionList(nodeName) ;
+        GetCurrentDescriptor()->AddToExecutionList(nodeName) ;
      }
   }
   //=======================================================================
@@ -319,7 +319,7 @@ namespace bbtk
                                const std::string& help)
   {
     // If the input is defined in the Root box
-    if (Current()==GetWorkspace()) 
+    if (GetCurrentDescriptor()==GetWorkspace()) 
       {
       // If the dialog mode is set to NoDialog
       // and the user passed the name in the Inputs map 
@@ -361,7 +361,7 @@ namespace bbtk
 #endif
     }
 
-    Current()->DefineInput(name,box,input,help);
+    GetCurrentDescriptor()->DefineInput(name,box,input,help);
 
   }
   //=======================================================================
@@ -372,7 +372,7 @@ namespace bbtk
                                  const std::string &output,
                                  const std::string& help)
   {
-    Current()->DefineOutput(name,box,output,help);
+    GetCurrentDescriptor()->DefineOutput(name,box,output,help);
   }
   //=======================================================================
 
@@ -381,7 +381,7 @@ namespace bbtk
                       const std::string &input,
                       const std::string &value)
   {
-    BlackBox::Pointer b = Current()->GetPrototype()->bbGetBlackBox(box);
+    BlackBox::Pointer b = GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(box);
     // Looks for the adaptor
 
     if ( b->bbGetInputType(input) !=  typeid(std::string) ) 
@@ -414,7 +414,7 @@ namespace bbtk
   std::string Executer::Get(const std::string &box,
                             const std::string &output)
   {
-    BlackBox::Pointer b = Current()->GetPrototype()->bbGetBlackBox(box);
+    BlackBox::Pointer b = GetCurrentDescriptor()->GetPrototype()->bbGetBlackBox(box);
     // Looks for the adaptor
     if (b->bbGetOutputType(output) != typeid(std::string)) 
       {
@@ -457,21 +457,21 @@ namespace bbtk
   //=======================================================================
   void Executer::Author(const std::string &authorName)
   {
-    Current()->AddToAuthor(authorName,Current()==GetWorkspace());
+    GetCurrentDescriptor()->AddToAuthor(authorName,GetCurrentDescriptor()==GetWorkspace());
   }
   //=======================================================================
 
   //=======================================================================
   void Executer::Category(const std::string &category)
   {
-    Current()->AddToCategory(category,Current()==GetWorkspace());
+    GetCurrentDescriptor()->AddToCategory(category,GetCurrentDescriptor()==GetWorkspace());
   }
   //=======================================================================
 
   //=======================================================================
   void Executer::Description(const std::string &d)
   {
-    Current()->AddToDescription(d,Current()==GetWorkspace());
+    GetCurrentDescriptor()->AddToDescription(d,GetCurrentDescriptor()==GetWorkspace());
   }
   //=======================================================================
 
@@ -480,8 +480,8 @@ namespace bbtk
   void Executer::PrintBoxes()
   {
     bbtkMessageInc("Help",1,"The black box descriptor \""
-                   <<Current()->GetTypeName()<<"\" contains : "<<std::endl);
-    Current()->PrintBlackBoxes();
+                   <<GetCurrentDescriptor()->GetTypeName()<<"\" contains : "<<std::endl);
+    GetCurrentDescriptor()->PrintBlackBoxes();
     bbtkDecTab("Help",1);
  }
   //=======================================================================
@@ -565,11 +565,11 @@ namespace bbtk
     BlackBox::Pointer blackbox;
     if (nameblackbox==".")
     {
-       blackbox = Current()->GetPrototype();
+       blackbox = GetCurrentDescriptor()->GetPrototype();
     }
     else
     {
-       blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox);
+       blackbox = GetCurrentDescriptor()->GetPrototype()->bbFindBlackBox(nameblackbox);
     }
     
     std::string page;
@@ -640,11 +640,11 @@ namespace bbtk
     BlackBox::Pointer blackbox;
     if (nameblackbox.compare(".")==0)
       {
-       blackbox=Current()->GetPrototype();
+       blackbox=GetCurrentDescriptor()->GetPrototype();
       } 
     else 
       {
-       blackbox = Current()->GetPrototype()->bbFindBlackBox(nameblackbox);
+       blackbox = GetCurrentDescriptor()->GetPrototype()->bbFindBlackBox(nameblackbox);
       }
     
     if (blackbox)
@@ -681,8 +681,8 @@ namespace bbtk
   ///
   void Executer::Print(const std::string &str)
   {  
-    if (GetNoExecMode() &&  (Current()==GetWorkspace()) ) return;
-    if (Current()!=GetWorkspace()) return;
+    if (GetNoExecMode() &&  (GetCurrentDescriptor()==GetWorkspace()) ) return;
+    if (GetCurrentDescriptor()!=GetWorkspace()) return;
 
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::Print(\""<<str<<"\")"<<std::endl);
 
@@ -741,7 +741,6 @@ namespace bbtk
     std::vector<std::string>::iterator i;
     for (i= chains.begin(); i!=chains.end(); ++i) 
       {
-       //  bbtkMessage("Echo",1,*i);
        Utilities::SubsBackslashN(*i);
        bbtkMessage("Output",1,*i);
       }
index 1e59b2c488e8e248d53676084726f8f3765ccf22..fc177e254bccff63993aab000714051de0cebccc 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkExecuter.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/18 12:59:15 $
-  Version:   $Revision: 1.13 $
+  Date:      $Date: 2008/04/22 09:40:10 $
+  Version:   $Revision: 1.14 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -186,13 +186,15 @@ namespace bbtk
     Package::Pointer GetUserPackage() 
     { return mRootPackage.lock(); }
 
+    /// Gets the current working black box 
+    ComplexBlackBoxDescriptor::Pointer GetCurrentDescriptor() 
+    { return mOpenDefinition.back().box; }
+    
+
   protected:
 
   private:
 
-    /// Gets the current working black box 
-    ComplexBlackBoxDescriptor::Pointer Current() 
-    { return mOpenDefinition.back().box; }
     
     /// Returns true when we are inside a define/endefine block
     //    bool InDefinitionBlock() { return (mOpenDefinition.size()>1); }
index 850784a8443909b112ddc4481cd87b8f7ed7e186..ef99c10124102b0eff4ff7487f1687dbadd26b44 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/22 08:29:09 $
-  Version:   $Revision: 1.62 $
+  Date:      $Date: 2008/04/22 09:40:10 $
+  Version:   $Revision: 1.63 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -56,26 +56,28 @@ namespace bbtk
   {
 
     bufferNb =0;  
-    bbtk::MessageManager::RegisterMessageType("Echo","Level>0 : Prints the 'echo' commands of the user.\n\tLevel>1 : Prints the command being interpreted",1);
+    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)
       {
-       mExecuter = boost::static_pointer_cast<VirtualExec>(bbtk::Transcriptor::New(cpp_file));
+       mVirtualExecuter = boost::static_pointer_cast<VirtualExec>(bbtk::Transcriptor::New(cpp_file));
       }
     else 
       {
-       mExecuter = boost::static_pointer_cast<VirtualExec>(bbtk::Executer::New());
+       bbtk::Executer::Pointer exe = bbtk::Executer::New();
+       mRealExecuter = exe;
+       mVirtualExecuter = boost::static_pointer_cast<VirtualExec>(exe);
       }
 
     // Lock this pointer or will auto-destruct !!
-    mExecuter->SetInterpreter(MakePointer(this,true));
+    mVirtualExecuter->SetInterpreter(MakePointer(this,true));
     
     // For the time being, comment out previous line, and
     // uncomment next line to check Transcriptor
 
-    //mExecuter = new bbtk::Transcriptor("GeneratedProgram.txt");
+    //mVirtualExecuter = new bbtk::Transcriptor("GeneratedProgram.txt");
 
     // Builds the commands dict
     CommandInfoType info;
@@ -117,7 +119,7 @@ namespace bbtk
     info.argmax = 1;
     info.code = cPrint;
     info.syntax = "print <string>";
-    info.help = "Prints the string. Substitutes any token of the form '$box.output$' by the string adaptation of the output of the box (requires the right adaptor). No carriage return is issued at the end, use '\\n' to add carriage returns. The level of 'Echo' messages must be greater than 1 (see the command 'message').";
+    info.help = "Prints the string. Substitutes any token of the form '$box.output$' by the string adaptation of the output of the box (requires the right adaptor). No carriage return is issued at the end, use '\\n' to add carriage returns. The level of 'echo' messages must be greater than 1 (see the command 'message').";
     mCommandDict[info.keyword] = info;
 
     info.keyword = "exec";
@@ -329,7 +331,7 @@ namespace bbtk
   Interpreter::~Interpreter()
   {
     bbtkDebugMessageInc("Interpreter",9,"==> Interpreter::~Interpreter()" <<std::endl);
-    mExecuter = VirtualExec::Pointer();
+    mVirtualExecuter = VirtualExec::Pointer();
     bbtkDebugMessageInc("Interpreter",9,"<== Interpreter::~Interpreter()" <<std::endl);
   }
   //=======================================================================
@@ -627,7 +629,7 @@ namespace bbtk
 void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
 {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretLine(\""<<line<<"\")"<<std::endl);
-    bbtkMessage("Echo",2,line<<std::endl);
+    bbtkMessage("echo",2,line<<std::endl);
 
     std::vector<std::string> words;
     SplitLine(line,words);
@@ -689,25 +691,25 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
     switch (command.code) 
     {
       case cNew :
-        mExecuter->Create(words[1],words[2]);
+        mVirtualExecuter->Create(words[1],words[2]);
         break;
 
       case cDelete :
-       mExecuter->Destroy(words[1]);
+       mVirtualExecuter->Destroy(words[1]);
         break;
 
       case cConnect :
         Utilities::SplitAroundFirstDot(words[1],left,right);
         Utilities::SplitAroundFirstDot(words[2],left2,right2);      
-        mExecuter->Connect(left,right,left2,right2);
+        mVirtualExecuter->Connect(left,right,left2,right2);
         break;
 
       case cPackage :
-        mExecuter->BeginPackage(words[1]);
+        mVirtualExecuter->BeginPackage(words[1]);
         break;
 
       case cEndPackage :
-        mExecuter->EndPackage();
+        mVirtualExecuter->EndPackage();
         break;
 
       case cDefine :
@@ -717,52 +719,52 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
         }
         if (words.size()==2) 
         {
-           mExecuter->Define(words[1],"",filename);
+           mVirtualExecuter->Define(words[1],"",filename);
         }
         else
         {
-           mExecuter->Define(words[1],words[2],filename);
+           mVirtualExecuter->Define(words[1],words[2],filename);
         }
         break;
 
       case cEndDefine :
-        mExecuter->EndDefine();
+        mVirtualExecuter->EndDefine();
         break;
 
       case cKind :
-        mExecuter->Kind(words[1]);
+        mVirtualExecuter->Kind(words[1]);
         break;
 
       case cPrint :
-        mExecuter->Print(words[1]);
+        mVirtualExecuter->Print(words[1]);
         break;
         
       case cExec :
         if (words[1]=="freeze") 
-          mExecuter->SetNoExecMode(true);
+          mVirtualExecuter->SetNoExecMode(true);
         else if (words[1]=="unfreeze") 
-          mExecuter->SetNoExecMode(false);
+          mVirtualExecuter->SetNoExecMode(false);
         else
-          mExecuter->Execute(words[1]);
+          mVirtualExecuter->Execute(words[1]);
         break;
 
       case cInput :
         Utilities::SplitAroundFirstDot(words[2],left,right);
-        mExecuter->DefineInput(words[1],left,right,words[3]);
+        mVirtualExecuter->DefineInput(words[1],left,right,words[3]);
         break;
 
       case cOutput :
         Utilities::SplitAroundFirstDot(words[2],left,right);
-        mExecuter->DefineOutput(words[1],left,right,words[3]);
+        mVirtualExecuter->DefineOutput(words[1],left,right,words[3]);
         break;
 
       case cSet :
         Utilities::SplitAroundFirstDot(words[1],left,right);
-        mExecuter->Set(left,right,words[2]);
+        mVirtualExecuter->Set(left,right,words[2]);
         break;
 
       case cAuthor :
-        mExecuter->Author(words[1]);
+        mVirtualExecuter->Author(words[1]);
         break;
 
       case cNewGUI :
@@ -770,7 +772,7 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
         break;
 
       case cCategory :
-        mExecuter->Category(words[1]);
+        mVirtualExecuter->Category(words[1]);
         break;
 
       case cIndex :
@@ -783,7 +785,7 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
         break;
 
       case cDescription :
-        mExecuter->Description(words[1]);
+        mVirtualExecuter->Description(words[1]);
         break;
 
       case cHelp :
@@ -793,12 +795,12 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
       case cMessage : 
         if (words.size()<3)
         {
-         mExecuter->HelpMessages();
+         mVirtualExecuter->HelpMessages();
         }
         else
         {
          sscanf(words[2].c_str(),"%d",&level);
-          mExecuter->SetMessageLevel(words[1],level);
+          mVirtualExecuter->SetMessageLevel(words[1],level);
         }
         break;
 
@@ -850,12 +852,12 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
       case cWorkspace :
         if (words.size() == 2) 
         {
-           if (words[1]=="freeze")        mExecuter->SetNoExecMode(true);
-           else if (words[1]=="unfreeze") mExecuter->SetNoExecMode(false);
+           if (words[1]=="freeze")        mVirtualExecuter->SetNoExecMode(true);
+           else if (words[1]=="unfreeze") mVirtualExecuter->SetNoExecMode(false);
         }
         else
         {
-           mExecuter->SetWorkspaceName(words[2]);
+           mVirtualExecuter->SetWorkspaceName(words[2]);
         }
         break;
         */
@@ -914,7 +916,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
     // Cannot close all files if the reset command is read from a file !
     //    CloseAllFiles();
     mFileNameHistory.clear();
-    this->mExecuter->Reset();
+    this->mVirtualExecuter->Reset();
   }
   //=======================================================================
 
@@ -925,7 +927,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
   /*
   void Interpreter::Print( const std::string& str)
   {
-    if (mExecuter->GetNoExecMode()) return;
+    if (mVirtualExecuter->GetNoExecMode()) return;
 
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::Print(\""<<str<<"\")"<<std::endl);
 
@@ -965,7 +967,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
          std::string tok,box,output;
          tok = str.substr(lastPos, pos - lastPos);
          Utilities::SplitAroundFirstDot(tok,box,output);
-         chains.push_back( mExecuter->Get(box,output) );
+         chains.push_back( mVirtualExecuter->Get(box,output) );
 
 // InterpretLine("connect %tok% _C_.In%num%") 
 
@@ -984,7 +986,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
      std::vector<std::string>::iterator i;
      for (i= chains.begin(); i!=chains.end(); ++i) 
      {
-       //  bbtkMessage("Echo",1,*i);
+
        Utilities::SubsBackslashN(*i);
        std::cout << *i;
      }
@@ -1831,31 +1833,31 @@ void Interpreter::Graph(const std::vector<std::string>& words)
  
     if (words.size()==1) 
     {
-      page = mExecuter->ShowGraph(".","0","0","","","",system_display);
+      page = mVirtualExecuter->ShowGraph(".","0","0","","","",system_display);
     }
     else if (words.size()==2) 
     {
-      page = mExecuter->ShowGraph(words[1],"0","0","","","",system_display);
+      page = mVirtualExecuter->ShowGraph(words[1],"0","0","","","",system_display);
     }
     else if (words.size()==3) 
     {
-      page = mExecuter->ShowGraph(words[1],words[2],"0","","","",system_display);
+      page = mVirtualExecuter->ShowGraph(words[1],words[2],"0","","","",system_display);
     }
     else if (words.size()==4) 
     {
-      page = mExecuter->ShowGraph(words[1],words[2],words[3],"","","",system_display);
+      page = mVirtualExecuter->ShowGraph(words[1],words[2],words[3],"","","",system_display);
     } 
     else if (words.size()==5) 
     {
-      page = mExecuter->ShowGraph(words[1],words[2],words[3],words[4],"","",system_display);
+      page = mVirtualExecuter->ShowGraph(words[1],words[2],words[3],words[4],"","",system_display);
     } 
     else if (words.size()==6) 
     {
-      page = mExecuter->ShowGraph(words[1],words[2],words[3],words[4],words[5],"",system_display);
+      page = mVirtualExecuter->ShowGraph(words[1],words[2],words[3],words[4],words[5],"",system_display);
     } 
     else if (words.size()==7) 
       {
-       page = mExecuter->ShowGraph(words[1],words[2],words[3],words[4],words[5],words[6],system_display);
+       page = mVirtualExecuter->ShowGraph(words[1],words[2],words[3],words[4],words[5],words[6],system_display);
       } 
     
     if ( ( mUser != 0 ) && ( mUser->InterpreterUserHasOwnHtmlPageViewer() ) )
@@ -1884,6 +1886,11 @@ void  Interpreter::Index(const std::string& filename,
 void  Interpreter::NewGUI(const std::string& boxname,
                             const std::string& instanceName)
 {
+  if (mRealExecuter.expired())
+    {
+      bbtkError("command 'newgui' cannot be compiled yet");
+    }
+
   std::string typeName = instanceName+"Type";
   std::stringstream* s = new std::stringstream;
   // create the complex box
@@ -1904,16 +1911,17 @@ void  Interpreter::NewGUI(const std::string& boxname,
   // vector which stores the list of inputs of the box which must be connected
   std::vector<std::string> in;
  
-  Factory::Pointer F = mExecuter->GetFactory();
+  Factory::Pointer F = mVirtualExecuter->GetFactory();
   /*
   Package::Pointer user = F->GetPackage("user");
   */
-  ComplexBlackBoxDescriptor::Pointer workspace = mExecuter->GetWorkspace();
+  ComplexBlackBoxDescriptor::Pointer workspace = 
+    mRealExecuter.lock()->GetCurrentDescriptor();
 
   if (workspace==0)
     {
       delete s;
-      bbtkError("Interpreter::CreateGUI : could not access the executer workspace");
+      bbtkError("Interpreter::CreateGUI : could not access the executer currently defined complex box");
     }
  
 
@@ -2059,7 +2067,7 @@ void  Interpreter::NewGUI(const std::string& boxname,
          {
            //      int o = MessageManager::GetMessageLevel("debug");
            //      if (o<2) MessageManager::SetMessageLevel("debug",2);
-           mExecuter->GetFactory()->CheckPackages();
+           mVirtualExecuter->GetFactory()->CheckPackages();
            //      MessageManager::SetMessageLevel("debug",o);
          }
       }
@@ -2104,7 +2112,7 @@ size_t  Interpreter::GetObjectInternalSize() const
   {
     size_t s = Superclass::GetObjectRecursiveSize();
     s += Interpreter::GetObjectInternalSize();
-    s += mExecuter->GetObjectRecursiveSize();
+    s += mVirtualExecuter->GetObjectRecursiveSize();
     return s;
   }
   //==========================================================================
index 42db24dc637bda891c28aa9d8518f2b5f8f17104..483068bf8935c230eb008e9b08a5c6ef09941029 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.h,v $ $
   Language:  C++
-  Date:      $Date: 2008/04/22 08:29:09 $
-  Version:   $Revision: 1.27 $
+  Date:      $Date: 2008/04/22 09:40:11 $
+  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
@@ -28,6 +28,7 @@
 #define __bbtkInterpreter_h__
 
 #include "bbtkVirtualExec.h"
+#include "bbtkExecuter.h"
 
 #include <fstream>
 #include <deque>
@@ -116,17 +117,18 @@ namespace bbtk
     /// Sets the inputs of the workspace :
     /// the map is passed as is to the Executer
     void SetInputs(const std::map<std::string,std::string>& m)
-    { mExecuter->SetInputs(m); }
+    { mVirtualExecuter->SetInputs(m); }
 
     /// Puts the executer in "no exec" mode,
     /// which creates but does not execute pipelines.
-    void SetNoExecMode(bool b) { mExecuter->SetNoExecMode(b); }
+    void SetNoExecMode(bool b) { mVirtualExecuter->SetNoExecMode(b); }
 
     ///
     //typedef Executer::DialogModeType DialogModeType;
     typedef VirtualExec::DialogModeType DialogModeType;
 
-    void SetDialogMode(DialogModeType t) { mExecuter->SetDialogMode(t); }
+    void SetDialogMode(DialogModeType t) 
+    { mVirtualExecuter->SetDialogMode(t); }
 
     /// Sets the bool that indicates wether we are in command line context
     void SetCommandLine(bool v = true) { mCommandLine = v; }
@@ -144,7 +146,7 @@ namespace bbtk
 #endif
 
     /// Gets the Executer 
-    VirtualExec::Pointer GetExecuter() const { return mExecuter; }
+    VirtualExec::Pointer GetExecuter() const { return mVirtualExecuter; }
 
 
   protected:
@@ -281,7 +283,8 @@ namespace bbtk
     // ATTRIBUTES
 
     /// The command executer used
-    bbtk::VirtualExec::Pointer mExecuter;
+    bbtk::VirtualExec::Pointer mVirtualExecuter;
+    bbtk::Executer::WeakPointer mRealExecuter;
 
     /// The user of  the interpreter (0 if none)
     bbtk::InterpreterUser* mUser;
diff --git a/packages/wx/bbs/appli/ExampleGUI1.bbs b/packages/wx/bbs/appli/ExampleGUI1.bbs
new file mode 100644 (file)
index 0000000..0271ef8
--- /dev/null
@@ -0,0 +1,49 @@
+
+description "Example of automatic gui creation with bbi command 'newgui'"
+category "example"
+author "laurent.guigues@creatis.insa-lyon.fr"
+
+load std
+include wx
+
+# Create a Add box
+new Add a
+
+# Set the initial values of its inputs :
+# will be used to initialize the GUI
+set a.In1 10
+set a.In2 20
+
+# And create its GUI
+# create a GUI for box 'a' and call it 'ag'
+# this bbi macro inspects the box provided 
+# and define a complex box called agType
+# which contains the suitable GUI components 
+# for the box provided (see User's Guide for details)
+# an instance of 'agType' called 'ag' is then created
+# and its output are connected to the corresponding inputs of 'a'
+
+# setting "Echo" message level to 2 allow
+# to see which commands are generated by the macro 'newgui'
+message echo 2
+newgui a ag
+message echo 0
+
+# Define the properties of the window of the GUI box created
+set ag.WinTitle "Automatic GUI"
+set ag.WinWidth 400
+set ag.WinHeight 200
+
+
+# Output of the add box
+new OutputText out
+connect a.Out out.In
+set out.WinWidth 200
+set out.WinHeight 200
+
+# Connect changes of the GUI to the execution of the output 
+# to refresh the output each time the user interacts with the GUI
+connect ag.BoxChange out.BoxExecute
+
+# go
+exec out