From 72e1281cc66954975acc2414264239dcf055c15f Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Fri, 14 Aug 2015 18:27:58 +0200 Subject: [PATCH] #2536 BBTK Feature New Normal - wt-version Package --- kernel/appli/bbi/bbiWeb.cxx | 33 +++++++++---- kernel/src/bbtkFactory.cxx | 94 +++++++++++++++++++++++++++++-------- kernel/src/bbtkFactory.h | 6 ++- 3 files changed, 104 insertions(+), 29 deletions(-) diff --git a/kernel/appli/bbi/bbiWeb.cxx b/kernel/appli/bbi/bbiWeb.cxx index 360b135..55ce986 100644 --- a/kernel/appli/bbi/bbiWeb.cxx +++ b/kernel/appli/bbi/bbiWeb.cxx @@ -37,11 +37,15 @@ int main(int argc, char* argv[]) { - printf("bbiWeb...1 argc=%d \n",argc); + printf("bbiWeb...A argc=%d \n",argc); + //bbtk::MessageManager::SetMessageLevel("all",9); printf("bbiWeb: [0]: %s \n",argv[0]); printf("bbiWeb: [1]: %s \n",argv[1]); - printf("bbiWeb...2\n"); +printf("bbiWeb: [2]: %s \n",argv[2]); +printf("bbiWeb: [3]: %s \n",argv[3]); +printf("bbiWeb: [4]: %s \n",argv[4]); + printf("bbiWeb...B\n"); bbtk::WtBlackBox::wtServerData::argc = argc; @@ -54,13 +58,24 @@ printf("bbiWeb: [1]: %s \n",argv[1]); bbtk::Interpreter::Pointer I = bbtk::Interpreter::New(); - printf("bbiWeb...3\n"); -// std::string f(argv[1]); -// std::string f("/var/www/testwtdbg/docroot/.bbtk/tmp/testwt.bbs"); - std::string f("/var/www/testwtdbg/docroot/.bbtk/tmp/demoPresentacion1Boton02.bbs"); - printf("bbiWeb...4\n"); - I->InterpretFile(f); - printf("bbiWeb...5\n"); + printf("bbiWeb...C\n"); + + std::string fileName = argv[0]; + std::size_t pos = fileName.find("_"); + fileName = fileName.substr (pos+1); + pos = fileName.find(".wt"); + fileName = fileName.erase (pos); + fileName = "bbs/"+fileName; + +printf("bbiWeb fileName %s\n", fileName.c_str() ); +// std::string fileName("/var/www/testwtdbg/docroot/.bbtk/tmp/demoPresentacion1Boton02.bbs"); + + + + + printf("bbiWeb...D\n"); + I->InterpretFile(fileName); + printf("bbiWeb...E\n"); return 0; } diff --git a/kernel/src/bbtkFactory.cxx b/kernel/src/bbtkFactory.cxx index 669a9fb..d541db3 100644 --- a/kernel/src/bbtkFactory.cxx +++ b/kernel/src/bbtkFactory.cxx @@ -548,23 +548,47 @@ namespace bbtk bbtkDebugDecTab("kernel",9); } - //=================================================================== -// ups3 EED borrame + //=================================================================== std::string Factory::GetPackageNameOfaBlackBox(std::string boxType) { - std::string result=""; + std::string packageName=""; PackageMapType::const_iterator i; - for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) - { - if ( i->second->ifBoxExist( boxType ) == true) + + std::size_t found = boxType.find(":"); + if (found!=std::string::npos) + { + packageName = boxType.substr(0,found); + } else { + for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) { - result = i->first; - } - } - return result; + if ( i->second->ifBoxExist( boxType ) == true) + { + packageName = i->first; + } // if ifBoxExist + } // for i + + } // if found + return packageName; } + + //=================================================================== + std::string Factory::GetTypeNameOfaBlackBox(std::string boxType) + { + std::string typeName=""; + + std::size_t found = boxType.find(":"); + if (found!=std::string::npos) + { + typeName = boxType.substr(found+1); + } else { + typeName=boxType; + } // if found + return typeName; + } + + //=================================================================== @@ -572,20 +596,52 @@ namespace bbtk BlackBox::Pointer Factory::NewBlackBox(const std::string& type, const std::string& name) const { - bbtkDebugMessageInc("kernel",7,"Factory::NewBlackBox(\"" + bbtkDebugMessageInc("kernel",7,"Factory::NewBlackBox(\"" <second->NewBlackBox(type,name); - if (b) break; - } + + std::string tmp = type; + std::string packageName = ((bbtk::Factory*)this)->GetPackageNameOfaBlackBox(tmp); + std::string type2 = ((bbtk::Factory*)this)->GetTypeNameOfaBlackBox(tmp); + i = mPackageMap.find(packageName); + if (i != mPackageMap.end()) + { + b = i->second->NewBlackBox(type2,name); + } else { + b =BlackBox::Pointer(); + } + +/* + std::size_t found = type.find(":"); + if (found!=std::string::npos) + { + std::string packageName = type.substr(0,found); + std::string type2 = type.substr(found+1); + i = mPackageMap.find(packageName); + if (i != mPackageMap.end()) + { + b = i->second->NewBlackBox(type2,name); + } else { + b =BlackBox::Pointer(); + } + } else { + for (i = mPackageMap.begin(); i!=mPackageMap.end(); ++i ) + { + b = i->second->NewBlackBox(type,name); + if (b) break; + } // for i + + } // if found : +*/ + + if (!b) - { - bbtkError("black box type \""<