Browse code

Second version bump after creating 2.14 release branch.

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Rgraphviz@88840 bc3139a8-67e5-0310-9ffc-ced21a209358

d.tenenbaum authored on 11/04/2014 21:21:21
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,770 @@
1
+/* $Id: types.h,v 1.106 2011/02/15 16:27:53 erg Exp $ $Revision: 1.106 $ */
2
+/* vim:set shiftwidth=4 ts=8: */
3
+
4
+/*************************************************************************
5
+ * Copyright (c) 2011 AT&T Intellectual Property 
6
+ * All rights reserved. This program and the accompanying materials
7
+ * are made available under the terms of the Eclipse Public License v1.0
8
+ * which accompanies this distribution, and is available at
9
+ * http://www.eclipse.org/legal/epl-v10.html
10
+ *
11
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
12
+ *************************************************************************/
13
+
14
+#ifndef GV_TYPES_H
15
+#define GV_TYPES_H
16
+
17
+#include <stdio.h>
18
+#include <assert.h>
19
+#include <signal.h>
20
+
21
+typedef unsigned char boolean;
22
+#ifndef NOT
23
+#define NOT(v) (!(v))
24
+#endif
25
+#ifndef FALSE
26
+#define FALSE 0
27
+#endif
28
+#ifndef TRUE
29
+#define TRUE NOT(FALSE)
30
+#endif
31
+
32
+#include "geom.h"
33
+#include "gvcext.h"
34
+#include "pathgeom.h"
35
+#include "textpara.h"
36
+
37
+#ifdef __cplusplus
38
+extern "C" {
39
+#endif
40
+
41
+    typedef int (*qsort_cmpf) (const void *, const void *);
42
+    typedef int (*bsearch_cmpf) (const void *, const void *);
43
+
44
+#ifdef WITH_CGRAPH
45
+#include <cgraph.h>
46
+    typedef struct Agraph_s graph_t;
47
+    typedef struct Agnode_s node_t;
48
+    typedef struct Agedge_s edge_t;
49
+    typedef struct Agsym_s attrsym_t;
50
+#define TAIL_ID "tailport"
51
+#define HEAD_ID "headport"
52
+#else
53
+    typedef struct Agraph_t graph_t;
54
+    typedef struct Agnode_t node_t;
55
+    typedef struct Agedge_t edge_t;
56
+    typedef struct Agsym_t attrsym_t;
57
+#endif
58
+
59
+    typedef struct htmllabel_t htmllabel_t;
60
+
61
+    typedef union inside_t {
62
+	struct {
63
+	    pointf* p;
64
+	    double* r;
65
+	} a;
66
+	struct {
67
+	    node_t* n;
68
+	    boxf*    bp;
69
+	} s;
70
+    } inside_t;
71
+
72
+    typedef struct port {	/* internal edge endpoint specification */
73
+	pointf p;		/* aiming point relative to node center */
74
+	double theta;		/* slope in radians */
75
+	boxf *bp;		/* if not null, points to bbox of 
76
+				 * rectangular area that is port target
77
+				 */
78
+	boolean	defined;        /* if true, edge has port info at this end */
79
+	boolean	constrained;    /* if true, constraints such as theta are set */
80
+	boolean clip;           /* if true, clip end to node/port shape */
81
+	boolean dyna;           /* if true, assign compass point dynamically */
82
+	unsigned char order;	/* for mincross */
83
+	unsigned char side;	/* if port is on perimeter of node, this
84
+                                 * contains the bitwise OR of the sides (TOP,
85
+                                 * BOTTOM, etc.) it is on. 
86
+                                 */
87
+	char *name;		/* port name, if it was explicitly given, otherwise NULL */
88
+    } port;
89
+
90
+    typedef struct {
91
+	boolean(*swapEnds) (edge_t * e);	/* Should head and tail be swapped? */
92
+	boolean(*splineMerge) (node_t * n);	/* Is n a node in the middle of an edge? */
93
+	boolean ignoreSwap;                     /* Test for swapped edges if false */
94
+	boolean isOrtho;                        /* Orthogonal routing used */
95
+    } splineInfo;
96
+
97
+    typedef struct pathend_t {
98
+	boxf nb;			/* the node box */
99
+	pointf np;		/* node port */
100
+	int sidemask;
101
+	int boxn;
102
+	boxf boxes[20];
103
+    } pathend_t;
104
+
105
+    typedef struct path {	/* internal specification for an edge spline */
106
+	port start, end;
107
+	int nbox;		/* number of subdivisions */
108
+	boxf *boxes;		/* rectangular regions of subdivision */
109
+	void *data;
110
+    } path;
111
+
112
+    typedef struct bezier {
113
+	pointf *list;
114
+	int size;
115
+	int sflag, eflag;
116
+	pointf sp, ep;
117
+    } bezier;
118
+
119
+    typedef struct splines {
120
+	bezier *list;
121
+	int size;
122
+	boxf bb;
123
+    } splines;
124
+
125
+    typedef struct textlabel_t {
126
+	char *text, *fontname, *fontcolor;
127
+	int charset;
128
+	double fontsize;
129
+	pointf dimen; /* the diagonal size of the label (estimated by layout) */
130
+	pointf space; /* the diagonal size of the space for the label */
131
+		      /*   the rendered label is aligned in this box */
132
+		      /*   space does not include pad or margin */
133
+	pointf pos;   /* the center of the space for the label */
134
+	union {
135
+	    struct {
136
+		textpara_t *para;
137
+		short nparas;
138
+	    } txt;
139
+	    htmllabel_t *html;
140
+	} u;
141
+	char valign;  /* 't' 'c' 'b' */
142
+	boolean set;  /* true if position is set */
143
+	boolean html; /* true if html label */
144
+    } textlabel_t;
145
+
146
+    typedef struct polygon_t {	/* mutable shape information for a node */
147
+	int regular;		/* true for symmetric shapes */
148
+	int peripheries;	/* number of periphery lines */
149
+	int sides;		/* number of sides */
150
+	double orientation;	/* orientation of shape (+ve degrees) */
151
+	double distortion;	/* distortion factor - as in trapezium */
152
+	double skew;		/* skew factor - as in parallelogram */
153
+	int option;		/* ROUNDED, DIAGONAL corners, etc. */
154
+	pointf *vertices;	/* array of vertex points */
155
+    } polygon_t;
156
+
157
+    typedef struct stroke_t {	/* information about a single stroke */
158
+	/* we would have called it a path if that term wasn't already used */
159
+	int nvertices;		/* number of points in the stroke */
160
+	int flags;		/* stroke style flags */
161
+	pointf *vertices;	/* array of vertex points */
162
+    } stroke_t;
163
+
164
+/* flag definitions for stroke_t */
165
+#define STROKE_CLOSED (1 << 0)
166
+#define STROKE_FILLED (1 << 1)
167
+#define STROKE_PENDOWN (1 << 2)
168
+#define STROKE_VERTICES_ALLOCATED (1 << 3)
169
+
170
+    typedef struct shape_t {	/* mutable shape information for a node */
171
+	int nstrokes;		/* number of strokes in array */
172
+	stroke_t *strokes;	/* array of strokes */
173
+	/* The last stroke must always be closed, but can be pen_up.
174
+	 * It is used as the clipping path */
175
+    } shape_t;
176
+
177
+    typedef struct shape_functions {	/* read-only shape functions */
178
+	void (*initfn) (node_t *);	/* initializes shape from node u.shape_info structure */
179
+	void (*freefn) (node_t *);	/* frees  shape from node u.shape_info structure */
180
+	 port(*portfn) (node_t *, char *, char *);	/* finds aiming point and slope of port */
181
+	 boolean(*insidefn) (inside_t * inside_context, pointf);	/* clips incident gvc->e spline on shape of gvc->n */
182
+	int (*pboxfn)(node_t* n, port* p, int side, boxf rv[], int *kptr); /* finds box path to reach port */
183
+	void (*codefn) (GVJ_t * job, node_t * n);	/* emits graphics code for node */
184
+    } shape_functions;
185
+
186
+    typedef enum { SH_UNSET, SH_POLY, SH_RECORD, SH_POINT, SH_EPSF} shape_kind;
187
+
188
+    typedef struct shape_desc {	/* read-only shape descriptor */
189
+	char *name;		/* as read from graph file */
190
+	shape_functions *fns;
191
+	polygon_t *polygon;	/* base polygon info */
192
+	boolean usershape;
193
+    } shape_desc;
194
+
195
+#include "usershape.h"		/* usershapes needed by gvc */
196
+
197
+    typedef struct nodequeue {
198
+	node_t **store, **limit, **head, **tail;
199
+    } nodequeue;
200
+
201
+    typedef struct adjmatrix_t {
202
+	int nrows, ncols;
203
+	char *data;
204
+    } adjmatrix_t;
205
+
206
+    typedef struct rank_t {
207
+	int n;			/* number of nodes in this rank  */
208
+	node_t **v;		/* ordered list of nodes in rank    */
209
+	int an;			/* globally allocated number of nodes   */
210
+	node_t **av;		/* allocated list of nodes in rank  */
211
+	int ht1, ht2;		/* height below/above centerline    */
212
+	int pht1, pht2;		/* as above, but only primitive nodes   */
213
+	boolean candidate;	/* for transpose () */
214
+	boolean valid;
215
+	int cache_nc;		/* caches number of crossings */
216
+	adjmatrix_t *flat;
217
+    } rank_t;
218
+
219
+    typedef enum { R_NONE =
220
+	    0, R_VALUE, R_FILL, R_COMPRESS, R_AUTO, R_EXPAND } ratio_t;
221
+
222
+    typedef struct layout_t {
223
+	double quantum;
224
+	double scale;
225
+	double ratio;		/* set only if ratio_kind == R_VALUE */
226
+	double dpi;
227
+	pointf margin;
228
+	pointf page;
229
+	pointf size;
230
+	boolean filled;
231
+	boolean landscape;
232
+	boolean centered;
233
+	ratio_t ratio_kind;
234
+	void* xdots;
235
+	char* id;
236
+    } layout_t;
237
+
238
+/* for "record" shapes */
239
+    typedef struct field_t {
240
+	pointf size;		/* its dimension */
241
+	boxf b;			/* its placement in node's coordinates */
242
+	int n_flds;
243
+	textlabel_t *lp;	/* n_flds == 0 */
244
+	struct field_t **fld;	/* n_flds > 0 */
245
+	char *id;		/* user's identifier */
246
+	unsigned char LR;	/* if box list is horizontal (left to right) */
247
+	unsigned char sides;    /* sides of node exposed to field */
248
+    } field_t;
249
+
250
+    typedef struct nlist_t {
251
+	node_t **list;
252
+	int size;
253
+    } nlist_t;
254
+
255
+    typedef struct elist {
256
+	edge_t **list;
257
+	int size;
258
+    } elist;
259
+
260
+#define GUI_STATE_ACTIVE    (1<<0)
261
+#define GUI_STATE_SELECTED  (1<<1)
262
+#define GUI_STATE_VISITED   (1<<2)
263
+#define GUI_STATE_DELETED   (1<<3)
264
+
265
+#define elist_fastapp(item,L) do {L.list[L.size++] = item; L.list[L.size] = NULL;} while(0)
266
+#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)
267
+#define alloc_elist(n,L)      do {L.size = 0; L.list = N_NEW(n + 1,edge_t*); } while (0)
268
+#define free_list(L)          do {if (L.list) free(L.list);} while (0)
269
+
270
+typedef enum {NATIVEFONTS,PSFONTS,SVGFONTS} fontname_kind;
271
+
272
+    typedef struct Agraphinfo_t {
273
+#ifdef WITH_CGRAPH
274
+	Agrec_t hdr;
275
+#endif
276
+	/* to generate code */
277
+	layout_t *drawing;
278
+	textlabel_t *label;	/* if the cluster has a title */
279
+	boxf bb;			/* bounding box */
280
+	pointf border[4];	/* sizes of margins for graph labels */
281
+	unsigned char gui_state; /* Graph state for GUI ops */
282
+	unsigned char has_labels;
283
+	boolean has_images;
284
+	unsigned char charset; /* input character set */
285
+	int rankdir;
286
+	int ht1, ht2;	/* below and above extremal ranks */
287
+	unsigned short flags;
288
+	void *alg;
289
+	GVC_t *gvc;	/* context for "globals" over multiple graphs */
290
+	void (*cleanup) (graph_t * g);   /* function to deallocate layout-specific data */
291
+
292
+#ifndef DOT_ONLY
293
+	/* to place nodes */
294
+	node_t **neato_nlist;
295
+	int move;
296
+	double **dist, **spring, **sum_t, ***t;
297
+	unsigned short ndim;
298
+	unsigned short odim;
299
+#endif
300
+#ifndef NEATO_ONLY
301
+	/* to have subgraphs */
302
+	int n_cluster;
303
+	graph_t **clust;	/* clusters are in clust[1..n_cluster] !!! */
304
+	node_t *nlist;
305
+	rank_t *rank;
306
+#ifdef WITH_CGRAPH
307
+	graph_t *parent;        /* containing cluster (not parent subgraph) */
308
+	int level;		/* cluster nesting level (not node level!) */
309
+	node_t	*minrep, *maxrep;	/* set leaders for min and max rank */
310
+#endif
311
+
312
+	/* fast graph node list */
313
+	nlist_t comp;
314
+	/* connected components */
315
+	node_t *minset, *maxset;	/* set leaders */
316
+	long n_nodes;
317
+	/* includes virtual */
318
+	short minrank, maxrank;
319
+
320
+	/* various flags */
321
+	boolean has_flat_edges;
322
+#ifdef WITH_CGRAPH
323
+	boolean has_sourcerank;
324
+	boolean has_sinkrank;
325
+#endif
326
+	unsigned char	showboxes;
327
+	boolean cluster_was_collapsed;
328
+	fontname_kind fontnames;		/* to override mangling in SVG */
329
+
330
+	int nodesep, ranksep;
331
+	node_t *ln, *rn;	/* left, right nodes of bounding box */
332
+
333
+	/* for clusters */
334
+	node_t *leader, **rankleader;
335
+	boolean expanded;
336
+	char installed;
337
+	char set_type;
338
+	char label_pos;
339
+	boolean exact_ranksep;
340
+#endif
341
+
342
+    } Agraphinfo_t;
343
+
344
+#ifdef WITH_CGRAPH
345
+#define GD_parent(g) (((Agraphinfo_t*)AGDATA(g))->parent)
346
+#define GD_level(g) (((Agraphinfo_t*)AGDATA(g))->level)
347
+#define GD_drawing(g) (((Agraphinfo_t*)AGDATA(g))->drawing)
348
+#define GD_bb(g) (((Agraphinfo_t*)AGDATA(g))->bb)
349
+#define GD_gvc(g) (((Agraphinfo_t*)AGDATA(g))->gvc)
350
+#define GD_cleanup(g) (((Agraphinfo_t*)AGDATA(g))->cleanup)
351
+#define GD_dist(g) (((Agraphinfo_t*)AGDATA(g))->dist)
352
+#define GD_alg(g) (((Agraphinfo_t*)AGDATA(g))->alg)
353
+#define GD_border(g) (((Agraphinfo_t*)AGDATA(g))->border)
354
+#define GD_cl_cnt(g) (((Agraphinfo_t*)AGDATA(g))->cl_nt)
355
+#define GD_clust(g) (((Agraphinfo_t*)AGDATA(g))->clust)
356
+#define GD_cluster_was_collapsed(g) (((Agraphinfo_t*)AGDATA(g))->cluster_was_collapsed)
357
+#define GD_comp(g) (((Agraphinfo_t*)AGDATA(g))->comp)
358
+#define GD_exact_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->exact_ranksep)
359
+#define GD_expanded(g) (((Agraphinfo_t*)AGDATA(g))->expanded)
360
+#define GD_flags(g) (((Agraphinfo_t*)AGDATA(g))->flags)
361
+#define GD_gui_state(g) (((Agraphinfo_t*)AGDATA(g))->gui_state)
362
+#define GD_charset(g) (((Agraphinfo_t*)AGDATA(g))->charset)
363
+#define GD_has_labels(g) (((Agraphinfo_t*)AGDATA(g))->has_labels)
364
+#define GD_has_images(g) (((Agraphinfo_t*)AGDATA(g))->has_images)
365
+#define GD_has_flat_edges(g) (((Agraphinfo_t*)AGDATA(g))->has_flat_edges)
366
+#define GD_has_sourcerank(g)	(((Agraphinfo_t*)AGDATA(g))->has_sourcerank)
367
+#define GD_has_sinkrank(g)	(((Agraphinfo_t*)AGDATA(g))->has_sinkrank)
368
+#define GD_ht1(g) (((Agraphinfo_t*)AGDATA(g))->ht1)
369
+#define GD_ht2(g) (((Agraphinfo_t*)AGDATA(g))->ht2)
370
+#define GD_inleaf(g) (((Agraphinfo_t*)AGDATA(g))->inleaf)
371
+#define GD_installed(g) (((Agraphinfo_t*)AGDATA(g))->installed)
372
+#define GD_label(g) (((Agraphinfo_t*)AGDATA(g))->label)
373
+#define GD_leader(g) (((Agraphinfo_t*)AGDATA(g))->leader)
374
+#define GD_rankdir2(g) (((Agraphinfo_t*)AGDATA(g))->rankdir)
375
+#define GD_rankdir(g) (((Agraphinfo_t*)AGDATA(g))->rankdir & 0x3)
376
+#define GD_flip(g) (GD_rankdir(g) & 1)
377
+#define GD_realrankdir(g) ((((Agraphinfo_t*)AGDATA(g))->rankdir) >> 2)
378
+#define GD_realflip(g) (GD_realrankdir(g) & 1)
379
+#define GD_ln(g) (((Agraphinfo_t*)AGDATA(g))->ln)
380
+#define GD_maxrank(g) (((Agraphinfo_t*)AGDATA(g))->maxrank)
381
+#define GD_maxset(g) (((Agraphinfo_t*)AGDATA(g))->maxset)
382
+#define GD_minrank(g) (((Agraphinfo_t*)AGDATA(g))->minrank)
383
+#define GD_minset(g) (((Agraphinfo_t*)AGDATA(g))->minset)
384
+#define GD_minrep(g) (((Agraphinfo_t*)AGDATA(g))->minrep)
385
+#define GD_maxrep(g) (((Agraphinfo_t*)AGDATA(g))->maxrep)
386
+#define GD_move(g) (((Agraphinfo_t*)AGDATA(g))->move)
387
+#define GD_n_cluster(g) (((Agraphinfo_t*)AGDATA(g))->n_cluster)
388
+#define GD_n_nodes(g) (((Agraphinfo_t*)AGDATA(g))->n_nodes)
389
+#define GD_ndim(g) (((Agraphinfo_t*)AGDATA(g))->ndim)
390
+#define GD_odim(g) (((Agraphinfo_t*)AGDATA(g))->odim)
391
+#define GD_neato_nlist(g) (((Agraphinfo_t*)AGDATA(g))->neato_nlist)
392
+#define GD_nlist(g) (((Agraphinfo_t*)AGDATA(g))->nlist)
393
+#define GD_nodesep(g) (((Agraphinfo_t*)AGDATA(g))->nodesep)
394
+#define GD_outleaf(g) (((Agraphinfo_t*)AGDATA(g))->outleaf)
395
+#define GD_rank(g) (((Agraphinfo_t*)AGDATA(g))->rank)
396
+#define GD_rankleader(g) (((Agraphinfo_t*)AGDATA(g))->rankleader)
397
+#define GD_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->ranksep)
398
+#define GD_rn(g) (((Agraphinfo_t*)AGDATA(g))->rn)
399
+#define GD_set_type(g) (((Agraphinfo_t*)AGDATA(g))->set_type)
400
+#define GD_label_pos(g) (((Agraphinfo_t*)AGDATA(g))->label_pos)
401
+#define GD_showboxes(g) (((Agraphinfo_t*)AGDATA(g))->showboxes)
402
+#define GD_fontnames(g) (((Agraphinfo_t*)AGDATA(g))->fontnames)
403
+#define GD_spring(g) (((Agraphinfo_t*)AGDATA(g))->spring)
404
+#define GD_sum_t(g) (((Agraphinfo_t*)AGDATA(g))->sum_t)
405
+#define GD_t(g) (((Agraphinfo_t*)AGDATA(g))->t)
406
+
407
+#else
408
+
409
+#define GD_alg(g) (g)->u.alg
410
+#define GD_bb(g) (g)->u.bb
411
+#define GD_border(g) (g)->u.border
412
+#define GD_cl_cnt(g) (g)->u.cl_cnt
413
+#define GD_cleanup(g) (g)->u.cleanup
414
+#define GD_clust(g) (g)->u.clust
415
+#define GD_cluster_was_collapsed(g) (g)->u.cluster_was_collapsed
416
+#define GD_comp(g) (g)->u.comp
417
+#define GD_dist(g) (g)->u.dist
418
+#define GD_drawing(g) (g)->u.drawing
419
+#define GD_exact_ranksep(g) (g)->u.exact_ranksep
420
+#define GD_expanded(g) (g)->u.expanded
421
+#define GD_flags(g) (g)->u.flags
422
+#define GD_gui_state(g) (g)->u.gui_state
423
+#define GD_gvc(g) (g)->u.gvc
424
+#define GD_charset(g) (g)->u.charset
425
+#define GD_has_labels(g) (g)->u.has_labels
426
+#define GD_has_images(g) (g)->u.has_images
427
+#define GD_has_flat_edges(g) (g)->u.has_flat_edges
428
+#define GD_ht1(g) (g)->u.ht1
429
+#define GD_ht2(g) (g)->u.ht2
430
+#define GD_inleaf(g) (g)->u.inleaf
431
+#define GD_installed(g) (g)->u.installed
432
+#define GD_label(g) (g)->u.label
433
+#define GD_leader(g) (g)->u.leader
434
+#define GD_rankdir(g) ((g)->u.rankdir & 0x3)
435
+#define GD_flip(g) (GD_rankdir(g) & 1)
436
+#define GD_realrankdir(g) ((g)->u.rankdir >> 2)
437
+#define GD_realflip(g) (GD_realrankdir(g) & 1)
438
+#define GD_ln(g) (g)->u.ln
439
+#define GD_maxrank(g) (g)->u.maxrank
440
+#define GD_maxset(g) (g)->u.maxset
441
+#define GD_minrank(g) (g)->u.minrank
442
+#define GD_minset(g) (g)->u.minset
443
+#define GD_move(g) (g)->u.move
444
+#define GD_n_cluster(g) (g)->u.n_cluster
445
+#define GD_n_nodes(g) (g)->u.n_nodes
446
+#define GD_ndim(g) (g)->u.ndim
447
+#define GD_odim(g) (g)->u.odim
448
+#define GD_neato_nlist(g) (g)->u.neato_nlist
449
+#define GD_nlist(g) (g)->u.nlist
450
+#define GD_nodesep(g) (g)->u.nodesep
451
+#define GD_outleaf(g) (g)->u.outleaf
452
+#define GD_rank(g) (g)->u.rank
453
+#define GD_rankleader(g) (g)->u.rankleader
454
+#define GD_ranksep(g) (g)->u.ranksep
455
+#define GD_rn(g) (g)->u.rn
456
+#define GD_set_type(g) (g)->u.set_type
457
+#define GD_label_pos(g) (g)->u.label_pos
458
+#define GD_showboxes(g) (g)->u.showboxes
459
+#define GD_fontnames(g) (g)->u.fontnames
460
+#define GD_spring(g) (g)->u.spring
461
+#define GD_sum_t(g) (g)->u.sum_t
462
+#define GD_t(g) (g)->u.t
463
+#endif
464
+
465
+    typedef struct Agnodeinfo_t {
466
+#ifdef WITH_CGRAPH
467
+	Agrec_t hdr;
468
+#endif
469
+	shape_desc *shape;
470
+	void *shape_info;
471
+	pointf coord;
472
+	double width, height;  /* inches */
473
+	boxf bb;
474
+	double ht, lw, rw;
475
+	textlabel_t *label;
476
+	textlabel_t *xlabel;
477
+	void *alg;
478
+	char state;
479
+	unsigned char gui_state; /* Node state for GUI ops */
480
+	boolean clustnode;
481
+
482
+#ifndef DOT_ONLY
483
+	unsigned char pinned;
484
+	int id, heapindex, hops;
485
+	double *pos, dist;
486
+#endif
487
+#ifndef NEATO_ONLY
488
+	unsigned char showboxes;
489
+	boolean  has_port;
490
+#ifdef WITH_CGRAPH
491
+	node_t* rep;
492
+	node_t *set;
493
+#endif
494
+
495
+	/* fast graph */
496
+	char node_type, mark, onstack;
497
+	char ranktype, weight_class;
498
+	node_t *next, *prev;
499
+	elist in, out, flat_out, flat_in, other;
500
+	graph_t *clust;
501
+
502
+	/* for union-find and collapsing nodes */
503
+	int UF_size;
504
+	node_t *UF_parent;
505
+	node_t *inleaf, *outleaf;
506
+
507
+	/* for placing nodes */
508
+	int rank, order;	/* initially, order = 1 for ordered edges */
509
+	int mval;
510
+	elist save_in, save_out;
511
+
512
+	/* for network-simplex */
513
+	elist tree_in, tree_out;
514
+	edge_t *par;
515
+	int low, lim;
516
+	int priority;
517
+
518
+	double pad[1];
519
+#endif
520
+
521
+    } Agnodeinfo_t;
522
+
523
+#ifdef WITH_CGRAPH
524
+#define ND_id(n) (((Agnodeinfo_t*)AGDATA(n))->id)
525
+#define ND_alg(n) (((Agnodeinfo_t*)AGDATA(n))->alg)
526
+#define ND_UF_parent(n) (((Agnodeinfo_t*)AGDATA(n))->UF_parent)
527
+#define ND_set(n) (((Agnodeinfo_t*)AGDATA(n))->set)
528
+#define ND_UF_size(n) (((Agnodeinfo_t*)AGDATA(n))->UF_size)
529
+#define ND_bb(n) (((Agnodeinfo_t*)AGDATA(n))->bb)
530
+#define ND_clust(n) (((Agnodeinfo_t*)AGDATA(n))->clust)
531
+#define ND_coord(n) (((Agnodeinfo_t*)AGDATA(n))->coord)
532
+#define ND_dist(n) (((Agnodeinfo_t*)AGDATA(n))->dist)
533
+#define ND_flat_in(n) (((Agnodeinfo_t*)AGDATA(n))->flat_in)
534
+#define ND_flat_out(n) (((Agnodeinfo_t*)AGDATA(n))->flat_out)
535
+#define ND_gui_state(n) (((Agnodeinfo_t*)AGDATA(n))->gui_state)
536
+#define ND_has_port(n) (((Agnodeinfo_t*)AGDATA(n))->has_port)
537
+#define ND_rep(n) (((Agnodeinfo_t*)AGDATA(n))->rep)
538
+#define ND_heapindex(n) (((Agnodeinfo_t*)AGDATA(n))->heapindex)
539
+#define ND_height(n) (((Agnodeinfo_t*)AGDATA(n))->height)
540
+#define ND_hops(n) (((Agnodeinfo_t*)AGDATA(n))->hops)
541
+#define ND_ht(n) (((Agnodeinfo_t*)AGDATA(n))->ht)
542
+#define ND_in(n) (((Agnodeinfo_t*)AGDATA(n))->in)
543
+#define ND_inleaf(n) (((Agnodeinfo_t*)AGDATA(n))->inleaf)
544
+#define ND_label(n) (((Agnodeinfo_t*)AGDATA(n))->label)
545
+#define ND_xlabel(n) (((Agnodeinfo_t*)AGDATA(n))->xlabel)
546
+#define ND_lim(n) (((Agnodeinfo_t*)AGDATA(n))->lim)
547
+#define ND_low(n) (((Agnodeinfo_t*)AGDATA(n))->low)
548
+#define ND_lw(n) (((Agnodeinfo_t*)AGDATA(n))->lw)
549
+#define ND_mark(n) (((Agnodeinfo_t*)AGDATA(n))->mark)
550
+#define ND_mval(n) (((Agnodeinfo_t*)AGDATA(n))->mval)
551
+#define ND_n_cluster(n) (((Agnodeinfo_t*)AGDATA(n))->n_cluster)
552
+#define ND_next(n) (((Agnodeinfo_t*)AGDATA(n))->next)
553
+#define ND_node_type(n) (((Agnodeinfo_t*)AGDATA(n))->node_type)
554
+#define ND_onstack(n) (((Agnodeinfo_t*)AGDATA(n))->onstack)
555
+#define ND_order(n) (((Agnodeinfo_t*)AGDATA(n))->order)
556
+#define ND_other(n) (((Agnodeinfo_t*)AGDATA(n))->other)
557
+#define ND_out(n) (((Agnodeinfo_t*)AGDATA(n))->out)
558
+#define ND_outleaf(n) (((Agnodeinfo_t*)AGDATA(n))->outleaf)
559
+#define ND_par(n) (((Agnodeinfo_t*)AGDATA(n))->par)
560
+#define ND_pinned(n) (((Agnodeinfo_t*)AGDATA(n))->pinned)
561
+#define ND_pos(n) (((Agnodeinfo_t*)AGDATA(n))->pos)
562
+#define ND_prev(n) (((Agnodeinfo_t*)AGDATA(n))->prev)
563
+#define ND_priority(n) (((Agnodeinfo_t*)AGDATA(n))->priority)
564
+#define ND_rank(n) (((Agnodeinfo_t*)AGDATA(n))->rank)
565
+#define ND_ranktype(n) (((Agnodeinfo_t*)AGDATA(n))->ranktype)
566
+#define ND_rw(n) (((Agnodeinfo_t*)AGDATA(n))->rw)
567
+#define ND_save_in(n) (((Agnodeinfo_t*)AGDATA(n))->save_in)
568
+#define ND_save_out(n) (((Agnodeinfo_t*)AGDATA(n))->save_out)
569
+#define ND_shape(n) (((Agnodeinfo_t*)AGDATA(n))->shape)
570
+#define ND_shape_info(n) (((Agnodeinfo_t*)AGDATA(n))->shape_info)
571
+#define ND_showboxes(n) (((Agnodeinfo_t*)AGDATA(n))->showboxes)
572
+#define ND_state(n) (((Agnodeinfo_t*)AGDATA(n))->state)
573
+#define ND_clustnode(n) (((Agnodeinfo_t*)AGDATA(n))->clustnode)
574
+#define ND_tree_in(n) (((Agnodeinfo_t*)AGDATA(n))->tree_in)
575
+#define ND_tree_out(n) (((Agnodeinfo_t*)AGDATA(n))->tree_out)
576
+#define ND_weight_class(n) (((Agnodeinfo_t*)AGDATA(n))->weight_class)
577
+#define ND_width(n) (((Agnodeinfo_t*)AGDATA(n))->width)
578
+#define ND_xsize(n) (ND_lw(n)+ND_rw(n))
579
+#define ND_ysize(n) (ND_ht(n))
580
+
581
+#else
582
+
583
+#define ND_UF_parent(n) (n)->u.UF_parent
584
+#define ND_UF_size(n) (n)->u.UF_size
585
+#define ND_alg(n) (n)->u.alg
586
+#define ND_bb(n) (n)->u.bb
587
+#define ND_clust(n) (n)->u.clust
588
+#define ND_coord(n) (n)->u.coord
589
+#define ND_dist(n) (n)->u.dist
590
+#define ND_flat_in(n) (n)->u.flat_in
591
+#define ND_flat_out(n) (n)->u.flat_out
592
+#define ND_gui_state(n) (n)->u.gui_state
593
+#define ND_has_port(n) (n)->u.has_port
594
+#define ND_heapindex(n) (n)->u.heapindex
595
+#define ND_height(n) (n)->u.height
596
+#define ND_hops(n) (n)->u.hops
597
+#define ND_ht(n) (n)->u.ht
598
+#define ND_id(n) (n)->u.id
599
+#define ND_in(n) (n)->u.in
600
+#define ND_inleaf(n) (n)->u.inleaf
601
+#define ND_label(n) (n)->u.label
602
+#define ND_xlabel(n) (n)->u.xlabel
603
+#define ND_lim(n) (n)->u.lim
604
+#define ND_low(n) (n)->u.low
605
+#define ND_lw(n) (n)->u.lw
606
+#define ND_mark(n) (n)->u.mark
607
+#define ND_mval(n) (n)->u.mval
608
+#define ND_n_cluster(n) (n)->u.n_cluster
609
+#define ND_next(n) (n)->u.next
610
+#define ND_node_type(n) (n)->u.node_type
611
+#define ND_onstack(n) (n)->u.onstack
612
+#define ND_order(n) (n)->u.order
613
+#define ND_other(n) (n)->u.other
614
+#define ND_out(n) (n)->u.out
615
+#define ND_outleaf(n) (n)->u.outleaf
616
+#define ND_par(n) (n)->u.par
617
+#define ND_pinned(n) (n)->u.pinned
618
+#define ND_pos(n) (n)->u.pos
619
+#define ND_prev(n) (n)->u.prev
620
+#define ND_priority(n) (n)->u.priority
621
+#define ND_rank(n) (n)->u.rank
622
+#define ND_ranktype(n) (n)->u.ranktype
623
+#define ND_rw(n) (n)->u.rw
624
+#define ND_save_in(n) (n)->u.save_in
625
+#define ND_save_out(n) (n)->u.save_out
626
+#define ND_shape(n) (n)->u.shape
627
+#define ND_shape_info(n) (n)->u.shape_info
628
+#define ND_showboxes(n) (n)->u.showboxes
629
+#define ND_state(n) (n)->u.state
630
+#define ND_clustnode(n) (n)->u.clustnode
631
+#define ND_tree_in(n) (n)->u.tree_in
632
+#define ND_tree_out(n) (n)->u.tree_out
633
+#define ND_weight_class(n) (n)->u.weight_class
634
+#define ND_width(n) (n)->u.width
635
+#define ND_xsize(n) (ND_lw(n)+ND_rw(n))
636
+#define ND_ysize(n) (ND_ht(n))
637
+#endif
638
+
639
+    typedef struct Agedgeinfo_t {
640
+#ifdef WITH_CGRAPH
641
+	Agrec_t hdr;
642
+#endif
643
+	splines *spl;
644
+	port tail_port, head_port;
645
+	textlabel_t *label, *head_label, *tail_label, *xlabel;
646
+	char edge_type;
647
+	char adjacent;          /* true for flat edge with adjacent nodes */
648
+	char label_ontop;
649
+	unsigned char gui_state; /* Edge state for GUI ops */
650
+	edge_t *to_orig;	/* for dot's shapes.c    */
651
+	void *alg;
652
+
653
+#ifndef DOT_ONLY
654
+	double factor;
655
+	double dist;
656
+	Ppolyline_t path;
657
+#endif
658
+#ifndef NEATO_ONLY
659
+	unsigned char showboxes;
660
+	boolean conc_opp_flag;
661
+	short xpenalty;
662
+	float weight;
663
+	int cutvalue, tree_index;
664
+	short count;
665
+	unsigned short minlen;
666
+	edge_t *to_virt;
667
+#endif
668
+    } Agedgeinfo_t;
669
+
670
+#ifdef WITH_CGRAPH
671
+#define ED_alg(e) (((Agedgeinfo_t*)AGDATA(e))->alg)
672
+#define ED_conc_opp_flag(e) (((Agedgeinfo_t*)AGDATA(e))->conc_opp_flag)
673
+#define ED_count(e) (((Agedgeinfo_t*)AGDATA(e))->count)
674
+#define ED_cutvalue(e) (((Agedgeinfo_t*)AGDATA(e))->cutvalue)
675
+#define ED_edge_type(e) (((Agedgeinfo_t*)AGDATA(e))->edge_type)
676
+#define ED_adjacent(e) (((Agedgeinfo_t*)AGDATA(e))->adjacent)
677
+#define ED_factor(e) (((Agedgeinfo_t*)AGDATA(e))->factor)
678
+#define ED_gui_state(e) (((Agedgeinfo_t*)AGDATA(e))->gui_state)
679
+#define ED_head_label(e) (((Agedgeinfo_t*)AGDATA(e))->head_label)
680
+#define ED_head_port(e) (((Agedgeinfo_t*)AGDATA(e))->head_port)
681
+#define ED_label(e) (((Agedgeinfo_t*)AGDATA(e))->label)
682
+#define ED_xlabel(e) (((Agedgeinfo_t*)AGDATA(e))->xlabel)
683
+#define ED_label_ontop(e) (((Agedgeinfo_t*)AGDATA(e))->label_ontop)
684
+#define ED_minlen(e) (((Agedgeinfo_t*)AGDATA(e))->minlen)
685
+#define ED_path(e) (((Agedgeinfo_t*)AGDATA(e))->path)
686
+#define ED_showboxes(e) (((Agedgeinfo_t*)AGDATA(e))->showboxes)
687
+#define ED_spl(e) (((Agedgeinfo_t*)AGDATA(e))->spl)
688
+#define ED_tail_label(e) (((Agedgeinfo_t*)AGDATA(e))->tail_label)
689
+#define ED_tail_port(e) (((Agedgeinfo_t*)AGDATA(e))->tail_port)
690
+#define ED_to_orig(e) (((Agedgeinfo_t*)AGDATA(e))->to_orig)
691
+#define ED_to_virt(e) (((Agedgeinfo_t*)AGDATA(e))->to_virt)
692
+#define ED_tree_index(e) (((Agedgeinfo_t*)AGDATA(e))->tree_index)
693
+#define ED_xpenalty(e) (((Agedgeinfo_t*)AGDATA(e))->xpenalty)
694
+#define ED_dist(e) (((Agedgeinfo_t*)AGDATA(e))->dist)
695
+#define ED_weight(e) (((Agedgeinfo_t*)AGDATA(e))->weight)
696
+
697
+#else
698
+
699
+#define ED_alg(e) (e)->u.alg
700
+#define ED_conc_opp_flag(e) (e)->u.conc_opp_flag
701
+#define ED_count(e) (e)->u.count
702
+#define ED_cutvalue(e) (e)->u.cutvalue
703
+#define ED_dist(e) (e)->u.dist
704
+#define ED_edge_type(e) (e)->u.edge_type
705
+#define ED_adjacent(e) (e)->u.adjacent
706
+#define ED_factor(e) (e)->u.factor
707
+#define ED_gui_state(e) (e)->u.gui_state
708
+#define ED_head_label(e) (e)->u.head_label
709
+#define ED_head_port(e) (e)->u.head_port
710
+#define ED_label(e) (e)->u.label
711
+#define ED_xlabel(e) (e)->u.xlabel
712
+#define ED_label_ontop(e) (e)->u.label_ontop
713
+#define ED_minlen(e) (e)->u.minlen
714
+#define ED_path(e) (e)->u.path
715
+#define ED_showboxes(e) (e)->u.showboxes
716
+#define ED_spl(e) (e)->u.spl
717
+#define ED_tail_label(e) (e)->u.tail_label
718
+#define ED_tail_port(e) (e)->u.tail_port
719
+#define ED_to_orig(e) (e)->u.to_orig
720
+#define ED_to_virt(e) (e)->u.to_virt
721
+#define ED_tree_index(e) (e)->u.tree_index
722
+#define ED_weight(e) (e)->u.weight
723
+#define ED_xpenalty(e) (e)->u.xpenalty
724
+#endif
725
+
726
+#ifdef WITH_CGRAPH
727
+#include "cgraph.h"
728
+#define SET_RANKDIR(g,rd) (GD_rankdir2(g) = rd)
729
+#define agfindedge(g,t,h) (agedge(g,t,h,NULL,0))
730
+#define agfindnode(g,n) (agnode(g,n,0))
731
+#define agfindgraphattr(g,a) (agattr(g,AGRAPH,a,NULL))
732
+#define agfindnodeattr(g,a) (agattr(g,AGNODE,a,NULL))
733
+#define agfindedgeattr(g,a) (agattr(g,AGEDGE,a,NULL))
734
+#else
735
+#include "graph.h"
736
+#define SET_RANKDIR(g,rd) ((g)->u.rankdir = (rd))
737
+#define agnameof(x) ((x)->name)
738
+    /* warning, agraphof doesn't work for edges */
739
+#define agraphof(n) ((n)->graph)
740
+#define agroot(g) ((g)->root)
741
+#define aghead(e) ((e)->head)
742
+#define agtail(e) ((e)->tail)
743
+#define agisdirected(g) ((g)->kind & AGFLAG_DIRECTED)
744
+#define AGID(x) ((x)->id)
745
+#define agfindgraphattr(g,a) agfindattr((g)->root,a)
746
+#define agfindnodeattr(g,a) agfindattr((g)->proto->n,a)
747
+#define agfindedgeattr(g,a) agfindattr((g)->proto->e,a)
748
+#define agcanonStr(s) agcanonical(s)
749
+#endif
750
+
751
+
752
+    typedef struct {
753
+        int useGrid;            /* use grid for speed up */
754
+        int useNew;             /* encode x-K into attractive force */
755
+        int numIters;           /* actual iterations in layout */
756
+        int unscaled;           /* % of iterations used in pass 1 */
757
+        double C;               /* Repulsion factor in xLayout */
758
+        double Tfact;           /* scale temp from default expression */
759
+        double K;               /* spring constant; ideal distance */
760
+        double T0;              /* initial temperature */
761
+    } fdpParms_t;
762
+
763
+    typedef struct {
764
+	int flags;
765
+    } gvlayout_features_t;
766
+
767
+#ifdef __cplusplus
768
+}
769
+#endif
770
+#endif