Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
cgraph.h
Go to the documentation of this file.
1
20/*************************************************************************
21 * Copyright (c) 2011 AT&T Intellectual Property
22 * All rights reserved. This program and the accompanying materials
23 * are made available under the terms of the Eclipse Public License v1.0
24 * which accompanies this distribution, and is available at
25 * https://www.eclipse.org/legal/epl-v10.html
26 *
27 * Contributors: Details at https://graphviz.org
28 *************************************************************************/
29
30#pragma once
31
32#include "cdt.h"
33#include <inttypes.h>
34#include <stdbool.h>
35#include <stddef.h>
36#include <stdint.h>
37#include <stdio.h>
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
55
56#ifdef GVDLL
57#ifdef EXPORT_CGRAPH
58#define CGRAPH_API __declspec(dllexport)
59#else
60#define CGRAPH_API __declspec(dllimport)
61#endif
62#endif
63
64#ifndef CGRAPH_API
65#define CGRAPH_API /* nothing */
66#endif
67
69
70/* forward struct type declarations */
73typedef uint64_t IDTYPE;
74typedef struct Agtag_s Agtag_t;
75typedef struct Agobj_s Agobj_t;
79typedef struct Agraph_s Agraph_t;
80typedef struct Agdesc_s Agdesc_t;
81typedef struct Agdstate_s Agdstate_t;
82typedef struct Agclos_s Agclos_t;
86typedef struct Agnode_s Agnode_t;
87typedef struct Agsubnode_s Agsubnode_t;
91typedef struct Agedge_s Agedge_t;
92typedef struct Agedgepair_s Agedgepair_t;
96typedef struct Agiddisc_s Agiddisc_t;
97typedef struct Agiodisc_s Agiodisc_t;
98typedef struct Agdisc_s Agdisc_t;
102typedef struct Agcbdisc_s Agcbdisc_t;
103typedef struct Agcbstack_s Agcbstack_t;
105
165typedef struct Agsym_s Agsym_t;
166typedef struct Agattr_s Agattr_t;
168typedef struct Agrec_s Agrec_t;
170
172struct Agrec_s {
173 char *name;
175 /* following this would be any programmer-defined data */
176};
179
197struct Agtag_s {
199 unsigned objtype : 2; /* see enum below */
200 unsigned mtflock : 1;
201 unsigned attrwf : 1; /* attrs written (parity, write.c) */
202 unsigned seq : (sizeof(unsigned) * 8 - 4); /* sequence no. */
203 IDTYPE id; /* client ID */
204};
205
208
214
215#define AGTAG(obj) (((Agobj_t *)(obj))->tag)
216#define AGTYPE(obj) (AGTAG(obj).objtype)
220#define AGID(obj) (AGTAG(obj).id)
222
223#define AGSEQ(obj) (AGTAG(obj).seq)
224#define AGATTRWF(obj) (AGTAG(obj).attrwf)
225#define AGDATA(obj) (((Agobj_t *)(obj))->data)
227
230
248struct Agsubnode_s { /* the node-per-graph-or-subgraph record */
249 Dtlink_t seq_link; /* must be first */
251 Agnode_t *node; /* the object */
252 Dtlink_t *in_id, *out_id; /* by node/ID for random access */
253 Dtlink_t *in_seq, *out_seq; /* by node/sequence for serial access */
256struct Agnode_s {
258 Agraph_t *root;
259 Agsubnode_t mainsub; /* embedded for main graph */
265struct Agedge_s {
267 Dtlink_t id_link; /* main graph only */
269 Agnode_t *node; /* the endpoint node */
273 Agedge_t out, in;
274};
279
281struct Agdesc_s { /* graph descriptor */
282 unsigned directed : 1; /* if edges are asymmetric */
283 unsigned strict : 1; /* if multi-edges forbidden */
284 unsigned no_loop : 1; /* if no loops */
285 unsigned maingraph : 1; /* if this is the top level graph */
286 unsigned no_write : 1; /* if a temporary subgraph */
287 unsigned has_attrs : 1; /* if string attr tables should be initialized */
288 unsigned has_cmpnd : 1; /* if may contain collapsed nodes */
313struct Agiddisc_s {
314 void *(*open)(Agraph_t *g, Agdisc_t *); /* associated with a graph */
315 long (*map)(void *state, int objtype, char *str, IDTYPE *id, int createflag);
316 long (*alloc)(void *state, int objtype, IDTYPE id);
317 void (*free)(void *state, int objtype, IDTYPE id);
318 char *(*print)(void *state, int objtype, IDTYPE id);
319 void (*close)(void *state);
320 void (*idregister)(void *state, int objtype, void *obj);
324struct Agiodisc_s {
325 int (*afread)(void *chan, char *buf, int bufsize);
326 int (*putstr)(void *chan, const char *str);
327 int (*flush)(void *chan); /* sync */
328 /* error messages? */
334struct Agdisc_s {
335 Agiddisc_t *id;
336 Agiodisc_t *io;
339/* default resource disciplines */
340
341CGRAPH_API extern Agiddisc_t AgIdDisc;
342CGRAPH_API extern Agiodisc_t AgIoDisc;
343
344CGRAPH_API extern Agdisc_t AgDefaultDisc;
346
360struct Agdstate_s {
361 void *id;
362 /* IO must be initialized and finalized outside Cgraph,
363 * and channels (FILES) are passed as void* arguments. */
365
366typedef void (*agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg);
367typedef void (*agobjupdfn_t)(Agraph_t *g, Agobj_t *obj, void *arg,
368 Agsym_t *sym);
385struct Agcbdisc_s {
386 struct {
396struct Agcbstack_s {
397 Agcbdisc_t *f; /* methods */
398 void *state; /* closure */
399 Agcbstack_t *prev; /* kept in a stack, unlike other disciplines */
402CGRAPH_API void agpushdisc(Agraph_t *g, Agcbdisc_t *disc, void *state);
403CGRAPH_API int agpopdisc(Agraph_t *g, Agcbdisc_t *disc);
404
406
408struct Agclos_s {
409 Agdisc_t disc; /* resource discipline functions */
410 Agdstate_t state; /* resource closures */
411 Dict_t *strdict; /* shared string dict */
412 uint64_t seq[3]; /* local object sequence number counter */
413 Agcbstack_t *cb; /* user and system callback function stacks */
419struct graphviz_node_set;
420
422struct Agraph_s {
449CGRAPH_API int agclose(Agraph_t *g);
451CGRAPH_API Agraph_t *agread(void *chan, Agdisc_t *disc);
453
454CGRAPH_API Agraph_t *agmemread(const char *cp);
456
457CGRAPH_API Agraph_t *agmemconcat(Agraph_t *g, const char *cp);
458
459CGRAPH_API void agsetfile(const char *);
461
462CGRAPH_API Agraph_t *agconcat(Agraph_t *g, void *chan, Agdisc_t *disc);
471CGRAPH_API int agwrite(Agraph_t *g, void *chan);
472CGRAPH_API int agisdirected(Agraph_t *g);
473CGRAPH_API int agisundirected(Agraph_t *g);
474CGRAPH_API int agisstrict(Agraph_t *g);
475CGRAPH_API int agissimple(Agraph_t *g);
477
480CGRAPH_API Agnode_t *agnode(Agraph_t *g, char *name, int createflag);
481CGRAPH_API Agnode_t *agidnode(Agraph_t *g, IDTYPE id, int createflag);
482CGRAPH_API Agnode_t *agsubnode(Agraph_t *g, Agnode_t *n, int createflag);
483CGRAPH_API Agnode_t *agfstnode(Agraph_t *g);
484CGRAPH_API Agnode_t *agnxtnode(Agraph_t *g, Agnode_t *n);
485CGRAPH_API Agnode_t *aglstnode(Agraph_t *g);
486CGRAPH_API Agnode_t *agprvnode(Agraph_t *g, Agnode_t *n);
487
488CGRAPH_API Agsubnode_t *agsubrep(Agraph_t *g, Agnode_t *n);
489CGRAPH_API int agnodebefore(Agnode_t *u, Agnode_t *v); /* we have no shame */
490CGRAPH_API int agdelnode(Agraph_t *g, Agnode_t *arg_n);
492CGRAPH_API int agrelabel_node(Agnode_t *n, char *newname);
494
516CGRAPH_API Agedge_t *agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name,
517 int createflag);
518CGRAPH_API Agedge_t *agidedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, IDTYPE id,
519 int createflag);
520CGRAPH_API Agedge_t *agsubedge(Agraph_t *g, Agedge_t *e, int createflag);
521CGRAPH_API Agedge_t *agfstin(Agraph_t *g, Agnode_t *n);
522CGRAPH_API Agedge_t *agnxtin(Agraph_t *g, Agedge_t *e);
523CGRAPH_API Agedge_t *agfstout(Agraph_t *g, Agnode_t *n);
524CGRAPH_API Agedge_t *agnxtout(Agraph_t *g, Agedge_t *e);
525CGRAPH_API Agedge_t *agfstedge(Agraph_t *g, Agnode_t *n);
526CGRAPH_API Agedge_t *agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n);
527CGRAPH_API int agdeledge(Agraph_t *g, Agedge_t *arg_e);
529
532
533// Generic object (graphs, nodes and edges) functions
534
535CGRAPH_API Agraph_t *agraphof(void *obj);
536CGRAPH_API Agraph_t *agroot(void *obj);
539
540CGRAPH_API int agcontains(Agraph_t *, void *obj);
542
543CGRAPH_API char *agnameof(void *);
545
546CGRAPH_API int agdelete(Agraph_t *g, void *obj);
553CGRAPH_API int agobjkind(void *obj);
557
580CGRAPH_API char *agstrdup(Agraph_t *, const char *);
584
585CGRAPH_API char *agstrdup_html(Agraph_t *, const char *);
588CGRAPH_API int aghtmlstr(const char *);
591CGRAPH_API char *agstrbind(Agraph_t *g, const char *);
594
595CGRAPH_API int agstrfree(Agraph_t *, const char *);
596CGRAPH_API char *agcanon(char *str, int html);
597CGRAPH_API char *agstrcanon(char *, char *);
598CGRAPH_API char *agcanonStr(char *str); /* manages its own buf */
600
623// definitions for dynamic string attributes
624
626struct Agattr_s { /* dynamic string attributes */
627 Agrec_t h; /* common data header */
628 Dict_t *dict;
629 char **str;
634struct Agsym_s {
636 char *name; /* attribute's name */
637 char *defval; /* its default value for initialization */
638 int id;
639 unsigned char kind; /* referent object type */
640 unsigned char fixed; /* immutable value */
641 unsigned char print; /* always print */
645 Agrec_t h; /* installed in list of graph recs */
646 struct {
647 Dict_t *n, *e, *g;
649};
651CGRAPH_API Agsym_t *agattr(Agraph_t *g, int kind, char *name,
652 const char *value);
667CGRAPH_API Agsym_t *agattrsym(void *obj, char *name);
669
670CGRAPH_API Agsym_t *agnxtattr(Agraph_t *g, int kind, Agsym_t *attr);
674
675CGRAPH_API int agcopyattr(void *oldobj, void *newobj);
684CGRAPH_API void *agbindrec(void *obj, const char *name, unsigned int recsize,
685 int move_to_front);
689
690CGRAPH_API Agrec_t *aggetrec(void *obj, const char *name, int move_to_front);
692
693CGRAPH_API int agdelrec(void *obj, const char *name);
695
696CGRAPH_API void aginit(Agraph_t *g, int kind, const char *rec_name,
697 int rec_size, int move_to_front);
705CGRAPH_API void agclean(Agraph_t *g, int kind, char *rec_name);
708
710
711CGRAPH_API char *agget(void *obj, char *name);
712CGRAPH_API char *agxget(void *obj, Agsym_t *sym);
713CGRAPH_API int agset(void *obj, char *name, const char *value);
714CGRAPH_API int agxset(void *obj, Agsym_t *sym, const char *value);
715CGRAPH_API int agsafeset(void *obj, char *name, const char *value,
716 const char *def);
719
721
749CGRAPH_API Agraph_t *agsubg(Agraph_t *g, char *name,
750 int cflag); /* constructor */
751CGRAPH_API Agraph_t *agidsubg(Agraph_t *g, IDTYPE id,
752 int cflag); /* constructor */
753CGRAPH_API Agraph_t *agfstsubg(Agraph_t *g);
754CGRAPH_API Agraph_t *agnxtsubg(Agraph_t *subg);
755CGRAPH_API Agraph_t *agparent(Agraph_t *g);
756CGRAPH_API int agdelsubg(Agraph_t *g, Agraph_t *sub); /* could be agclose */
758
782CGRAPH_API int agnnodes(Agraph_t *g);
783CGRAPH_API int agnedges(Agraph_t *g);
784CGRAPH_API int agnsubg(Agraph_t *g);
785CGRAPH_API int agdegree(Agraph_t *g, Agnode_t *n, int in, int out);
786CGRAPH_API int agcountuniqedges(Agraph_t *g, Agnode_t *n, int in, int out);
788
791/* an engineering compromise is a joy forever */
792CGRAPH_API void aginternalmapclearlocalnames(Agraph_t *g);
794
796
797/* support for extra API misuse warnings if available */
798#ifdef __GNUC__
799#define PRINTF_LIKE(index, first) __attribute__((format(printf, index, first)))
800#else
801#define PRINTF_LIKE(index, first) /* nothing */
802#endif
803
805
846typedef enum { AGWARN, AGERR, AGMAX, AGPREV } agerrlevel_t;
847typedef int (*agusererrf)(char *);
849CGRAPH_API char *aglasterr(void);
850CGRAPH_API int agerr(agerrlevel_t level, const char *fmt, ...)
851 PRINTF_LIKE(2, 3);
852CGRAPH_API void agerrorf(const char *fmt, ...) PRINTF_LIKE(1, 2);
853CGRAPH_API void agwarningf(const char *fmt, ...) PRINTF_LIKE(1, 2);
854CGRAPH_API int agerrors(void);
855CGRAPH_API int agreseterrors(void);
858
859#undef PRINTF_LIKE
861
864/* data access macros */
865/* this assumes that e[0] is out and e[1] is inedge, see @ref Agedgepair_s */
866#define AGIN2OUT(inedge) ((inedge) - 1)
867#define AGOUT2IN(outedge) \
868 ((outedge) + 1)
869#define AGOPP(e) ((AGTYPE(e) == AGINEDGE) ? AGIN2OUT(e) : AGOUT2IN(e))
870#define AGMKOUT(e) (AGTYPE(e) == AGOUTEDGE ? (e) : AGIN2OUT(e))
871#define AGMKIN(e) (AGTYPE(e) == AGINEDGE ? (e) : AGOUT2IN(e))
872#define AGTAIL(e) (AGMKIN(e)->node)
873#define AGHEAD(e) (AGMKOUT(e)->node)
874#define AGEQEDGE(e, f) (AGMKOUT(e) == AGMKOUT(f))
875/* These macros are also exposed as functions, so they can be linked against. */
876#define agtail(e) AGTAIL(e)
877#define aghead(e) AGHEAD(e)
878#define agopp(e) \
879 AGOPP(e)
880#define ageqedge(e, f) AGEQEDGE(e, f)
882#define TAILPORT_ID "tailport"
883#define HEADPORT_ID "headport"
888CGRAPH_API extern Agdesc_t Agdirected;
889CGRAPH_API extern Agdesc_t Agstrictdirected;
891CGRAPH_API extern Agdesc_t Agundirected;
892CGRAPH_API extern Agdesc_t Agstrictundirected;
894
900/* this is expedient but a bit slimey because it "knows" that dict entries of
901both nodes and edges are embedded in main graph objects but allocated separately
902in subgraphs */
903#define AGSNMAIN(sn) ((sn) == (&((sn)->node->mainsub)))
904#define EDGEOF(sn, rep) \
905 (AGSNMAIN(sn) \
906 ? ((Agedge_t *)((unsigned char *)(rep) - offsetof(Agedge_t, seq_link))) \
907 : ((Dthold_t *)(rep))->obj)
912
914typedef struct {
915 FILE *outFile;
916 bool doWrite;
917 bool Verbose;
928CGRAPH_API bool graphviz_acyclic(Agraph_t *g,
930 size_t *num_rev);
931
933typedef struct {
934 bool Verbose;
935 bool PrintRemovedEdges;
936 FILE *out;
937 FILE *err;
947CGRAPH_API void graphviz_tred(Agraph_t *g, const graphviz_tred_options_t *opts);
948
950typedef struct {
951 bool Do_fans;
952 int MaxMinlen;
953 int ChainLimit;
962CGRAPH_API void graphviz_unflatten(Agraph_t *g,
964
978CGRAPH_API size_t graphviz_node_induce(Agraph_t *g, Agraph_t *edgeset);
980
981#ifdef __cplusplus
982}
983#endif
static void out(agerrlevel_t level, const char *fmt, va_list args)
Report messages using a user-supplied or default write function.
Definition agerror.c:84
container data types API
#define sub(h, i)
Definition closest.c:67
static FILE * outFile
Definition cvtgxl.c:35
static char * err
Definition delaunay.c:708
#define PRINTF_LIKE(index, first)
Definition error.h:48
static Dtdisc_t disc
Definition exparse.y:209
static bool Verbose
Definition gml2gv.c:23
int agnsubg(Agraph_t *g)
Definition graph.c:185
int agcountuniqedges(Agraph_t *g, Agnode_t *n, int in, int out)
Definition graph.c:219
int agnedges(Agraph_t *g)
Definition graph.c:175
int agdegree(Agraph_t *g, Agnode_t *n, int in, int out)
Definition graph.c:237
int agnnodes(Agraph_t *g)
Definition graph.c:169
void aginternalmapclearlocalnames(Agraph_t *g)
Definition imap.c:165
bool graphviz_acyclic(Agraph_t *g, const graphviz_acyclic_options_t *opts, size_t *num_rev)
Definition acyclic.c:86
void graphviz_unflatten(Agraph_t *g, const graphviz_unflatten_options_t *opts)
Definition unflatten.c:56
size_t graphviz_node_induce(Agraph_t *g, Agraph_t *edgeset)
Definition node_induce.c:9
void graphviz_tred(Agraph_t *g, const graphviz_tred_options_t *opts)
programmatic access to tred - transitive reduction
Definition tred.c:183
Agsym_t * agattrsym(void *obj, char *name)
looks up a string attribute for a graph object given as an argument
Definition attr.c:156
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
Definition attr.c:338
int agset(void *obj, char *name, const char *value)
Definition attr.c:466
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
permits traversing the list of attributes of a given type
Definition attr.c:353
int agxset(void *obj, Agsym_t *sym, const char *value)
Definition attr.c:478
char * agget(void *obj, char *name)
Definition attr.c:439
int agsafeset(void *obj, char *name, const char *value, const char *def)
ensures the given attribute is declared before setting it locally on an object
Definition attr.c:507
char * agxget(void *obj, Agsym_t *sym)
Definition attr.c:455
int agcopyattr(void *oldobj, void *newobj)
copies all of the attributes from one object to another
Definition attr.c:549
int agpopdisc(Agraph_t *g, Agcbdisc_t *disc)
Definition obj.c:211
void agpushdisc(Agraph_t *g, Agcbdisc_t *disc, void *state)
Definition obj.c:202
Agdisc_t AgDefaultDisc
Definition graph.c:289
Agiddisc_t AgIdDisc
Definition id.c:100
Agiodisc_t AgIoDisc
Definition io.c:39
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Definition edge.c:260
Agedge_t * agidedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, IDTYPE id, int createflag)
Definition edge.c:238
Agedge_t * agsubedge(Agraph_t *g, Agedge_t *e, int createflag)
Definition edge.c:355
int agdeledge(Agraph_t *g, Agedge_t *arg_e)
Definition edge.c:334
Agedge_t * agnxtin(Agraph_t *g, Agedge_t *e)
Definition edge.c:69
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Definition edge.c:24
Agedge_t * agnxtedge(Agraph_t *g, Agedge_t *e, Agnode_t *n)
Definition edge.c:94
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
Definition edge.c:39
Agedge_t * agfstedge(Agraph_t *g, Agnode_t *n)
Definition edge.c:85
Agedge_t * agfstin(Agraph_t *g, Agnode_t *n)
Definition edge.c:55
agerrlevel_t
Definition cgraph.h:849
int agreseterrors(void)
Definition agerror.c:183
void agwarningf(const char *fmt,...)
Definition agerror.c:173
void agerrorf(const char *fmt,...)
Definition agerror.c:165
agerrlevel_t agseterr(agerrlevel_t)
Definition agerror.c:38
char * aglasterr(void)
Definition agerror.c:44
agusererrf agseterrf(agusererrf)
Definition agerror.c:32
int agerr(agerrlevel_t level, const char *fmt,...)
Definition agerror.c:155
int agerrors(void)
Definition agerror.c:181
int(* agusererrf)(char *)
Definition cgraph.h:850
@ AGWARN
Definition cgraph.h:849
@ AGMAX
Definition cgraph.h:849
@ AGERR
Definition cgraph.h:849
@ AGPREV
Definition cgraph.h:849
void(* agobjupdfn_t)(Agraph_t *g, Agobj_t *obj, void *arg, Agsym_t *sym)
Definition cgraph.h:370
void(* agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg)
Definition cgraph.h:369
Agdesc_t Agundirected
undirected
Definition graph.c:286
int agisdirected(Agraph_t *g)
Definition graph.c:190
Agdesc_t Agstrictundirected
strict undirected
Definition graph.c:287
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Definition graph.c:102
int agisstrict(Agraph_t *g)
Definition graph.c:200
int agissimple(Agraph_t *g)
Definition graph.c:205
Agdesc_t Agstrictdirected
strict directed. A strict graph cannot have multi-edges or self-arcs.
Definition graph.c:285
Agraph_t * agmemconcat(Agraph_t *g, const char *cp)
Definition io.c:102
Agraph_t * agconcat(Agraph_t *g, void *chan, Agdisc_t *disc)
merges the file contents with a pre-existing graph
Definition grammar.c:2280
Agraph_t * agmemread(const char *cp)
reads a graph from the input string
Definition io.c:97
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Definition graph.c:44
int agisundirected(Agraph_t *g)
Definition graph.c:195
int agwrite(Agraph_t *g, void *chan)
Return 0 on success, EOF on failure.
Definition write.c:730
void agsetfile(const char *)
sets the current file name for subsequent error reporting
Definition scan.c:2415
Agraph_t * agread(void *chan, Agdisc_t *disc)
constructs a new graph
Definition grammar.c:2292
Agdesc_t Agdirected
directed
Definition graph.c:284
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Definition node.c:145
int agnodebefore(Agnode_t *u, Agnode_t *v)
Definition node.c:332
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Definition node.c:47
Agnode_t * agprvnode(Agraph_t *g, Agnode_t *n)
Definition node.c:62
Agnode_t * agfstnode(Agraph_t *g)
Definition node.c:40
Agnode_t * agsubnode(Agraph_t *g, Agnode_t *n, int createflag)
Definition node.c:259
Agnode_t * agidnode(Agraph_t *g, IDTYPE id, int createflag)
Definition node.c:122
Agnode_t * aglstnode(Agraph_t *g)
Definition node.c:55
int agrelabel_node(Agnode_t *n, char *newname)
Definition node.c:237
int agdelnode(Agraph_t *g, Agnode_t *arg_n)
removes a node from a graph or subgraph.
Definition node.c:195
Agsubnode_t * agsubrep(Agraph_t *g, Agnode_t *n)
Definition edge.c:145
Agraph_t * agraphof(void *obj)
Definition obj.c:185
char * agnameof(void *)
returns a string descriptor for the object.
Definition id.c:158
uint64_t IDTYPE
unique per main graph ID
Definition cgraph.h:73
int agdelete(Agraph_t *g, void *obj)
deletes object. Equivalent to agclose, agdelnode, and agdeledge for obj being a graph,...
Definition obj.c:20
int agcontains(Agraph_t *, void *obj)
returns non-zero if obj is a member of (sub)graph
Definition obj.c:233
int agobjkind(void *obj)
Definition obj.c:252
Agraph_t * agroot(void *obj)
Definition obj.c:168
@ AGOUTEDGE
Definition cgraph.h:207
@ AGEDGE
Definition cgraph.h:207
@ AGNODE
Definition cgraph.h:207
@ AGINEDGE
Definition cgraph.h:207
@ AGRAPH
Definition cgraph.h:207
Agrec_t * aggetrec(void *obj, const char *name, int move_to_front)
find record in circular list and do optional move-to-front and lock
Definition rec.c:41
void aginit(Agraph_t *g, int kind, const char *rec_name, int rec_size, int move_to_front)
attach new records to objects of specified kind
Definition rec.c:170
void * agbindrec(void *obj, const char *name, unsigned int recsize, int move_to_front)
attaches a new record of the given size to the object
Definition rec.c:89
void agclean(Agraph_t *g, int kind, char *rec_name)
calls agdelrec for all objects of the same class in an entire graph
Definition rec.c:202
int agdelrec(void *obj, const char *name)
deletes a named record from one object
Definition rec.c:137
int aghtmlstr(const char *)
Definition refstr.c:164
int agstrfree(Agraph_t *, const char *)
Definition refstr.c:139
char * agstrcanon(char *, char *)
Definition write.c:209
char * agstrdup(Agraph_t *, const char *)
returns a pointer to a reference-counted copy of the argument string, creating one if necessary
Definition refstr.c:131
char * agcanon(char *str, int html)
Definition write.c:252
char * agstrbind(Agraph_t *g, const char *)
Definition refstr.c:96
char * agcanonStr(char *str)
Definition write.c:239
char * agstrdup_html(Agraph_t *, const char *)
Definition refstr.c:135
Agraph_t * agparent(Agraph_t *g)
Definition subg.c:91
Agraph_t * agidsubg(Agraph_t *g, IDTYPE id, int cflag)
Definition subg.c:49
Agraph_t * agfstsubg(Agraph_t *g)
Definition subg.c:78
Agraph_t * agnxtsubg(Agraph_t *subg)
Definition subg.c:83
Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
Definition subg.c:58
int agdelsubg(Agraph_t *g, Agraph_t *sub)
Definition subg.c:99
static uint64_t id
Definition gv2gml.c:42
static opts_t opts
Definition gvgen.c:394
textitem scanner parser str
Definition htmlparse.y:224
string attribute container
Definition cgraph.h:629
char ** str
the attribute string values indexed by Agsym_s.id
Definition cgraph.h:632
Dict_t * dict
shared dict of Agsym_s to interpret Agattr_s.str
Definition cgraph.h:631
Agrec_t h
Definition cgraph.h:630
client event callbacks, used in Agcbstack_s
Definition cgraph.h:388
agobjupdfn_t mod
Definition cgraph.h:391
agobjfn_t ins
Definition cgraph.h:390
struct Agcbdisc_s::@63 edge
struct Agcbdisc_s::@63 graph
struct Agcbdisc_s::@63 node
agobjfn_t del
Definition cgraph.h:392
object event callbacks
Definition cgraph.h:399
void * state
Definition cgraph.h:401
Agcbdisc_t * f
Definition cgraph.h:400
Agcbstack_t * prev
Definition cgraph.h:402
shared resources for Agraph_s
Definition cgraph.h:411
Dict_t * lookup_by_id[3]
Definition cgraph.h:418
Agdisc_t disc
Definition cgraph.h:412
Agdstate_t state
Definition cgraph.h:413
Dict_t * strdict
Definition cgraph.h:414
Dict_t * lookup_by_name[3]
Definition cgraph.h:417
Agcbstack_t * cb
Definition cgraph.h:416
uint64_t seq[3]
Definition cgraph.h:415
Dict_t * n
Definition cgraph.h:650
Dict_t * e
Definition cgraph.h:650
struct Agdatadict_s::@64 dict
Dict_t * g
Definition cgraph.h:650
Agrec_t h
< set of dictionaries per graph
Definition cgraph.h:648
graph descriptor
Definition cgraph.h:284
unsigned has_attrs
Definition cgraph.h:290
unsigned maingraph
Definition cgraph.h:288
unsigned no_loop
Definition cgraph.h:287
unsigned strict
Definition cgraph.h:286
unsigned no_write
Definition cgraph.h:289
unsigned has_cmpnd
Definition cgraph.h:291
unsigned directed
Definition cgraph.h:285
user's discipline
Definition cgraph.h:337
Agiddisc_t * id
Definition cgraph.h:338
Agiodisc_t * io
Definition cgraph.h:339
client state (closures)
Definition cgraph.h:363
void * id
Definition cgraph.h:364
Dtlink_t seq_link
Definition cgraph.h:271
Agnode_t * node
Definition cgraph.h:272
Agobj_t base
Definition cgraph.h:269
Dtlink_t id_link
Definition cgraph.h:270
Agedge_t in
Definition cgraph.h:276
Agedge_t out
Definition cgraph.h:276
object ID allocator discipline
Definition cgraph.h:316
long(* map)(void *state, int objtype, char *str, IDTYPE *id, int createflag)
Definition cgraph.h:318
void(* idregister)(void *state, int objtype, void *obj)
Definition cgraph.h:323
void(* close)(void *state)
Definition cgraph.h:322
void(* free)(void *state, int objtype, IDTYPE id)
Definition cgraph.h:320
long(* alloc)(void *state, int objtype, IDTYPE id)
Definition cgraph.h:319
IO services.
Definition cgraph.h:327
int(* afread)(void *chan, char *buf, int bufsize)
Definition cgraph.h:328
int(* flush)(void *chan)
Definition cgraph.h:330
int(* putstr)(void *chan, const char *str)
Definition cgraph.h:329
Agsubnode_t mainsub
Definition cgraph.h:262
Agraph_t * root
Definition cgraph.h:261
Agobj_t base
Definition cgraph.h:260
a generic header of Agraph_s, Agnode_s and Agedge_s
Definition cgraph.h:210
Agrec_t * data
stores programmer-defined data, access with AGDATA
Definition cgraph.h:212
Agtag_t tag
access with AGTAG
Definition cgraph.h:211
graph or subgraph
Definition cgraph.h:425
struct graphviz_node_set * n_id
the node set indexed by ID
Definition cgraph.h:431
Dict_t * g_seq
Definition cgraph.h:433
Agraph_t * root
subgraphs - ancestors
Definition cgraph.h:434
Dtlink_t seq_link
Definition cgraph.h:428
Dict_t * g_id
subgraphs - descendants
Definition cgraph.h:433
Agobj_t base
Definition cgraph.h:426
Dict_t * e_seq
Definition cgraph.h:432
Dict_t * n_seq
the node set in sequence
Definition cgraph.h:430
Agclos_t * clos
shared resources
Definition cgraph.h:435
Agraph_t * parent
Definition cgraph.h:434
Agdesc_t desc
Definition cgraph.h:427
Dtlink_t id_link
Definition cgraph.h:429
Dict_t * e_id
holders for edge sets
Definition cgraph.h:432
implementation of Agrec_t
Definition cgraph.h:172
Agrec_t * next
circular linked list of records
Definition cgraph.h:174
char * name
Definition cgraph.h:173
This is the node struct allocated per graph (or subgraph).
Definition cgraph.h:251
Dtlink_t * out_seq
Definition cgraph.h:256
Dtlink_t * out_id
Definition cgraph.h:255
Dtlink_t seq_link
Definition cgraph.h:252
Dtlink_t * in_id
Definition cgraph.h:255
Dtlink_t id_link
Definition cgraph.h:253
Agnode_t * node
Definition cgraph.h:254
Dtlink_t * in_seq
Definition cgraph.h:256
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:637
Dtlink_t link
Definition cgraph.h:638
char * name
Definition cgraph.h:639
unsigned char kind
Definition cgraph.h:642
int id
index in Agattr_s.str
Definition cgraph.h:641
unsigned char fixed
Definition cgraph.h:643
char * defval
Definition cgraph.h:640
unsigned char print
Definition cgraph.h:644
tag in Agobj_s for graphs, nodes, and edges.
Definition cgraph.h:197
unsigned attrwf
Definition cgraph.h:201
unsigned objtype
access with AGTYPE
Definition cgraph.h:199
unsigned seq
Definition cgraph.h:202
unsigned mtflock
move-to-front lock, guards Agobj_s::data
Definition cgraph.h:200
IDTYPE id
Definition cgraph.h:203
Definition cdt.h:100
options for passing to graphviz_acyclic
Definition cgraph.h:919
options for passing to graphviz_tred
Definition cgraph.h:938
options for passing to graphviz_unflatten
Definition cgraph.h:955