int main(int argc, char **argv) { std::vector<option> options; for (auto it = options_plus.begin(); it != options_plus.end(); ++it) { option op = {it->name, it->has_arg, it->flag, it->val}; options.push_back(op); } Config config; std::string train_file; std::string save_vectors; std::string save_vectors_bin; while (1) { int option_index = 0; int opt = getopt_long(argc, argv, "hv", options.data(), &option_index); if (opt == -1) break; switch (opt) { case 0: break; case 'h': print_usage(); return 0; case 'v': config.verbose = true; break; case 'a': config.dimension = atoi(optarg); break; case 'b': config.min_count = atoi(optarg); break; case 'c': config.window_size = atoi(optarg); break; case 'd': config.n_threads = atoi(optarg); break; case 'e': config.max_iterations = atoi(optarg); break; case 'f': config.negative = atoi(optarg); break; case 'g': config.starting_alpha = atof(optarg); break; case 'i': config.subsampling = atof(optarg); break; case 'j': config.skip_gram = true; break; case 'k': config.hierarchical_softmax = true; break; case 'l': config.sent_vector = true; break; case 'm': train_file = std::string(optarg); break; case 'n': save_vectors = std::string(optarg); break; case 'o': save_vectors_bin = std::string(optarg); break; default: abort(); } } if (!train_file.empty()) { if (!save_vectors.empty()) { Main(train_file, save_vectors, config); return 0; } else if (!save_vectors_bin.empty()) { config.binary = true; Main(train_file, save_vectors_bin, config); return 0; } } print_usage(); return 0; }
int OverlappedCall::TryMain() { int ret; __try { _set_thread_local_invalid_parameter_handler(InvalidCrtParameterHandler); ret = Main(); } __except(MainExceptionFilter(GetExceptionInformation())) { #if TRACING == 1 { TRACELOCK(); TRACESTREAM << std::hex << GetCurrentThreadId()<< L": Terminating; " << *this << std::endl; } #endif NotifyInterpreterOfTermination(); ret = 0; } Term(); // Thread is terminating, so don't want handles (also lets Complete() know we have terminated) return ret; }
int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow ) { App::hInstance = hInstance; App::hPrevInstance = hPrevInstance; App::CmdLine = lpszCmdLine; App::nCmdShow = nCmdShow; int ret=Main(); // TextWindow open if (App::TextWindow && (App::TextWindow->StayOpen)) { App::TextWindow->Parent=NULL; App::MainWindow=(Object *) App::TextWindow; String S(GetWindowTextLength(App::MainWindow->hWnd)+1); GetWindowText(App::MainWindow->hWnd,S,S.Size()); S.Update(); S << " (finished)"; SetWindowText(App::MainWindow->hWnd,S); ShowWindow(App::MainWindow->hWnd, SW_SHOW ); // wait until closed return App::MessageLoop(); // delete App::TextWindow; ?? } return ret; }
//***************************************************************************** // // This is the code that gets called when the processor first starts execution // following a reset event. Only the absolutely necessary set is performed, // after which the application supplied entry() routine is called. Any fancy // actions (such as making decisions based on the reset cause register, and // resetting the bits in that register) are left solely in the hands of the // application. // //***************************************************************************** void ResetISR(void) { unsigned long *pulSrc, *pulDest; // // Copy the data segment initializers from flash to SRAM. // pulSrc = &_etext; for(pulDest = &_data; pulDest < &_edata; ) { *pulDest++ = *pulSrc++; } // // Zero fill the bss segment. // for(pulDest = &_bss; pulDest < &_ebss; ) { *pulDest++ = 0; } // // Call the application's entry point. // Main(); }
bool TaskQueue::ProcessOneMainTask() { // static std_::unique_ptr<Task> task; { QMutexLocker lock(&Main().tasks_mutex_); auto &tasks = Main().tasks_; if (tasks.empty()) { return false; } task.reset(tasks.front()); tasks.pop_front(); } (*task)(); return true; }
int main(int argc, char **argv) { while (true) { int action = Main(); switch (action) { case LAUNCH_NICKEL: KoboExecNickel(); return EXIT_FAILURE; case SimulatorPromptWindow::FLY: KoboRunXCSoar("-fly"); /* return to menu after XCSoar quits */ break; case SimulatorPromptWindow::SIMULATOR: KoboRunXCSoar("-simulator"); /* return to menu after XCSoar quits */ break; case POWEROFF: KoboPowerOff(); return EXIT_SUCCESS; default: return EXIT_SUCCESS; } } }
static int Main() { dialog_settings.SetDefaults(); ScreenGlobalInit screen_init; Layout::Initialize({600, 800}); InitialiseFonts(); DialogLook dialog_look; dialog_look.Initialise(); TopWindowStyle main_style; main_style.Resizable(); SingleWindow main_window; main_window.Create(_T("XCSoar/KoboMenu"), {600, 800}, main_style); main_window.Show(); global_dialog_look = &dialog_look; global_main_window = &main_window; int action = Main(main_window, dialog_look); main_window.Destroy(); DeinitialiseFonts(); return action; }
int main( int argc, char* argv[] ) { Allocator::Enable( true ); Allocator::GetDefault().Initialize( g_MainMemorySize ); Main( argc, argv ); #if DO_PROFILING #if BUILD_DEBUG // I ship Release ContentSyncer, not Final. Profiler::GetInstance()->Dump( FileStream( "profiler.txt", FileStream::EFM_Write ) ); #endif Profiler::DeleteInstance(); #endif #if BUILD_DEBUG Allocator::GetDefault().Report( FileStream( "content-syncer-memory-exit-report.txt", FileStream::EFM_Write ) ); #endif DEBUGASSERT( Allocator::GetDefault().CheckForLeaks() ); Allocator::GetDefault().ShutDown(); DEBUGASSERT( _CrtCheckMemory() ); DEBUGASSERT( !_CrtDumpMemoryLeaks() ); return 0; }
void BaseTask::Run() { if (_cancelled) { return; } Main(); }
int APIENTRY WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmd, int nShow) { char **argv= NULL; int argc; win_command_line = GetCommandLine(); argc = makeargv(win_command_line, " \t\n", &argv); Main(argc, (char **) argv); freemakeargv(argv); // attempt to restart if requested if(restart_required > 0){ STARTUPINFO si; PROCESS_INFORMATION pi; LOG_INFO("Restarting %s", win_command_line); ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); CreateProcess(NULL, win_command_line, NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE. DETACHED_PROCESS, // Keep this separate NULL, // Use parent's environment block. NULL, // Use parent's starting directory. &si, // Pointer to STARTUPINFO structure. &pi); // Pointer to PROCESS_INFORMATION structure } return 0; }
/* WinMain() */ int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpCmdLine, int nCmdShow) { Main(); return (int)0; }
void Prog() { MatchString("PROGRAM"); Header(); TopDecls(); Main(); Match('.'); }
int Boot(){ if (!RegisterClassEx(&WndClassEx_Properties.Get_WndClass_Ex()))return -1; WinMain_Properties.Set_hWnd(CreateWindowEx(WinMain_Properties, WndClassEx_Properties, Window_Properties)); ShowWindow(WinMain_Properties.Get_hWnd(), WinMain_Properties.Get_nCmdShow()); UpdateWindow(WinMain_Properties.Get_hWnd()); SetWindowLong(WinMain_Properties.Get_hWnd(), GWL_USERDATA, (LONG)this); MSG msg; DrawClass_Init(); unsigned int STime, PedTime, RTime = timeGetTime(), FCounter = 0; while (!EndFlag){ STime = timeGetTime(); if (PeekMessage(&msg, WinMain_Properties.Get_hWnd(), 0, 0, PM_REMOVE)){ if (msg.message != WM_QUIT){ TranslateMessage(&msg); DispatchMessage(&msg); } else break; } Main(); PedTime = timeGetTime() - STime; Wait((1000 / Window_Properties.Get_Set_Fps() > PedTime) ? (1000 / Window_Properties.Get_Set_Fps() - PedTime) : 0); if (timeGetTime() - RTime >= 1000){ RTime = timeGetTime(); Window_Properties.Set_Measured_Fps(FCounter); FCounter = 0; } ++FCounter; } return 0; }
int main() { while (scanf("%d%d%d",&A,&B,&N),N) { Main(); } }
inline int Main( int argc, char* const argv[] ) { Config config; // !TBD: This doesn't always work, for some reason // if( isDebuggerActive() ) // config.useStream( "debug" ); return Main( argc, argv, config ); }
int main() { while (scanf("%d",&N)!=EOF) { Main(); } return 0; }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(nCmdShow); return Main(hInstance); }
void CSoldierBase::SeqMain() { EveryAction(); Main(); }
int main() { while (scanf("%d",&N),N) { Main(); } return 0; }
int main() { while (scanf("%d%d",&N,&R),N!=0) { Main(); } return 0; }
int main() { while (scanf("%d%d%d",&K,&C,&M)!=EOF) { Main(); } return 0; }
int sAltonaMain() { sAltonaInit(); sLog("sys","calling Main()"); Main(); sLog("sys","Main() returned"); return sAltonaExit(); }
int main() { for (int i=1;i;++i) { scanf("%d",&N);if (!N) break; printf("Case %d: ",i); Main(); } return 0; }
int main() { while (~scanf("%d%d",&N,&M)) { if (N==0) return 0; Main(); } return 0; }
int main(int argc, const char *argv[]) { int RetVal; dbg_logger_stdout(); #if defined(CONF_FAMILY_UNIX) signal(SIGINT, ExitFunc); signal(SIGTERM, ExitFunc); signal(SIGQUIT, ExitFunc); signal(SIGHUP, ReloadFunc); #endif char aUsage[128]; CConfig Config; str_format(aUsage, sizeof(aUsage), "%s [options]", argv[0]); const char *pConfigFile = 0; const char *pWebDir = 0; const char *pBindAddr = 0; struct argparse_option aOptions[] = { OPT_HELP(), OPT_BOOLEAN('v', "verbose", &Config.m_Verbose, "Verbose output", 0), OPT_STRING('c', "config", &pConfigFile, "Config file to use", 0), OPT_STRING('d', "web-dir", &pWebDir, "Location of the web directory", 0), OPT_STRING('b', "bind", &pBindAddr, "Bind to address", 0), OPT_INTEGER('p', "port", &Config.m_Port, "Listen on port", 0), OPT_END(), }; struct argparse Argparse; argparse_init(&Argparse, aOptions, aUsage, 0); argc = argparse_parse(&Argparse, argc, argv); if(pConfigFile) str_copy(Config.m_aConfigFile, pConfigFile, sizeof(Config.m_aConfigFile)); if(pWebDir) str_copy(Config.m_aWebDir, pWebDir, sizeof(Config.m_aWebDir)); if(pBindAddr) str_copy(Config.m_aBindAddr, pBindAddr, sizeof(Config.m_aBindAddr)); if(Config.m_aWebDir[strlen(Config.m_aWebDir)-1] != '/') str_append(Config.m_aWebDir, "/", sizeof(Config.m_aWebDir)); if(!fs_is_dir(Config.m_aWebDir)) { dbg_msg("main", "ERROR: Can't find web directory: %s", Config.m_aWebDir); return 1; } char aTmp[1024]; str_format(aTmp, sizeof(aTmp), "%s%s", Config.m_aWebDir, Config.m_aJSONFile); str_copy(Config.m_aJSONFile, aTmp, sizeof(Config.m_aJSONFile)); CMain Main(Config); RetVal = Main.Run(); return RetVal; }
NonLiving::NonLiving(int x, int y, ActorType NewType):Actor(x,y) { setScriptSource(NewType.Script); Action Stand("Stand",""); Animation Main(NewType.Source,"0,",0,0,1,true); //Main.setRotation(270,90,0); Stand.setMainAnimation(0); Stand.addAnimation(Main); addAction(Stand); };
int main() { int i=0; while (scanf("%s",S)!=EOF) { printf("Case %d: ",++i); Main(); } return 0; }
int main() { scanf("%d",&n); for (int i=1;i<=n;++i) { scanf("%d",&d[i]); } srand(time(0)); for (int i=1;i<=2700;++i) Main(); }
int WINAPI wWinMain(HINSTANCE, HINSTANCE, wchar_t*, int) { _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); ::OutputDebugStringW(L"Siv3D for Windows\n"); Main(); return 0; }
inline int Main ( int argc, char* const argv[] ) { Config config; // if( isDebuggerActive() ) // config.useStream( "debug" ); return Main( argc, argv, config ); }