gint main(gint argc, gchar *argv[]) { GhbValue *gval; g_type_init(); file = g_fopen(argv[1], "r"); gval = ghb_plist_parse_file(file); if (argc > 2) ghb_plist_write_file(argv[2], gval); else ghb_plist_write(stdout, gval); if (file) fclose (file); return 0; }
gint main(gint argc, gchar *argv[]) { FILE *file; GValue *gval; int opt; const gchar *src, *dst; do { opt = getopt(argc, argv, OPTS); switch (opt) { case -1: break; case 'I': inc_list = g_list_prepend(inc_list, g_strdup(optarg)); break; } } while (opt != -1); if (optind != argc - 2) { usage(argv[0]); return EXIT_FAILURE; } src = argv[optind++]; dst = argv[optind++]; #if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); #endif file = g_fopen(src, "r"); if (file == NULL) { fprintf(stderr, "Error: failed to open %s\n", src); return EXIT_FAILURE; } gval = ghb_resource_parse_file(file); ghb_plist_write_file(dst, gval); fclose(file); return 0; }
int main(gint argc, gchar *argv[]) { gint ii, jj; GValue *top; gint count = sizeof(dep_map) / sizeof(dependency_t); g_type_init(); top = ghb_dict_value_new(); for (ii = 0; ii < count; ii++) { const gchar *name; GValue *array; name = dep_map[ii].widget_name; if (ghb_dict_lookup(top, name)) continue; array = ghb_array_value_new(8); for (jj = 0; jj < count; jj++) { if (strcmp(name, dep_map[jj].widget_name) == 0) { ghb_array_append(array, ghb_value_dup(ghb_string_value(dep_map[jj].dep_name))); } } ghb_dict_insert(top, g_strdup(name), array); } ghb_plist_write_file("widget.deps", top); // reverse map top = ghb_dict_value_new(); for (ii = 0; ii < count; ii++) { const gchar *name; GValue *array; name = dep_map[ii].dep_name; if (ghb_dict_lookup(top, name)) continue; array = ghb_array_value_new(8); for (jj = 0; jj < count; jj++) { if (strcmp(name, dep_map[jj].dep_name) == 0) { GValue *data; data = ghb_array_value_new(3); ghb_array_append(data, ghb_value_dup( ghb_string_value(dep_map[jj].widget_name))); ghb_array_append(data, ghb_value_dup( ghb_string_value(dep_map[jj].enable_value))); ghb_array_append(data, ghb_value_dup( ghb_boolean_value(dep_map[jj].disable_if_equal))); ghb_array_append(data, ghb_value_dup( ghb_boolean_value(dep_map[jj].hide))); ghb_array_append(array, data); } } ghb_dict_insert(top, g_strdup(name), array); } ghb_plist_write_file("widget_reverse.deps", top); return 0; }