# knowledge of the CeCILL-B license and that you accept its terms.
# ------------------------------------------------------------------------ */
+//__asm__(".symver fcntl64,fcntl64@GLIBC_2.27");
#ifdef _USE_WXWIDGETS_
+
+#include <exception>
+
//==========================================================================
// WITH WX
//==========================================================================
#include <map>
//==========================================================================
-// 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
+
+
+
+
//==========================================================================
//==========================================================================
bbtk::StaticInitTime::PrintObjectListInfo = true;
}
- debug = ( parser.Found(_T("d")) );
- quiet = ( parser.Found(_T("q")) );
- help = ( parser.Found(_T("h")) );
- graphical_dialog = ( parser.Found(_T("g")) );
- 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);
((input_file.size() == 0) &&
(!no_console) &&
(!usage) ) );
-
+
}
//==========================================================================
-
-
-
//==========================================================================
// 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);
+
// std::cout << "OnInit"<<std::endl;
wxApp::OnInit();
#ifdef __WXGTK__
setlocale(LC_NUMERIC, "C");
#endif
-
if (cmd.quiet) bbtk::MessageManager::SetMessageLevel("max",0);
if (cmd.debug) bbtk::MessageManager::SetMessageLevel("all",9);
+//Borrame
+//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);
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<std::string>::const_iterator i;
bool error = false;
+
for (i=cmd.input_file.begin(); i!=cmd.input_file.end(); ++i)
{
error = ! I->InterpretFile(*i);
I->GetInterpreter()->GetExecuter()->GetFactory()->PrintHelpDescriptor("workspace",package,false);
}
+
/*
std::cout << "soe="<<show_on_error <<std::endl;
std::cout << "con="<<console<<std::endl;
// you need to use the linker option "/subsystem:console" and the following code:
int main(int argc, char* argv[])
{
- return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
+//Borrame
+//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main C\n"); fclose(ff);
+
+ // EED 2018-07-16
+ char buffer[1500];
+ wcstombs(buffer , ::GetCommandLine() , 1500 );
+ return WinMain(::GetModuleHandle(NULL), NULL, buffer , SW_SHOWNORMAL);
+ // return WinMain(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), SW_SHOWNORMAL);
}
+
#else
//==========================================================================
// OTHER ( Linux... )
int main(int argc, char* argv[])
{
+//Borrame
+//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main A\n"); fclose(ff);
+
wxMessageOutput::Set( new wxMessageOutputBest );
wxCmdLineParser parser(cmdLineDesc,argc,argv);
if (!cmdline.proceed) return 0;
- if (cmdline.no_console)
+ if (cmdline.no_console)
{
// std::cout << "main NC"<<std::endl;
// Interpreter
bool error = false;
for (i=cmdline.input_file.begin();
i!=cmdline.input_file.end(); ++i)
- {
- error = ! I->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
}
std::cout << "BBI (Black Box Interpreter) - bbtk "
<< bbtk::GetVersion()<< " - (c) Creatis 2007"
<< std::endl;
+//Borrame
+//FILE *ff; ff = fopen ("/tmp/wt.log","a+"); fprintf(ff,"EED main B\n"); fclose(ff);
bbtk::Interpreter::Pointer I = bbtk::Interpreter::New();
if (argc==1)