int main (void) { int test, result_idx; int result[101]; long result_total[101]; for (result_idx = 0; result_idx <= 100; result_idx++) { result_total[result_idx] = 0; } for (test = 0; test < NUMTEST; test ++) { for (result_idx = 0; result_idx <= 100; result_idx++) { result[result_idx] = 0; } printf("test %d started\n", test); node_t* p_node = testnode; /*节点指针 pointer to a vertex (node)*/ /*初始化阶段*/ /*Initialization stage*/ node_init (p_node); /*节点的初始化 Initialization on nodes*/ dag_init (); /*DAG图邻接矩阵的初始化 init on adjacent matrix of DAG*/ epower_init (); /*DAG图边权值矩阵的初始化 init on edges' power matrix of DAG*/ core_init (); /*处理器模型的初始化 init on the processor model */ /*随机数生成阶段*/ /*Stage of random number generation*/ p_node = testnode; empower_node (p_node);/*随机生成节点权值 Randomly generates the power of nodes*/ dag_create ();/*DAG图邻接矩阵的随机生成 Randomly generates the adjacent matrix of the DAG.*/ empower_epower ();/*DAG图边权值的随机生成 Randomly generates the power of edges.*/ dag_makeup (); /*将DAG补全成AOE网络 Convert the DAG to Activity-on-Edge network*/ //dag_print (); /*调度算法实施阶段*/ /*Stage of implementing scheduling algorithm.*/ for (var = 0; var <= 100; var++) { MIU = (float)var / 100.0; core_init (); node_recover (); list_init (); convert_dag (); /*DAG图权值的变换 Transfer the power from vertices to edges*/ createadjlist (); critical_path (); /*AOE关键路径的求解 Solving the critical path.*/ result[var] = algorithm (); result_total[var] += result[var]; } for (result_idx = 0; result_idx <= 100; result_idx++) { printf("MIU %d' total time is %d\n", result_idx, result_total[result_idx]); } } return 0; }
/** * @brief ChibiOS/RT initialization. * @details After executing this function the current instructions stream * becomes the main thread. * @pre Interrupts must be still disabled when @p chSysInit() is invoked * and are internally enabled. * @post The main thread is created with priority @p NORMALPRIO. * @note This function has special, architecture-dependent, requirements, * see the notes into the various port reference manuals. * * @special */ void chSysInit(void) { static Thread mainthread; port_init(); scheduler_init(); vt_init(); #if CH_USE_MEMCORE core_init(); #endif #if CH_USE_HEAP heap_init(); #endif #if CH_DBG_ENABLE_TRACE trace_init(); #endif /* Now this instructions flow becomes the main thread.*/ setcurrp(_thread_init(&mainthread, NORMALPRIO)); currp->p_state = THD_STATE_CURRENT; chSysEnable(); #if !CH_NO_IDLE_THREAD /* This thread has the lowest priority in the system, its role is just to serve interrupts in its context while keeping the lowest energy saving mode compatible with the system status.*/ chThdCreateStatic(_idle_thread_wa, sizeof(_idle_thread_wa), IDLEPRIO, (tfunc_t)_idle_thread, NULL); #endif }
/*#####################################################*/ bool board_init() { //RtcStruct.Rtc_ClkSource = _Rtc_Clk_Source_RCOSC_gc; core_init(); //timer_init(); /*-----------------------------------------------------*/ /* Set up the Uart 0 like debug interface with RxBuff = 256, TxBuff = 256, 115200b/s*/ DebugCom = new_(new_uart); DebugCom->BaudRate = 115200; DebugCom->RxBuffSize = 20; DebugCom->TxBuffSize = 10; //DebugCom->Mode = UsartCom_Mode_Asynchronus; DebugCom->Priority = 0; DebugCom->UartNr = 5; uart_open(DebugCom); /*-----------------------------------------------------*/ /* Display board message*/ #if defined(BOARD_MESSAGE) UARTPutc(DebugCom, 0xFF); UARTPutc(DebugCom, 0xFF); UARTPutc(DebugCom, '\n'); UARTPutc(DebugCom, '\r'); UARTprintf(DebugCom, "Use %s Board.\n\r", BOARD_MESSAGE); #endif /*-----------------------------------------------------*/ HARDBTN1 = gpio_assign(0, 1, GPIO_DIR_INPUT); gpio_up_dn(HARDBTN1, 1); /*-----------------------------------------------------*/ LED1 = gpio_assign(3, 12, GPIO_DIR_OUTPUT); LED2 = gpio_assign(3, 13, GPIO_DIR_OUTPUT); LED3 = gpio_assign(3, 14, GPIO_DIR_OUTPUT); LED4 = gpio_assign(3, 15, GPIO_DIR_OUTPUT); /*-----------------------------------------------------*/ return true; }
int main(int argc, char** argv) { pthread_t core_thread; core_attr_t core_info; rdr_t* render_data; int width = 1000, height = 600; core_thread = core_init(); set_core_attribute(CORE_SET_TITLE, (void*)words); set_core_attribute(CORE_SET_WIDTH, &width); set_core_attribute(CORE_SET_HEIGHT, &height); core_attach_render_routine(setup_program); core_attach_mouse_routine(grid_handler); core_attach_keyboard_routine(start_calculating_life_game); core_start(); render_data = setup_render_data(); core_load_render_data(render_data); core_info = get_core_attribute(CORE_WINDOW_RESOLUTION); fprintf (stderr,"Current resolution %dx%d\n", core_info.resolution[0], core_info.resolution[1]); while (core_check_state()) { if (start) life_game(); SDL_Delay(300); } pthread_join(core_thread, NULL); return 0; }
int main(int argc, char** argv) { command_t cmd; command_init(&cmd, "dhcore-test", "1.0"); command_option_pos(&cmd, "test", "Choose unit test", TRUE, cmd_gettest); command_parse(&cmd, argc, argv, NULL); if (IS_FAIL(core_init(CORE_INIT_ALL))) { printf("core init error.\n"); return -1; } log_outputconsole(TRUE); if (g_testidx == -1) g_testidx = show_help(); if (g_testidx != -1) g_tests[g_testidx].test_fn(); #if defined(_DEBUG_) core_release(TRUE); #else core_release(FALSE); #endif return 1; }
void noui_init(void) { static struct poptOption options[] = { POPT_AUTOHELP { "load", 'l', POPT_ARG_STRING, &autoload_module, 0, "Module to load (default = bot)", "MODULE" }, { NULL, '\0', 0, NULL } }; autoload_module = NULL; args_register(options); irssi_gui = IRSSI_GUI_NONE; core_init(); irc_init(); module_register("core", "fe-none"); signal_add("reload", (SIGNAL_FUNC) sig_reload); signal_add("gui exit", (SIGNAL_FUNC) sig_exit); #ifdef HAVE_STATIC_PERL perl_core_init(); #endif signal_emit("irssi init finished", 0); }
int main(int argc, char** argv) { if (argc < 2) { fprintf(stderr, "Usage: %s <trace file>\n", argv[0]); return EXIT_FAILURE; } char* trace_path = argv[argc - 1]; if (!trace_read_open(trace_path)) { fprintf(stderr, "Can't open trace file '%s'.\n", trace_path); return EXIT_FAILURE; } uint32_t rdram_size; trace_read_header(&rdram_size); plugin_set_rdram_size(rdram_size); core_init(&config); retrace_frames(); core_close(); trace_read_close(); return EXIT_SUCCESS; }
void sccd_init() { #if defined(SCCD_BACKEND_RELIC) core_init(); ec_param_set_any(); #endif sccd_random_init(); }
int main(int argc, char * argv[]) { int verbose = 0; int level = 0; FILE * dest = stderr; char optchar = -1; while (optchar = getopt(argc, argv, "c:vd:e:h")) { if (-1 == optchar) break; switch (optchar) { case 'c': conf.source = strdup(optarg); if (NULL == conf.source) fprintf(stderr, "cannot open config file: %s\n", optarg); break; case 'v': verbose = 1; break; case 'e': if (0 == strcmp(optarg, "stderr")) dest = stderr; else if (0 == strcmp(optarg, "stdout")) dest = stdout; else { FILE * out = fopen(optarg, "r"); if (NULL == out) { fprintf(stderr, "failed to open destination for debug, using stderr\n"); dest = stderr; } else dest = out; } break; case 'd': level = atoi(optarg); break; case 'h': show_help(argv[0]); exit(1); break; default: break; } } if (NULL == conf.source) { fprintf(stderr, "no config file in use\n"); exit(1); } dbg_init(dest, level, verbose); DBG(1, "mpsd startup\n"); if (RET_OK == conf_load(&conf)) { core_init(&conf); core_deinit(&conf); DBG(1, "mpsd closing\n"); } conf_unload(&conf); return 0; }
int main(void) { core_init(); task_new("hello-1", hellof, 56, 1024, -1, (void *)50); task_new("hello-2", hellof, 10, 1024, -1, (void *)100); core_start(); return 0; }
status_t pairing_init(void) { int err_code = core_init(); if(err_code != STS_OK) return ELEMENT_PAIRING_INIT_FAILED; // conf_print(); pc_param_set_any(); // see if we can open this up? return ELEMENT_OK; }
gpointer core_new(gchar *elem, gchar *label, struct model_pak *model) { struct core_pak *core; g_assert(elem != NULL); g_assert(model != NULL); core = g_malloc(sizeof(struct core_pak)); /* element related initialization */ core_init(elem, core, model); /* general initialization */ if (label) core->atom_label = g_strdup(label); else core->atom_label = g_strdup(elem); VEC4SET(core->x, 0.0, 0.0, 0.0, 1.0); VEC4SET(core->rx, 0.0, 0.0, 0.0, 1.0); VEC3SET(core->v, 0.0, 0.0, 0.0); VEC3SET(core->offset, 0.0, 0.0, 0.0); core->status = NORMAL; core->primary = TRUE; core->orig = TRUE; core->ghost = FALSE; core->breathe = FALSE; core->growth = FALSE; core->translate = FALSE; core->render_mode = BALL_STICK; core->render_wire = FALSE; core->region = REGION1A; core->radius = 0.0; core->has_sof = FALSE; core->sof = 1.0; core->charge = 0.0; core->lookup_charge = TRUE; core->flags = NULL; core->bonds = NULL; core->mol = NULL; core->shell = NULL; core->primary_core = NULL; core->vibx_list = NULL; core->viby_list = NULL; core->vibz_list = NULL; /* NEW: hydrogen bond capabilities */ if (g_strrstr(elem, "H") != NULL) core->hydrogen_bond = TRUE; else core->hydrogen_bond = FALSE; return(core); }
/*#####################################################*/ bool board_init() { //RtcStruct.Rtc_ClkSource = _Rtc_Clk_Source_RCOSC_gc; core_init(); timer_init(); /*-----------------------------------------------------*/ #ifdef UART_0_INIT UART_0_INIT #endif /*-----------------------------------------------------*/ #ifdef DXL_INTERFACE_INIT DXL_INTERFACE_INIT #endif /*-----------------------------------------------------*/ /* Display board message*/ #if defined(BOARD_MESSAGE) UARTPutc(DebugCom, 0xFF); UARTPutc(DebugCom, 0xFF); UARTPutc(DebugCom, '\n'); UARTPutc(DebugCom, '\r'); UARTprintf(DebugCom, "Use %s Board.\n\r", BOARD_MESSAGE); #endif /*-----------------------------------------------------*/ #ifdef TWI_1_INIT TWI_1_INIT #endif /*-----------------------------------------------------*/ #ifdef ADC_0_INIT ADC_0_INIT #endif /*-----------------------------------------------------*/ #ifdef SHT11_INIT SHT11_INIT #endif /*-----------------------------------------------------*/ #ifdef SRF02_INIT SRF02_INIT #endif /*-----------------------------------------------------*/ #ifdef MHC5883_INIT MHC5883_INIT #endif /*-----------------------------------------------------*/ #ifdef MS5611_INIT MS5611_INIT #endif /*-----------------------------------------------------*/ #ifdef MPU60x0_INIT MPU60x0_INIT #endif /*-----------------------------------------------------*/ LED1 = gpio_assign(IOC, 13, GPIO_OUT_PUSH_PULL, false); return true; }
// Main application entry void main_entry( uint32 *stack_top ) { stack_limit = stack_top; InitHW(); // init hardware if ( core_init( NULL ) ) { failure = true; return; } ui_st = ui_init( NULL ); }
EXPORT int CALL RomOpen (void) { window_fullscreen = ConfigGetParamBool(configVideoGeneral, "Fullscreen"); window_width = ConfigGetParamInt(configVideoGeneral, "ScreenWidth"); window_height = ConfigGetParamInt(configVideoGeneral, "ScreenHeight"); config.num_workers = ConfigGetParamInt(configVideoAngrylionPlus, "NumWorkers"); config.vi.mode = ConfigGetParamInt(configVideoAngrylionPlus, "ViMode"); config.vi.widescreen = ConfigGetParamBool(configVideoGeneral, "AnamorphicWidescreen"); core_init(&config); return 1; }
/** * The function that is called directly from the host application (rct2.exe)'s WinMain. * This will be removed when OpenRCT2 can be built as a stand alone application. */ sint32 main(sint32 argc, const char **argv) { core_init(); sint32 run_game = cmdline_run(argv, argc); if (run_game == 1) { openrct2_launch(); } exit(gExitCode); return gExitCode; }
static void server_destroy_flood_set_up(ServerDestroyFloodData *fixture, const void *data) { args_execute(0, NULL); core_init(); irc_init(); fe_common_core_init(); fe_common_irc_init(); signal_emit("irssi init finished", 0); command_bind("echo", NULL, (SIGNAL_FUNC) cmd_echo); signal_add("message public", (SIGNAL_FUNC) sig_public); signal_add("server destroyed", (SIGNAL_FUNC) print_destroyed); signal_add_first("server disconnected", (SIGNAL_FUNC) print_disconnect); }
static rstatus_t mcp_pre_run(struct context *ctx) { rstatus_t status; struct opt *opt = &ctx->opt; /* initialize logger */ status = log_init(opt->log_level, opt->log_filename); if (status != MCP_OK) { return status; } /* initialize buffer */ memset(ctx->buf1m, '0', sizeof(ctx->buf1m)); /* resolve server info */ status = mcp_resolve_addr(opt->server, opt->port, &opt->si); if (status != MCP_OK) { return status; } /* * Initialize distribution for {conn, call, size} load generators with * either default or user-supplied values. */ dist_init(&ctx->conn_dist, opt->conn_dopt.type, opt->conn_dopt.min, opt->conn_dopt.max, opt->client.id); dist_init(&ctx->call_dist, opt->call_dopt.type, opt->call_dopt.min, opt->call_dopt.max, opt->client.id); dist_init(&ctx->size_dist, opt->size_dopt.type, opt->size_dopt.min, opt->size_dopt.max, opt->client.id); /* initialize stats subsystem */ stats_init(ctx); /* initialize timer */ timer_init(); /* initialize core */ status = core_init(ctx); if (status != MCP_OK) { return status; } return MCP_OK; }
int start(int nodeID) { snprintf(thisID, 10, "%d", nodeID); core_init(); if (pc_param_set_any() != STS_OK) { return 1; } /* Simulate PKG. The private key should be loaded statically in real deployments. */ bn_init(&masterKey, BN_DIGS); bn_read_str(&masterKey, "123456789ABCDEF123456789ABCDEF123456789ABCDEF123456789ABCDEF", 64, 16); cp_sokaka_gen_prv(privateKey, thisID, strlen(thisID), &masterKey); printf("TinyPBC \t Private key received.\n"); return 0; }
int main(int argc,char* argv[]) { posix_parse_command_line(argc, argv); // Read the lib and app infusion archives from file di_app_archive = posix_load_infusion_archive(posix_app_infusion_filename); // initialise memory manager void *mem = malloc(HEAPSIZE); ref_t_base_address = (char*)mem - 42; core_init(mem, HEAPSIZE); dj_exec_setRunlevel(RUNLEVEL_RUNNING); wkpf_picokong(di_app_archive); return 0; }
int main() { // Declared in djarchive.c so that the reprogramming code can find it. di_app_archive = (dj_di_pointer)di_app_infusion_archive_data; // initialise serial port avr_serialInit(115200); core_init(mem, HEAPSIZE); dj_vm_main((dj_di_pointer)di_lib_infusions_archive_data, (dj_di_pointer)di_app_infusion_archive_data, java_library_native_handlers, java_library_native_handlers_length); // Listen to the radio while(true) dj_hook_call(dj_core_pollingHook, NULL); return 0; }
int main() { // Declared in djarchive.c so that the reprogramming code can find it. di_app_archive = (dj_di_pointer)di_app_infusion_archive_data; // initialise serial port avr_serialInit(115200); core_init(mem, HEAPSIZE); dj_exec_setRunlevel(RUNLEVEL_RUNNING); wkpf_picokong((dj_di_pointer)di_app_infusion_archive_data); // Listen to the radio while(true) dj_hook_call(dj_core_pollingHook, NULL); return 0; }
static void textui_init(void) { static struct poptOption options[] = { POPT_AUTOHELP { NULL, '\0', 0, NULL } }; args_register(options); irssi_gui = IRSSI_GUI_TEXT; core_init(); irc_init(); fe_common_core_init(); fe_common_irc_init(); theme_register(gui_text_formats); signal_add("gui exit", (SIGNAL_FUNC) sig_exit); }
void noui_init(void) { srand(time(NULL)); irssi_gui = IRSSI_GUI_NONE; core_init(); irc_init(); module_register("core", "fe-none"); signal_add("reload", (SIGNAL_FUNC) sig_reload); signal_add("gui exit", (SIGNAL_FUNC) sig_exit); #ifdef HAVE_STATIC_PERL perl_core_init(); #endif signal_emit("irssi init finished", 0); }
static void textui_init(void) { #ifdef SIGTRAP struct sigaction act; sigemptyset(&act.sa_mask); act.sa_flags = 0; act.sa_handler = SIG_IGN; sigaction(SIGTRAP, &act, NULL); #endif irssi_gui = IRSSI_GUI_TEXT; core_init(); irc_init(); fe_common_core_init(); fe_common_irc_init(); theme_register(gui_text_formats); signal_add_last("gui exit", (SIGNAL_FUNC) sig_exit); }
int main() { log_init(&logger,NULL,LOG_LEVEL_VERB); log_info("server test start"); struct context *ctx; struct conn* conn; ctx = core_init(); conn = server_create_conn("127.0.0.1", 80, ctx); conn->conn_parse = conn_parse1; conn->conn_close = conn_close1; core_loop(ctx); core_destory(ctx); //conn_close(conn); log_deinit(&logger); return 0; }
int main(int argc,char* argv[]) { posix_parse_command_line(argc, argv); // Read the lib and app infusion archives from file di_lib_archive = posix_load_infusion_archive("lib_infusions.dja"); di_app_archive = posix_load_infusion_archive("app_infusion.dja"); // initialise memory manager void *mem = malloc(HEAPSIZE); ref_t_base_address = (char*)mem - 42; core_init(mem, HEAPSIZE); dj_vm_main(di_lib_archive, di_app_archive, java_library_native_handlers, java_library_native_handlers_length); // Listen to the radio while(true) dj_hook_call(dj_core_pollingHook, NULL); return 0; }
void arch_setup(struct service_backend *backend) { core_init(&core0, 0, ARCH_KERNELSTACKADDRESS + ARCH_KERNELSTACKSIZE, 0); arch_configuregdt(); arch_configureidt(); arch_configuretss(&tss0, core0.id, core0.sp); mapkernel(0, 0x00000000, 0x00000000, 0x00400000); mapkernel(1, 0x00400000, 0x00400000, 0x00400000); mapkernel(2, 0x00800000, 0x00800000, 0x00400000); mapkernel(3, 0x00C00000, 0x00C00000, 0x00400000); mmu_setdirectory(getkerneldirectory()); mmu_enable(); kernel_setup((char *)ARCH_MAILBOXADDRESS); kernel_setcallback(coreget, coreassign); abi_setup(spawn, despawn); binary_setupelf(); service_setupcpio(); resource_register(&backend->resource); setuptask(); arch_leave(&core0); }
int main(int argc, char** argv) { struct paki_args args; // read arguments memset(&args, 0x00, sizeof(args)); args.compress_mode = COMPRESS_NORMAL; command_t cmd; command_init(&cmd, argv[0], VERSION); command_option_pos(&cmd, "pakfile", "pakfile (.pak)", 0, cmdline_pakfile); command_option_pos(&cmd, "path", "path to input directory (for compress mode) or" " path to a file in pakfile (for extract mode)", 1, cmdline_path); command_option(&cmd, "-v", "--verbose", "enable verbose mode", cmdline_verbose); command_option(&cmd, "-l", "--list", "list files in pak", cmdline_list); command_option(&cmd, "-x", "--extract", "extract a file from pak", cmdline_extract); command_option(&cmd, "-c", "--compress", "compress a directory into pak", cmdline_compress); command_option(&cmd, "-z", "--zmode <mode>", "define compression mode, " "compression modes are (none, normal, best, fast)", cmdline_compressmode); cmd.data = &args; command_parse(&cmd, argc, argv, NULL); command_free(&cmd); core_init(CORE_INIT_ALL); log_outputconsole(TRUE); /* check for arguments validity */ if (args.pakfile[0] == 0 || ((BIT_CHECK(args.usage, PAKI_USAGE_EXTRACT) + BIT_CHECK(args.usage, PAKI_USAGE_COMPRESS) + BIT_CHECK(args.usage, PAKI_USAGE_LIST)) != 1)) { printf(TERM_BOLDRED "Invalid arguments\n" TERM_RESET); core_release(FALSE); return -1; } if (BIT_CHECK(args.usage, PAKI_USAGE_EXTRACT) || BIT_CHECK(args.usage, PAKI_USAGE_COMPRESS)) { if (str_isempty(args.path)) { printf(TERM_BOLDRED "'path' argument is not provided\n" TERM_RESET); core_release(FALSE); return -1; } } /* creating archive (-c flag) */ if (BIT_CHECK(args.usage, PAKI_USAGE_COMPRESS)) { save_pak(&args); } else if(BIT_CHECK(args.usage, PAKI_USAGE_EXTRACT)) { load_pak(&args); } else if(BIT_CHECK(args.usage, PAKI_USAGE_LIST)) { list_pak(&args); } #if defined(_DEBUG_) core_release(TRUE); #else core_release(FALSE); #endif return 0; }
static std::vector<paint_session> extract_paint_session(const std::string parkFileName) { core_init(); gOpenRCT2Headless = true; auto context = OpenRCT2::CreateContext(); std::vector<paint_session> sessions; log_info("Starting..."); if (context->Initialise()) { drawing_engine_init(); if (!context->LoadParkFromFile(parkFileName)) { log_error("Failed to load park!"); return {}; } gIntroState = INTRO_STATE_NONE; gScreenFlags = SCREEN_FLAGS_PLAYING; int32_t mapSize = gMapSize; int32_t resolutionWidth = (mapSize * 32 * 2); int32_t resolutionHeight = (mapSize * 32 * 1); resolutionWidth += 8; resolutionHeight += 128; rct_viewport viewport; viewport.x = 0; viewport.y = 0; viewport.width = resolutionWidth; viewport.height = resolutionHeight; viewport.view_width = viewport.width; viewport.view_height = viewport.height; viewport.var_11 = 0; viewport.flags = 0; int32_t customX = (gMapSize / 2) * 32 + 16; int32_t customY = (gMapSize / 2) * 32 + 16; int32_t x = 0, y = 0; int32_t z = tile_element_height(customX, customY) & 0xFFFF; x = customY - customX; y = ((customX + customY) / 2) - z; viewport.view_x = x - ((viewport.view_width) / 2); viewport.view_y = y - ((viewport.view_height) / 2); viewport.zoom = 0; gCurrentRotation = 0; // Ensure sprites appear regardless of rotation reset_all_sprite_quadrant_placements(); rct_drawpixelinfo dpi; dpi.x = 0; dpi.y = 0; dpi.width = resolutionWidth; dpi.height = resolutionHeight; dpi.pitch = 0; dpi.bits = (uint8_t*)malloc(dpi.width * dpi.height); log_info("Obtaining sprite data..."); viewport_render(&dpi, &viewport, 0, 0, viewport.width, viewport.height, &sessions); free(dpi.bits); drawing_engine_dispose(); } log_info("Got %u paint sessions.", std::size(sessions)); return sessions; }