]> Creatis software - bbtk.git/commitdiff
#2536 BBTK Feature New Normal wt-version Package
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 5 Aug 2015 12:40:02 +0000 (14:40 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 5 Aug 2015 12:40:02 +0000 (14:40 +0200)
kernel/appli/bbi/CMakeLists.txt
kernel/appli/bbi/bbi.cxx
kernel/src/bbtkConfigurationFile.cxx
kernel/src/bbtkExecuter.cxx
kernel/src/bbtkInterpreterVirtual.cxx
kernel/src/bbtkPackage.cxx
kernel/src/bbtkUtilities.cxx
kernel/src/bbtkUtilities.h
kernel/src/bbtkWtBlackBox.cxx
kernel/src/bbtkWtBlackBox.h

index 71b16c16dfef389ec05658bc56c7e815afefe60c..bfe73d59342910f3d9026f9249d3b94d0c64a295 100644 (file)
@@ -45,3 +45,15 @@ ENDIF(BBTK_USE_WXWIDGETS AND WIN32)
 
 TARGET_LINK_LIBRARIES(bbi bbtk)
 INSTALL_TARGETS(/bin/ bbi)
+
+SET(SOURCES
+  bbiWeb
+  )
+
+ADD_EXECUTABLE(bbiWeb.wt MACOSX_BUNDLE ${SOURCES})  
+TARGET_LINK_LIBRARIES(bbiWeb.wt bbtk)
+INSTALL_TARGETS(/bin/ bbiWeb.wt)
+
+
+
+
index c7bb3254b5c478b7c0201b0d5c04fa7899c57b0f..89a3daa305de477cb5ad38f819a1875e7758de05 100644 (file)
@@ -195,7 +195,7 @@ bool wxBBIApp::OnInit( )
 
 //Borrame
 //printf ("EED bbi wxBBIApp::OnInit .....................\n");
-cmd.input_file.push_back("/home/davila/Borrame/testwt.bbs");
+//cmd.input_file.push_back("/home/davila/Borrame/testwt.bbs");
 
 
   bbtk::WxGUIConsole *I = new bbtk::WxGUIConsole(0,_T("bbi"),wxSize(800,600));
@@ -206,9 +206,9 @@ cmd.input_file.push_back("/home/davila/Borrame/testwt.bbs");
   I->SetInputs(cmd.param_map);
 
   bool help_on_script = cmd.help && (cmd.input_file.size() > 0);
-  if (help_on_script)     I->SetNoExecMode(true);
-  if (cmd.graphical_dialog)     I->SetDialogMode(bbtk::VirtualExec::GraphicalDialog);
-  if (cmd.text_dialog)     I->SetDialogMode(bbtk::VirtualExec::TextDialog);
+  if (help_on_script)         I->SetNoExecMode(true);
+  if (cmd.graphical_dialog)   I->SetDialogMode(bbtk::VirtualExec::GraphicalDialog);
+  if (cmd.text_dialog)        I->SetDialogMode(bbtk::VirtualExec::TextDialog);
 
   std::vector<std::string>::const_iterator i;
   bool error = false;
index c79747c0378f512cd63f36182cab6a074831618e..770608440abde5f91c223b2e011f26b41724cce0 100644 (file)
@@ -64,6 +64,7 @@ namespace bbtk
     // ==> Set system paths
     mBin_path = Utilities::GetExecutablePath();
 
+
 /*     EED 23 Mars 2009
 #ifdef MACOSX
     mInstall_path = mBin_path + "/../../../..";
@@ -81,6 +82,7 @@ namespace bbtk
          }
 #endif
 
+
 ///\TODO : better use ??
          mInstall_path = mBin_path + "/..";
 
@@ -230,6 +232,7 @@ namespace bbtk
     if (!Utilities::FileExists(mDot_bbtk_path)) mDot_bbtk_is_new = true;
     Utilities::CreateDirectoryIfNeeded(mDot_bbtk_path);
 
+
     mDoc_path = Utilities::MakeUserSettingsFullFileName("doc");
     Utilities::CreateDirectoryIfNeeded(mDoc_path);
 
@@ -293,6 +296,7 @@ namespace bbtk
     mTemp_path = Utilities::MakeUserSettingsFullFileName("tmp");
     Utilities::CreateDirectoryIfNeeded(mTemp_path);
 
+
   }
   //=========================================================================
 
@@ -346,9 +350,13 @@ namespace bbtk
     strcpy(bbtk_path, Utilities::GetExecutablePath().c_str());  // JPR
     //strcpy(bbtk_path, "/usr/local/bin");
 
+
+    std::string str_home=Utilities::GetEnvHome();
+
+
     // rootDirectory
     char rootDirectory[200];
-    sprintf( rootDirectory,  "%s/.bbtk", getenv("HOME"));
+    sprintf( rootDirectory,  "%s/.bbtk", str_home.c_str());
 
     // configPath
     char configPath[200];
index d20ed655310e3b8dece8b01ec28ca197c055d5c1..bf51fe564d3a1b644ee850f9bbc044d9b3abfa08 100644 (file)
@@ -132,6 +132,7 @@ namespace bbtk
 #if(USE_WXWIDGETS)
     Wx::ProcessPendingEvents();
 #endif
+
  
     // Create user package
     Package::Pointer p =
index 2498e9018e0738f08468ba04ecd6a6975851bd78..d3538e1a2a46af6a95e7349ff5232e8c61bcf98f 100644 (file)
@@ -77,6 +77,7 @@ namespace bbtk
   //=======================================================================
   void InterpreterVirtual::Init() 
   {
+printf("EED InterpreterVirtual::Init start\n"); 
     mUser                      = 0;
     mCommandLine       = false;
     mThrow                     = false;
@@ -345,7 +346,7 @@ namespace bbtk
     mCommandDict[info.keyword] = info;
     */
 
-
+printf("EED InterpreterVirtual::Init end\n");
 
   } 
   //=======================================================================
index 16f4ffbf692335afcb22c3d115116272ff7b0403..7cf93fc1f68996148cc88650b00e0016dc294a7d 100644 (file)
@@ -85,8 +85,10 @@ namespace bbtk
     mDescription(description),
     mVersion(version)
   {
+
     bbtkDebugMessage("object",2,"==> Package('"<<name<<"',...)"
                     <<bbtkendl);
+
     std::string default_doc_dir = ConfigurationFile::GetInstance().Get_default_temp_dir();
     char c = default_doc_dir.c_str()[strlen(default_doc_dir.c_str())-1];
     std::string url = default_doc_dir; 
index 747f772fdcf67fa7fa0f94c593f39c95b752df68..7e85dc76787497b9e350fc332188b4283f88304b 100644 (file)
@@ -332,12 +332,8 @@ namespace bbtk
   /// Returns the user settings dir, e.g. /home/username/.bbtk
   std::string Utilities::GetUserSettingsDir()
   {
-#if defined(__GNUC__)
-    std::string str_home(getenv("HOME"));
-#elif defined(_WIN32)
-    std::string str_home(getenv("USERPROFILE"));
-#endif
-    std::string fullname = str_home + "/.bbtk";
+    std::string str_Home=Utilities::GetEnvHome();
+    std::string fullname = str_Home + "/.bbtk";
     MakeValidFileName(fullname);
     return fullname;
   }
@@ -348,11 +344,7 @@ namespace bbtk
   /// in user settings dir, e.g. /home/username/.bbtk/
   std::string Utilities::MakeUserSettingsFullFileName(const std::string& name)
   {
-#if defined(__GNUC__)
-    std::string str_home(getenv("HOME"));
-#elif defined(_WIN32)
-    std::string str_home(getenv("USERPROFILE"));
-#endif
+    std::string str_home=Utilities::GetEnvHome();
     std::string fullname = str_home + "/.bbtk/" + name;
     MakeValidFileName(fullname);
     return fullname;
@@ -767,6 +759,26 @@ namespace bbtk
   }
   //=========================================================================
 
+
+std::string Utilities::GetEnvHome()
+{
+#if defined(__GNUC__)
+       std::string strHome;
+    char *envHome=getenv("HOME");
+    if (envHome!=NULL)  
+       { 
+               strHome=envHome; 
+       } else {
+               strHome = "/var/www/testwtdbg/docroot";
+       } // if
+#elif defined(_WIN32)
+       std::string strHome( getenv("USERPROFILE") );
+#endif
+       return strHome;
+}   
+
+
+
 //TAD Arbol CFT
 
 
index fa2db5bec4a5fc9652174b05da5ae2094ea73b0f..90bb34099c6ab2e10788795647f0626122cdb6ce 100644 (file)
@@ -197,7 +197,8 @@ namespace bbtk
     
     static bool loosematch(std::string stdLine,std::string stdOptions);
     
-   
+
+    static std::string GetEnvHome();
     
     
   };
index a8bec6700c043ec4a18f371bc41b04be9edd83f7..a5925d48a95cae3c3e3efb79b7b1a3aba041df73 100644 (file)
@@ -141,15 +141,18 @@ namespace bbtk
 
                //this->require("http://get.goXTK.com/xtk.js");
                //this->useStyleSheet("css/demo.css");
+
+
+       //this->require("http://get.goXTK.com/xtk.js");
+       this->require( "resourcesXTK/xtk.js" );
+
                
        //      this->require("http://get.goXTK.com/xtk_edge.js");
 //     this->require("http://get.goXTK.com/xtk_xdat.gui.js");
-       this->require("xtk_xdat.gui.js");
+       this->require( "resourcesXTK/xtk_xdat.gui.js" );
 
-       //this->require("http://get.goXTK.com/xtk.js");
-       this->require("xtk.js");
 
-  this->useStyleSheet("styleWT.css"); 
+  this->useStyleSheet("resourcesXTK/styleWT.css"); 
   
 
        //      std::cout<<"Cargado------------           "<<loadedJS<<std::endl;
@@ -296,21 +299,18 @@ namespace bbtk
        //std::string WtBlackBox::wtServerData::docRoot = "/usr/local/share/wtResources";
   //std::string WtBlackBox::wtServerData::port    = "8081";
 
-       std::string WtBlackBox::wtServerData::docRoot = "<void>";
-       std::string WtBlackBox::wtServerData::port    = "<void>";
-  std::string WtBlackBox::wtServerData::address = "0.0.0.0";
-       
+       std::string WtBlackBox::wtServerData::docRoot   = "<void>";
+       std::string WtBlackBox::wtServerData::port      = "<void>";
+  std::string WtBlackBox::wtServerData::address        = "0.0.0.0";
+  int WtBlackBox::wtServerData::argc                   = 0;
+  char **WtBlackBox::wtServerData::argv                = NULL;
+
   //=========================================================================
   //=========================================================================
   void WtBlackBox::bbUserSetDefaultValues()
   {
     bbtkBlackBoxDebugMessage("widget",5,"WtBlackBox::bbUserSetDefaultValues()"<<std::endl);
     bbmWindow = 0;
-  /*  WtBlackBox::serData.docRoot = "/home/gonzalez/Documents/pruebaResources";
-    WtBlackBox::serData.address = "0.0.0.0";
-    WtBlackBox::serData.port    = "8080";*/
-    
-
   }
   //=========================================================================
 
@@ -367,21 +367,34 @@ namespace bbtk
                //char  *argv[7] =  {"./WtTest","--docroot","/home/gonzalez/Documents/pruebaResources","--http-address","0.0.0.0","--http-port","8080"};
                //int argc = 7;
                
-               
-                       char  *argv[7] =  {"./WtTest","--docroot",(char*)WtBlackBox::wtServerData::docRoot.c_str(),"--http-address",(char*)WtBlackBox::wtServerData::address.c_str(),"--http-port",(char*)WtBlackBox::wtServerData::port.c_str()};
-               int argc = 7;
-               
+/*             
+                       char  *argv[7] =  {"./WtTest"
+,"--docroot",(char*)WtBlackBox::wtServerData::docRoot.c_str()
+,"--http-address",(char*)WtBlackBox::wtServerData::address.c_str()
+,"--http-port",(char*)WtBlackBox::wtServerData::port.c_str()
+};
+               int argc = 3;
                std::cout<<" ---  PUERTO  :"<<WtBlackBox::wtServerData::port<<std::endl;
-               
+*/
+
+/*             
+char  *argv[2] =  {"./bbiWeb.wt","client"};
+int argc=2;
+*/
+
+
        /*      if(Wt::WServer::instance()->isRunning())
                {
                        std::cout<<"Checking the existence of a Server deployed  -DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<<std::endl;
                        Wt::WServer::instance()->stop();
                }
        */
-               std::cout<<"Deploying Server -- Definition of server parameters by default  -DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<<std::endl;
-               Wt::WRun(argc,argv,&createApplication); 
-       }
+               std::cout<<"EED WtBlackBox::bbCreateFrameWindow  Deploying Server -- Definition of server parameters by default  -DELETE THIS MESSAGE bbtkWTBlackBox.cxx"<<std::endl;
+//             Wt::WRun(argc,argv,&createApplication); 
+               Wt::WRun(WtBlackBox::wtServerData::argc,
+                         WtBlackBox::wtServerData::argv,
+                         &createApplication);  
+   }
 
   //==================================================================    
 
index 844d9d407c9fd9cf596f3a33c919c95696eca8b4..bd36a45037e7fbf3ac90f7e1c4617a33ec9b365d 100644 (file)
@@ -96,6 +96,9 @@ namespace bbtk
              static std::string docRoot  ;
              static std::string port     ;
              static std::string address  ;
+             
+              static int argc;
+              static char **argv;
            };
   
   /*   static std::string* jScript;