API_EXPORTED struct eegdev* egd_open(const char* confstring) { struct conf cf; struct eegdev* dev = NULL; const char* device; // Load global configuration if (init_configuration(&cf, confstring) || load_configuration_file(&cf, "eegdev.conf", 1)) { free_configuration(&cf); return NULL; } // Get device type device = get_conf_setting(&cf, "device", "any"); if (!strcmp(device, "any")) dev = open_any(&cf); else dev = open_plugin_device(device, &cf); free_configuration(&cf); return dev; }
int main() { load_configuration_file(); // ŁADOWANIE BIBLIOTEK al_init(); al_init_image_addon(); al_init_primitives_addon(); al_install_keyboard(); al_init_font_addon(); al_init_ttf_addon(); al_install_audio(); al_init_acodec_addon(); al_reserve_samples(100); // WYŚWTIETLANIE EKRANU display.view = NULL; // al_get_display_mode(al_get_num_display_modes() -3, &disp_data); // al_set_new_display_flags(ALLEGRO_FULLSCREEN); display.view = al_create_display(display.width, display.height); // TIMER main_timer = NULL; main_timer = al_create_timer(1.0 / display.FPS); GAME_MODE = MENU; Exit_game = false; al_start_timer(main_timer); while (!Exit_game) { switch (GAME_MODE) { case MENU: menu(); break; case GAMEPLAY: gameplay(); break; case AFTER_GAMEPLAY: menu(); break; default: break; } } al_destroy_display(display.view); al_destroy_timer(main_timer); return 111; }
static struct eegdev* open_plugin_device(const char* dname, struct conf *cf) { struct eegdev* dev = NULL; void *handle; const struct egdi_plugin_info* info; const char* dir = getenv("EEGDEV_PLUGINS_DIR"); char path[128], confname[64]; unsigned int nopt; // dlopen the plugin snprintf(path, sizeof(path), "%s/%s"LT_MODULE_EXT, (dir?dir:PLUGINS_DIR), dname); if ( !(handle = dlopen(path, RTLD_LAZY | RTLD_LOCAL)) || !(info = dlsym(handle, "eegdev_plugin_info")) || (info->plugin_abi != EEGDEV_PLUGIN_ABI_VERSION) ) { errno = ENOSYS; goto fail; } // Count the number of options supported by the plugin nopt = 0; if (info->supported_opts) { while (info->supported_opts[nopt].name) nopt++; } // Load device specific configuration snprintf(confname, sizeof(confname), "%s.conf", dname); if (load_configuration_file(cf, confname, 0)) goto fail; // Try to open the device dev = open_init_device(info, nopt, cf); if (!dev) goto fail; dev->handle = handle; return dev; fail: if (handle) dlclose(handle); return NULL; }
/*---------------------------------------------------*/ void do_save_conf() { save_own_conf("DEFAULT.BCF"); load_configuration_file(); }
int main(int argc, char* argv[]) { int cache_size_L1 = 128; int block_size_L1 = 16; int num_of_blocks_L1 = cache_size_L1/block_size_L1; L1_BLOCK block; int cache_size_L2 = 128; int block_size_L2=16; int num_of_blocks_L2 = cache_size_L2/block_size_L2; block.block_trans_start_time = 12; block.block_trans_end_time = 16; block.critical_word_offset = 8; block.tag = 5; block.valid = 1; L1_CACHE INST_CACHE_L1; INST_CACHE_L1.block_arr = (L1_BLOCK*)malloc(128*sizeof(L1_BLOCK)); INST_CACHE_L1.block_arr[0] = block; L2_CACHE INST_CACHE_L2; INST_CACHE_L2.block_arr= (L2_BLOCK*)malloc(1024*sizeof(L1_BLOCK)); L2_BLOCK block2; block2.block_trans_start_time[1]=10; block2.block_trans_end_time[1]= 18; block2.critical_word_offset[1] = 12; block2.LRU = 0; block2.tag[1]=5; block2.valid[1]=1; block2.valid[0]=0; INST_CACHE_L2.block_arr[0]=block2; int current_time = 11; CONFIG config; FILE* config_file = fopen("C:\\Users\\dell\\Desktop\\config_file.txt","rb"); if (config_file == NULL){ printf("Error openning file %s\n", config_file); return -1; } load_configuration_file (config_file,&config); is_in_L2(0, 5, 4, &INST_CACHE_L2, ¤t_time, &config); /*assert(argc ==8); char* cmd = argv[1];//input file name char* config = argv[2];//input file name char* mem_init = argv[3];//input file name char* regs_dump = argv[4];//output file name char* mem_dump = argv[5] ;//output file name char* time = argv[6] ; //output file name char* committed = argv[7] ; //output file name FILE* cmd_file ; FILE* config_file ; FILE* mem_init_file ; FILE* regs_dump_file; FILE* mem_dump_file ; FILE* time_file; FILE* committed_file ; COMMAND* commands_arr = (COMMAND*)malloc(sizeof(COMMAND)*MAX_NUM_COMMANDS); byte* mem = (byte*)calloc(MAX_MEM_SIZE,sizeof(byte)); int* registers_arr = (int*)calloc(32,sizeof(int)); int line_counter = 0; int counter = 0; CONFIG config_struct; cmd_file = fopen(cmd,"r"); if (cmd_file == NULL){ printf("Error openning file %s\n", cmd_file); return -1; } config_file = fopen(config,"rb"); if (config_file == NULL){ printf("Error openning file %s\n", config_file); return -1; } mem_init_file = fopen(mem_init,"rb") ; if (mem_init_file == NULL){ printf("Error openning file %s\n", mem_init); return -1; } regs_dump_file = fopen(regs_dump,"w"); if (regs_dump_file == NULL){ printf("Error openning file %s\n", regs_dump); return -1; } mem_dump_file = fopen(mem_dump,"w"); if (mem_dump_file == NULL){ printf("Error openning file %s\n", mem_dump); return -1; } time_file = fopen(time,"w"); if (time_file == NULL){ printf("Error openning file %s\n", time); return -1; } committed_file = fopen(committed,"w"); if (committed_file == NULL){ printf("Error openning file %s\n", committed); return -1; } load_memory(mem_init_file ,mem); load_configuration_file (config_file,&config_struct); parse_cmd_file(cmd_file,commands_arr); counter = execute_set_of_instructions(commands_arr, registers_arr, mem); update_mem_file(mem_dump_file, mem); update_regs_file(regs_dump_file, registers_arr); update_time_file(time_file, counter); update_time_file(committed_file, counter); free(commands_arr); free(mem); free(registers_arr); fclose(config_file); fclose(mem_init_file); fclose(regs_dump_file); fclose(mem_dump_file); fclose(time_file); fclose(committed_file); */ int x; scanf("%d", &x); return 0 ; }
/*---------------------------------------------------*/ void load_configuration() { FILE *file; int f_id=0; config_type *cnf; char *boot_mem,*boot_mem1; void *adr; int anz; load_configuration_file(); boot_mem=get_tabele(); if (boot_mem==0) { f_id=(int)Fopen(boot_prg_name,FO_READ); if (f_id<0) return; boot_mem1=(char *)malloc(4096); if (boot_mem1==0) {Fclose(f_id);return;} (void)Fread(f_id,4096L,boot_mem1); Fclose(f_id); boot_mem=boot_mem1+32; } h2_v3=*(int*)(boot_mem+2614+166-32); for(anz=0;anz<=4;anz++) { if (*(int*)(boot_mem+anz*256)!=2) { if (anz!=pl_idx) sprintf(tree1[COL2RES+anz].ob_spec.tedinfo->te_ptext, "%i*%i",1+*(int*)(boot_mem+64+anz*256), 1+*(int*)(boot_mem+66+anz*256)); else if (sledgehammer==-1) sprintf(tree1[COL2RES+anz].ob_spec.tedinfo->te_ptext, "%i*%i",1+*(int*)(boot_mem+64+anz*256), 1+*(int*)(boot_mem+66+anz*256)); else sprintf(tree1[COL2RES+anz].ob_spec.tedinfo->te_ptext, "%i*%i",1+sledgehammer, 1+*(int*)(boot_mem+66+anz*256)); } } for(anz=0;anz<=4;anz++) { if (*(int*)(boot_mem+anz*256+5*256)!=2) { sprintf(tree1[CO2RES2+anz].ob_spec.tedinfo->te_ptext, "%i*%i",1+*(int*)(boot_mem+64+anz*256+5*256), 1+*(int*)(boot_mem+66+anz*256+5*256)); } } if (*(int*)(boot_mem+2608-32)) { long satime; satime=*(long*)(boot_mem+2604-32); tree1[SAVER].ob_state|=SELECTED; sprintf(tree1[SAVTIME].ob_spec.tedinfo->te_ptext, "%03li",satime/2000L); } #if (!DEMO_VERSION) tree1[SUPER78].ob_state&=~SELECTED; if (42==*(int*)(boot_mem+2614+170-32)) tree1[SUPER78].ob_state|=SELECTED; #endif if (f_id!=0) { Fclose(f_id); free(boot_mem); } }