#ifdef _USE_WXWIDGETS_ //========================================================================== // WITH WX //========================================================================== #include "bbtkObject.h" #include "bbtkInterpreter.h" #include "bbtkWxBlackBox.h" #include "bbtkWxGUIConsole.h" #include #include #include static const wxCmdLineEntryDesc cmdLineDesc[] = { { wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("print this help or help on the application defined in input bbs file if any") }, { wxCMD_LINE_SWITCH, _T("g"), _T("graphical-dialog"), _T("prompt the input parameter values using graphical dialog") }, { wxCMD_LINE_SWITCH, _T("t"), _T("text-dialog"), _T("prompt the input parameter values in text mode") }, { wxCMD_LINE_SWITCH, _T("c"), _T("console"), _T("open bbi console") }, { wxCMD_LINE_SWITCH, _T("N"), _T("no-console"), _T("never open bbi console even on error") }, { wxCMD_LINE_SWITCH, _T("q"), _T("quiet"), _T("be quiet (='message max 0')") }, { wxCMD_LINE_SWITCH, _T("d"), _T("debug"), _T("turn all messages on (='message all 9')") }, { wxCMD_LINE_SWITCH, _T("D"), _T("Debug"), _T("memory debug on exit (='debug -D')") }, { wxCMD_LINE_PARAM, NULL, NULL, _T("file [file [...]]"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE }, { wxCMD_LINE_NONE } }; class wxBBIApp : public wxApp { public: bool OnInit( ); int OnExit() { // std::cout << "wxBBIApp::OnExit()"< argv; bool console; bool debug; bool quiet; bool help; bool graphical_dialog; bool text_dialog; bool no_console; std::map param_map; std::vector input_file; }; IMPLEMENT_APP(wxBBIApp); void wxBBIApp::OnInitCmdLine(wxCmdLineParser& parser) { // std::cout << "OnInitCmdLine"<Show(true); I->SetInputs(param_map); bool help_on_script = help && (input_file.size() > 0); if (help_on_script) I->SetNoExecMode(true); if (graphical_dialog) I->SetDialogMode(bbtk::VirtualExec::GraphicalDialog); if (text_dialog) I->SetDialogMode(bbtk::VirtualExec::TextDialog); std::vector::const_iterator i; bool error = false; for (i=input_file.begin(); i!=input_file.end(); ++i) { error = ! I->InterpretFile(*i); if (error) break; } bool show_on_error = error && ! no_console; if (show_on_error) I->Show(); I->SetNoExecMode(false); if (help_on_script) { std::string package; I->GetInterpreter()->GetExecuter()->GetFactory()->HelpBlackBox("workspace",package,false); } /* std::cout << "soe="<Close"<Close"<2) return 0; std::cout << "BBI (Black Box Interpreter) - bbtk " << bbtk::GetVersion()<< " - (c) Creatis 2007" <