X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2Fbbi%2Fbbi.cxx;h=c4729fc90b52f4e7fb261368c7f2a2a601a08eb0;hb=5529db4fdab74bdb508c71ea3c2b8298a1f14a74;hp=89a3daa305de477cb5ad38f819a1875e7758de05;hpb=427d8c0ac838ab789a57b28f62a7f9ff243e7b60;p=bbtk.git diff --git a/kernel/appli/bbi/bbi.cxx b/kernel/appli/bbi/bbi.cxx index 89a3daa..c4729fc 100644 --- a/kernel/appli/bbi/bbi.cxx +++ b/kernel/appli/bbi/bbi.cxx @@ -24,9 +24,13 @@ # knowledge of the CeCILL-B license and that you accept its terms. # ------------------------------------------------------------------------ */ +//__asm__(".symver fcntl64,fcntl64@GLIBC_2.27"); #ifdef _USE_WXWIDGETS_ + +#include + //========================================================================== // WITH WX //========================================================================== @@ -40,20 +44,43 @@ #include //========================================================================== -// Command line options definition -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 } -}; + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 + // Command line options definition + 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 } + }; +#else + // Command line options definition + static const wxCmdLineEntryDesc cmdLineDesc[] = + { + { wxCMD_LINE_SWITCH, "h", "help", "print this help or help on the application defined in input bbs file if any" }, + { wxCMD_LINE_SWITCH, "g", "graphical-dialog", "prompt the input parameter values using graphical dialog" }, + { wxCMD_LINE_SWITCH, "t", "text-dialog", "prompt the input parameter values in text mode" }, + { wxCMD_LINE_SWITCH, "c", "console", "open bbi console" }, + { wxCMD_LINE_SWITCH, "N", "no-console", "never open bbi console even on error" }, + { wxCMD_LINE_SWITCH, "q", "quiet", "be quiet (='message max 0')" }, + { wxCMD_LINE_SWITCH, "d", "debug", "turn all messages on (='message all 9')" }, + { wxCMD_LINE_SWITCH, "D", "Debug", "memory debug on exit (='debug -D')" }, + { wxCMD_LINE_PARAM, NULL, NULL, "file [file [...]]", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_PARAM_MULTIPLE }, + { wxCMD_LINE_NONE } + }; +#endif + + + + //========================================================================== //========================================================================== @@ -88,13 +115,20 @@ void WxProcessCmdLine::Process(wxCmdLineParser& parser) bbtk::StaticInitTime::PrintObjectListInfo = true; } - debug = ( parser.Found(_T("d")) ); - quiet = ( parser.Found(_T("q")) ); - help = ( parser.Found(_T("h")) ); - graphical_dialog = ( parser.Found(_T("wxcommandlineg")) ); - text_dialog = ( parser.Found(_T("t")) ); - no_console = ( parser.Found(_T("N")) ); - + debug = ( parser.Found(_T("d")) ); + quiet = ( parser.Found(_T("q")) ); + help = ( parser.Found(_T("h")) ); + +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 + graphical_dialog = ( parser.Found(_T("wxcommandlineg")) ); +#else + printf("EED Warnning. WxProcessCmdLine::Process g wxcommandlineg \n"); + graphical_dialog = ( parser.Found(_T("g")) ); +#endif + + text_dialog = ( parser.Found(_T("t")) ); + no_console = ( parser.Found(_T("N")) ); if (quiet) bbtk::MessageManager::SetMessageLevel("max",0); if (debug) bbtk::MessageManager::SetMessageLevel("all",9); @@ -130,7 +164,7 @@ void WxProcessCmdLine::Process(wxCmdLineParser& parser) ((input_file.size() == 0) && (!no_console) && (!usage) ) ); - + } //========================================================================== @@ -170,14 +204,12 @@ bool wxBBIApp::OnCmdLineParsed(wxCmdLineParser& parser) - - - //========================================================================== // The `main program' equivalent, creating the windows and returning the // main frame bool wxBBIApp::OnInit( ) { + //Borrame //FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED wxBBIApp::OnInit\n"); fclose(ff); @@ -188,7 +220,6 @@ bool wxBBIApp::OnInit( ) setlocale(LC_NUMERIC, "C"); #endif - if (cmd.quiet) bbtk::MessageManager::SetMessageLevel("max",0); if (cmd.debug) bbtk::MessageManager::SetMessageLevel("all",9); @@ -197,7 +228,6 @@ bool wxBBIApp::OnInit( ) //printf ("EED bbi wxBBIApp::OnInit .....................\n"); //cmd.input_file.push_back("/home/davila/Borrame/testwt.bbs"); - bbtk::WxGUIConsole *I = new bbtk::WxGUIConsole(0,_T("bbi"),wxSize(800,600)); SetTopWindow(I); if (cmd.console) I->Show(true); @@ -213,6 +243,7 @@ bool wxBBIApp::OnInit( ) std::vector::const_iterator i; bool error = false; + for (i=cmd.input_file.begin(); i!=cmd.input_file.end(); ++i) { error = ! I->InterpretFile(*i); @@ -229,6 +260,7 @@ bool wxBBIApp::OnInit( ) I->GetInterpreter()->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",package,false); } + /* std::cout << "soe="<InterpretFile(*i); - if (error) break; - } - if (help_on_script) - { - I->SetNoExecMode(false); - std::string package; - I->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace", + { + error = ! I->InterpretFile(*i); + if (error) break; + } + if (help_on_script) + { + I->SetNoExecMode(false); + std::string package; + I->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace", package, false); - } - if (cmdline.input_file.size()==0) - I->CommandLineInterpreter(); - + } + if (cmdline.input_file.size()==0) + { + I->CommandLineInterpreter(); + } // if cmdline.input_file.size // - } - else - { + } else { wxEntry(argc, argv); - } + } // if cmdline.no_console }