X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2Fbbi%2Fbbi.cxx;h=954b38468949a423175e0259c3fe96ca7b9aa8a3;hb=32f572e3d47f4c17b65787a6616a73e9d718c04e;hp=76aaef3e6667d6c9ea8ebe984438f24029da464c;hpb=8c690fedb5ea897b6a69584e1e237cb5dbad97a5;p=bbtk.git diff --git a/kernel/appli/bbi/bbi.cxx b/kernel/appli/bbi/bbi.cxx index 76aaef3..954b384 100644 --- a/kernel/appli/bbi/bbi.cxx +++ b/kernel/appli/bbi/bbi.cxx @@ -31,9 +31,9 @@ static const wxCmdLineEntryDesc cmdLineDesc[] = //========================================================================== // Processes the command line parsing result -struct ProcessCmdLine +struct WxProcessCmdLine { - ProcessCmdLine() {} + WxProcessCmdLine() {} void Process(wxCmdLineParser& parser); // int argc; @@ -53,7 +53,7 @@ struct ProcessCmdLine //========================================================================== //========================================================================== -void ProcessCmdLine::Process(wxCmdLineParser& parser) +void WxProcessCmdLine::Process(wxCmdLineParser& parser) { proceed = true; if (parser.Found(_T("D"))) @@ -120,7 +120,7 @@ public: void OnInitCmdLine(wxCmdLineParser& parser); bool OnCmdLineParsed(wxCmdLineParser& parser); - ProcessCmdLine cmd; + WxProcessCmdLine cmd; }; //========================================================================== @@ -171,12 +171,9 @@ bool wxBBIApp::OnInit( ) 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::const_iterator i; bool error = false; @@ -194,7 +191,7 @@ bool wxBBIApp::OnInit( ) if (help_on_script) { std::string package; - I->GetInterpreter()->GetExecuter()->GetFactory()->HelpBlackBox("workspace",package,false); + I->GetInterpreter()->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",package,false); } /* @@ -255,7 +252,7 @@ int main(int argc, char* argv[]) parser.Usage(); return 0; } - ProcessCmdLine cmdline; + WxProcessCmdLine cmdline; cmdline.Process(parser); if (!cmdline.proceed) return 0; @@ -281,9 +278,9 @@ int main(int argc, char* argv[]) { I->SetNoExecMode(false); std::string package; - I->GetExecuter()->GetFactory()->HelpBlackBox("workspace", - package, - false); + I->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace", + package, + false); } if (cmdline.input_file.size()==0) I->CommandLineInterpreter(); @@ -314,15 +311,112 @@ int main(int argc, char* argv[]) //========================================================================== #include "bbtkInterpreter.h" -//#include "bbtkWx.h" -int main(int argc, char* argv[]) -{ - if (argc>2) +// Processes the command line parsing result +struct ProcessCmdLine +{ + ProcessCmdLine() {} + void Process(int argc_, char *argv_[]); + bool Found(std::string value); + + int argc; + std::vector argv; + bool console; + bool debug; + bool quiet; + bool help; + bool graphical_dialog; + bool text_dialog; + bool no_console; + bool proceed; + std::map param_map; + std::vector input_file; + +}; + +bool ProcessCmdLine::Found(std::string value) +{ + bool result=false; + for (int i=1; i2) +// { +// std::cout << "usage : "<CommandLineInterpreter(); - } - else - - { - std::string f(argv[1]); - I->InterpretFile(f); - } + { + I->CommandLineInterpreter(); + } else { + + ProcessCmdLine cmd; + cmd.Process(argc,argv); + I->SetInputs(cmd.param_map); + + std::string f(argv[1]); + I->InterpretFile(f); + } // bbtk::Wx::LoopUntilAllWindowsClose();