X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2Fbbi%2Fbbi.cxx;h=954b38468949a423175e0259c3fe96ca7b9aa8a3;hb=a94262289f8148799f8e319c216d5af2a6053c18;hp=c4ef2fd628b33456beb9f968900320e08976b8bc;hpb=236a8e2fee9937c050e2d16c7222e1caa993f01c;p=bbtk.git diff --git a/kernel/appli/bbi/bbi.cxx b/kernel/appli/bbi/bbi.cxx index c4ef2fd..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); } /* @@ -202,7 +199,7 @@ bool wxBBIApp::OnInit( ) std::cout << "con="<Close"<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,14 +312,111 @@ int main(int argc, char* argv[]) #include "bbtkInterpreter.h" -int main(int argc, char* argv[]) -{ +// Processes the command line parsing result +struct ProcessCmdLine +{ + ProcessCmdLine() {} + void Process(int argc_, char *argv_[]); + bool Found(std::string value); - if (argc>2) + 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(); + // bbtk::Wx::LoopUntilAllWindowsClose(); return 0;