]> granicus.if.org Git - graphviz/commitdiff
need a better list of original plugin libraries to support introspection
authorellson <devnull@localhost>
Mon, 13 Oct 2008 22:34:18 +0000 (22:34 +0000)
committerellson <devnull@localhost>
Mon, 13 Oct 2008 22:34:18 +0000 (22:34 +0000)
lib/gvc/gvcint.h
lib/gvc/gvconfig.c
lib/gvc/gvcontext.c

index d61c21d417a0b158f6fee67ab0b091b2301e9b7e..bcd957f3346b69141fbd3309b72dc656b8512aae 100644 (file)
@@ -40,6 +40,14 @@ extern "C" {
         char *type;
     } gvplugin_active_textlayout_t;
 
+    typedef struct gvplugin_package_s gvplugin_package_t;
+
+    struct gvplugin_package_s {
+        gvplugin_package_t *next;
+        char *path;
+        char *packagename;
+    };
+
     struct gvplugin_available_s {
        gvplugin_available_t *next;       /* next plugin in linked list, or NULL */
        const char *typestr;             /* type string, e.g. "png" or "ps" */
@@ -85,6 +93,7 @@ extern "C" {
        gvplugin_available_t *apis[ APIS ]; /* array of linked-list of plugins per api */
        gvplugin_available_t *api[ APIS ];  /* array of current plugins per api */
 #undef ELEM
+       gvplugin_package_t *packages;   /* list of available packages */
 
        /* keybindings for keyboard events */
        gvevent_key_binding_t *keybindings;
index 21223ffbf2eebceeb99c1e695e044cefca7467d4..586724bd2dfc8f8e44f0c2988fded8b192067745 100644 (file)
@@ -160,6 +160,16 @@ static char *token(int *nest, char **tokens)
     return t;
 }
 
+static gvplugin_package_t * gvplugin_package_record(GVC_t * gvc, char *path, char *packagename)
+{
+    gvplugin_package_t *package = gmalloc(sizeof(gvplugin_package_t));
+    package->path = strdup(path);
+    package->packagename = strdup(packagename);
+    package->next = gvc->packages;
+    gvc->packages = package;
+    return package;
+}
+
 static int gvconfig_plugin_install_from_config(GVC_t * gvc, char *s)
 {
     char *path, *packagename, *api;
@@ -167,6 +177,7 @@ static int gvconfig_plugin_install_from_config(GVC_t * gvc, char *s)
     api_t gv_api;
     int quality, rc;
     int nest = 0;
+    gvplugin_package_t *package;
 
     separator(&nest, &s);
     while (*s) {
@@ -175,6 +186,7 @@ static int gvconfig_plugin_install_from_config(GVC_t * gvc, char *s)
            packagename = token(&nest, &s);
         else
            packagename = "x";
+        package = gvplugin_package_record(gvc, path, packagename);
        do {
            api = token(&nest, &s);
            gv_api = gvplugin_api(api);
@@ -211,9 +223,6 @@ static void gvconfig_plugin_install_from_library(GVC_t * gvc, char *path, gvplug
 
     for (apis = library->apis; (types = apis->types); apis++) {
        for (i = 0; types[i].type; i++) {
-           /* FIXME - should only install if dependencies on other plugins are satisfied */
-           /*         e.g. "render" "gtk" depends on "device" "gtk" */
-           /*         only need to check during actual loading, so no need to store dependencies in config */
            gvplugin_install(gvc, apis->api, types[i].type,
                        types[i].quality, library->packagename, path, &types[i]);
         }
index a892dab9aeedbb4312ee0e8381d4989db2c55cd1..390d706c113730e925e94b525cd5b00f07efefa8 100644 (file)
@@ -57,6 +57,7 @@ GVC_t *gvNEWcontext(char **info, char *user)
 int gvFreeContext(GVC_t * gvc)
 {
     GVG_t *gvg, *gvg_next;
+    gvplugin_package_t *package, *package_next;
 
     if (gvc->active_jobs)
        gvrender_end_job(gvc->active_jobs);
@@ -66,6 +67,13 @@ int gvFreeContext(GVC_t * gvc)
        gvg_next = gvg->next;
        free(gvg);
     }
+    package_next = gvc->packages;
+    while ((package = package_next)) {
+       package_next = package->next;
+       free(package->path);
+       free(package->packagename);
+       free(package);
+    }
     gvjobs_delete(gvc);
     if (gvc->config_path)
        free(gvc->config_path);