From: ellson Date: Tue, 14 Oct 2008 23:13:24 +0000 (+0000) Subject: more cgraph merging - enough for today... X-Git-Tag: LAST_LIBGRAPH~32^2~3125 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2b3b37c47244f57a9690bff8fb92f77d17ec616c;p=graphviz more cgraph merging - enough for today... --- diff --git a/lib/common/arrows.c b/lib/common/arrows.c index 535385fd7..42915cb55 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -185,10 +185,11 @@ void arrow_flags(Agedge_t * e, int *sflag, int *eflag) *sflag = ARR_TYPE_NONE; #ifdef WITH_CGRAPH *eflag = agisdirected(agraphof(e)) ? ARR_TYPE_NORM : ARR_TYPE_NONE; + if (E_dir && ((attr = agxget(e, E_dir)))[0]) { #else *eflag = AG_IS_DIRECTED(e->tail->graph) ? ARR_TYPE_NORM : ARR_TYPE_NONE; -#endif if (E_dir && ((attr = agxget(e, E_dir->index)))[0]) { +#endif for (arrowdir = Arrowdirs; arrowdir->dir; arrowdir++) { if (streq(attr, arrowdir->dir)) { *sflag = arrowdir->sflag; @@ -197,10 +198,17 @@ void arrow_flags(Agedge_t * e, int *sflag, int *eflag) } } } +#ifdef WITH_CGRAPH + if (E_arrowhead && ((attr = agxget(e, E_arrowhead)))[0]) + arrow_match_name(attr, eflag); + if (E_arrowtail && ((attr = agxget(e, E_arrowtail)))[0]) + arrow_match_name(attr, sflag); +#else if (E_arrowhead && ((attr = agxget(e, E_arrowhead->index)))[0]) arrow_match_name(attr, eflag); if (E_arrowtail && ((attr = agxget(e, E_arrowtail->index)))[0]) arrow_match_name(attr, sflag); +#endif if (ED_conc_opp_flag(e)) { edge_t *f; int s0, e0; diff --git a/lib/common/htmltable.c b/lib/common/htmltable.c index ac8118e0c..a339606b3 100644 --- a/lib/common/htmltable.c +++ b/lib/common/htmltable.c @@ -1108,10 +1108,11 @@ static void checkChain(graph_t * g) for (h = ND_next(t); h; h = ND_next(h)) { #ifdef WITH_CGRAPH if (!agedge(g, t, h, (char *)NULL, FALSE)) { + e = agedge(g, t, h,NULL,1); #else if (!agfindedge(g, t, h)) { -#endif e = agedge(g, t, h); +#endif ED_minlen(e) = 0; elist_append(e, ND_out(t)); elist_append(e, ND_in(h)); @@ -1144,7 +1145,11 @@ void makeGraphs(htmltbl_t * tbl, graph_t * rowg, graph_t * colg) lastn = NULL; for (i = 0; i <= tbl->cc; i++) { +#ifdef WITH_CGRAPH + t = agnode(colg, nToName(i),1); +#else t = agnode(colg, nToName(i)); +#endif alloc_elist(tbl->rc, ND_in(t)); alloc_elist(tbl->rc, ND_out(t)); if (lastn) { @@ -1156,7 +1161,11 @@ void makeGraphs(htmltbl_t * tbl, graph_t * rowg, graph_t * colg) } lastn = NULL; for (i = 0; i <= tbl->rc; i++) { +#ifdef WITH_CGRAPH + t = agnode(rowg, nToName(i),1); +#else t = agnode(rowg, nToName(i)); +#endif alloc_elist(tbl->cc, ND_in(t)); alloc_elist(tbl->cc, ND_out(t)); if (lastn) { @@ -1181,9 +1190,15 @@ void makeGraphs(htmltbl_t * tbl, graph_t * rowg, graph_t * colg) for (cells = tbl->u.n.cells; *cells; cells++) { int x, y, c, r; cp = *cells; +#ifdef WITH_CGRAPH + t = agnode(colg, nToName(cp->col),0); + h = agnode(colg, nToName(cp->col + cp->cspan),0); + e = agedge(colg, t, h,NULL,1); +#else t = agfindnode(colg, nToName(cp->col)); h = agfindnode(colg, nToName(cp->col + cp->cspan)); e = agedge(colg, t, h); +#endif x = 0; for (c = 0; c < cp->cspan; c++) x += minc[cp->col + c]; @@ -1196,9 +1211,15 @@ void makeGraphs(htmltbl_t * tbl, graph_t * rowg, graph_t * colg) elist_append(e, ND_out(t)); elist_append(e, ND_in(h)); +#ifdef WITH_CGRAPH + t = agnode(rowg, nToName(cp->row),0); + h = agnode(rowg, nToName(cp->row + cp->rspan),0); + e = agedge(rowg, t, h,NULL,1); +#else t = agfindnode(rowg, nToName(cp->row)); h = agfindnode(rowg, nToName(cp->row + cp->rspan)); e = agedge(rowg, t, h); +#endif y = 0; for (r = 0; r < cp->rspan; r++) y += minr[cp->row + r]; @@ -1267,8 +1288,13 @@ void sizeArray(htmltbl_t * tbl) tbl->heights = N_NEW(tbl->rc + 1, int); tbl->widths = N_NEW(tbl->cc + 1, int); +#ifdef WITH_CGRAPH + rowg = agopen("rowg", Agdirected,NIL(Agdisc_t *)); + colg = agopen("colg", Agdirected,NIL(Agdisc_t *)); +#else rowg = agopen("rowg", AGDIGRAPH); colg = agopen("colg", AGDIGRAPH); +#endif makeGraphs(tbl, rowg, colg); rank(rowg, 2, INT_MAX); rank(colg, 2, INT_MAX); @@ -1574,6 +1600,25 @@ size_html_tbl(graph_t *g, htmltbl_t * tbl, htmlcell_t * parent, htmlenv_t * env) static char *nameOf(void *obj, agxbuf * xb) { Agedge_t *ep; +#ifdef WITH_CGRAPH + switch (agobjkind(obj)) { + case AGRAPH: + agxbput(xb, agnameof(((Agraph_t *) obj))); + break; + case AGNODE: + agxbput(xb, agnameof(((Agnode_t *) obj))); + break; + case AGEDGE: + ep = (Agedge_t *) obj; + agxbput(xb, agnameof(agtail(ep))); + agxbput(xb, agnameof(aghead(ep))); + if (agisdirected(agraphof(ep))) + agxbput(xb, "->"); + else + agxbput(xb, "--"); + break; + } +#else switch (agobjkind(obj)) { case AGGRAPH: agxbput(xb, ((Agraph_t *) obj)->name); @@ -1585,16 +1630,13 @@ static char *nameOf(void *obj, agxbuf * xb) ep = (Agedge_t *) obj; agxbput(xb, ep->tail->name); agxbput(xb, ep->head->name); -#ifdef WITH_CGRAPH - if (agisdirected(agraphof(ep))) -#else if (AG_IS_DIRECTED(ep->tail->graph)) -#endif agxbput(xb, "->"); else agxbput(xb, "--"); break; } +#endif return agxbuse(xb); } @@ -1743,6 +1785,19 @@ int make_html_label(void *obj, textlabel_t * lp) char *s; env.obj = obj; +#ifdef WITH_CGRAPH + switch (agobjkind(obj)) { + case AGRAPH: + env.g = ((Agraph_t *) obj)->root; + break; + case AGNODE: + env.g = agraphof(((Agnode_t *) obj)); + break; + case AGEDGE: + env.g = agraphof(aghead (((Agedge_t *) obj))); + break; + } +#else switch (agobjkind(obj)) { case AGGRAPH: env.g = ((Agraph_t *) obj)->root; @@ -1754,6 +1809,7 @@ int make_html_label(void *obj, textlabel_t * lp) env.g = ((Agedge_t *) obj)->head->graph; break; } +#endif g = env.g->root; env.finfo.size = lp->fontsize; diff --git a/lib/common/input.c b/lib/common/input.c index 4e628cc34..c56e99e97 100644 --- a/lib/common/input.c +++ b/lib/common/input.c @@ -18,6 +18,12 @@ #include "render.h" #include "htmltable.h" +#ifdef WITH_CGRAPH +#define SET_RANKDIR(g,rd) (GD_rankdir2(g) = rd) +#else +#define SET_RANKDIR(g,rd) ((g)->u.rankdir = (rd)) +#endif + static char *usageFmt = "Usage: %s [-Vv?] [-(GNE)name=val] [-(KTlso)] \n"; @@ -166,8 +172,24 @@ static void use_library(GVC_t *gvc, const char *name) gvc->common.lib = Lib; } -void global_def(const char *dcl, - attrsym_t * ((*dclfun) (Agraph_t *, char *, char *))) +#ifdef WITH_CGRAPH +static void global_def(const char *dcl,int kind, + attrsym_t * ((*dclfun) (Agraph_t *, int kind, char *, char *)) ) +{ + char *p; + const char *rhs = "true"; + + attrsym_t *sym; + if ((p = strchr(dcl, '='))) { + *p++ = '\0'; + rhs = p; + } + sym = dclfun(NULL, kind, dcl, rhs); + sym->fixed = 1; +} +#else +static void global_def(const char *dcl, + attrsym_t * ((*dclfun) (Agraph_t *, char *, char *))) { char *p; const char *rhs = "true"; @@ -180,6 +202,7 @@ void global_def(const char *dcl, sym = dclfun(NULL, dcl, rhs); sym->fixed = 1; } +#endif static void gvg_init(GVC_t *gvc, graph_t *g, char *fn, int gidx) { @@ -237,7 +260,10 @@ void dotneato_args_initialize(GVC_t * gvc, int argc, char **argv) Verbose = gvc->common.verbose; CmdName = gvc->common.cmdname; +#ifdef WITH_CGRAPH +#else aginit(); +#endif nfiles = 0; for (i = 1; i < argc; i++) if (argv[i] && argv[i][0] != '-') @@ -250,7 +276,11 @@ void dotneato_args_initialize(GVC_t * gvc, int argc, char **argv) switch (c = argv[i][1]) { case 'G': if (*rest) +#ifdef WITH_CGRAPH + global_def(rest,AGRAPH,agattr); +#else global_def(rest, agraphattr); +#endif else { fprintf(stderr, "Missing argument for -G flag\n"); dotneato_usage(1); @@ -258,7 +288,11 @@ void dotneato_args_initialize(GVC_t * gvc, int argc, char **argv) break; case 'N': if (*rest) +#ifdef WITH_CGRAPH + global_def(rest, AGNODE,agattr); +#else global_def(rest, agnodeattr); +#endif else { fprintf(stderr, "Missing argument for -N flag\n"); dotneato_usage(1); @@ -266,7 +300,11 @@ void dotneato_args_initialize(GVC_t * gvc, int argc, char **argv) break; case 'E': if (*rest) +#ifdef WITH_CGRAPH + global_def(rest, AGEDGE,agattr); +#else global_def(rest, agedgeattr); +#endif else { fprintf(stderr, "Missing argument for -E flag\n"); dotneato_usage(1); @@ -373,8 +411,11 @@ void dotneato_args_initialize(GVC_t * gvc, int argc, char **argv) } /* set persistent attributes here (if not already set from command line options) */ +#ifdef WITH_CGRAPH +#else if (!(agfindattr(agprotograph()->proto->n, "label"))) agnodeattr(NULL, "label", NODENAME_ESC); +#endif } /* getdoubles2ptf: @@ -488,8 +529,12 @@ graph_t *gvNextInputGraph(GVC_t *gvc) agsetfile(fn ? fn : ""); #ifdef EXPERIMENTAL_MYFGETS g = agread_usergets(fp, myfgets); +#else +#ifdef WITH_CGRAPH + g = agread(fp,NIL(Agdisc_t*)); #else g = agread(fp); +#endif #endif if (g) { gvg_init(gvc, g, fn, gidx++); @@ -511,7 +556,11 @@ static int findCharset (graph_t * g) int enc; char* p; +#ifdef WITH_CGRAPH + p = late_nnstring(g,agattr(g,AGRAPH,"charset",(char*)0),"utf-8"); +#else p = late_nnstring(g,agfindattr(g,"charset"),"utf-8"); +#endif if (!strcasecmp(p,"latin-1") || !strcasecmp(p,"latin1") || !strcasecmp(p,"l1") @@ -604,8 +653,13 @@ void graph_init(graph_t * g, boolean use_rankdir) GD_charset(g) = findCharset (g); +#ifdef WITH_CGRAPH + GD_drawing(g)->quantum = + late_double(g, agattr(g, AGRAPH, "quantum",(char*)0), 0.0, 0.0); +#else GD_drawing(g)->quantum = late_double(g, agfindattr(g, "quantum"), 0.0, 0.0); +#endif /* setting rankdir=LR is only defined in dot, * but having it set causes shape code and others to use it. @@ -628,11 +682,20 @@ void graph_init(graph_t * g, boolean use_rankdir) else SET_RANKDIR (g, (rankdir << 2)); - xf = late_double(g, agfindattr(g, "nodesep"), DEFAULT_NODESEP, - MIN_NODESEP); +#ifdef WITH_CGRAPH + xf = late_double(g, agattr(g, AGRAPH, "nodesep",(char*)0), + DEFAULT_NODESEP, MIN_NODESEP); +#else + xf = late_double(g, agfindattr(g, "nodesep"), + DEFAULT_NODESEP, MIN_NODESEP); +#endif GD_nodesep(g) = POINTS(xf); +#ifdef WITH_CGRAPH + p = late_string(g, agattr(g, AGRAPH, "ranksep", (char*)0), NULL); +#else p = late_string(g, agfindattr(g, "ranksep"), NULL); +#endif if (p) { if (sscanf(p, "%lf", &xf) == 0) xf = DEFAULT_RANKSEP; @@ -646,8 +709,13 @@ void graph_init(graph_t * g, boolean use_rankdir) xf = DEFAULT_RANKSEP; GD_ranksep(g) = POINTS(xf); +#ifdef WITH_CGRAPH + GD_showboxes(g) = late_int(g, agattr(g,AGRAPH, "showboxes",(char*)0), 0, 0); + p = late_string(g, agattr(g, AGRAPH,"fontnames",(char*)0), NULL); +#else GD_showboxes(g) = late_int(g, agfindattr(g, "showboxes"), 0, 0); p = late_string(g, agfindattr(g, "fontnames"), NULL); +#endif GD_fontnames(g) = maptoken(p, fontnamenames, fontnamecodes); setRatio(g); @@ -680,6 +748,34 @@ void graph_init(graph_t * g, boolean use_rankdir) Initial_dist = MYHUGE; /* initialize nodes */ +#ifdef WITH_CGRAPH + N_height = agattr(g, AGNODE,"height",(char*)0); + N_width = agattr(g, AGNODE, "width",(char*)0); + N_shape = agattr(g, AGNODE, "shape",(char*)0); + N_color = agattr(g, AGNODE, "color",(char*)0); + N_fillcolor = agattr(g, AGNODE, "fillcolor",(char*)0); + N_style = agattr(g, AGNODE, "style",(char*)0); + N_fontsize = agattr(g, AGNODE, "fontsize",(char*)0); + N_fontname = agattr(g, AGNODE, "fontname",(char*)0); + N_fontcolor = agattr(g, AGNODE, "fontcolor",(char*)0); + N_label = agattr(g, AGNODE, "label",(char*)0); + N_showboxes = agattr(g, AGNODE, "showboxes",(char*)0); + N_penwidth = agattr(g, AGNODE, "penwidth",(char*)0); + /* attribs for polygon shapes */ + N_sides = agattr(g, AGNODE, "sides",(char*)0); + N_peripheries = agattr(g, AGNODE, "peripheries",(char*)0); + N_skew = agattr(g, AGNODE, "skew",(char*)0); + N_orientation = agattr(g, AGNODE, "orientation",(char*)0); + N_distortion = agattr(g, AGNODE, "distortion",(char*)0); + N_fixed = agattr(g, AGNODE, "fixedsize",(char*)0); + N_imagescale = agattr(g, AGNODE, "imagescale",(char*)0); + N_nojustify = agattr(g, AGNODE, "nojustify",(char*)0); + N_layer = agattr(g, AGNODE, "layer",(char*)0); + N_group = agattr(g, AGNODE, "group",(char*)0); + N_comment = agattr(g, AGNODE, "comment",(char*)0); + N_vertices = agattr(g, AGNODE, "vertices",(char*)0); + N_z = agattr(g, AGNODE, "z",(char*)0); +#else N_height = agfindattr(g->proto->n, "height"); N_width = agfindattr(g->proto->n, "width"); N_shape = agfindattr(g->proto->n, "shape"); @@ -706,8 +802,41 @@ void graph_init(graph_t * g, boolean use_rankdir) N_comment = agfindattr(g->proto->n, "comment"); N_vertices = agfindattr(g->proto->n, "vertices"); N_z = agfindattr(g->proto->n, "z"); +#endif /* initialize edges */ +#ifdef WITH_CGRAPH + E_weight = agattr(g, AGEDGE, "weight",(char*)0); + E_color = agattr(g, AGEDGE, "color",(char*)0); + E_fontsize = agattr(g, AGEDGE, "fontsize",(char*)0); + E_fontname = agattr(g, AGEDGE, "fontname",(char*)0); + E_fontcolor = agattr(g, AGEDGE, "fontcolor",(char*)0); + E_label = agattr(g, AGEDGE, "label",(char*)0); + E_label_float = agattr(g, AGEDGE, "labelfloat",(char*)0); + /* vladimir */ + E_dir = agattr(g, AGEDGE, "dir",(char*)0); + E_arrowhead = agattr(g, AGEDGE, "arrowhead",(char*)0); + E_arrowtail = agattr(g, AGEDGE, "arrowtail",(char*)0); + E_headlabel = agattr(g, AGEDGE, "headlabel",(char*)0); + E_taillabel = agattr(g, AGEDGE, "taillabel",(char*)0); + E_labelfontsize = agattr(g, AGEDGE, "labelfontsize",(char*)0); + E_labelfontname = agattr(g, AGEDGE, "labelfontname",(char*)0); + E_labelfontcolor = agattr(g, AGEDGE, "labelfontcolor",(char*)0); + E_labeldistance = agattr(g, AGEDGE, "labeldistance",(char*)0); + E_labelangle = agattr(g, AGEDGE, "labelangle",(char*)0); + /* end vladimir */ + E_minlen = agattr(g, AGEDGE, "minlen",(char*)0); + E_showboxes = agattr(g, AGEDGE, "showboxes",(char*)0); + E_style = agattr(g, AGEDGE, "style",(char*)0); + E_decorate = agattr(g, AGEDGE, "decorate",(char*)0); + E_arrowsz = agattr(g, AGEDGE, "arrowsize",(char*)0); + E_constr = agattr(g, AGEDGE, "constraint",(char*)0); + E_layer = agattr(g, AGEDGE, "layer",(char*)0); + E_comment = agattr(g, AGEDGE, "comment",(char*)0); + E_tailclip = agattr(g, AGEDGE, "tailclip",(char*)0); + E_headclip = agattr(g, AGEDGE, "headclip",(char*)0); + E_penwidth = agattr(g, AGEDGE, "penwidth",(char*)0); +#else E_weight = agfindattr(g->proto->e, "weight"); E_color = agfindattr(g->proto->e, "color"); E_fontsize = agfindattr(g->proto->e, "fontsize"); @@ -738,6 +867,7 @@ void graph_init(graph_t * g, boolean use_rankdir) E_tailclip = agfindattr(g->proto->e, "tailclip"); E_headclip = agfindattr(g->proto->e, "headclip"); E_penwidth = agfindattr(g->proto->e, "penwidth"); +#endif } void graph_cleanup(graph_t *g) @@ -745,7 +875,13 @@ void graph_cleanup(graph_t *g) free(GD_drawing(g)); GD_drawing(g) = NULL; free_label(GD_label(g)); +#ifdef WITH_CGRAPH + //FIX HERE , STILL SHALLOW + //memset(&(g->u), 0, sizeof(Agraphinfo_t)); + agclean(g, AGRAPH,"Agraphinfo_t"); +#else memset(&(g->u), 0, sizeof(Agraphinfo_t)); +#endif } /* charsetToStr: @@ -790,14 +926,32 @@ void do_graph_label(graph_t * sg) pointf dimen; GD_has_labels(sg->root) |= GRAPH_LABEL; + +#ifdef WITH_CGRAPH + GD_label(sg) = make_label(agroot(sg), str, (aghtmlstr(str) ? LT_HTML : LT_NONE), + late_double(sg, agattr(sg,AGRAPH,"fontsize",(char*)0), + DEFAULT_FONTSIZE, MIN_FONTSIZE), + late_nnstring(sg, agattr(sg,AGRAPH, "fontname",(char*)0), + DEFAULT_FONTNAME), + late_nnstring(sg, agattr(sg,AGRAPH, "fontcolor",(char*)0), + DEFAULT_COLOR)); +#else GD_label(sg) = make_label((void*)sg, str, (aghtmlstr(str) ? LT_HTML : LT_NONE), - late_double(sg, agfindattr(sg, "fontsize"), DEFAULT_FONTSIZE, MIN_FONTSIZE), - late_nnstring(sg, agfindattr(sg, "fontname"), DEFAULT_FONTNAME), - late_nnstring(sg, agfindattr(sg, "fontcolor"), DEFAULT_COLOR)); + late_double(sg, agfindattr(sg, "fontsize"), + DEFAULT_FONTSIZE, MIN_FONTSIZE), + late_nnstring(sg, agfindattr(sg, "fontname"), + DEFAULT_FONTNAME), + late_nnstring(sg, agfindattr(sg, "fontcolor"), + DEFAULT_COLOR)); +#endif /* set label position */ pos = agget(sg, "labelloc"); +#ifdef WITH_CGRAPH + if (sg != agroot(sg)) { +#else if (sg != sg->root) { +#endif if (pos && (pos[0] == 'b')) pos_flag = LABEL_AT_BOTTOM; else @@ -817,14 +971,22 @@ void do_graph_label(graph_t * sg) } GD_label_pos(sg) = pos_flag; - if (sg == sg->root) +#ifdef WITH_CGRAPH + if (sg == agroot(sg)) +#else + if (sg == sg->root) { +#endif return; /* Set border information for cluster labels to allow space */ dimen = GD_label(sg)->dimen; PAD(dimen); +#ifdef WITH_CGRAPH + if (!GD_flip(agroot(sg))) { +#else if (!GD_flip(sg->root)) { +#endif if (GD_label_pos(sg) & LABEL_AT_TOP) pos_ix = TOP_IX; else diff --git a/lib/common/macros.h b/lib/common/macros.h index 1c5446daf..3cbd6aa5b 100644 --- a/lib/common/macros.h +++ b/lib/common/macros.h @@ -31,8 +31,6 @@ #define SET_CLUST_EDGE(g) (GD_flags(g) |= 1) #define EDGE_TYPE(g) (GD_flags(g) & (7 << 1)) -#define SET_RANKDIR(g,rd) ((g)->u.rankdir = (rd)) - #ifndef streq #define streq(a,b) (*(a)==*(b)&&!strcmp(a,b)) #endif diff --git a/lib/common/types.h b/lib/common/types.h index 8f2de38bf..24ecae0a4 100644 --- a/lib/common/types.h +++ b/lib/common/types.h @@ -36,6 +36,11 @@ typedef unsigned char boolean; #include "gvcext.h" #include "pathgeom.h" #include "textpara.h" +#ifdef WITH_CGRAPH +#include "cgraph.h" +#else +#include "graph.h" +#endif #ifdef __cplusplus extern "C" { @@ -49,6 +54,8 @@ extern "C" { typedef struct Agnode_s node_t; typedef struct Agedge_s edge_t; typedef struct Agsym_s attrsym_t; +#define TAIL_ID "tailport" +#define HEAD_ID "headport" #else typedef struct Agraph_t graph_t; typedef struct Agnode_t node_t; @@ -378,6 +385,64 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind; } Agraphinfo_t; +#ifdef WITH_CGRAPH +#define GD_u(g)(((Agraphinfo_t*)AGDATA(g))) +#define GD_drawing(g) (((Agraphinfo_t*)AGDATA(g))->drawing) +#define GD_bb(g) (((Agraphinfo_t*)AGDATA(g))->bb) +#define GD_gvc(g) (((Agraphinfo_t*)AGDATA(g))->gvc) +#define GD_cleanup(g) (((Agraphinfo_t*)AGDATA(g))->cleanup) +#define GD_dist(g) (((Agraphinfo_t*)AGDATA(g))->dist) +#define GD_alg(g) (((Agraphinfo_t*)AGDATA(g))->alg) +#define GD_border(g) (((Agraphinfo_t*)AGDATA(g))->border) +#define GD_cl_cnt(g) (((Agraphinfo_t*)AGDATA(g))->cl_nt) +#define GD_clust(g) (((Agraphinfo_t*)AGDATA(g))->clust) +#define GD_cluster_was_collapsed(g) (((Agraphinfo_t*)AGDATA(g))->cluster_was_collapsed) +#define GD_comp(g) (((Agraphinfo_t*)AGDATA(g))->comp) +#define GD_exact_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->exact_ranksep) +#define GD_expanded(g) (((Agraphinfo_t*)AGDATA(g))->expanded) +#define GD_flags(g) (((Agraphinfo_t*)AGDATA(g))->flags) +#define GD_gui_state(g) (((Agraphinfo_t*)AGDATA(g))->gui_state) +#define GD_charset(g) (((Agraphinfo_t*)AGDATA(g))->charset) +#define GD_has_labels(g) (((Agraphinfo_t*)AGDATA(g))->has_labels) +#define GD_has_images(g) (((Agraphinfo_t*)AGDATA(g))->has_images) +#define GD_has_flat_edges(g) (((Agraphinfo_t*)AGDATA(g))->has_flat_edges) +#define GD_ht1(g) (((Agraphinfo_t*)AGDATA(g))->ht1) +#define GD_ht2(g) (((Agraphinfo_t*)AGDATA(g))->ht2) +#define GD_inleaf(g) (((Agraphinfo_t*)AGDATA(g))->inleaf) +#define GD_installed(g) (((Agraphinfo_t*)AGDATA(g))->installed) +#define GD_label(g) (((Agraphinfo_t*)AGDATA(g))->label) +#define GD_leader(g) (((Agraphinfo_t*)AGDATA(g))->leader) +#define GD_rankdir2(g) (((Agraphinfo_t*)AGDATA(g))->rankdir) +#define GD_rankdir(g) (((Agraphinfo_t*)AGDATA(g))->rankdir & 0x3) +#define GD_flip(g) (GD_rankdir(g) & 1) +#define GD_realrankdir(g) ((((Agraphinfo_t*)AGDATA(g))->rankdir) >> 2) +#define GD_realflip(g) (GD_realrankdir(g) & 1) +#define GD_ln(g) (((Agraphinfo_t*)AGDATA(g))->ln) +#define GD_maxrank(g) (((Agraphinfo_t*)AGDATA(g))->maxrank) +#define GD_maxset(g) (((Agraphinfo_t*)AGDATA(g))->maxset) +#define GD_minrank(g) (((Agraphinfo_t*)AGDATA(g))->minrank) +#define GD_minset(g) (((Agraphinfo_t*)AGDATA(g))->minset) +#define GD_move(g) (((Agraphinfo_t*)AGDATA(g))->move) +#define GD_n_cluster(g) (((Agraphinfo_t*)AGDATA(g))->n_cluster) +#define GD_n_nodes(g) (((Agraphinfo_t*)AGDATA(g))->n_nodes) +#define GD_ndim(g) (((Agraphinfo_t*)AGDATA(g))->ndim) +#define GD_odim(g) (((Agraphinfo_t*)AGDATA(g))->odim) +#define GD_neato_nlist(g) (((Agraphinfo_t*)AGDATA(g))->neato_nlist) +#define GD_nlist(g) (((Agraphinfo_t*)AGDATA(g))->nlist) +#define GD_nodesep(g) (((Agraphinfo_t*)AGDATA(g))->nodesep) +#define GD_outleaf(g) (((Agraphinfo_t*)AGDATA(g))->outleaf) +#define GD_rank(g) (((Agraphinfo_t*)AGDATA(g))->rank) +#define GD_rankleader(g) (((Agraphinfo_t*)AGDATA(g))->rankleader) +#define GD_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->ranksep) +#define GD_rn(g) (((Agraphinfo_t*)AGDATA(g))->rn) +#define GD_set_type(g) (((Agraphinfo_t*)AGDATA(g))->set_type) +#define GD_label_pos(g) (((Agraphinfo_t*)AGDATA(g))->label_pos) +#define GD_showboxes(g) (((Agraphinfo_t*)AGDATA(g))->showboxes) +#define GD_fontnames(g) (((Agraphinfo_t*)AGDATA(g))->fontnames) +#define GD_spring(g) (((Agraphinfo_t*)AGDATA(g))->spring) + +#else + #define GD_alg(g) (g)->u.alg #define GD_bb(g) (g)->u.bb #define GD_border(g) (g)->u.border @@ -432,6 +497,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind; #define GD_spring(g) (g)->u.spring #define GD_sum_t(g) (g)->u.sum_t #define GD_t(g) (g)->u.t +#endif typedef struct Agnodeinfo_t { shape_desc *shape; @@ -484,6 +550,63 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind; } Agnodeinfo_t; +#ifdef WITH_CGRAPH +#define ND_id(n) (((Agnodeinfo_t*)AGDATA(n))->id) +#define ND_alg(n) (((Agnodeinfo_t*)AGDATA(n))->alg) +#define ND_UF_parent(n) (((Agnodeinfo_t*)AGDATA(n))->UF_parent) +#define ND_UF_size(n) (((Agnodeinfo_t*)AGDATA(n))->UF_size) +#define ND_bb(n) (((Agnodeinfo_t*)AGDATA(n))->bb) +#define ND_clust(n) (((Agnodeinfo_t*)AGDATA(n))->clust) +#define ND_coord_i(n) (((Agnodeinfo_t*)AGDATA(n))->coord) +#define ND_dist(n) (((Agnodeinfo_t*)AGDATA(n))->dist) +#define ND_flat_in(n) (((Agnodeinfo_t*)AGDATA(n))->flat_in) +#define ND_flat_out(n) (((Agnodeinfo_t*)AGDATA(n))->flat_out) +#define ND_gui_state(n) (((Agnodeinfo_t*)AGDATA(n))->gui_state) +#define ND_has_port(n) (((Agnodeinfo_t*)AGDATA(n))->has_port) +#define ND_heapindex(n) (((Agnodeinfo_t*)AGDATA(n))->heapindex) +#define ND_height(n) (((Agnodeinfo_t*)AGDATA(n))->height) +#define ND_hops(n) (((Agnodeinfo_t*)AGDATA(n))->hops) +#define ND_ht_i(n) (((Agnodeinfo_t*)AGDATA(n))->ht) +#define ND_in(n) (((Agnodeinfo_t*)AGDATA(n))->in) +#define ND_inleaf(n) (((Agnodeinfo_t*)AGDATA(n))->inleaf) +#define ND_label(n) (((Agnodeinfo_t*)AGDATA(n))->label) +#define ND_lim(n) (((Agnodeinfo_t*)AGDATA(n))->lim) +#define ND_low(n) (((Agnodeinfo_t*)AGDATA(n))->low) +#define ND_lw_i(n) (((Agnodeinfo_t*)AGDATA(n))->lw) +#define ND_mark(n) (((Agnodeinfo_t*)AGDATA(n))->mark) +#define ND_mval(n) (((Agnodeinfo_t*)AGDATA(n))->mval) +#define ND_n_cluster(n) (((Agnodeinfo_t*)AGDATA(n))->n_cluster) +#define ND_next(n) (((Agnodeinfo_t*)AGDATA(n))->next) +#define ND_node_type(n) (((Agnodeinfo_t*)AGDATA(n))->node_type) +#define ND_onstack(n) (((Agnodeinfo_t*)AGDATA(n))->onstack) +#define ND_order(n) (((Agnodeinfo_t*)AGDATA(n))->order) +#define ND_other(n) (((Agnodeinfo_t*)AGDATA(n))->other) +#define ND_out(n) (((Agnodeinfo_t*)AGDATA(n))->out) +#define ND_outleaf(n) (((Agnodeinfo_t*)AGDATA(n))->outleaf) +#define ND_par(n) (((Agnodeinfo_t*)AGDATA(n))->par) +#define ND_pinned(n) (((Agnodeinfo_t*)AGDATA(n))->pinned) +#define ND_pos(n) (((Agnodeinfo_t*)AGDATA(n))->pos) +#define ND_prev(n) (((Agnodeinfo_t*)AGDATA(n))->prev) +#define ND_priority(n) (((Agnodeinfo_t*)AGDATA(n))->priority) +#define ND_rank(n) (((Agnodeinfo_t*)AGDATA(n))->rank) +#define ND_ranktype(n) (((Agnodeinfo_t*)AGDATA(n))->ranktype) +#define ND_rw_i(n) (((Agnodeinfo_t*)AGDATA(n))->rw) +#define ND_save_in(n) (((Agnodeinfo_t*)AGDATA(n))->save_in) +#define ND_save_out(n) (((Agnodeinfo_t*)AGDATA(n))->save_out) +#define ND_shape(n) (((Agnodeinfo_t*)AGDATA(n))->shape) +#define ND_shape_info(n) (((Agnodeinfo_t*)AGDATA(n))->shape_info) +#define ND_showboxes(n) (((Agnodeinfo_t*)AGDATA(n))->showboxes) +#define ND_state(n) (((Agnodeinfo_t*)AGDATA(n))->state) +#define ND_clustnode(n) (((Agnodeinfo_t*)AGDATA(n))->clustnode) +#define ND_tree_in(n) (((Agnodeinfo_t*)AGDATA(n))->tree_in) +#define ND_tree_out(n) (((Agnodeinfo_t*)AGDATA(n))->tree_out) +#define ND_weight_class(n) (((Agnodeinfo_t*)AGDATA(n))->weight_class) +#define ND_width(n) (((Agnodeinfo_t*)AGDATA(n))->width) +#define ND_xsize(n) (((Agnodeinfo_t*)AGDATA(n))->xsize) +#define ND_ysize(n) (((Agnodeinfo_t*)AGDATA(n))->ysize) + +#else + #define ND_UF_parent(n) (n)->u.UF_parent #define ND_UF_size(n) (n)->u.UF_size #define ND_alg(n) (n)->u.alg @@ -537,6 +660,7 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind; #define ND_width(n) (n)->u.width #define ND_xsize(n) (n)->u.xsize #define ND_ysize(n) (n)->u.ysize +#endif typedef struct Agedgeinfo_t { splines *spl; @@ -564,9 +688,36 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind; unsigned short minlen; edge_t *to_virt; #endif - } Agedgeinfo_t; +#ifdef WITH_CGRAPH +#define ED_alg(e) (((Agedgeinfo_t*)AGDATA(e))->alg) +#define ED_conc_opp_flag(e) (((Agedgeinfo_t*)AGDATA(e))->conc_opp_flag) +#define ED_count(e) (((Agedgeinfo_t*)AGDATA(e))->count) +#define ED_cutvalue(e) (((Agedgeinfo_t*)AGDATA(e))->cutvalue) +#define ED_edge_type(e) (((Agedgeinfo_t*)AGDATA(e))->edge_type) +#define ED_adjacent(e) (((Agedgeinfo_t*)AGDATA(e))->adjacent) +#define ED_factor(e) (((Agedgeinfo_t*)AGDATA(e))->factor) +#define ED_gui_state(e) (((Agedgeinfo_t*)AGDATA(e))->gui_state) +#define ED_head_label(e) (((Agedgeinfo_t*)AGDATA(e))->head_label) +#define ED_head_port(e) (((Agedgeinfo_t*)AGDATA(e))->head_port) +#define ED_label(e) (((Agedgeinfo_t*)AGDATA(e))->label) +#define ED_label_ontop(e) (((Agedgeinfo_t*)AGDATA(e))->label_ontop) +#define ED_minlen(e) (((Agedgeinfo_t*)AGDATA(e))->minlen) +#define ED_path(e) (((Agedgeinfo_t*)AGDATA(e))->path) +#define ED_showboxes(e) (((Agedgeinfo_t*)AGDATA(e))->showboxes) +#define ED_spl(e) (((Agedgeinfo_t*)AGDATA(e))->spl) +#define ED_tail_label(e) (((Agedgeinfo_t*)AGDATA(e))->tail_label) +#define ED_tail_port(e) (((Agedgeinfo_t*)AGDATA(e))->tail_port) +#define ED_to_orig(e) (((Agedgeinfo_t*)AGDATA(e))->to_orig) +#define ED_to_virt(e) (((Agedgeinfo_t*)AGDATA(e))->to_virt) +#define ED_tree_index(e) (((Agedgeinfo_t*)AGDATA(e))->tree_index) +#define ED_xpenalty(e) (((Agedgeinfo_t*)AGDATA(e))->xpenalty) +#define ED_dist(e) (((Agedgeinfo_t*)AGDATA(e))->dist) +#define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight) + +#else + #define ED_alg(e) (e)->u.alg #define ED_conc_opp_flag(e) (e)->u.conc_opp_flag #define ED_count(e) (e)->u.count @@ -591,11 +742,6 @@ typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind; #define ED_tree_index(e) (e)->u.tree_index #define ED_weight(e) (e)->u.weight #define ED_xpenalty(e) (e)->u.xpenalty - -#ifdef WITH_CGRAPH -#include "cgraph.h" -#else -#include "graph.h" #endif typedef struct {