int WINAPI WinMain (HINSTANCE hInstance ,HINSTANCE hPrevInstance ,LPSTR lpCmdLine ,int nCmdShow ) #endif // LMI_MSW defined. { // (Historical notes.) Using wx-2.5.1 and mpatrol-1.4.8, both // dynamically linked to this application built with gcc-3.2.3, // three memory leaks are reported with: // MPATROL_OPTIONS='SHOWUNFREED' // It's easier to trace them with: // MPATROL_OPTIONS='LOGALL SHOWUNFREED USEDEBUG' // Two are apparently mpatrol artifacts traceable to symbols: // [space follows leading underscores in reserved names] // "_ _ _ mp_findsource" // "_ _ _ mp_init" // The third is traceable in 'mpatrol.log' with 'USEDEBUG' to // Skeleton::GetEventHashTable() const // (although stepping through the code in gdb suggests it's really // WinMain(), and mpatrol or libbfd just got the symbol wrong) // and seems to be triggered the first time the program allocates // memory. The next line forces that to occur here; otherwise, // tracing this 'leak' becomes cumbersome and mysterious. std::string unused("Seems to trigger initialization of something."); int result = EXIT_FAILURE; try { initialize_application(); initialize_filesystem(); #ifndef LMI_MSW result = wxEntry(argc, argv); #else // LMI_MSW defined. result = wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); #endif // LMI_MSW defined. } catch(...) { try { report_exception(); } catch(...) { safely_show_message("Logic error: untrapped exception."); } } fenv_validate(); return result; }
int main(int argc, char* argv[]) { MyApp* myApp = new MyApp(); wxApp::SetInstance(myApp); #ifdef _WIN32 wxEntry(GetModuleHandle(NULL)); #else wxEntry(argc, argv); #endif return 0; }
int main(int argc, char **argv) { int i; G_gisinit(argv[0]); for (i = 0; i < MAXVIEWS; i++) { char buf[BUFSIZ]; viewopts[i] = G_define_option(); sprintf(buf, "view%d", i + 1); viewopts[i]->key = G_store(buf); viewopts[i]->type = TYPE_STRING; viewopts[i]->required = (i ? NO : YES); viewopts[i]->multiple = YES; viewopts[i]->gisprompt = "old,cell,Raster";; sprintf(buf, _("Raster file(s) for View%d"), i + 1); viewopts[i]->description = G_store(buf); } if (G_parser(argc, argv)) exit(EXIT_FAILURE); parse_command(viewopts, vfiles, &numviews, &frames); return wxEntry(argc, argv); }
void *wxe_main_loop(void *vpdl) { int result; int argc = 1; char * temp = (char *) "Erlang\0"; char ** argv = &temp; ErlDrvPDL pdl = (ErlDrvPDL) vpdl; driver_pdl_inc_refc(pdl); // ErlDrvSysInfo einfo; // driver_system_info(&einfo, sizeof(ErlDrvSysInfo)); // Disable floating point execption if they are on. // This should be done in emulator but it's not in yet. #ifndef _WIN32 erts_thread_disable_fpe(); #endif result = wxEntry(argc, argv); // fprintf(stderr, "WXWidgets quits main loop %d \r\n", result); if(result >= 0 && wxe_status == WXE_INITIATED) { /* We are done try to make a clean exit */ wxe_status = WXE_EXITED; driver_pdl_dec_refc(pdl); erl_drv_thread_exit(NULL); return NULL; } else { erl_drv_mutex_lock(wxe_status_m); wxe_status = WXE_ERROR; erl_drv_cond_signal(wxe_status_c); erl_drv_mutex_unlock(wxe_status_m); driver_pdl_dec_refc(pdl); return NULL; } }
value wxApp_wxEntry_c(value onInit_v, value argv_v){ int argc = Wosize_val(argv_v); char **argv_c = argc == 0 ? NULL : (char**)argv_v; initHandler = new OCamlCallback(onInit_v); terminating = 0; #ifdef _WIN32 HINSTANCE wxhInstance = GetModuleHandle(NULL); wxEntry(wxhInstance, NULL, NULL /* argv_c DOES NOT WORK */, SW_SHOWNORMAL); #else wxEntry(argc, argv_c); #endif terminating = 1; return Val_unit; }
value wx_boot(value inOnInit) { sgOnInit = inOnInit; wchar_t *prog[] = { (wchar_t *)0}; int argc = 0; int result = wxEntry(argc,prog); return alloc_int(result); }
void WINAPI initRiPE() { //mshscrcBypass(true); //Call the wxWidgets trainer class from here //ExtractResource(dllHandle, IDR_BIN_1, L"Filter2.txt"); wxApp::SetInitializerFunction(wxCreateApp); wxEntry(0,NULL); }
bool initWxWidgets(int argc, char** argv) { wxEntry(argc, argv); if ( !wxTheApp || !wxTheApp->CallOnInit() ) return false; return true; }
int main(int argc, char *argv[]) { //printf( "XInitThreads - calling\n" ); #ifndef NDEBUG //mtrace(); #endif if ( XInitThreads() == 0 ) { fprintf( stderr, "%s: Unable to initialize multithreaded X11 code (XInitThreads failed).\n", argv[0] ); exit( EXIT_FAILURE ); } return wxEntry(argc, argv); }
bool initWxWidgets(HINSTANCE hInst, int CmdShow, int argc, char** argv) { hIISHook = SetWindowsHookEx(WH_CALLWNDPROC, (HOOKPROC)CallWndProc, 0, GetCurrentThreadId()); wxSetInstance(hInst); wxApp::m_nCmdShow = CmdShow; wxEntry(argc, argv); if (!wxTheApp || !wxTheApp->CallOnInit()) return false; return true; }
EWXWEXPORT(void,ELJApp_initialize)(void* self,AppInitFunc _func,int _argc,void* _argv) { APPTerminating = 0; wxEntry(_argc, (char**)_argv); APPTerminating = 1; /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */ #if !defined(WXMAKINGDLL) && !defined(WXUSINGDLL) wxPendingEvents = NULL; #endif #if defined(wxUSE_ODBC) && (wxUSE_ODBC != 0) wxDbCloseConnections(); #endif }
int wxEntry() { /* There is no command line in PalmOS. For now generate a fake argument * list. Later this may be changed to reflect the application launch code */ static const int argc = 0; wxChar **argv = new wxChar *[argc + 1]; // argv[] must be NULL-terminated argv[argc] = NULL; return wxEntry(const_cast<int>(argc), argv); }
EWXWEXPORT(void,ELJApp_initialize)(void* self,AppInitFunc _func,char* _cmd,void* _inst) { HINSTANCE wxhInstance = (HINSTANCE)_inst; APPTerminating = 0; wxEntry(wxhInstance, NULL, _cmd, SW_SHOWNORMAL); APPTerminating = 1; /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */ #if !defined(WXMAKINGDLL) && !defined(WXUSINGDLL) wxPendingEvents = NULL; #endif #if defined(wxUSE_ODBC) && (wxUSE_ODBC != 0) wxDbCloseConnections(); #endif }
//------------------------------------------------------------------------------------ // NPP_Initialize: //------------------------------------------------------------------------------------ NPError NPP_Initialize(void) { // MessageBox(NULL, "NPP_Initialize", "NPTest", MB_OK); /* wxPluginApp *app = wxGetPluginApp(); if ( app ) return app->NPP_Initialize(); else return NPERR_NO_ERROR; */ wxEntry((WXHINSTANCE) GetModuleHandle(NULL)); return NPERR_NO_ERROR; }
// This can't work now because we don't have a global app until wxEntry is called. // We'll put the wxEntry call in npshell.cpp instead. NPError wxPluginApp::NPP_Initialize(void) { static int init = FALSE; if ( init == TRUE ) MessageBox(NULL, "wxPluginApp::NPP_Initialize:\nabout to call wxEntry for 2nd time!!!", "wxPlugin", MB_OK); wxEntry((WXHINSTANCE) GetModuleHandle(NULL)); init = TRUE; // MessageBox(NULL, "wxPluginApp::NPP_Initialize: have called wxEntry", "wxPlugin", MB_OK); return NPERR_NO_ERROR; }
int main(int argc,char** argv) { try { gApp = new SpinachApp; wxApp::SetInstance(gApp); wxEntry(argc,argv); } catch (logic_error& e) { cerr << "Uncaught logic_error what()=" << e.what() << endl; } catch (runtime_error& e) { cerr << "Uncaught runtime_error what()=" << e.what() << endl; } catch (...) { cerr << "Uncaught unknown exception." << endl; throw; } return 0; }
virtual unsigned threadProc( void *param ) { // setup wx wxEntry( gInstance, 0, NULL, 0, false ); // setup ui dout << "Creating MulticrewUI" << std::endl; ui = new MulticrewUI( hFSimWindow ); // hook FS window oldWndProc = (WNDPROC)SetWindowLong( hFSimWindow, GWL_WNDPROC, (LONG)FSimWindowProc ); // thread message queue MSG msg; BOOL ret; dout << "Starting MulticrewUI thread" << std::endl; while( (ret=GetMessage( &msg, NULL, 0, 0 ))!=0 ) { //dout << "MulticrewUI thread message " << msg.message << std::endl; switch( msg.message ) { case WM_COMMAND: { //dout << "message was WM_COMMAND " << LOWORD(msg.wParam) << std::endl; switch( LOWORD(msg.wParam) ) { case ID_HOST_MENUITEM: ui->host(); break; case ID_CONNECT_MENUITEM: ui->connect(); break; case ID_DISCONNECT_MENUITEM: ui->disconnect(); break; case ID_STATUS_MENUITEM: ui->status(); break; case ID_LOG: ui->log(); break; //case ID_ASYNC: ui->async(); break; } } break; } DispatchMessage(&msg); } // shutdown ui dout << "Shutting down MulticrewUI" << std::endl; delete ui; // shutdown wx wxGetApp().OnExit(); wxApp::CleanUp(); //wxEntryCleanup(); // crashes :( //wxUninitialize(); return true; }
EWXWEXPORT(void,ELJApp_InitializeC)(wxClosure* closure,int _argc,char** _argv) { wxHANDLE wxhInstance = GetModuleHandle(NULL); /* check memory leaks with visual C++ */ #if (defined(__WXDEBUG__) && defined(_MSC_VER)) _CrtMemState memStart,memEnd,memDif; _CrtMemCheckpoint( &memStart ); _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT ); _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT ); #endif initClosure = closure; APPTerminating = 0; wxEntry(wxhInstance, NULL, (_argc > 0 ? _argv[0] : NULL), SW_SHOWNORMAL); APPTerminating = 1; /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */ #if !defined(WXMAKINGDLL) && !defined(WXUSINGDLL) wxPendingEvents = NULL; #endif #if defined(wxUSE_ODBC) && (wxUSE_ODBC != 0) wxDbCloseConnections(); #endif /* check memory leaks with visual C++ */ #if (defined(__WXDEBUG__) && defined(_MSC_VER)) _CrtMemCheckpoint( &memEnd ); if (_CrtMemDifference( &memDif, &memStart, &memEnd) && (memDif.lCounts[_NORMAL_BLOCK]>=-2 && memDif.lCounts[_NORMAL_BLOCK] <= 0)) { _RPT0(_CRT_WARN,"\n** memory leak detected (**\n" ); _CrtMemDumpStatistics(&memDif); /* _CrtMemDumpAllObjectsSince(&memStart); */ _RPT0(_CRT_WARN,"** memory leak report done **\n\n" ); } #endif }
void GUIThread::run_wx_gui_thread() { thread_collector = boost::thread(&GUIThread::wait_for_threads, this); boost::recursive_mutex::scoped_lock lock( mutex ); while (!tasks.empty() || !active_threads.empty()) { if (!tasks.empty()) { wx_widgets_running = true; lock.unlock(); int wx_argc = 1; char* wx_argv[1] = { prog_name }; wxEntry( wx_argc, wx_argv ); lock.lock(); wx_widgets_running = false; have_task.notify_all(); } else { have_task.wait( lock ); } } }
int main(int argc, char* argv[]) { #ifdef _WIN32 // To be compatible with cygwin, we want to avoid lf->crlf conversion _setmode( _fileno( stdout ), _O_BINARY ); #endif // We want to keep the ansi versions for the arguments so // that we can convert them from utf8. for (int i = 0; i < argc; ++i) { CocoaDialogApp::utf8_args.Add(wxString(argv[i], wxConvUTF8)); } // Start by initializing wxWidgets. // this is needed as we do not have a main wxApp class. wxEntry(argc, argv); return 0; }
int main(int argc, char* argv[]) { boost::program_options::options_description desc("Options"); desc.add_options() ("version", "Print version information and quit") ("help,h", "Print basic usage information to stdout and quit") ; boost::program_options::variables_map vm; boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm); boost::program_options::notify(vm); if (vm.count("help")) { std::cout << desc << "\n"; return 0; } if (vm.count("version")) { std::cout << "hello_world " << VERSIONNUMBER << "\n"; return 0; } return wxEntry(argc, argv); }
int wxEntry() { /* There is no command line in PalmOS. For now generate a fake arument * list. Later this may be changed to reflect the application launch code */ wxArrayString args; int argc = args.GetCount(); // +1 here for the terminating NULL wxChar **argv = new wxChar *[argc + 1]; for ( int i = 0; i < argc; i++ ) { argv[i] = wxStrdup(args[i]); } // argv[] must be NULL-terminated argv[argc] = NULL; return wxEntry(argc, argv); }
void *wxe_main_loop(void *vpdl) { int result; int argc = 1; char * temp = (char *) "Erlang"; char * argv[] = {temp,NULL}; ErlDrvPDL pdl = (ErlDrvPDL) vpdl; driver_pdl_inc_refc(pdl); // Disable floating point execption if they are on. // This should be done in emulator but it's not in yet. #ifndef _WIN32 erts_thread_disable_fpe(); #else // Setup that wxWidgets should look for cursors and icons in // this dll and not in werl.exe (which is the default) HMODULE WXEHandle = GetModuleHandle(_T("wxe_driver")); wxSetInstance((HINSTANCE) WXEHandle); #endif wxe_ps_init(); result = wxEntry(argc, argv); // fprintf(stderr, "WXWidgets quits main loop %d \r\n", result); if(result >= 0 && wxe_status == WXE_INITIATED) { /* We are done try to make a clean exit */ wxe_status = WXE_EXITED; driver_pdl_dec_refc(pdl); #ifndef __DARWIN__ erl_drv_thread_exit(NULL); #endif return NULL; } else { erl_drv_mutex_lock(wxe_status_m); wxe_status = WXE_ERROR; erl_drv_cond_signal(wxe_status_c); erl_drv_mutex_unlock(wxe_status_m); driver_pdl_dec_refc(pdl); return NULL; } }
EWXWEXPORT(void,ELJApp_InitializeC)(wxClosure* closure,int _argc,char** _argv) { char* args[] = { "wxc", NULL }; initClosure = closure; if (_argv == NULL) { /* note: wxGTK crashes when argv == NULL */ _argv = args; _argc = 1; } APPTerminating = 0; wxEntry(_argc,_argv); APPTerminating = 1; /* wxPendingEvents is deleted but not set to NULL -> disaster when restarted from an interpreter */ #if !defined(WXMAKINGDLL) && !defined(WXUSINGDLL) wxPendingEvents = NULL; #endif #if defined(wxUSE_ODBC) && (wxUSE_ODBC != 0) wxDbCloseConnections(); #endif }
int main(int argc, char** argv) { std::string locale = CInitializer::GetLocaleOption(); if (locale != "") { if (!CInitializer::SetLocale(locale)) { #ifdef __WXDEBUG__ printf("failed to set locale\n"); #endif CInitializer::error = true; } else { #ifdef __WXDEBUG__ printf("locale set to %s\n", setlocale(LC_ALL, 0)); #endif } } return wxEntry(argc, argv); }
// as with wxEntryStart, we provide an ANSI wrapper int wxEntry(int& argc, char **argv) { ConvertArgsToUnicode(argc, argv); return wxEntry(argc, gs_initData.argv); }
int main(int argc, char **argv) { wxDISABLE_DEBUG_SUPPORT(); return wxEntry(argc, argv); }
void BaczekKPAI::InitAI(IGlobalAICallback* callback, int team) { init_rng(); this->callback=callback; cb = callback->GetAICallback(); cheatcb = callback->GetCheatInterface(); cheatcb->EnableCheatEvents(true); datadir = aiexport_getDataDir(true, ""); std::string dd(datadir); cb->SendTextMsg(AI_NAME, 0); cb->SendTextMsg(AI_VERSION, 0); cb->SendTextMsg("AI data directory:", 0); cb->SendTextMsg(datadir, 0); if (!ailog) { ailog.reset(new Log(callback)); std::stringstream ss; ss << dd << "/log.txt"; std::string logname = ss.str(); ailog->open(logname.c_str()); ailog->info() << "Logging initialized.\n"; ailog->info() << "Baczek KP AI compiled on " __TIMESTAMP__ "\n"; ailog->info() << AI_NAME << " " << AI_VERSION << std::endl; ss.clear(); } InitializeUnitDefs(); std::stringstream ss; ss << dd << "status" << team << ".txt"; std::string logname = ss.str(); statusName = strdup(logname.c_str()); map.h = cb->GetMapHeight(); map.w = cb->GetMapWidth(); map.squareSize = SQUARE_SIZE; float3::maxxpos = map.w * SQUARE_SIZE; float3::maxzpos = map.h * SQUARE_SIZE; ailog->info() << "Map size: " << float3::maxxpos << "x" << float3::maxzpos << std::endl; FindGeovents(); std::string influence_conf = dd+"influence.json"; if (!fs::is_regular_file(fs::path(influence_conf))) { InfluenceMap::WriteDefaultJSONConfig(influence_conf); } influence = new InfluenceMap(this, influence_conf); PythonScripting::RegisterAI(team, this); python = new PythonScripting(team, datadir); debugLines = python->GetIntValue("debugDrawLines", false); debugMsgs = python->GetIntValue("debugMessages", false); toplevel = new TopLevelAI(this); assert(randfloat() != randfloat() || randfloat() != randfloat()); #ifdef USE_STATUS_WINDOW int argc = 1; static char *argv[] = {"SkirmishAI.dll"}; wxEntry(argc, argv); // Create the main application window frame = new MyFrame(_T("Drawing sample"), wxPoint(50, 50), wxSize(550, 340)); // Show it and tell the application that it's our main window frame->Show(true); #endif }
int main() { int x = 0; wxEntry(x, (char**)NULL); //MyApp *myApp = new MyApp(); return (0); }
int main(int argc,char **argv) { vga(); memset(buffers,0,sizeof(buffers)); if(setjmp(jb)!=0) goto frame_limit; /*===============================================*/ test(); /*===============================================*/ frame_limit: if(0) if(frame_count>0) { static void *gifimage=0; static void *gsdata=0; unsigned char *tmp=anim_palette; int ctable[256*3]; int i; for(i=0; i<256; i++) { ctable[i*3]=tmp[i*3]; ctable[i*3+1]=tmp[i*3+1]; ctable[i*3+2]=tmp[i*3+2]; } gifimage=0; gsdata=newgif(&gifimage,W,H,ctable,0); if(gsdata!=0) { int i; int glen; FILE *f; char *fname="c:\\temp\\temp.gif"; animategif(gsdata,0,5,0,2); for(i=0; i<frame_count; i++) { int j; tmp=anim_palette+(i*768); for(j=0; j<256; j++) { ctable[j*3]=tmp[j*3]; ctable[j*3+1]=tmp[j*3+1]; ctable[j*3+2]=tmp[j*3+2]; } fputgif(gsdata,0,0,W,H,buffers+(i*H*W),ctable); } glen=endgif(gsdata); f=fopen(fname,"wb"); if(f) { fwrite(gifimage,1,glen,f); fclose(f); printf("wrote %i frames to %s\n",frame_count,fname); } } } #ifdef USEWX wxEntry(0,0,0,SW_SHOWNORMAL); #else #ifdef _WIN32 DialogBox(0,(LPSTR)IDD_DIALOG1,0,dlg); #endif #endif // USEWX return 0; }