void edosu_beatmap_load_objects(EdosuBeatmap *beatmap, osux_beatmap *osux_bm) { GtkTreeStore *ts; ts = gtk_tree_store_new(COL_NUM, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); beatmap->Objects = ts; gtk_tree_store_append(ts, &beatmap->TimingPoints, NULL); gtk_tree_store_set(ts, &beatmap->TimingPoints, COL_TYPE, _("TimingPoints"), COL_OFFSET, osux_bm->timingpoint_count, -1); load_timing_points(osux_bm, ts, &beatmap->TimingPoints); gtk_tree_store_append(ts, &beatmap->HitObjects, NULL); gtk_tree_store_set(ts, &beatmap->HitObjects, COL_TYPE, _("HitObjects"), COL_OFFSET, osux_bm->hitobject_count, -1); load_hit_objects(osux_bm, ts, beatmap->HitObjectsSeq, &beatmap->HitObjects); gtk_tree_store_append(ts, &beatmap->Bookmarks, NULL); gtk_tree_store_set(ts, &beatmap->Bookmarks, COL_TYPE, _("Bookmarks"), COL_OFFSET, osux_bm->bookmark_count, -1); load_bookmarks(osux_bm, ts, &beatmap->Bookmarks); gtk_tree_store_append(ts, &beatmap->Events, NULL); gtk_tree_store_set(ts, &beatmap->Events, COL_TYPE, _("Events"), COL_OFFSET, osux_bm->event_count, -1); load_events(osux_bm, ts, &beatmap->Events); gtk_tree_store_append(ts, &beatmap->Colors, NULL); gtk_tree_store_set(ts, &beatmap->Colors, COL_TYPE, _("Colors"), COL_OFFSET, osux_bm->color_count, -1); load_colors(osux_bm, ts, &beatmap->Colors); edosu_beatmap_steal_objects(beatmap, osux_bm); }
static int load_cap_events(struct trace_capture *cap, struct tracecmd_xml_handle *handle, struct tracecmd_xml_system_node *node) { struct shark_info *info = cap->info; const char *name; char **systems = NULL; int sys_len = 0; ks_clear_capture_events(info); for (node = tracecmd_xml_node_child(node); node; node = tracecmd_xml_node_next(node)) { name = tracecmd_xml_node_type(node); if (strcmp(name, "CaptureType") == 0) { name = tracecmd_xml_node_value(handle, node); if (strcmp(name, "all events") == 0) { info->cap_all_events = TRUE; break; } continue; } else if (strcmp(name, "System") == 0) { name = tracecmd_xml_node_value(handle, node); systems = tracecmd_add_list(systems, name, sys_len++); } else if (strcmp(name, "Events") == 0) load_events(cap, handle, node); } info->cap_systems = systems; return 0; }
/** * tracecmd_fill_local_events - Fill a pevent with the events on system * @tracing_dir: The directory that contains the events. * @pevent: Allocated pevent which will be filled * * Returns whether the operation succeeded */ int tracecmd_fill_local_events(const char *tracing_dir, struct pevent *pevent) { struct dirent *dent; char *events_dir; struct stat st; DIR *dir; int ret, failure = 0; if (!tracing_dir) return -1; events_dir = append_file(tracing_dir, "events"); if (!events_dir) return -1; ret = stat(events_dir, &st); if (ret < 0 || !S_ISDIR(st.st_mode)) { ret = -1; goto out_free; } dir = opendir(events_dir); if (!dir) { ret = -1; goto out_free; } ret = read_header(pevent, events_dir); if (ret < 0) { ret = -1; goto out_free; } while ((dent = readdir(dir))) { const char *name = dent->d_name; char *sys; if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) continue; sys = append_file(events_dir, name); ret = stat(sys, &st); if (ret < 0 || !S_ISDIR(st.st_mode)) { free(sys); continue; } ret = load_events(pevent, name, sys); free(sys); if (ret) failure = 1; } closedir(dir); /* always succeed because parsing failures are not critical */ ret = 0; out_free: free(events_dir); pevent->parsing_failures = failure; return ret; }
void machine_t::load(const iodata::record *r) { next_cookie = r->get("next_cookie")->value() ; const iodata::array *a = r->get("events")->arr() ; load_events(a, true, true) ; }
void set_event_mode() { event_mode = EVENT_MODE; load_events(); }