wolffd@0: /* $Id: types.h,v 1.101 2009/08/28 19:46:42 erg Exp $ $Revision: 1.101 $ */ wolffd@0: /* vim:set shiftwidth=4 ts=8: */ wolffd@0: wolffd@0: /********************************************************** wolffd@0: * This software is part of the graphviz package * wolffd@0: * http://www.graphviz.org/ * wolffd@0: * * wolffd@0: * Copyright (c) 1994-2004 AT&T Corp. * wolffd@0: * and is licensed under the * wolffd@0: * Common Public License, Version 1.0 * wolffd@0: * by AT&T Corp. * wolffd@0: * * wolffd@0: * Information and Software Systems Research * wolffd@0: * AT&T Research, Florham Park NJ * wolffd@0: **********************************************************/ wolffd@0: wolffd@0: #ifndef GV_TYPES_H wolffd@0: #define GV_TYPES_H wolffd@0: wolffd@0: #include wolffd@0: #include wolffd@0: #include wolffd@0: wolffd@0: typedef unsigned char boolean; wolffd@0: #ifndef NOT wolffd@0: #define NOT(v) (!(v)) wolffd@0: #endif wolffd@0: #ifndef FALSE wolffd@0: #define FALSE 0 wolffd@0: #endif wolffd@0: #ifndef TRUE wolffd@0: #define TRUE NOT(FALSE) wolffd@0: #endif wolffd@0: wolffd@0: #include "geom.h" wolffd@0: #include "gvcext.h" wolffd@0: #include "pathgeom.h" wolffd@0: #include "textpara.h" wolffd@0: wolffd@0: #ifdef __cplusplus wolffd@0: extern "C" { wolffd@0: #endif wolffd@0: wolffd@0: typedef int (*qsort_cmpf) (const void *, const void *); wolffd@0: typedef int (*bsearch_cmpf) (const void *, const void *); wolffd@0: wolffd@0: #ifdef WITH_CGRAPH wolffd@0: #include wolffd@0: typedef struct Agraph_s graph_t; wolffd@0: typedef struct Agnode_s node_t; wolffd@0: typedef struct Agedge_s edge_t; wolffd@0: typedef struct Agsym_s attrsym_t; wolffd@0: #define TAIL_ID "tailport" wolffd@0: #define HEAD_ID "headport" wolffd@0: #else wolffd@0: typedef struct Agraph_t graph_t; wolffd@0: typedef struct Agnode_t node_t; wolffd@0: typedef struct Agedge_t edge_t; wolffd@0: typedef struct Agsym_t attrsym_t; wolffd@0: #endif wolffd@0: wolffd@0: typedef struct htmllabel_t htmllabel_t; wolffd@0: wolffd@0: typedef union inside_t { wolffd@0: struct { wolffd@0: pointf* p; wolffd@0: double* r; wolffd@0: } a; wolffd@0: struct { wolffd@0: node_t* n; wolffd@0: boxf* bp; wolffd@0: } s; wolffd@0: } inside_t; wolffd@0: wolffd@0: typedef struct port { /* internal edge endpoint specification */ wolffd@0: pointf p; /* aiming point relative to node center */ wolffd@0: double theta; /* slope in radians */ wolffd@0: boxf *bp; /* if not null, points to bbox of wolffd@0: * rectangular area that is port target wolffd@0: */ wolffd@0: boolean defined; /* if true, edge has port info at this end */ wolffd@0: boolean constrained; /* if true, constraints such as theta are set */ wolffd@0: boolean clip; /* if true, clip end to node/port shape */ wolffd@0: boolean dyna; /* if true, assign compass point dynamically */ wolffd@0: unsigned char order; /* for mincross */ wolffd@0: unsigned char side; /* if port is on perimeter of node, this wolffd@0: * contains the bitwise OR of the sides (TOP, wolffd@0: * BOTTOM, etc.) it is on. wolffd@0: */ wolffd@0: char *name; /* port name, if it was explicitly given, otherwise NULL */ wolffd@0: } port; wolffd@0: wolffd@0: typedef struct { wolffd@0: boolean(*swapEnds) (edge_t * e); /* Should head and tail be swapped? */ wolffd@0: boolean(*splineMerge) (node_t * n); /* Is n a node in the middle of an edge? */ wolffd@0: boolean ignoreSwap; /* Test for swapped edges if false */ wolffd@0: } splineInfo; wolffd@0: wolffd@0: typedef struct pathend_t { wolffd@0: boxf nb; /* the node box */ wolffd@0: pointf np; /* node port */ wolffd@0: int sidemask; wolffd@0: int boxn; wolffd@0: boxf boxes[20]; wolffd@0: } pathend_t; wolffd@0: wolffd@0: typedef struct path { /* internal specification for an edge spline */ wolffd@0: port start, end; wolffd@0: int nbox; /* number of subdivisions */ wolffd@0: boxf *boxes; /* rectangular regions of subdivision */ wolffd@0: void *data; wolffd@0: } path; wolffd@0: wolffd@0: typedef struct bezier { wolffd@0: pointf *list; wolffd@0: int size; wolffd@0: int sflag, eflag; wolffd@0: pointf sp, ep; wolffd@0: } bezier; wolffd@0: wolffd@0: typedef struct splines { wolffd@0: bezier *list; wolffd@0: int size; wolffd@0: boxf bb; wolffd@0: } splines; wolffd@0: wolffd@0: typedef struct textlabel_t { wolffd@0: char *text, *fontname, *fontcolor; wolffd@0: int charset; wolffd@0: double fontsize; wolffd@0: pointf dimen; /* the diagonal size of the label (estimated by layout) */ wolffd@0: pointf space; /* the diagonal size of the space for the label */ wolffd@0: /* the rendered label is aligned in this box */ wolffd@0: /* space does not include pad or margin */ wolffd@0: pointf pos; /* the center of the space for the label */ wolffd@0: union { wolffd@0: struct { wolffd@0: textpara_t *para; wolffd@0: short nparas; wolffd@0: } txt; wolffd@0: htmllabel_t *html; wolffd@0: } u; wolffd@0: char valign; /* 't' 'c' 'b' */ wolffd@0: boolean set; /* true if position is set */ wolffd@0: boolean html; /* true if html label */ wolffd@0: } textlabel_t; wolffd@0: wolffd@0: typedef struct polygon_t { /* mutable shape information for a node */ wolffd@0: int regular; /* true for symmetric shapes */ wolffd@0: int peripheries; /* number of periphery lines */ wolffd@0: int sides; /* number of sides */ wolffd@0: double orientation; /* orientation of shape (+ve degrees) */ wolffd@0: double distortion; /* distortion factor - as in trapezium */ wolffd@0: double skew; /* skew factor - as in parallelogram */ wolffd@0: int option; /* ROUNDED, DIAGONAL corners, etc. */ wolffd@0: pointf *vertices; /* array of vertex points */ wolffd@0: } polygon_t; wolffd@0: wolffd@0: typedef struct stroke_t { /* information about a single stroke */ wolffd@0: /* we would have called it a path if that term wasn't already used */ wolffd@0: int nvertices; /* number of points in the stroke */ wolffd@0: int flags; /* stroke style flags */ wolffd@0: pointf *vertices; /* array of vertex points */ wolffd@0: } stroke_t; wolffd@0: wolffd@0: /* flag definitions for stroke_t */ wolffd@0: #define STROKE_CLOSED (1 << 0) wolffd@0: #define STROKE_FILLED (1 << 1) wolffd@0: #define STROKE_PENDOWN (1 << 2) wolffd@0: #define STROKE_VERTICES_ALLOCATED (1 << 3) wolffd@0: wolffd@0: typedef struct shape_t { /* mutable shape information for a node */ wolffd@0: int nstrokes; /* number of strokes in array */ wolffd@0: stroke_t *strokes; /* array of strokes */ wolffd@0: /* The last stroke must always be closed, but can be pen_up. wolffd@0: * It is used as the clipping path */ wolffd@0: } shape_t; wolffd@0: wolffd@0: typedef struct shape_functions { /* read-only shape functions */ wolffd@0: void (*initfn) (node_t *); /* initializes shape from node u.shape_info structure */ wolffd@0: void (*freefn) (node_t *); /* frees shape from node u.shape_info structure */ wolffd@0: port(*portfn) (node_t *, char *, char *); /* finds aiming point and slope of port */ wolffd@0: boolean(*insidefn) (inside_t * inside_context, pointf); /* clips incident gvc->e spline on shape of gvc->n */ wolffd@0: int (*pboxfn)(node_t* n, port* p, int side, boxf rv[], int *kptr); /* finds box path to reach port */ wolffd@0: void (*codefn) (GVJ_t * job, node_t * n); /* emits graphics code for node */ wolffd@0: } shape_functions; wolffd@0: wolffd@0: typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF} shape_kind; wolffd@0: wolffd@0: typedef struct shape_desc { /* read-only shape descriptor */ wolffd@0: char *name; /* as read from graph file */ wolffd@0: shape_functions *fns; wolffd@0: polygon_t *polygon; /* base polygon info */ wolffd@0: boolean usershape; wolffd@0: } shape_desc; wolffd@0: wolffd@0: #include "usershape.h" /* usershapes needed by gvc */ wolffd@0: wolffd@0: typedef struct nodequeue { wolffd@0: node_t **store, **limit, **head, **tail; wolffd@0: } nodequeue; wolffd@0: wolffd@0: typedef struct adjmatrix_t { wolffd@0: int nrows, ncols; wolffd@0: char *data; wolffd@0: } adjmatrix_t; wolffd@0: wolffd@0: typedef struct rank_t { wolffd@0: int n; /* number of nodes in this rank */ wolffd@0: node_t **v; /* ordered list of nodes in rank */ wolffd@0: int an; /* globally allocated number of nodes */ wolffd@0: node_t **av; /* allocated list of nodes in rank */ wolffd@0: int ht1, ht2; /* height below/above centerline */ wolffd@0: int pht1, pht2; /* as above, but only primitive nodes */ wolffd@0: boolean candidate; /* for transpose () */ wolffd@0: boolean valid; wolffd@0: int cache_nc; /* caches number of crossings */ wolffd@0: adjmatrix_t *flat; wolffd@0: } rank_t; wolffd@0: wolffd@0: typedef enum { R_NONE = wolffd@0: 0, R_VALUE, R_FILL, R_COMPRESS, R_AUTO, R_EXPAND } ratio_t; wolffd@0: wolffd@0: typedef struct layout_t { wolffd@0: double quantum; wolffd@0: double scale; wolffd@0: double ratio; /* set only if ratio_kind == R_VALUE */ wolffd@0: double dpi; wolffd@0: pointf margin; wolffd@0: pointf page; wolffd@0: pointf size; wolffd@0: boolean filled; wolffd@0: boolean landscape; wolffd@0: boolean centered; wolffd@0: ratio_t ratio_kind; wolffd@0: void* xdots; wolffd@0: } layout_t; wolffd@0: wolffd@0: /* for "record" shapes */ wolffd@0: typedef struct field_t { wolffd@0: pointf size; /* its dimension */ wolffd@0: boxf b; /* its placement in node's coordinates */ wolffd@0: int n_flds; wolffd@0: textlabel_t *lp; /* n_flds == 0 */ wolffd@0: struct field_t **fld; /* n_flds > 0 */ wolffd@0: char *id; /* user's identifier */ wolffd@0: unsigned char LR; /* if box list is horizontal (left to right) */ wolffd@0: unsigned char sides; /* sides of node exposed to field */ wolffd@0: } field_t; wolffd@0: wolffd@0: typedef struct nlist_t { wolffd@0: node_t **list; wolffd@0: int size; wolffd@0: } nlist_t; wolffd@0: wolffd@0: typedef struct elist { wolffd@0: edge_t **list; wolffd@0: int size; wolffd@0: } elist; wolffd@0: wolffd@0: #define GUI_STATE_ACTIVE (1<<0) wolffd@0: #define GUI_STATE_SELECTED (1<<1) wolffd@0: #define GUI_STATE_VISITED (1<<2) wolffd@0: #define GUI_STATE_DELETED (1<<3) wolffd@0: wolffd@0: #define elist_fastapp(item,L) do {L.list[L.size++] = item; L.list[L.size] = NULL;} while(0) wolffd@0: #define elist_append(item,L) do {L.list = ALLOC(L.size + 2,L.list,edge_t*); L.list[L.size++] = item; L.list[L.size] = NULL;} while(0) wolffd@0: #define alloc_elist(n,L) do {L.size = 0; L.list = N_NEW(n + 1,edge_t*); } while (0) wolffd@0: #define free_list(L) do {if (L.list) free(L.list);} while (0) wolffd@0: wolffd@0: typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind; wolffd@0: wolffd@0: typedef struct Agraphinfo_t { wolffd@0: #ifdef WITH_CGRAPH wolffd@0: Agrec_t hdr; wolffd@0: #endif wolffd@0: /* to generate code */ wolffd@0: layout_t *drawing; wolffd@0: textlabel_t *label; /* if the cluster has a title */ wolffd@0: boxf bb; /* bounding box */ wolffd@0: pointf border[4]; /* sizes of margins for graph labels */ wolffd@0: unsigned char gui_state; /* Graph state for GUI ops */ wolffd@0: unsigned char has_labels; wolffd@0: boolean has_images; wolffd@0: unsigned char charset; /* input character set */ wolffd@0: int rankdir; wolffd@0: int ht1, ht2; /* below and above extremal ranks */ wolffd@0: unsigned short flags; wolffd@0: void *alg; wolffd@0: GVC_t *gvc; /* context for "globals" over multiple graphs */ wolffd@0: void (*cleanup) (graph_t * g); /* function to deallocate layout-specific data */ wolffd@0: wolffd@0: #ifndef DOT_ONLY wolffd@0: /* to place nodes */ wolffd@0: node_t **neato_nlist; wolffd@0: int move; wolffd@0: double **dist, **spring, **sum_t, ***t; wolffd@0: unsigned short ndim; wolffd@0: unsigned short odim; wolffd@0: #endif wolffd@0: #ifndef NEATO_ONLY wolffd@0: /* to have subgraphs */ wolffd@0: int n_cluster; wolffd@0: graph_t **clust; /* clusters are in clust[1..n_cluster] !!! */ wolffd@0: node_t *nlist; wolffd@0: rank_t *rank; wolffd@0: /* fast graph node list */ wolffd@0: nlist_t comp; wolffd@0: /* connected components */ wolffd@0: node_t *minset, *maxset; /* set leaders */ wolffd@0: long n_nodes; wolffd@0: /* includes virtual */ wolffd@0: short minrank, maxrank; wolffd@0: wolffd@0: /* various flags */ wolffd@0: boolean has_flat_edges; wolffd@0: unsigned char showboxes; wolffd@0: boolean cluster_was_collapsed; wolffd@0: fontname_kind fontnames; /* to override mangling in SVG */ wolffd@0: wolffd@0: int nodesep, ranksep; wolffd@0: node_t *ln, *rn; /* left, right nodes of bounding box */ wolffd@0: wolffd@0: wolffd@0: /* for clusters */ wolffd@0: node_t *leader, **rankleader; wolffd@0: boolean expanded; wolffd@0: char installed; wolffd@0: char set_type; wolffd@0: char label_pos; wolffd@0: boolean exact_ranksep; wolffd@0: #endif wolffd@0: wolffd@0: } Agraphinfo_t; wolffd@0: wolffd@0: #ifdef WITH_CGRAPH wolffd@0: #define GD_u(g)(((Agraphinfo_t*)AGDATA(g))) wolffd@0: #define GD_drawing(g) (((Agraphinfo_t*)AGDATA(g))->drawing) wolffd@0: #define GD_bb(g) (((Agraphinfo_t*)AGDATA(g))->bb) wolffd@0: #define GD_gvc(g) (((Agraphinfo_t*)AGDATA(g))->gvc) wolffd@0: #define GD_cleanup(g) (((Agraphinfo_t*)AGDATA(g))->cleanup) wolffd@0: #define GD_dist(g) (((Agraphinfo_t*)AGDATA(g))->dist) wolffd@0: #define GD_alg(g) (((Agraphinfo_t*)AGDATA(g))->alg) wolffd@0: #define GD_border(g) (((Agraphinfo_t*)AGDATA(g))->border) wolffd@0: #define GD_cl_cnt(g) (((Agraphinfo_t*)AGDATA(g))->cl_nt) wolffd@0: #define GD_clust(g) (((Agraphinfo_t*)AGDATA(g))->clust) wolffd@0: #define GD_cluster_was_collapsed(g) (((Agraphinfo_t*)AGDATA(g))->cluster_was_collapsed) wolffd@0: #define GD_comp(g) (((Agraphinfo_t*)AGDATA(g))->comp) wolffd@0: #define GD_exact_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->exact_ranksep) wolffd@0: #define GD_expanded(g) (((Agraphinfo_t*)AGDATA(g))->expanded) wolffd@0: #define GD_flags(g) (((Agraphinfo_t*)AGDATA(g))->flags) wolffd@0: #define GD_gui_state(g) (((Agraphinfo_t*)AGDATA(g))->gui_state) wolffd@0: #define GD_charset(g) (((Agraphinfo_t*)AGDATA(g))->charset) wolffd@0: #define GD_has_labels(g) (((Agraphinfo_t*)AGDATA(g))->has_labels) wolffd@0: #define GD_has_images(g) (((Agraphinfo_t*)AGDATA(g))->has_images) wolffd@0: #define GD_has_flat_edges(g) (((Agraphinfo_t*)AGDATA(g))->has_flat_edges) wolffd@0: #define GD_ht1(g) (((Agraphinfo_t*)AGDATA(g))->ht1) wolffd@0: #define GD_ht2(g) (((Agraphinfo_t*)AGDATA(g))->ht2) wolffd@0: #define GD_inleaf(g) (((Agraphinfo_t*)AGDATA(g))->inleaf) wolffd@0: #define GD_installed(g) (((Agraphinfo_t*)AGDATA(g))->installed) wolffd@0: #define GD_label(g) (((Agraphinfo_t*)AGDATA(g))->label) wolffd@0: #define GD_leader(g) (((Agraphinfo_t*)AGDATA(g))->leader) wolffd@0: #define GD_rankdir2(g) (((Agraphinfo_t*)AGDATA(g))->rankdir) wolffd@0: #define GD_rankdir(g) (((Agraphinfo_t*)AGDATA(g))->rankdir & 0x3) wolffd@0: #define GD_flip(g) (GD_rankdir(g) & 1) wolffd@0: #define GD_realrankdir(g) ((((Agraphinfo_t*)AGDATA(g))->rankdir) >> 2) wolffd@0: #define GD_realflip(g) (GD_realrankdir(g) & 1) wolffd@0: #define GD_ln(g) (((Agraphinfo_t*)AGDATA(g))->ln) wolffd@0: #define GD_maxrank(g) (((Agraphinfo_t*)AGDATA(g))->maxrank) wolffd@0: #define GD_maxset(g) (((Agraphinfo_t*)AGDATA(g))->maxset) wolffd@0: #define GD_minrank(g) (((Agraphinfo_t*)AGDATA(g))->minrank) wolffd@0: #define GD_minset(g) (((Agraphinfo_t*)AGDATA(g))->minset) wolffd@0: #define GD_move(g) (((Agraphinfo_t*)AGDATA(g))->move) wolffd@0: #define GD_n_cluster(g) (((Agraphinfo_t*)AGDATA(g))->n_cluster) wolffd@0: #define GD_n_nodes(g) (((Agraphinfo_t*)AGDATA(g))->n_nodes) wolffd@0: #define GD_ndim(g) (((Agraphinfo_t*)AGDATA(g))->ndim) wolffd@0: #define GD_odim(g) (((Agraphinfo_t*)AGDATA(g))->odim) wolffd@0: #define GD_neato_nlist(g) (((Agraphinfo_t*)AGDATA(g))->neato_nlist) wolffd@0: #define GD_nlist(g) (((Agraphinfo_t*)AGDATA(g))->nlist) wolffd@0: #define GD_nodesep(g) (((Agraphinfo_t*)AGDATA(g))->nodesep) wolffd@0: #define GD_outleaf(g) (((Agraphinfo_t*)AGDATA(g))->outleaf) wolffd@0: #define GD_rank(g) (((Agraphinfo_t*)AGDATA(g))->rank) wolffd@0: #define GD_rankleader(g) (((Agraphinfo_t*)AGDATA(g))->rankleader) wolffd@0: #define GD_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->ranksep) wolffd@0: #define GD_rn(g) (((Agraphinfo_t*)AGDATA(g))->rn) wolffd@0: #define GD_set_type(g) (((Agraphinfo_t*)AGDATA(g))->set_type) wolffd@0: #define GD_label_pos(g) (((Agraphinfo_t*)AGDATA(g))->label_pos) wolffd@0: #define GD_showboxes(g) (((Agraphinfo_t*)AGDATA(g))->showboxes) wolffd@0: #define GD_fontnames(g) (((Agraphinfo_t*)AGDATA(g))->fontnames) wolffd@0: #define GD_spring(g) (((Agraphinfo_t*)AGDATA(g))->spring) wolffd@0: #define GD_sum_t(g) (((Agraphinfo_t*)AGDATA(g))->sum_t) wolffd@0: #define GD_t(g) (((Agraphinfo_t*)AGDATA(g))->t) wolffd@0: wolffd@0: #else wolffd@0: wolffd@0: #define GD_alg(g) (g)->u.alg wolffd@0: #define GD_bb(g) (g)->u.bb wolffd@0: #define GD_border(g) (g)->u.border wolffd@0: #define GD_cl_cnt(g) (g)->u.cl_cnt wolffd@0: #define GD_cleanup(g) (g)->u.cleanup wolffd@0: #define GD_clust(g) (g)->u.clust wolffd@0: #define GD_cluster_was_collapsed(g) (g)->u.cluster_was_collapsed wolffd@0: #define GD_comp(g) (g)->u.comp wolffd@0: #define GD_dist(g) (g)->u.dist wolffd@0: #define GD_drawing(g) (g)->u.drawing wolffd@0: #define GD_exact_ranksep(g) (g)->u.exact_ranksep wolffd@0: #define GD_expanded(g) (g)->u.expanded wolffd@0: #define GD_flags(g) (g)->u.flags wolffd@0: #define GD_gui_state(g) (g)->u.gui_state wolffd@0: #define GD_gvc(g) (g)->u.gvc wolffd@0: #define GD_charset(g) (g)->u.charset wolffd@0: #define GD_has_labels(g) (g)->u.has_labels wolffd@0: #define GD_has_images(g) (g)->u.has_images wolffd@0: #define GD_has_flat_edges(g) (g)->u.has_flat_edges wolffd@0: #define GD_ht1(g) (g)->u.ht1 wolffd@0: #define GD_ht2(g) (g)->u.ht2 wolffd@0: #define GD_inleaf(g) (g)->u.inleaf wolffd@0: #define GD_installed(g) (g)->u.installed wolffd@0: #define GD_label(g) (g)->u.label wolffd@0: #define GD_leader(g) (g)->u.leader wolffd@0: #define GD_rankdir(g) ((g)->u.rankdir & 0x3) wolffd@0: #define GD_flip(g) (GD_rankdir(g) & 1) wolffd@0: #define GD_realrankdir(g) ((g)->u.rankdir >> 2) wolffd@0: #define GD_realflip(g) (GD_realrankdir(g) & 1) wolffd@0: #define GD_ln(g) (g)->u.ln wolffd@0: #define GD_maxrank(g) (g)->u.maxrank wolffd@0: #define GD_maxset(g) (g)->u.maxset wolffd@0: #define GD_minrank(g) (g)->u.minrank wolffd@0: #define GD_minset(g) (g)->u.minset wolffd@0: #define GD_move(g) (g)->u.move wolffd@0: #define GD_n_cluster(g) (g)->u.n_cluster wolffd@0: #define GD_n_nodes(g) (g)->u.n_nodes wolffd@0: #define GD_ndim(g) (g)->u.ndim wolffd@0: #define GD_odim(g) (g)->u.odim wolffd@0: #define GD_neato_nlist(g) (g)->u.neato_nlist wolffd@0: #define GD_nlist(g) (g)->u.nlist wolffd@0: #define GD_nodesep(g) (g)->u.nodesep wolffd@0: #define GD_outleaf(g) (g)->u.outleaf wolffd@0: #define GD_rank(g) (g)->u.rank wolffd@0: #define GD_rankleader(g) (g)->u.rankleader wolffd@0: #define GD_ranksep(g) (g)->u.ranksep wolffd@0: #define GD_rn(g) (g)->u.rn wolffd@0: #define GD_set_type(g) (g)->u.set_type wolffd@0: #define GD_label_pos(g) (g)->u.label_pos wolffd@0: #define GD_showboxes(g) (g)->u.showboxes wolffd@0: #define GD_fontnames(g) (g)->u.fontnames wolffd@0: #define GD_spring(g) (g)->u.spring wolffd@0: #define GD_sum_t(g) (g)->u.sum_t wolffd@0: #define GD_t(g) (g)->u.t wolffd@0: #endif wolffd@0: wolffd@0: typedef struct Agnodeinfo_t { wolffd@0: #ifdef WITH_CGRAPH wolffd@0: Agrec_t hdr; wolffd@0: #endif wolffd@0: shape_desc *shape; wolffd@0: void *shape_info; wolffd@0: pointf coord; wolffd@0: double width, height; /* inches */ wolffd@0: boxf bb; wolffd@0: double ht, lw, rw; wolffd@0: textlabel_t *label; wolffd@0: textlabel_t *xlabel; wolffd@0: void *alg; wolffd@0: char state; wolffd@0: unsigned char gui_state; /* Node state for GUI ops */ wolffd@0: boolean clustnode; wolffd@0: wolffd@0: #ifndef DOT_ONLY wolffd@0: unsigned char pinned; wolffd@0: short xsize, ysize; wolffd@0: int id, heapindex, hops; wolffd@0: double *pos, dist; wolffd@0: #endif wolffd@0: #ifndef NEATO_ONLY wolffd@0: unsigned char showboxes; wolffd@0: boolean has_port; wolffd@0: wolffd@0: /* fast graph */ wolffd@0: char node_type, mark, onstack; wolffd@0: char ranktype, weight_class; wolffd@0: node_t *next, *prev; wolffd@0: elist in, out, flat_out, flat_in, other; wolffd@0: graph_t *clust; wolffd@0: wolffd@0: /* for union-find and collapsing nodes */ wolffd@0: int UF_size; wolffd@0: node_t *UF_parent; wolffd@0: node_t *inleaf, *outleaf; wolffd@0: wolffd@0: /* for placing nodes */ wolffd@0: int rank, order; /* initially, order = 1 for ordered edges */ wolffd@0: int mval; wolffd@0: elist save_in, save_out; wolffd@0: wolffd@0: /* for network-simplex */ wolffd@0: elist tree_in, tree_out; wolffd@0: edge_t *par; wolffd@0: int low, lim; wolffd@0: int priority; wolffd@0: wolffd@0: double pad[1]; wolffd@0: #endif wolffd@0: wolffd@0: } Agnodeinfo_t; wolffd@0: wolffd@0: #ifdef WITH_CGRAPH wolffd@0: #define ND_id(n) (((Agnodeinfo_t*)AGDATA(n))->id) wolffd@0: #define ND_alg(n) (((Agnodeinfo_t*)AGDATA(n))->alg) wolffd@0: #define ND_UF_parent(n) (((Agnodeinfo_t*)AGDATA(n))->UF_parent) wolffd@0: #define ND_UF_size(n) (((Agnodeinfo_t*)AGDATA(n))->UF_size) wolffd@0: #define ND_bb(n) (((Agnodeinfo_t*)AGDATA(n))->bb) wolffd@0: #define ND_clust(n) (((Agnodeinfo_t*)AGDATA(n))->clust) wolffd@0: #define ND_coord(n) (((Agnodeinfo_t*)AGDATA(n))->coord) wolffd@0: #define ND_dist(n) (((Agnodeinfo_t*)AGDATA(n))->dist) wolffd@0: #define ND_flat_in(n) (((Agnodeinfo_t*)AGDATA(n))->flat_in) wolffd@0: #define ND_flat_out(n) (((Agnodeinfo_t*)AGDATA(n))->flat_out) wolffd@0: #define ND_gui_state(n) (((Agnodeinfo_t*)AGDATA(n))->gui_state) wolffd@0: #define ND_has_port(n) (((Agnodeinfo_t*)AGDATA(n))->has_port) wolffd@0: #define ND_heapindex(n) (((Agnodeinfo_t*)AGDATA(n))->heapindex) wolffd@0: #define ND_height(n) (((Agnodeinfo_t*)AGDATA(n))->height) wolffd@0: #define ND_hops(n) (((Agnodeinfo_t*)AGDATA(n))->hops) wolffd@0: #define ND_ht(n) (((Agnodeinfo_t*)AGDATA(n))->ht) wolffd@0: #define ND_in(n) (((Agnodeinfo_t*)AGDATA(n))->in) wolffd@0: #define ND_inleaf(n) (((Agnodeinfo_t*)AGDATA(n))->inleaf) wolffd@0: #define ND_label(n) (((Agnodeinfo_t*)AGDATA(n))->label) wolffd@0: #define ND_xlabel(n) (((Agnodeinfo_t*)AGDATA(n))->xlabel) wolffd@0: #define ND_lim(n) (((Agnodeinfo_t*)AGDATA(n))->lim) wolffd@0: #define ND_low(n) (((Agnodeinfo_t*)AGDATA(n))->low) wolffd@0: #define ND_lw(n) (((Agnodeinfo_t*)AGDATA(n))->lw) wolffd@0: #define ND_mark(n) (((Agnodeinfo_t*)AGDATA(n))->mark) wolffd@0: #define ND_mval(n) (((Agnodeinfo_t*)AGDATA(n))->mval) wolffd@0: #define ND_n_cluster(n) (((Agnodeinfo_t*)AGDATA(n))->n_cluster) wolffd@0: #define ND_next(n) (((Agnodeinfo_t*)AGDATA(n))->next) wolffd@0: #define ND_node_type(n) (((Agnodeinfo_t*)AGDATA(n))->node_type) wolffd@0: #define ND_onstack(n) (((Agnodeinfo_t*)AGDATA(n))->onstack) wolffd@0: #define ND_order(n) (((Agnodeinfo_t*)AGDATA(n))->order) wolffd@0: #define ND_other(n) (((Agnodeinfo_t*)AGDATA(n))->other) wolffd@0: #define ND_out(n) (((Agnodeinfo_t*)AGDATA(n))->out) wolffd@0: #define ND_outleaf(n) (((Agnodeinfo_t*)AGDATA(n))->outleaf) wolffd@0: #define ND_par(n) (((Agnodeinfo_t*)AGDATA(n))->par) wolffd@0: #define ND_pinned(n) (((Agnodeinfo_t*)AGDATA(n))->pinned) wolffd@0: #define ND_pos(n) (((Agnodeinfo_t*)AGDATA(n))->pos) wolffd@0: #define ND_prev(n) (((Agnodeinfo_t*)AGDATA(n))->prev) wolffd@0: #define ND_priority(n) (((Agnodeinfo_t*)AGDATA(n))->priority) wolffd@0: #define ND_rank(n) (((Agnodeinfo_t*)AGDATA(n))->rank) wolffd@0: #define ND_ranktype(n) (((Agnodeinfo_t*)AGDATA(n))->ranktype) wolffd@0: #define ND_rw(n) (((Agnodeinfo_t*)AGDATA(n))->rw) wolffd@0: #define ND_save_in(n) (((Agnodeinfo_t*)AGDATA(n))->save_in) wolffd@0: #define ND_save_out(n) (((Agnodeinfo_t*)AGDATA(n))->save_out) wolffd@0: #define ND_shape(n) (((Agnodeinfo_t*)AGDATA(n))->shape) wolffd@0: #define ND_shape_info(n) (((Agnodeinfo_t*)AGDATA(n))->shape_info) wolffd@0: #define ND_showboxes(n) (((Agnodeinfo_t*)AGDATA(n))->showboxes) wolffd@0: #define ND_state(n) (((Agnodeinfo_t*)AGDATA(n))->state) wolffd@0: #define ND_clustnode(n) (((Agnodeinfo_t*)AGDATA(n))->clustnode) wolffd@0: #define ND_tree_in(n) (((Agnodeinfo_t*)AGDATA(n))->tree_in) wolffd@0: #define ND_tree_out(n) (((Agnodeinfo_t*)AGDATA(n))->tree_out) wolffd@0: #define ND_weight_class(n) (((Agnodeinfo_t*)AGDATA(n))->weight_class) wolffd@0: #define ND_width(n) (((Agnodeinfo_t*)AGDATA(n))->width) wolffd@0: #define ND_xsize(n) (((Agnodeinfo_t*)AGDATA(n))->xsize) wolffd@0: #define ND_ysize(n) (((Agnodeinfo_t*)AGDATA(n))->ysize) wolffd@0: wolffd@0: #else wolffd@0: wolffd@0: #define ND_UF_parent(n) (n)->u.UF_parent wolffd@0: #define ND_UF_size(n) (n)->u.UF_size wolffd@0: #define ND_alg(n) (n)->u.alg wolffd@0: #define ND_bb(n) (n)->u.bb wolffd@0: #define ND_clust(n) (n)->u.clust wolffd@0: #define ND_coord(n) (n)->u.coord wolffd@0: #define ND_dist(n) (n)->u.dist wolffd@0: #define ND_flat_in(n) (n)->u.flat_in wolffd@0: #define ND_flat_out(n) (n)->u.flat_out wolffd@0: #define ND_gui_state(n) (n)->u.gui_state wolffd@0: #define ND_has_port(n) (n)->u.has_port wolffd@0: #define ND_heapindex(n) (n)->u.heapindex wolffd@0: #define ND_height(n) (n)->u.height wolffd@0: #define ND_hops(n) (n)->u.hops wolffd@0: #define ND_ht(n) (n)->u.ht wolffd@0: #define ND_id(n) (n)->u.id wolffd@0: #define ND_in(n) (n)->u.in wolffd@0: #define ND_inleaf(n) (n)->u.inleaf wolffd@0: #define ND_label(n) (n)->u.label wolffd@0: #define ND_xlabel(n) (n)->u.xlabel wolffd@0: #define ND_lim(n) (n)->u.lim wolffd@0: #define ND_low(n) (n)->u.low wolffd@0: #define ND_lw(n) (n)->u.lw wolffd@0: #define ND_mark(n) (n)->u.mark wolffd@0: #define ND_mval(n) (n)->u.mval wolffd@0: #define ND_n_cluster(n) (n)->u.n_cluster wolffd@0: #define ND_next(n) (n)->u.next wolffd@0: #define ND_node_type(n) (n)->u.node_type wolffd@0: #define ND_onstack(n) (n)->u.onstack wolffd@0: #define ND_order(n) (n)->u.order wolffd@0: #define ND_other(n) (n)->u.other wolffd@0: #define ND_out(n) (n)->u.out wolffd@0: #define ND_outleaf(n) (n)->u.outleaf wolffd@0: #define ND_par(n) (n)->u.par wolffd@0: #define ND_pinned(n) (n)->u.pinned wolffd@0: #define ND_pos(n) (n)->u.pos wolffd@0: #define ND_prev(n) (n)->u.prev wolffd@0: #define ND_priority(n) (n)->u.priority wolffd@0: #define ND_rank(n) (n)->u.rank wolffd@0: #define ND_ranktype(n) (n)->u.ranktype wolffd@0: #define ND_rw(n) (n)->u.rw wolffd@0: #define ND_save_in(n) (n)->u.save_in wolffd@0: #define ND_save_out(n) (n)->u.save_out wolffd@0: #define ND_shape(n) (n)->u.shape wolffd@0: #define ND_shape_info(n) (n)->u.shape_info wolffd@0: #define ND_showboxes(n) (n)->u.showboxes wolffd@0: #define ND_state(n) (n)->u.state wolffd@0: #define ND_clustnode(n) (n)->u.clustnode wolffd@0: #define ND_tree_in(n) (n)->u.tree_in wolffd@0: #define ND_tree_out(n) (n)->u.tree_out wolffd@0: #define ND_weight_class(n) (n)->u.weight_class wolffd@0: #define ND_width(n) (n)->u.width wolffd@0: #define ND_xsize(n) (n)->u.xsize wolffd@0: #define ND_ysize(n) (n)->u.ysize wolffd@0: #endif wolffd@0: wolffd@0: typedef struct Agedgeinfo_t { wolffd@0: #ifdef WITH_CGRAPH wolffd@0: Agrec_t hdr; wolffd@0: #endif wolffd@0: splines *spl; wolffd@0: port tail_port, head_port; wolffd@0: textlabel_t *label, *head_label, *tail_label, *xlabel; wolffd@0: char edge_type; wolffd@0: char adjacent; /* true for flat edge with adjacent nodes */ wolffd@0: char label_ontop; wolffd@0: unsigned char gui_state; /* Edge state for GUI ops */ wolffd@0: edge_t *to_orig; /* for dot's shapes.c */ wolffd@0: void *alg; wolffd@0: wolffd@0: #ifndef DOT_ONLY wolffd@0: double factor; wolffd@0: double dist; wolffd@0: Ppolyline_t path; wolffd@0: #endif wolffd@0: #ifndef NEATO_ONLY wolffd@0: unsigned char showboxes; wolffd@0: boolean conc_opp_flag; wolffd@0: short xpenalty; wolffd@0: int weight; wolffd@0: int cutvalue, tree_index; wolffd@0: short count; wolffd@0: unsigned short minlen; wolffd@0: edge_t *to_virt; wolffd@0: #endif wolffd@0: } Agedgeinfo_t; wolffd@0: wolffd@0: #ifdef WITH_CGRAPH wolffd@0: #define ED_alg(e) (((Agedgeinfo_t*)AGDATA(e))->alg) wolffd@0: #define ED_conc_opp_flag(e) (((Agedgeinfo_t*)AGDATA(e))->conc_opp_flag) wolffd@0: #define ED_count(e) (((Agedgeinfo_t*)AGDATA(e))->count) wolffd@0: #define ED_cutvalue(e) (((Agedgeinfo_t*)AGDATA(e))->cutvalue) wolffd@0: #define ED_edge_type(e) (((Agedgeinfo_t*)AGDATA(e))->edge_type) wolffd@0: #define ED_adjacent(e) (((Agedgeinfo_t*)AGDATA(e))->adjacent) wolffd@0: #define ED_factor(e) (((Agedgeinfo_t*)AGDATA(e))->factor) wolffd@0: #define ED_gui_state(e) (((Agedgeinfo_t*)AGDATA(e))->gui_state) wolffd@0: #define ED_head_label(e) (((Agedgeinfo_t*)AGDATA(e))->head_label) wolffd@0: #define ED_head_port(e) (((Agedgeinfo_t*)AGDATA(e))->head_port) wolffd@0: #define ED_label(e) (((Agedgeinfo_t*)AGDATA(e))->label) wolffd@0: #define ED_xlabel(e) (((Agedgeinfo_t*)AGDATA(e))->xlabel) wolffd@0: #define ED_label_ontop(e) (((Agedgeinfo_t*)AGDATA(e))->label_ontop) wolffd@0: #define ED_minlen(e) (((Agedgeinfo_t*)AGDATA(e))->minlen) wolffd@0: #define ED_path(e) (((Agedgeinfo_t*)AGDATA(e))->path) wolffd@0: #define ED_showboxes(e) (((Agedgeinfo_t*)AGDATA(e))->showboxes) wolffd@0: #define ED_spl(e) (((Agedgeinfo_t*)AGDATA(e))->spl) wolffd@0: #define ED_tail_label(e) (((Agedgeinfo_t*)AGDATA(e))->tail_label) wolffd@0: #define ED_tail_port(e) (((Agedgeinfo_t*)AGDATA(e))->tail_port) wolffd@0: #define ED_to_orig(e) (((Agedgeinfo_t*)AGDATA(e))->to_orig) wolffd@0: #define ED_to_virt(e) (((Agedgeinfo_t*)AGDATA(e))->to_virt) wolffd@0: #define ED_tree_index(e) (((Agedgeinfo_t*)AGDATA(e))->tree_index) wolffd@0: #define ED_xpenalty(e) (((Agedgeinfo_t*)AGDATA(e))->xpenalty) wolffd@0: #define ED_dist(e) (((Agedgeinfo_t*)AGDATA(e))->dist) wolffd@0: #define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight) wolffd@0: wolffd@0: #else wolffd@0: wolffd@0: #define ED_alg(e) (e)->u.alg wolffd@0: #define ED_conc_opp_flag(e) (e)->u.conc_opp_flag wolffd@0: #define ED_count(e) (e)->u.count wolffd@0: #define ED_cutvalue(e) (e)->u.cutvalue wolffd@0: #define ED_dist(e) (e)->u.dist wolffd@0: #define ED_edge_type(e) (e)->u.edge_type wolffd@0: #define ED_adjacent(e) (e)->u.adjacent wolffd@0: #define ED_factor(e) (e)->u.factor wolffd@0: #define ED_gui_state(e) (e)->u.gui_state wolffd@0: #define ED_head_label(e) (e)->u.head_label wolffd@0: #define ED_head_port(e) (e)->u.head_port wolffd@0: #define ED_label(e) (e)->u.label wolffd@0: #define ED_xlabel(e) (e)->u.xlabel wolffd@0: #define ED_label_ontop(e) (e)->u.label_ontop wolffd@0: #define ED_minlen(e) (e)->u.minlen wolffd@0: #define ED_path(e) (e)->u.path wolffd@0: #define ED_showboxes(e) (e)->u.showboxes wolffd@0: #define ED_spl(e) (e)->u.spl wolffd@0: #define ED_tail_label(e) (e)->u.tail_label wolffd@0: #define ED_tail_port(e) (e)->u.tail_port wolffd@0: #define ED_to_orig(e) (e)->u.to_orig wolffd@0: #define ED_to_virt(e) (e)->u.to_virt wolffd@0: #define ED_tree_index(e) (e)->u.tree_index wolffd@0: #define ED_weight(e) (e)->u.weight wolffd@0: #define ED_xpenalty(e) (e)->u.xpenalty wolffd@0: #endif wolffd@0: wolffd@0: #ifdef WITH_CGRAPH wolffd@0: #include "cgraph.h" wolffd@0: #define SET_RANKDIR(g,rd) (GD_rankdir2(g) = rd) wolffd@0: #define agfindedge(g,t,h) (agedge(g,t,h,NULL,0)) wolffd@0: #define agfindnode(g,n) (agnode(g,n,0)) wolffd@0: #define agfindgraphattr(g,a) (agattr(g,AGRAPH,a,NULL)) wolffd@0: #define agfindnodeattr(g,a) (agattr(g,AGNODE,a,NULL)) wolffd@0: #define agfindedgeattr(g,a) (agattr(g,AGEDGE,a,NULL)) wolffd@0: #else wolffd@0: #include "graph.h" wolffd@0: #define SET_RANKDIR(g,rd) ((g)->u.rankdir = (rd)) wolffd@0: #define agnameof(x) ((x)->name) wolffd@0: /* warning, agraphof doesn't work for edges */ wolffd@0: #define agraphof(n) ((n)->graph) wolffd@0: #define agroot(g) ((g)->root) wolffd@0: #define aghead(e) ((e)->head) wolffd@0: #define agtail(e) ((e)->tail) wolffd@0: #define agisdirected(g) ((g)->kind & AGFLAG_DIRECTED) wolffd@0: #define AGID(x) ((x)->id) wolffd@0: #define agfindgraphattr(g,a) agfindattr((g)->root,a) wolffd@0: #define agfindnodeattr(g,a) agfindattr((g)->proto->n,a) wolffd@0: #define agfindedgeattr(g,a) agfindattr((g)->proto->e,a) wolffd@0: #define agcanonStr(s) agcanonical(s) wolffd@0: #endif wolffd@0: wolffd@0: wolffd@0: typedef struct { wolffd@0: int useGrid; /* use grid for speed up */ wolffd@0: int useNew; /* encode x-K into attractive force */ wolffd@0: int numIters; /* actual iterations in layout */ wolffd@0: int unscaled; /* % of iterations used in pass 1 */ wolffd@0: double C; /* Repulsion factor in xLayout */ wolffd@0: double Tfact; /* scale temp from default expression */ wolffd@0: double K; /* spring constant; ideal distance */ wolffd@0: double T0; /* initial temperature */ wolffd@0: } fdpParms_t; wolffd@0: wolffd@0: typedef struct { wolffd@0: int flags; wolffd@0: } gvlayout_features_t; wolffd@0: wolffd@0: #ifdef __cplusplus wolffd@0: } wolffd@0: #endif wolffd@0: #endif