]> granicus.if.org Git - graphviz/commitdiff
cut back on overloading: set -> getv + setv
authorellson <devnull@localhost>
Tue, 18 Oct 2005 18:53:17 +0000 (18:53 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 18:53:17 +0000 (18:53 +0000)
lib/common/types.h
lib/gvc/gvc.h
lib/gvc/gvcext.h
lib/gvc/gvcjob.h
lib/gvc/gvplugin.h
tclpkg/gv/gv.cpp
tclpkg/gv/gv.i

index 4d2af6372dbad07942da55acbc44d2ef001a6d02..f9849aaf3a4f694f9f1c3d75aa8269ce8ab28314 100644 (file)
@@ -189,6 +189,9 @@ extern "C" {
     } shape_desc;
 
 #ifndef DISABLE_CODEGENS
+    typedef struct codegen_s codegen_t;
+    typedef struct codegen_info_s codegen_info_t;
+
     struct codegen_s {
        void (*reset) (void);
        void (*begin_job) (FILE * ofp, graph_t * g, char **lib, char *user,
index ab20bf30c9a6cf278277eb0eebf31c83f54e912b..ad789f42d8360cf5ffc55b3b43dc09b860791100 100644 (file)
@@ -24,7 +24,7 @@
 #include "types.h"
 #include "globals.h"
 #include "graph.h"
-#include "gvplugin.h"
+#include "gvcext.h"
 
 #ifdef __cplusplus
 extern "C" {
index 9e94e80857e304822189a2d2f855694dd99eb899..ce17376605f9fb0cd6008868d2452c614ae86dae 100644 (file)
 extern "C" {
 #endif
 
-    typedef struct gvdevice_engine_s gvdevice_engine_t;
-    typedef struct gvrender_engine_s gvrender_engine_t;
-    typedef struct gvlayout_engine_s gvlayout_engine_t;
-    typedef struct gvtextlayout_engine_s gvtextlayout_engine_t;
-    typedef struct gvusershape_engine_s gvusershape_engine_t;
-
     typedef struct GVJ_s GVJ_t;
     typedef struct GVC_s GVC_t;
 
-#ifndef DISABLE_CODEGENS
-    typedef struct codegen_s codegen_t;
-    typedef struct codegen_info_s codegen_info_t;
-#endif
+    typedef struct {
+       const char *name;
+       void* address;
+    } lt_symlist_t;
+
+    extern const lt_symlist_t lt_preloaded_symbols[];
 
 #ifdef __cplusplus
 }
index f4dbfeaa9e2bf9727940dc3d0365956fffb4f923..4a6f585926aa2a58d92b3b1ffa525facd9cd846a 100644 (file)
 extern "C" {
 #endif
 
-#include "geom.h"
-#include "color.h"
+#include "types.h"
 
 #define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
 
+    typedef struct gvdevice_engine_s gvdevice_engine_t;
+    typedef struct gvrender_engine_s gvrender_engine_t;
+    typedef struct gvlayout_engine_s gvlayout_engine_t;
+    typedef struct gvtextlayout_engine_s gvtextlayout_engine_t;
+    typedef struct gvusershape_engine_s gvusershape_engine_t;
+
+
     typedef enum { PEN_NONE, PEN_DASHED, PEN_DOTTED, PEN_SOLID } pen_type;
     typedef enum { FILL_NONE, FILL_SOLID } fill_type;
     typedef enum { FONT_REGULAR, FONT_BOLD, FONT_ITALIC } font_type;
@@ -112,6 +118,13 @@ extern "C" {
         void (*modify) (GVJ_t * job, char *name, char *value);
     } gvdevice_callbacks_t;
 
+    typedef int (*gvevent_key_callback_t) (GVJ_t * job);
+
+    typedef struct gvevent_key_binding_s {
+       char *keystring;
+       gvevent_key_callback_t callback;
+    } gvevent_key_binding_t;
+
     struct GVJ_s {
        GVC_t *gvc;             /* parent gvc */
        GVJ_t *next;            /* linked list of jobs */
@@ -153,11 +166,13 @@ extern "C" {
 
         unsigned int width;     /* device width in device units */
         unsigned int height;    /* device height in device units */
+       box     boundingBox;    /* drawable region in device units */
        int dpi;                /* device resolution device-units-per-inch */
+
+       boxf bb;                /* bb in graph units */
        double zoom;            /* viewport zoom factor */
        int rotation;           /* viewport rotation  0=portrait, 1=landscape */
        pointf focus;           /* viewport focus in graph units */
-       box     boundingBox;    /* drawable region in device units */
 
        boxf clip;              /* clip region in graph units */
        boxf pageBoxClip;       /* intersection of clip and pageBox */
@@ -186,14 +201,12 @@ extern "C" {
                                /* e.g. "color" "red" "style" "filled" */
 
        void *window;           /* display-specific data for gvrender plugin */
-    };
-
-    typedef int (*gvevent_key_callback_t) (GVJ_t * job);
 
-    typedef struct gvevent_key_binding_s {
-       char *keystring;
-       gvevent_key_callback_t callback;
-    } gvevent_key_binding_t;
+        /* keybindings for keyboard events */
+       gvevent_key_binding_t *keybindings;
+       int numkeys;
+       void *keycodes;
+    };
 
 #ifdef __cplusplus
 }
index 3ed6e2a6de23651e360bd6a3eb09c1285dfb4ff6..a7bf48af7deb48af24a996b5d634bee542187d08 100644 (file)
@@ -76,14 +76,6 @@ extern "C" {
        gvplugin_api_t *apis;
     } gvplugin_library_t;
 
-
-    typedef struct {
-       const char *name;
-       void* address;
-    } lt_symlist_t;
-
-    extern const lt_symlist_t lt_preloaded_symbols[];
-
 #ifdef __cplusplus
 }
 #endif
index 213848d52566b7e3e9b8a57726dfff172d50fa57..fccbe780d4dba531f7b78ae979a40b42acaa51b1 100644 (file)
@@ -109,7 +109,7 @@ Agedge_t *edge(Agraph_t *g, char *tname, char *hname)
 }
 
 //-------------------------------------------------
-char *set(Agraph_t *g, Agsym_t *a)
+char *getv(Agraph_t *g, Agsym_t *a)
 {
     char *val;
 
@@ -120,7 +120,7 @@ char *set(Agraph_t *g, Agsym_t *a)
        return "";
     return val;
 }
-char *set(Agraph_t *g, char *attr)
+char *getv(Agraph_t *g, char *attr)
 {
     Agsym_t *a;
     char *val;
@@ -135,39 +135,27 @@ char *set(Agraph_t *g, char *attr)
        return "";
     return val;
 }
-char *set(Agraph_t *g, Agsym_t *a, char *val)
+char *setv(Agraph_t *g, Agsym_t *a, char *val)
 {
-    if (!g || !a)
+    if (!g || !a || !val)
        return NULL;
-    if (!val) {
-       val = agxget(g, a->index);
-       if (!val)
-               return "";
-       return val;
-    }
     agxset(g, a->index, val);
     return val;
 }
-char *set(Agraph_t *g, char *attr, char *val)
+char *setv(Agraph_t *g, char *attr, char *val)
 {
     Agsym_t *a;
 
-    if (!g || !attr)
+    if (!g || !attr || !val)
        return NULL;
     a = agfindattr(g->root, attr);
     if (!a)
         a = agraphattr(g->root, attr, "");
-    if (!val) {
-       val = agxget(g, a->index);
-       if (!val)
-           return "";
-       return val;
-    }
     agxset(g, a->index, val);
     return val;
 }
 //-------------------------------------------------
-char *set(Agnode_t *n, Agsym_t *a)
+char *getv(Agnode_t *n, Agsym_t *a)
 {
     char *val;
 
@@ -178,7 +166,7 @@ char *set(Agnode_t *n, Agsym_t *a)
        return "";
     return val;
 }
-char *set(Agnode_t *n, char *attr)
+char *getv(Agnode_t *n, char *attr)
 {
     Agraph_t *g;
     Agsym_t *a;
@@ -195,41 +183,29 @@ char *set(Agnode_t *n, char *attr)
        return "";
     return val;
 }
-char *set(Agnode_t *n, Agsym_t *a, char *val)
+char *setv(Agnode_t *n, Agsym_t *a, char *val)
 {
-    if (!n || !a)
+    if (!n || !a || !val)
        return NULL;
-    if (!val) {
-        val = agxget(n, a->index);
-        if (!val)
-           return "";
-        return val;
-    }
     agxset(n, a->index, val);
     return val;
 }
-char *set(Agnode_t *n, char *attr, char *val)
+char *setv(Agnode_t *n, char *attr, char *val)
 {
     Agraph_t *g;
     Agsym_t *a;
 
-    if (!n || !attr)
+    if (!n || !attr || !val)
        return NULL;
     g = n->graph->root;
     a = agfindattr(g->proto->n, attr);
     if (!a)
         a = agnodeattr(g, attr, "");
-    if (!val) {
-        val = agxget(n, a->index);
-        if (!val)
-           return "";
-        return val;
-    }
     agxset(n, a->index, val);
     return val;
 }
 //-------------------------------------------------
-char *set(Agedge_t *e, Agsym_t *a)
+char *getv(Agedge_t *e, Agsym_t *a)
 {
     char *val;
 
@@ -240,7 +216,7 @@ char *set(Agedge_t *e, Agsym_t *a)
        return "";
     return val;
 }
-char *set(Agedge_t *e, char *attr)
+char *getv(Agedge_t *e, char *attr)
 {
     Agraph_t *g;
     Agsym_t *a;
@@ -257,36 +233,24 @@ char *set(Agedge_t *e, char *attr)
        return "";
     return val;
 }
-char *set(Agedge_t *e, Agsym_t *a, char *val)
+char *setv(Agedge_t *e, Agsym_t *a, char *val)
 {
-    if (!e || !a)
+    if (!e || !a || !val)
        return NULL;
-    if (!val) {
-        val = agxget(e, a->index);
-        if (!val)
-           return "";
-        return val;
-    }
     agxset(e, a->index, val);
     return val;
 }
-char *set(Agedge_t *e, char *attr, char *val)
+char *setv(Agedge_t *e, char *attr, char *val)
 {
     Agraph_t *g;
     Agsym_t *a;
 
-    if (!e || !attr)
+    if (!e || !attr || !val)
        return NULL;
     g = e->head->graph->root;
     a = agfindattr(g->proto->e, attr);
     if (!a)
         a = agnodeattr(g, attr, "");
-    if (!val) {
-        val = agxget(e, a->index);
-        if (!val)
-           return "";
-        return val;
-    }
     agxset(e, a->index, val);
     return val;
 }
index c15b32da8e4c215425d6e59ecbe8457ac68bb4d8..d951808f36a3fb16e90a1bb2a9801e009ad15e2e 100644 (file)
@@ -40,13 +40,21 @@ extern Agedge_t *edge(char *tname, Agnode_t *h);/* add edge, named tail which wi
 extern Agedge_t *edge(Agraph_t *g, char *tname, char *hname);/* add edge between named nodes, induced as necessary */
 
 /* set/get attribute of graph/node/edge */
-extern char *set(Agraph_t *g, char *attr, char *val=NULL);
-extern char *set(Agnode_t *n, char *attr, char *val=NULL);
-extern char *set(Agedge_t *e, char *attr, char *val=NULL);
+extern char *setv(Agraph_t *g, char *attr, char *val);
+extern char *setv(Agnode_t *n, char *attr, char *val);
+extern char *setv(Agedge_t *e, char *attr, char *val);
 
-extern char *set(Agraph_t *g, Agsym_t *a, char *val=NULL);
-extern char *set(Agnode_t *n, Agsym_t *a, char *val=NULL);
-extern char *set(Agedge_t *e, Agsym_t *a, char *val=NULL);
+extern char *setv(Agraph_t *g, Agsym_t *a, char *val);
+extern char *setv(Agnode_t *n, Agsym_t *a, char *val);
+extern char *setv(Agedge_t *e, Agsym_t *a, char *val);
+
+extern char *getv(Agraph_t *g, char *attr);
+extern char *getv(Agnode_t *n, char *attr);
+extern char *getv(Agedge_t *e, char *attr);
+
+extern char *getv(Agraph_t *g, Agsym_t *a);
+extern char *getv(Agnode_t *n, Agsym_t *a);
+extern char *getv(Agedge_t *e, Agsym_t *a);
 
 /* names */
 extern char *nameof(Agraph_t *g);