int GameThread::Execute() { //startwin_open(); baselayer_init(); app_main(_buildargc, _buildargv); return 0; }
// WinMain - Windows calls this to execute application int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { application_instance = hInstance; // record the application instance for accessing resources full_screen_window = NULL; app_main(); // call our real program close_eyelink_connection(); // make sure EYELINK DLL is released if(full_screen_window) close_full_screen_window(); return 0; }
int main() { try { return app_main() ; } catch( const std::exception& e ) { std::cerr << "platform is not instantiated\n" ; } }
int main() { // test_error(); // test_main(); // init_isr(); app_main(); return 0; }
static void _app_main(void *arg) { start_info_t *si = arg; #ifdef CONFIG_PCI init_pcifront(NULL); #endif app_main(si); }
LOCAL_C void DoStartL() { CActiveScheduler *scheduler = new (ELeave) CActiveScheduler; CleanupStack::PushL(scheduler); CActiveScheduler::Install(scheduler); app_main(); CActiveScheduler::Install(NULL); CleanupStack::Pop(scheduler); delete scheduler; }
int catch_app_main(Portal &portal, const std::vector<char *> &args) { try { return app_main(portal, args); } catch (const std::exception &e) { std::string description = std::string("An error has occured:\n") + e.what(); // FIXME: if DEV, don't display this; make it easy to bt in gdb portal.requestInterface<Glfw::WindowManager>()->displayError( "Error in application; can't continue", description.c_str()); } return EXIT_FAILURE; }
int main(int argc, char *argv[]) { app_main(argc, argv, service_main, NULL, APP_CTL_INIT_FN, service_init, /* APP_CTL_INIT_CTX, NULL, */ APP_CTL_EXIT_FN, service_exit, /* APP_CTL_EXIT_CTX, NULL, */ APP_CTL_CFG_BOOL, service_conf_bool_tab, APP_CTL_CFG_INT, service_conf_int_tab, APP_CTL_CFG_STR, service_conf_str_tab, APP_CTL_END); exit (0); }
static void d2cs(void * dummy) { switch (app_main(__argc, __argv)) { case EXIT_SERVICE: gui_run = FALSE; /* close gui */ case EXIT_ERROR: d2cs_run = FALSE; /* don't restart */ case EXIT_OK: ; /* do nothing */ } d2cs::fprintf(stderr, "Server Stopped\n"); d2cs_running = FALSE; }
int main(int argc, char *argv[]) { /* acl_debug_malloc_init("log.txt"); */ app_main(argc, argv, service_main, NULL, APP_CTL_INIT_FN, service_init, /* APP_CTL_INIT_CTX, NULL, */ APP_CTL_EXIT_FN, service_exit, /* APP_CTL_EXIT_CTX, NULL, */ APP_CTL_CFG_BOOL, service_conf_bool_tab, APP_CTL_CFG_INT, service_conf_int_tab, APP_CTL_CFG_STR, service_conf_str_tab, APP_CTL_DENY_INFO, reply_403_close, APP_CTL_END); exit (0); }
static int thread_sdl_app_main(void *param) { SDL_LockMutex(m); cores[CURRENT_CORE].running = &threads[0]; /* Set the jump address for return */ if (setjmp(thread_jmpbufs[0]) == 0) { app_main(param); /* should not ever be reached but... */ THREAD_PANICF("app_main returned!\n"); } /* Unlock and exit */ SDL_UnlockMutex(m); return 0; }
/* Application entry */ int SGX_CDECL main(int argc, char *argv[]) { /* Initialize the enclave */ if(initialize_enclave() < 0){ printf("Enter a character before exit ...\n"); getchar(); return -1; } app_main(argc, argv); /* Destroy the enclave */ sgx_destroy_enclave(global_eid); printf("Info: SampleEnclave successfully returned.\n"); return 0; }
void _task_init(void) { kprintf("\nHAL: _task_init()"); hf_spawn(_idletask, 0, 0, 0, "idle task", 1024); #ifdef USTACK ustack_init(); #endif app_main(); kprintf("\nKERNEL: free heap: %d bytes", krnl_free); kprintf("\nKERNEL: HellfireOS is up\n"); krnl_task = &krnl_tcb[0]; hf_schedlock(0); _context_restore(krnl_task->task_context, 1); }
void start_kernel(void) { /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ local_irq_enable(); setup_xen_features(); /* Init memory management. */ init_mm(); /* Init GDT */ init_gdt(); /* Init time and timers. */ init_time(); /* Init the console driver. */ init_console(); /* Init grant tables */ init_gnttab(); /* Init scheduler. */ init_sched(); /* Init XenBus */ init_xenbus(); /* Init futexes */ init_futex(); #ifdef CONFIG_XENBUS create_thread("shutdown", shutdown_thread, NULL); #endif /* Call (possibly overridden) app_main() */ app_main(&start_info); /* Everything initialised, start idle thread */ run_idle_thread(); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { int argc = 1; char* argv[] = { "" }; #else int main(int argc, char* argv[]) { #endif // SkGraphics::Init(); // SkEvent::Init(); int res = app_main(argc, argv); // SkEvent::Term(); // SkGraphics::Term(); return res; }
int main(int argc, char **argv) { QApplication Q(argc, argv); app_main(); QTApplication *D = new QTApplication(); D->show(); int ret = 1; try { ret = Q.exec(); } catch (Exception &e) { fprintf(stderr, "Fatal error: %s\n", e.getMessage()); e.printStackTrace(); } catch (std::exception &e) { fprintf(stderr, "Fatal exception %s\n", e.what()); } return ret; }
/* * INITIAL C ENTRY POINT. */ void start_kernel(start_info_t *si) { static char hello[] = "Bootstrapping...\n"; (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello); arch_init(si); trap_init(); /* print out some useful information */ printk("Mirage OS!\n"); printk(" start_info: %p(VA)\n", si); printk(" nr_pages: 0x%lx\n", si->nr_pages); printk(" shared_inf: 0x%08lx(MA)\n", si->shared_info); printk(" pt_base: %p(VA)\n", (void *)si->pt_base); printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames); printk(" mfn_list: %p(VA)\n", (void *)si->mfn_list); printk(" mod_start: 0x%lx(VA)\n", si->mod_start); printk(" mod_len: %lu\n", si->mod_len); printk(" flags: 0x%x\n", (unsigned int)si->flags); printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti(); arch_print_info(); setup_xen_features(); /* Init memory management. */ init_mm(); /* Init time and timers. */ init_time(); /* Call (possibly overridden) app_main() */ app_main(&start_info); }
int main(int argc, char **argv) { Portal interfaces; if (!glfwInit()) { std::cerr << "glfw: failed to initialize" << std::endl; return EXIT_FAILURE; } std::cout << "glfw: registering interfaces..." << std::endl; interfaces.registerInterface<Glfw::WindowManager>(); interfaces.registerInterface<Glfw::Input>(); interfaces.registerInterface<OpenGl::Graphics>(); interfaces.registerInterface<DevIl::ImageLoader>(); std::cout << "glfw: initialized" << std::endl; app_main(interfaces); glfwTerminate(); }
int main(int argc, char **argv) { // create and register default log consumer Log::registerConsumer(Log::DefaultLogConsumer()); std::stringstream ss; ss << argv[0]; for (int i(1); i != argc; ++i) { ss << " " << argv[i]; } Log(INFO) << "Starting-up: " << ss.str(); Portal interfaces; if (!glfwInit()) { std::cerr << "glfw: failed to initialize" << std::endl; return EXIT_FAILURE; } std::cout << "glfw: registering interfaces..." << std::endl; interfaces.registerInterface<Glfw::WindowManager>(); interfaces.registerInterface<Glfw::Input>(); interfaces.registerInterface<OpenGl::Graphics>(); interfaces.registerInterface<DevIl::ImageLoader>(); interfaces.registerInterface<Enet::Network>(); std::cout << "glfw: initialized" << std::endl; std::vector<char *> args(argv, argv + argc); int exitCode; #ifndef DEV // Catch any exceptions thrown from main, then show it to the user exitCode = catch_app_main(interfaces, args); #else // Don't catch any exceptions at this level during debug; makes it easier to // see where the error is using gdb/other debugging tool exitCode = app_main(interfaces, args); #endif glfwTerminate(); }
int main(int argc, char *argv[]) { int r; buildkeytranslationtable(); #ifdef HAVE_GTK2 gtkbuild_init(&argc, &argv); #endif startwin_open(); #ifdef __APPLE__ // consume Xcode's "-NSDocumentRevisionsDebugMode xx" parameter _buildargv = calloc(argc+1, sizeof(char *)); for (r = _buildargc = 0; r < argc; r++) { if (strcmp(argv[r], "-NSDocumentRevisionsDebugMode") == 0) { r++; } else { _buildargv[_buildargc++] = argv[r]; } } _buildargv[_buildargc] = 0; #else _buildargc = argc; _buildargv = (const char **)argv; #endif baselayer_init(); r = app_main(_buildargc, (char const * const*)_buildargv); #ifdef __APPLE__ free(_buildargv); #endif startwin_close(); #ifdef HAVE_GTK2 gtkbuild_exit(r); #endif return r; }
void WINAPI ServiceMain(DWORD argc, char *argv[]) { // initialise service status serviceStatus.dwServiceType = SERVICE_WIN32; serviceStatus.dwCurrentState = SERVICE_START_PENDING; serviceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_PAUSE_CONTINUE; serviceStatus.dwWin32ExitCode = NO_ERROR; serviceStatus.dwServiceSpecificExitCode = NO_ERROR; serviceStatus.dwCheckPoint = 0; serviceStatus.dwWaitHint = 0; serviceStatusHandle = RegisterServiceCtrlHandler(serviceName, ServiceControlHandler); if (serviceStatusHandle) { char path[_MAX_PATH + 1]; unsigned int i, last_slash = 0; GetModuleFileName(0, path, sizeof(path) / sizeof(path[0])); for (i = 0; i < std::strlen(path); i++) { if (path[i] == '\\') last_slash = i; } path[last_slash] = 0; // service is starting serviceStatus.dwCurrentState = SERVICE_START_PENDING; SetServiceStatus(serviceStatusHandle, &serviceStatus); // do initialisation here SetCurrentDirectory(path); // running serviceStatus.dwControlsAccepted |= (SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); serviceStatus.dwCurrentState = SERVICE_RUNNING; SetServiceStatus(serviceStatusHandle, &serviceStatus); //////////////////////// // service main cycle // //////////////////////// g_ServiceStatus = 1; argc = 1; #ifdef WIN32_GUI app_main(argc, argv); #else main(argc, argv); #endif // service was stopped serviceStatus.dwCurrentState = SERVICE_STOP_PENDING; SetServiceStatus(serviceStatusHandle, &serviceStatus); // do cleanup here // service is now stopped serviceStatus.dwControlsAccepted &= ~(SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN); serviceStatus.dwCurrentState = SERVICE_STOPPED; SetServiceStatus(serviceStatusHandle, &serviceStatus); } }
/* WinMain - Windows calls this to execute application */ int PASCAL WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { app_main(NULL,NULL);/* call our real program */ return 0; }
/** * Local main function which calls the application Main * app_main will be the entry point to application and * must return. **/ static void local_main(void * arg) { arch_init(); app_main(arg); }
int main() { pj_caching_pool cp; pj_cli_cfg cli_cfg; pj_cli_telnet_cfg tcfg; pj_str_t xml; pj_status_t status; int i; pj_init(); pj_caching_pool_init(&cp, NULL, 0); pjlib_util_init(); /* * Create CLI app. */ pj_cli_cfg_default(&cli_cfg); cli_cfg.pf = &cp.factory; cli_cfg.name = pj_str("mycliapp"); cli_cfg.title = pj_str("My CLI Application"); status = pj_cli_create(&cli_cfg, &cli); if (status != PJ_SUCCESS) goto on_return; /* * Register some commands. */ for (i = 0; i < sizeof(cmd_xmls)/sizeof(cmd_xmls[0]); i++) { xml = pj_str(cmd_xmls[i].xml); status = pj_cli_add_cmd_from_xml(cli, NULL, &xml, cmd_xmls[i].handler, NULL, get_codec_list); if (status != PJ_SUCCESS) goto on_return; } /* * Start telnet daemon */ pj_cli_telnet_cfg_default(&tcfg); // tcfg.passwd = pj_str("pjsip"); #if USE_RANDOM_PORT tcfg.port = 0; #else tcfg.port = 2233; #endif tcfg.prompt_str = pj_str("CoolWater% "); status = pj_cli_telnet_create(cli, &tcfg, NULL); if (status != PJ_SUCCESS) goto on_return; /* * Run the system specific main loop. */ status = app_main(cli); on_return: /* * Destroy */ pj_cli_destroy(cli); cli = NULL; pj_caching_pool_destroy(&cp); pj_shutdown(); return (status != PJ_SUCCESS ? 1 : 0); }
int main() { pj_caching_pool cp; pj_cli_cfg cli_cfg; pj_cli_telnet_cfg tcfg; pj_str_t xml; pj_status_t status; pj_status_t cli_status; int i; pj_log_set_level(LOG_LEVEL); print_msg(("", "INITING .... \n")); status = pj_init(); PJ_ASSERT_RETURN(status == PJ_SUCCESS, 1); if (status != PJ_SUCCESS) { print_msg(("", "PJ INIT FAILED \n")); } pj_caching_pool_init(&cp, NULL, 0); pjlib_util_init(); /* * Create CLI app. */ pj_cli_cfg_default(&cli_cfg); print_msg(("", "INITING CLI CFG.... \n")); cli_cfg.pf = &cp.factory; cli_cfg.name = pj_str("tinysipcli"); cli_cfg.title = pj_str("TINYSIP"); cli_status = pj_cli_create(&cli_cfg, &cli); print_msg(("", "AFTER INITING CLI CFG.... \n")); if (cli_status != PJ_SUCCESS) { print_msg(("", "CLI FAILED \n")); goto on_return; } /* * Register some commands. */ for (i = 0; i < sizeof(cmd_xmls) / sizeof(cmd_xmls[0]); i++) { xml = pj_str(cmd_xmls[i].xml); // print_msg(("",cmd_xmls[i].xml)); status = pj_cli_add_cmd_from_xml(cli, NULL, &xml, cmd_xmls[i].handler, NULL, get_cmd_list); if (status != PJ_SUCCESS) continue; // goto on_return; } /* Create pjsua first! */ status = pjsua_create(); if (status != PJ_SUCCESS) error_exit("Error in pjsua_create()", status); /* Init pjsua */ { pjsua_logging_config log_cfg; pjsua_logging_config_default(&log_cfg); log_cfg.console_level = LOG_LEVEL; pjsua_config cfg; pjsua_config_default(&cfg); cfg.cb.on_incoming_call = &on_incoming_call; cfg.cb.on_call_media_state = &on_call_media_state; cfg.cb.on_call_state = &on_call_state; status = pjsua_init(&cfg, &log_cfg, NULL); if (status != PJ_SUCCESS) error_exit("Error in pjsua_init()", status); } /* Add UDP transport. */ { pjsua_transport_config cfg; pjsua_transport_config_default(&cfg); cfg.port = 5060; status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &cfg, NULL); if (status != PJ_SUCCESS) error_exit("Error creating transport", status); } /* * Start telnet daemon */ pj_cli_telnet_cfg_default(&tcfg); // tcfg.passwd = pj_str("pjsip"); #if USE_RANDOM_PORT tcfg.port = 0; #else tcfg.port = 2233; #endif tcfg.prompt_str = pj_str("CMD % "); status = pj_cli_telnet_create(cli, &tcfg, NULL); if (status != PJ_SUCCESS) goto on_return; /* * Run the system specific main loop. */ status = app_main(cli); on_return: print_msg(("", "There're some issues, application is going down now!\n")); /* * Destroy */ pj_cli_destroy(cli); cli = NULL; pj_caching_pool_destroy(&cp); pj_shutdown(); return (status != PJ_SUCCESS ? 1 : 0); }
int main(int argc, char* argv[]) { return app_main(argc, argv); }
int main() { // Bring up soft reset button. resetButton.mode(PullUp); resetButton.fall(microbit_reset); #if CONFIG_ENABLED(MICROBIT_DBG) // For diagnostics. Gives time to open the console window. :-) for (int i=3; i>0; i--) { uBit.serial.printf("=== SUPERMAIN: Starting in %d ===\n", i); wait(1.0); } uBit.serial.printf("micro:bit runtime DAL version %s\n", MICROBIT_DAL_VERSION); #endif // Bring up our nested heap allocator. microbit_heap_init(); // Bring up fiber scheduler scheduler_init(); // Bring up random number generator, BLE, display and system timers. uBit.init(); // Provide time for all threaded initialisers to complete. uBit.sleep(100); #if CONFIG_ENABLED(MICROBIT_BLE_PAIRING_MODE) // Test if we need to enter BLE pairing mode... int i=0; while (uBit.buttonA.isPressed() && uBit.buttonB.isPressed() && i<10) { uBit.sleep(100); i++; if (i == 10) { // Start the BLE stack, if it isn't already running. if (!uBit.ble) { uBit.bleManager.init(uBit.getName(), uBit.getSerial(), true); uBit.ble = uBit.bleManager.ble; } // Enter pairing mode, using the LED matrix for any necessary pairing operations uBit.bleManager.pairingMode(uBit.display); } } #endif #if CONFIG_ENABLED(MICROBIT_BLE_ENABLED) // Start the BLE stack, if it isn't already running. if (!uBit.ble) { uBit.bleManager.init(uBit.getName(), uBit.getSerial(), false); uBit.ble = uBit.bleManager.ble; } #endif app_main(); // If app_main exits, there may still be other fibers running, registered event handlers etc. // Simply release this fiber, which will mean we enter the scheduler. Worse case, we then // sit in the idle task forever, in a power efficient sleep. release_fiber(); // We should never get here, but just in case. while(1); }
/****************************************************************************** Program Main *******************************************************************************/ int main(int argc, char *argv[]) { int ret = 0, d, index; char shortoptions[] = "s:c:p:m:d:w:"; /* 0 or 1 */ static int channel_no; /* 0 - NTSC, 1 - PAL */ static int input_std = V4L2_STD_NTSC; input_device = CAPTURE_DEVICE0; input_name = CAPTURE_INPUT0; for (;;) { d = getopt_long(argc, argv, shortoptions, (void *)NULL, &index); if (-1 == d) break; switch (d) { case 'm': case 'M': input_std = atoi(optarg); if (input_std) { input_std_id = V4L2_STD_PAL; sizeimage = BYTESPERLINE*576*2; } break; case 's': case 'S': stress_test = atoi(optarg); break; case 'p': case 'P': print_fn = atoi(optarg); break; case 'c': case 'C': channel_no = atoi(optarg); if (channel_no == 1) { input_device = CAPTURE_DEVICE1; input_name = CAPTURE_INPUT1; } break; case 'd': case 'D': display_enable = atoi(optarg); break; case 'w': case 'W': save_frame = atoi(optarg); break; default: menu(); exit(1); } } if (save_frame) { file_fp = fopen("./capt_frame.yuv", "wb"); if (file_fp == NULL) { printf("Unable to open ./capt_frame.yuv\n"); exit(1); } } app_main(); return 0; }
void MyTask::RunL() { int rc = app_main(); asw_->AsyncStop(); }
/* * INITIAL C ENTRY POINT. */ void start_kernel(start_info_t *si) { static char hello[] = "Bootstrapping...\n"; (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello); setup_xen_features(); pvh_early_init(); arch_init(si); trap_init(); /* print out some useful information */ printk("Xen Minimal OS!\n"); printk(" start_info: %p(VA)\n", si); printk(" nr_pages: 0x%lx\n", si->nr_pages); printk(" shared_inf: 0x%08lx(MA)\n", si->shared_info); printk(" pt_base: %p(VA)\n", (void *)si->pt_base); printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames); printk(" mfn_list: %p(VA)\n", (void *)si->mfn_list); printk(" mod_start: 0x%lx(VA)\n", si->mod_start); printk(" mod_len: %lu\n", si->mod_len); printk(" flags: 0x%x\n", (unsigned int)si->flags); printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti(); arch_print_info(); /* Init memory management. */ init_mm(); /* Init time and timers. */ init_time(); /* Init the console driver. */ init_console(); /* Init grant tables */ init_gnttab(); /* Init scheduler. */ init_sched(); /* Init XenBus */ init_xenbus(); #ifdef CONFIG_XENBUS /* Init shutdown thread */ init_shutdown(si); #endif /* Call (possibly overridden) app_main() */ app_main(&start_info); /* Everything initialised, start idle thread */ run_idle_thread(); }