]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkInterpreter.cxx
Fixed crash with Interpreter without WxConsole (case of RUN button of WxBrowser)
[bbtk.git] / kernel / src / bbtkInterpreter.cxx
index 7a7e08b47b0c25fd9827e64d4a6c0b2995808f85..d791462c9464d2a338f819fd01317aada1a88b8b 100644 (file)
@@ -3,8 +3,8 @@
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
   Program:   bbtk
   Module:    $RCSfile: bbtkInterpreter.cxx,v $ $
   Language:  C++
-  Date:      $Date: 2008/02/14 20:26:54 $
-  Version:   $Revision: 1.32 $
+  Date:      $Date: 2008/03/11 12:27:21 $
+  Version:   $Revision: 1.43 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -26,6 +26,7 @@
 #include "bbtkWxConsole.h"
 #include "bbtkUtilities.h"
 #include <sys/stat.h>
 #include "bbtkWxConsole.h"
 #include "bbtkUtilities.h"
 #include <sys/stat.h>
+#include <algorithm>
 #ifdef CMAKE_HAVE_TERMIOS_H
 #include <termios.h>
 #define BBTK_USE_TERMIOS_BASED_PROMPT
 #ifdef CMAKE_HAVE_TERMIOS_H
 #include <termios.h>
 #define BBTK_USE_TERMIOS_BASED_PROMPT
@@ -36,7 +37,7 @@
 namespace bbtk
 {
 
 namespace bbtk
 {
 
-Interpreter* Interpreter::mGlobalInterpreter = NULL;
+  //Interpreter* Interpreter::mGlobalInterpreter = NULL;
 
  //=======================================================================
  /**
 
  //=======================================================================
  /**
@@ -44,15 +45,17 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL;
    */
   Interpreter::Interpreter() 
     :
    */
   Interpreter::Interpreter() 
     :
+#ifdef _USE_WXWIDGETS_
+    mWxConsole(0),
+#endif
     mCommandLine(false)
   {
     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("Interpreter","Messages of the interpreter",0);
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::Interpreter()" <<std::endl);
  
     mCommandLine(false)
   {
     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("Interpreter","Messages of the interpreter",0);
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::Interpreter()" <<std::endl);
  
-    mGlobalInterpreter = this;
-
     mExecuter = new bbtk::Executer();
     mExecuter = new bbtk::Executer();
+    mExecuter->SetInterpreter(this);
     
     // For the time being, comment out previous line, and
     // uncomment next line to check Transcriptor
     
     // For the time being, comment out previous line, and
     // uncomment next line to check Transcriptor
@@ -171,8 +174,8 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL;
     info.argmax = 2;
     info.code = cIndex;
 
     info.argmax = 2;
     info.code = cIndex;
 
-    info.syntax = "index [<filename> ['Initials'(default)|'Packages'|'Categories']]";
-    info.help = "Creates an html index of known boxes. If filename is provided then save it to the file 'filename'. The default index entries are the initial letters of the names of the boxes. If 'Packages' or 'Categories' is provided then the entries are either the packages names or the categories";
+    info.syntax = "index [<filename> ['Initials'(default)|'Packages'|'Categories'|'Adaptors']]";
+    info.help = "Creates an html index of known boxes. If filename is provided then save it to the file 'filename'. The default index entries are the initial letters of the names of the boxes. If 'Packages' or 'Categories' is provided then the entries are either the packages names or the categories. If 'Adaptors' is provided then an alphabetical index of all adaptors is created.";
     mCommandDict[info.category] = info;
 
     info.category = "reset";  //EED
     mCommandDict[info.category] = info;
 
     info.category = "reset";  //EED
@@ -286,9 +289,10 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL;
    */
   Interpreter::~Interpreter()
   {
    */
   Interpreter::~Interpreter()
   {
+
+std::cout << "=========================================~Interpreter()" << std::endl;
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::~Interpreter()" <<std::endl);
     delete mExecuter;
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::~Interpreter()" <<std::endl);
     delete mExecuter;
-    //delete mFactory;
 
     bbtkDebugDecTab("Interpreter",9);
   }
 
     bbtkDebugDecTab("Interpreter",9);
   }
@@ -299,8 +303,7 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL;
   /**
    *  
    */
   /**
    *  
    */
-  void Interpreter::InterpretFile( const std::string& filename,  
-                                   bool use_configuration_file)
+  void Interpreter::InterpretFile( const std::string& filename )
   {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
 
   {
     bbtkDebugMessageInc("Interpreter",9,"Interpreter::InterpretFile(\""<<filename<<"\")"<<std::endl);
 
@@ -309,17 +312,25 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL;
 
     try 
     {
 
     try 
     {
-      SwitchToFile(filename, use_configuration_file);
+      SwitchToFile(filename);
+      /*
+      printf("EED Interpreter::InterpretFile 0001\n" );
+int ii,ssize = mFileName.size();
+for (ii=0;ii<ssize;ii++)
+{
+       printf("EED RRR Interpreter::InterpretFile %s\n", mFileName[ii].c_str() );
+}
+      */
       bool insideComment = false; // for multiline comment
       while (mFile.size()>0) 
       {
       bool insideComment = false; // for multiline comment
       while (mFile.size()>0) 
       {
+       //printf("EED --- %s --- Interpreter::InterpretFile \n", mFileName[0].c_str() );
          while ((mFile.size()>0) && 
                 (!mFile.back()->eof()))
          {
             mLine.back()++;
             char buf[500];
             mFile.back()->getline(buf,500);
          while ((mFile.size()>0) && 
                 (!mFile.back()->eof()))
          {
             mLine.back()++;
             char buf[500];
             mFile.back()->getline(buf,500);
-      
             std::string str(buf);
             int size=str.length();
             if ( str[ size-1 ]==13  )
             std::string str(buf);
             int size=str.length();
             if ( str[ size-1 ]==13  )
@@ -328,6 +339,7 @@ Interpreter* Interpreter::mGlobalInterpreter = NULL;
             }
       
             InterpretLine(str, insideComment);
             }
       
             InterpretLine(str, insideComment);
+           //printf("EED Interpreter::InterpretFile %s\n", str.c_str() );
          }
         //if (mFile.size()>0) 
         CloseCurrentFile();
          }
         //if (mFile.size()>0) 
         CloseCurrentFile();
@@ -483,7 +495,7 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
         break;
 
       case cPrint :
         break;
 
       case cPrint :
-        Print(words[1]); /// \todo use mExecuter 
+        Print(words[1]); /// \todo use generate command 
         break;
         
       case cExec :
         break;
         
       case cExec :
@@ -562,25 +574,25 @@ void Interpreter::InterpretLine( const std::string& line, bool &insideComment )
       case cInclude :
         if (mCommandLine)
         {
       case cInclude :
         if (mCommandLine)
         {
-           InterpretFile(words[1], true ); // true : better pass use_config_file
+           InterpretFile(words[1]); 
         }
         else
         {
         }
         else
         {
-            SwitchToFile(words[1], true ); // true : better pass use_config_file
+            SwitchToFile(words[1]);
         }
        // if 'source' was given
        if (words.size()==3) 
          {
         }
        // if 'source' was given
        if (words.size()==3) 
          {
-           this->mExecuter->SetCurrentFileName(words[1]);
+           GetExecuter()->SetCurrentFileName(words[1]);
          }
         break;
 
       case cLoad:
          }
         break;
 
       case cLoad:
-        LoadPackage(words[1], true ); // true : better pass use_config_file
+        GetExecuter()->GetFactory()->LoadPackage(words[1]);
         break;
 
       case cUnload:
         break;
 
       case cUnload:
-        UnLoadPackage(words[1]);
+        GetExecuter()->GetFactory()->UnLoadPackage(words[1]);
         break;
 
       case cQuit :
         break;
 
       case cQuit :
@@ -674,7 +686,15 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
   {
     if (mExecuter->GetNoExecMode()) return;
 
   {
     if (mExecuter->GetNoExecMode()) return;
 
-    bbtkDebugMessageInc("Interpreter",9,"Interpreter::SplitLine(\""<<str<<"\")"<<std::endl);
+    bbtkDebugMessageInc("Interpreter",9,"Interpreter::Print(\""<<str<<"\")"<<std::endl);
+
+ // TO DO :
+ // InterpretLine ("load std")
+ // InterpretLine("new ConcatStrings _C_ ") -> trouver un nom unique : # commande 
+ // InterpretLine("new Print _P_") 
+ // InterpretLine("connect _C_.Out _P_.In")
+ // int num = 1
 
     std::vector<std::string> chains;
     std::string delimiters("$");
 
     std::vector<std::string> chains;
     std::string delimiters("$");
@@ -693,14 +713,21 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
        {
           // Found a text token, add it to the vector.
           chains.push_back(str.substr(lastPos, pos - lastPos));
        {
           // Found a text token, add it to the vector.
           chains.push_back(str.substr(lastPos, pos - lastPos));
+ // std::string token = str.substr(lastPos, pos - lastPos)
+ // InterpretLine("set _C_.In%num% %token%")
        }
        else 
        {
        }
        else 
        {
+
        // is an output (between $$) : decode 
          std::string tok,box,output;
          tok = str.substr(lastPos, pos - lastPos);
          Utilities::SplitAroundFirstDot(tok,box,output);
          chains.push_back( mExecuter->Get(box,output) );
        // is an output (between $$) : decode 
          std::string tok,box,output;
          tok = str.substr(lastPos, pos - lastPos);
          Utilities::SplitAroundFirstDot(tok,box,output);
          chains.push_back( mExecuter->Get(box,output) );
+
+// InterpretLine("connect %tok% _C_.In%num%") 
+
        }
         // Skip delimiters.  Note the "not_of"
        lastPos = str.find_first_not_of(delimiters, pos);
        }
         // Skip delimiters.  Note the "not_of"
        lastPos = str.find_first_not_of(delimiters, pos);
@@ -708,7 +735,11 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
        pos = str.find_first_of(delimiters, lastPos);
     //
        is_text = !is_text;
        pos = str.find_first_of(delimiters, lastPos);
     //
        is_text = !is_text;
+// num ++;
      }
      }
+// InterpretLine("exec _P_")
+// if (IS_IN_WORKSPACE) InterpretLine("delete _C_; delete _P_");
+
      std::vector<std::string>::iterator i;
      for (i= chains.begin(); i!=chains.end(); ++i) 
      {
      std::vector<std::string>::iterator i;
      for (i= chains.begin(); i!=chains.end(); ++i) 
      {
@@ -727,8 +758,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
 
 // ===================================================================================
 
 
 // ===================================================================================
 
-  void Interpreter::SwitchToFile( const std::string& name,
-                                  bool use_configuration_file )
+  void Interpreter::SwitchToFile( const std::string& name )
   {
   // Note : in the following :
   // name : the user supplied name 
   {
   // Note : in the following :
   // name : the user supplied name 
@@ -748,16 +778,14 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
     std::string pkgname;             // e.g. <scriptname>.bbs
     std::vector<std::string> Filenames;
 
     std::string pkgname;             // e.g. <scriptname>.bbs
     std::vector<std::string> Filenames;
 
-    if (use_configuration_file)
-    {
-        // The following is *NOT* a debug time message :
-        // It's a user intended message.
-        // Please don't remove it.
-      bbtkMessage("Interpreter",1,
-                 "look for : [" << name
-                 << "] (use_configuration_file == TRUE)" << std::endl);
-      script_paths = ConfigurationFile::GetInstance().Get_bbs_paths();
-    }
+    // The following is *NOT* a debug time message :
+    // It's a user intended message.
+    // Please don't remove it.
+    bbtkMessage("Interpreter",1,
+               "look for : [" << name
+                 << "]" << std::endl);
+    script_paths = ConfigurationFile::GetInstance().Get_bbs_paths();
+
     std::string upath;
     pkgname = Utilities::ExtractScriptName(name,upath);
 
     std::string upath;
     pkgname = Utilities::ExtractScriptName(name,upath);
 
@@ -776,7 +804,11 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
         {
            if ((*i).substr((*i).size()-4, 4) != ".bbs")
               continue;      // ignore non .bbs files
         {
            if ((*i).substr((*i).size()-4, 4) != ".bbs")
               continue;      // ignore non .bbs files
-           LoadScript(*i,name);
+          std::string command("include ");
+          command += *i;
+          //  LoadScript(*i,name);
+          bool tmp;
+          InterpretLine(command,tmp);
            nbBssFiles++;
         }
         if (nbBssFiles==0)
            nbBssFiles++;
         }
         if (nbBssFiles==0)
@@ -789,7 +821,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
       std::string path;
       std::vector<std::string>::iterator i;
       std::string fullDirectoryName;
       std::string path;
       std::vector<std::string>::iterator i;
       std::string fullDirectoryName;
-      for (i=script_paths.begin();i!=script_paths.end();++i)// ==== relative name, iterate + load all .bbs files
+      for (i=script_paths.begin();i!=script_paths.end();i++)// ==== relative name, iterate + load all .bbs files
       {
         path = *i;
 
       {
         path = *i;
 
@@ -803,8 +835,12 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
 
         fullDirectoryName = Utilities::MakePkgnameFromPath(path, upath, false);
 
 
         fullDirectoryName = Utilities::MakePkgnameFromPath(path, upath, false);
 
+        //EED 18 Fev 2008
+        // without last slash "\"
+        std::string fullDirectoryNameClean = fullDirectoryName.substr(0,fullDirectoryName.size()-1);
+
       // Check if library exists
       // Check if library exists
-        if ( ! Utilities::IsDirectory(fullDirectoryName) )
+        if ( ! Utilities::IsDirectory( fullDirectoryNameClean ) )
         {
         // The following is *NOT* a debug time message :
         // It's a user intended message.
         {
         // The following is *NOT* a debug time message :
         // It's a user intended message.
@@ -815,16 +851,20 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
         }
         foundFile = true;
 
         }
         foundFile = true;
 
-
+               Filenames.clear();
         int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames);
 
         nbBssFiles = 0;
         for (std::vector<std::string>::iterator i = Filenames.begin(); i!= Filenames.end(); ++i)
         {
         int nbFiles = Utilities::Explore(fullDirectoryName, false, Filenames);
 
         nbBssFiles = 0;
         for (std::vector<std::string>::iterator i = Filenames.begin(); i!= Filenames.end(); ++i)
         {
-
+//EEDprintf("EED Interpreter::SwitchToFile %s\n",(*i).c_str() );
            if ((*i).substr((*i).size()-4, 4) != ".bbs")
               continue;      // ignore non .bbs files
            if ((*i).substr((*i).size()-4, 4) != ".bbs")
               continue;      // ignore non .bbs files
-           LoadScript(*i,name);
+          std::string command("include ");
+          command += *i;
+          bool tmp;
+          InterpretLine(command,tmp);
+          //           LoadScript(*i,name);
            nbBssFiles++;
         }
         if (nbBssFiles==0)
            nbBssFiles++;
         }
         if (nbBssFiles==0)
@@ -942,9 +982,25 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
   void Interpreter::LoadScript( std::string fullPathScriptName,
                                std::string includeScriptName)
   {
   void Interpreter::LoadScript( std::string fullPathScriptName,
                                std::string includeScriptName)
   {
-    if (find(mFileName.begin(),mFileName.end(),fullPathScriptName)
-       !=mFileName.end()) 
+//EED printf("EED Interpreter::LoadScript >>01\n");
+       Utilities::replace( fullPathScriptName , INVALID_FILE_SEPARATOR , VALID_FILE_SEPARATOR);
+
+       bool okScriptExist=false;
+       int iStrScript,sizeVecStricpt=mFileName.size();
+       for ( iStrScript=0;iStrScript<sizeVecStricpt;iStrScript++)
+       {
+//EED printf("  EED %d Interpreter::LoadScript %s __>>__ %s\n", iStrScript,mFileName[iStrScript].c_str(),fullPathScriptName.c_str() );
+               if (mFileName[iStrScript] == fullPathScriptName )
+               {
+                 //                    printf("  EED %d Interpreter::LoadScript iguales\n",iStrScript ); 
+                       okScriptExist=true;
+               } // if
+       } // for
+
+    if (find(mFileName.begin(),mFileName.end(),fullPathScriptName)!=mFileName.end()) 
+//    if (okScriptExist==true) 
       {
       {
+//EED printf("EED Interpreter::LoadScript Exit method\n");
        bbtkMessage("Interpreter",1,"file '"<<fullPathScriptName
                    <<"' already open : I do not open it once more to prevent recursive inclusion"<<std::endl);
        return;
        bbtkMessage("Interpreter",1,"file '"<<fullPathScriptName
                    <<"' already open : I do not open it once more to prevent recursive inclusion"<<std::endl);
        return;
@@ -966,6 +1022,7 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
     mFileName.push_back(fullPathScriptName);
     mIncludeFileName.push_back(includeScriptName);
     mLine.push_back(0);
     mFileName.push_back(fullPathScriptName);
     mIncludeFileName.push_back(includeScriptName);
     mLine.push_back(0);
+//EED printf("EED Interpreter::LoadScript >>02\n");
     return;
   }
 
     return;
   }
 
@@ -984,15 +1041,23 @@ void Interpreter::SplitLine ( const std::string& str, std::vector<std::string>&
       return;
     }
 
       return;
     }
 
+    bbtkDebugMessage("Interpreter",9," Closing file '"<<mFileName.back()<<"'"<<std::endl);
     mFile.back()->close();
     delete mFile.back();
     mFile.pop_back();
     mFile.back()->close();
     delete mFile.back();
     mFile.pop_back();
-    bbtkDebugMessage("Interpreter",9,
-                     " Closing file '"<<mFileName.back()<<"'"<<std::endl);
-
     mFileName.pop_back();
     mIncludeFileName.pop_back();
     mFileName.pop_back();
     mIncludeFileName.pop_back();
-    mLine.pop_back();
+       mLine.pop_back();
+/*EED3
+       bbtkDebugMessage("Interpreter",9," Closing file '"<<mFileName[0]<<"'"<<std::endl);
+       mFile[0]->close();
+    delete mFile[0];
+    mFile.erase( mFile.begin() );
+       mFileName.erase( mFileName.begin() );
+    mIncludeFileName.erase( mIncludeFileName.begin() );
+    mLine.erase( mLine.begin() );
+*/
+
     bbtkDebugMessage("Interpreter",9," Remains "
                      <<mFile.size()
                      <<" open"<<std::endl);
     bbtkDebugMessage("Interpreter",9," Remains "
                      <<mFile.size()
                      <<" open"<<std::endl);
@@ -1072,7 +1137,7 @@ void Interpreter::Help(const std::vector<std::string>& words)
     {
       if (words[1]=="packages") 
       {
     {
       if (words[1]=="packages") 
       {
-         PrintPackages(true);
+         GetExecuter()->GetFactory()->PrintPackages(true);
          return;
       }
       try 
          return;
       }
       try 
@@ -1083,16 +1148,16 @@ void Interpreter::Help(const std::vector<std::string>& words)
       {
          try 
          {
       {
          try 
          {
-            HelpPackage(words[1]);
+            GetExecuter()->GetFactory()->HelpPackage(words[1]);
 #ifdef _USE_WXWIDGETS_
 #ifdef _USE_WXWIDGETS_
-           if ( WxConsole::GetInstance() != 0 )
+           if ( mWxConsole != 0 )
              {
                std::string url = 
                  ConfigurationFile::GetInstance().Get_doc_path();
                url += "/bbdoc/" + words[1] + "/index.html";
                if (Utilities::FileExists(url)) 
                  {
              {
                std::string url = 
                  ConfigurationFile::GetInstance().Get_doc_path();
                url += "/bbdoc/" + words[1] + "/index.html";
                if (Utilities::FileExists(url)) 
                  {
-                   WxConsole::GetInstance()->ShowHtmlPage(url);
+                   mWxConsole->ShowHtmlPage(url);
                  }
              }
 #endif     
                  }
              }
 #endif     
@@ -1102,9 +1167,9 @@ void Interpreter::Help(const std::vector<std::string>& words)
             try 
             {
              std::string package;
             try 
             {
              std::string package;
-             HelpBlackBox(words[1],package);
+             GetExecuter()->GetFactory()->HelpBlackBox(words[1],package);
 #ifdef _USE_WXWIDGETS_
 #ifdef _USE_WXWIDGETS_
-              if ( WxConsole::GetInstance() != 0 )
+              if ( mWxConsole != 0 )
                 {
                   std::string url = 
                     ConfigurationFile::GetInstance().Get_doc_path();
                 {
                   std::string url = 
                     ConfigurationFile::GetInstance().Get_doc_path();
@@ -1112,7 +1177,7 @@ void Interpreter::Help(const std::vector<std::string>& words)
                   if (Utilities::FileExists(url))
                     {
                       url += "#" + words[1];
                   if (Utilities::FileExists(url))
                     {
                       url += "#" + words[1];
-                      WxConsole::GetInstance()->ShowHtmlPage(url);
+                      mWxConsole->ShowHtmlPage(url);
                     }
                 }
 #endif
                     }
                 }
 #endif
@@ -1121,7 +1186,7 @@ void Interpreter::Help(const std::vector<std::string>& words)
              {
                try
                  {
              {
                try
                  {
-                   this->mExecuter->ShowRelations(words[1],"0","9999");
+                   GetExecuter()->ShowRelations(words[1],"0","9999");
                  }
                catch (bbtk::Exception h){
                  bbtkError("\""<<words[1].c_str()
                  }
                catch (bbtk::Exception h){
                  bbtkError("\""<<words[1].c_str()
@@ -1137,12 +1202,12 @@ void Interpreter::Help(const std::vector<std::string>& words)
       {
          if ( words[1]=="packages" )
          {
       {
          if ( words[1]=="packages" )
          {
-            PrintPackages(true,true);
+            GetExecuter()->GetFactory()->PrintPackages(true,true);
             return;
           }
          try 
          {
             return;
           }
          try 
          {
-            HelpPackage(words[1],true);
+            GetExecuter()->GetFactory()->HelpPackage(words[1],true);
          }
          catch (bbtk::Exception f) 
          {
          }
          catch (bbtk::Exception f) 
          {
@@ -1510,7 +1575,7 @@ void Interpreter::Graph(const std::vector<std::string>& words)
     bool system_display = true;
 
 #ifdef _USE_WXWIDGETS_
     bool system_display = true;
 
 #ifdef _USE_WXWIDGETS_
-    if ( WxConsole::GetInstance() != 0 ) system_display = false; 
+    if ( mWxConsole != 0 ) system_display = false; 
 #endif
  
     if (words.size()==1) 
 #endif
  
     if (words.size()==1) 
@@ -1543,8 +1608,8 @@ void Interpreter::Graph(const std::vector<std::string>& words)
       } 
     
 #ifdef _USE_WXWIDGETS_
       } 
     
 #ifdef _USE_WXWIDGETS_
-    if ( WxConsole::GetInstance() != 0 )
-      WxConsole::GetInstance()->ShowHtmlPage(page);
+    if ( mWxConsole != 0 )
+      mWxConsole->ShowHtmlPage(page);
 #endif
   }
 //=======================================================================
 #endif
   }
 //=======================================================================
@@ -1558,8 +1623,9 @@ void  Interpreter::Index(const std::string& filename,
   if (type=="Initials") t = Factory::Initials;
   else if (type=="Categories") t = Factory::Categories;
   else if (type=="Packages") t = Factory::Packages;
   if (type=="Initials") t = Factory::Initials;
   else if (type=="Categories") t = Factory::Categories;
   else if (type=="Packages") t = Factory::Packages;
+  else if (type=="Adaptors") t = Factory::Adaptors;
   
   
-  GetGlobalFactory()->CreateHtmlIndex(t,filename);
+  GetExecuter()->GetFactory()->CreateHtmlIndex(t,filename);
 }
 //=======================================================================
 
 }
 //=======================================================================