mmc_GC_page_type page_create(size_t default_page_size, size_t default_free_slots_size) { mmc_GC_page_type page = {0, 0, 0, 0}; page.start = (modelica_metatype)malloc(default_page_size); if (!page.start) { fprintf(stderr, "not enough memory (%lu) to allocate the pages!\n", (long unsigned int)default_page_size); fflush(NULL); assert(page.start != 0); } page.size = default_page_size; page.free = list_create(default_free_slots_size); page = list_populate(page); page.maxFree = default_page_size; /* update the total sizes! */ mmc_GC_state->mas.totalPageSize += default_page_size; mmc_GC_state->mas.totalFreeSize += default_page_size; assert(mmc_GC_state->mas.totalFreeSize <= mmc_GC_state->mas.totalPageSize); return page; }
long recipe_window::on_cmd_stack_change(FXObject *, FXSelector, void *) { list_populate(fit_list, recipe->parameters, recipe->seeds_list, true); setup_parameters_list(); return 1; }
void recipe_window::bind_new_fit_recipe(fit_recipe *rcp) { recipe = rcp; list_populate(fit_list, recipe->parameters, recipe->seeds_list, true); setup_parameters_list(); setup_multi_sample_parameters(); setup_config_parameters(); }
static void _win_populate_job(void *data) { Win *w = data; w->job.populate = NULL; if (w->db) { db_close(w->db); w->db = NULL; } if (access(w->db_path, F_OK|X_OK) == 0) w->db = db_open(w->db_path); if (!w->db) { char tmpdir[PATH_MAX]; lms_t *lms = lms_new(w->db_path); if (!lms) goto no_lms; enjoy_lms_charsets_add(lms); if (!enjoy_lms_parsers_add(lms)) goto no_parsers; snprintf(tmpdir, sizeof(tmpdir), "%s/tmpdir-nomusic", enjoy_cache_dir_get()); ecore_file_mkpath(tmpdir); if (lms_process_single_process(lms, tmpdir) != 0) CRITICAL("Failed to scan empty directory %s", tmpdir); ecore_file_rmdir(tmpdir); lms_free(lms); w->db = db_open(w->db_path); if (!w->db) goto no_lms; goto populate; no_parsers: CRITICAL("could not add any lightmediascanner parser!"); lms_free(lms); no_lms: CRITICAL("could not create database at %s!", w->db_path); exit(-1); } populate: ecore_event_add(ENJOY_EVENT_DB_UNLOCKED, NULL, NULL, NULL); list_populate(w->list, w->db); }
recipe_window::recipe_window(fit_recipe *rcp, FXComposite *p, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb, FXint hs, FXint vs) : FXPacker(p, opts, x, y, w, h, pl, pr, pt, pb, hs, vs), recipe(rcp), param_list(NULL), seed_dirty(true) { top_frame = new FXHorizontalFrame(this, LAYOUT_FILL_X|LAYOUT_FILL_Y); FXVerticalFrame *pframe = new FXVerticalFrame(top_frame); FXGroupBox *sgb = new FXGroupBox(pframe, "Fit Options", GROUPBOX_NORMAL|FRAME_GROOVE); FXMatrix *rmatrix = new FXMatrix(sgb, 2, MATRIX_BY_COLUMNS); new FXLabel(rmatrix, "Wavelength Range"); range_textfield = new FXTextField(rmatrix, 10, this, ID_SPECTRA_RANGE, FRAME_SUNKEN); range_textfield->setTipText("Spectra Range in nanometers (\"min-max\")"); new FXLabel(rmatrix, "ChiSq threshold"); chisq_textfield = new FXTextField(rmatrix, 5, this, ID_CHISQ_THRESHOLD, FRAME_SUNKEN|TEXTFIELD_REAL); chisq_textfield->setTipText("Chi Square threshold used in grid search"); new FXLabel(rmatrix, "Max Iterations"); iter_textfield = new FXTextField(rmatrix, 5, this, ID_ITERATIONS, FRAME_SUNKEN|TEXTFIELD_INTEGER); iter_textfield->setTipText("Maximum number of iterations for fitting procedure"); new FXLabel(rmatrix, "Sub sampling"); subsamp_textfield = new FXTextField(rmatrix, 5, this, ID_SUBSAMPLE, FRAME_SUNKEN|TEXTFIELD_INTEGER); subsamp_textfield->setTipText("Enable subsampling of spectra to speedup calculations"); multi_sample_button = new FXCheckButton(sgb, "Enable multi-sample", this, ID_MULTI_SAMPLE); setup_config_parameters(); FXSpring *fpspr = new FXSpring(top_frame, LAYOUT_FILL_X|LAYOUT_FILL_Y, 42, 0); FXGroupBox *lgb = new FXGroupBox(fpspr, "Fit Parameters", GROUPBOX_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_GROOVE); fit_list = new FXList(lgb, this, ID_PARAMETER, LIST_SINGLESELECT|LAYOUT_FILL_X|LAYOUT_FILL_Y); fit_list->setNumVisible(4); FXGroupBox *fpgroup = new FXGroupBox(pframe, "Add Fit Parameters", GROUPBOX_NORMAL|LAYOUT_FILL_Y|FRAME_GROOVE); params_group = new FXPacker(fpgroup, LAYOUT_FILL_Y|LAYOUT_SIDE_LEFT); param_listbox = new FXListBox(params_group, this, ID_PARAM_SELECT, FRAME_SUNKEN|LISTBOX_NORMAL); param_listbox->setNumVisible(8); setup_parameters_list(); FXMatrix *matrix = new FXMatrix(fpgroup, 2, MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y|LAYOUT_SIDE_RIGHT); new FXLabel(matrix, "Value", NULL, LAYOUT_FILL_ROW); seed_tf = new FXTextField(matrix, 8, this, ID_SEED, FRAME_SUNKEN|TEXTFIELD_REAL|TEXTFIELD_ENTER_ONLY); seed_tf->setTipText("Initial value of fitting parameter"); new FXLabel(matrix, "Range", NULL, LAYOUT_FILL_ROW); range_tf = new FXTextField(matrix, 8, this, ID_RANGE, LAYOUT_FILL_ROW|FRAME_SUNKEN|TEXTFIELD_REAL|TEXTFIELD_ENTER_ONLY); range_tf->setTipText("Optional range used in grid search"); list_populate(fit_list, recipe->parameters, recipe->seeds_list, true); if (recipe->ms_setup) { setup_multi_sample_parameters(false); } }
static void _win_populate_job(void *data) { Win *w = data; w->job.populate = NULL; if (w->db) db_close(w->db); w->db = db_open(w->db_path); if (!w->db) { CRITICAL("no database at %s!", w->db_path); // TODO: remove me! create library manager and start it from here printf("SCAN and LIBRARY MANAGER are not implemeted yet!\n" "Meanwhile please run " "(./test = binary from lightmediascanner/src/bin):\n" " ./test -p id3 -i 5000 -s %s/Music %s\n" "sorry about the inconvenience!\n", getenv("HOME"), w->db_path); exit(-1); } list_populate(w->list, w->db); }