X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2Fbbi%2Fbbi.cxx;h=954b38468949a423175e0259c3fe96ca7b9aa8a3;hb=a94262289f8148799f8e319c216d5af2a6053c18;hp=16cbb8f0b45565addc4cc3ed00180051f7e09380;hpb=664e5cdbbcaf3dafa5fc9f206a7094248c289d5a;p=bbtk.git diff --git a/kernel/appli/bbi/bbi.cxx b/kernel/appli/bbi/bbi.cxx index 16cbb8f..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; @@ -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; @@ -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();