17%define api.prefix {gml}
44static char *
sortToStr(
unsigned short sort);
93 attrs_t *
const lp =
gv_alloc(
sizeof(attrs_t));
128 graphs_append(
G->graphlist, g);
150static gmlattr *
mkAttr(
char* name,
unsigned short sort,
unsigned short kind,
151 char*
str, attrs_t* list) {
154 assert (name || sort);
163 if (list !=
NULL && attrs_is_empty(list)) {
179 if (dir < 0) dir = -1;
180 else if (dir > 0) dir = 1;
185 for (g =
G->parent; g; g = g->
parent) {
235glist : glist glistitem
239glistitem :
node { nodes_append(&
G->nodelist,
$1); }
244 yyerror(
"mixed directed and undirected graphs");
256nlist : nlist nlistitem
348 for (
size_t i = 0; alist !=
NULL && i < attrs_size(alist); ++i) {
349 gmlattr *
const ap = attrs_get(alist, i);
378 for (
size_t i = 0; i < attrs_size(alist); ++i) {
379 gmlattr *
const ap = attrs_get(alist, i);
420 for (
size_t i = 0; i < attrs_size(alist); ++i) {
421 gmlattr *
const ap = attrs_get(alist, i);
470 for (
size_t i = 0; alist !=
NULL && i < attrs_size(alist); ++i) {
471 gmlattr *
const ap = attrs_get(alist, i);
480 snprintf(buf,
sizeof(buf),
"%.04f", d/72.0);
485 snprintf(buf,
sizeof(buf),
"%.04f", d/72.0);
529 for (
size_t i = 0; alist !=
NULL && i < attrs_size(alist); ++i) {
530 gmlattr *
const ap = attrs_get(alist, i);
538 fprintf (stderr,
"non-X/Y field in point attribute");
549 for (
size_t i = 0; i < attrs_size(alist); ++i) {
550 gmlattr *
const ap = attrs_get(alist, i);
555 fprintf (stderr,
"non-point field in line attribute");
566 for (
size_t i = 0; alist !=
NULL && i < attrs_size(alist); ++i) {
567 gmlattr *
const ap = attrs_get(alist, i);
600 for (
size_t i = 0; i < attrs_size(alist); ++i) {
601 gmlattr *
const ap = attrs_get(alist, i);
633 else if (
graph->directed >= 1)
641 for (
size_t i = 0; i < nodes_size(&
graph->nodelist); ++i) {
644 fprintf (stderr,
"node without an id attribute");
651 for (
size_t i = 0; i < edges_size(&
graph->edgelist); ++i) {
654 fprintf (stderr,
"edge without an source attribute");
658 fprintf (stderr,
"node without an target attribute");
666 for (
size_t i = 0; i < graphs_size(
graph->graphlist); ++i) {
719 s =
"directed";
break;
737 s =
"graphics";
break;
739 s =
"labelGraphics";
break;
745 s =
"outline";
break;
747 s =
"outlineStyle";
break;
749 s =
"outlineWidth";
break;
761 s =
"fontSize";
break;
763 s =
"fontName";
break;
767 s =
"integer";
break;
static void agxbfree(agxbuf *xb)
free any malloced resources
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
static void agxbclear(agxbuf *xb)
resets pointer to data
static WUR char * agxbuse(agxbuf *xb)
static size_t agxblen(const agxbuf *xb)
return number of characters currently stored
static int agxbputc(agxbuf *xb, char c)
add character to buffer
Memory allocation wrappers that exit on failure.
static char * gv_strdup(const char *original)
static void * gv_alloc(size_t size)
static NORETURN void graphviz_exit(int status)
void free_graph(gmlgraph *p)
void free_node(gmlnode *p)
void free_edge(gmledge *p)
static void free_attrs(attrs_t *a)
static void cleanup(void)
static gmlnode * mkNode(void)
static int setDir(char *d)
static gmledge * mkEdge(void)
static void pushAlist(void)
static gmlattr * mkAttr(char *name, unsigned short sort, unsigned short kind, char *str, attrs_t *list)
static attrs_t * popAlist(void)
static char * sortToStr(unsigned short sort)
static void addEdgeGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb, agxbuf *unk)
static void addAttrs(Agobj_t *obj, attrs_t *alist, agxbuf *xb, agxbuf *unk)
static void deparseAttr(gmlattr *ap, agxbuf *xb)
static void addEdgeLabelGraphics(Agedge_t *ep, attrs_t *alist, agxbuf *xb, agxbuf *unk)
void free_attr(gmlattr *p)
static void addNodeLabelGraphics(Agnode_t *np, attrs_t *alist, agxbuf *unk)
static Agraph_t * mkGraph(gmlgraph *graph, Agraph_t *parent, char *name, agxbuf *xb, agxbuf *unk)
static void addNodeGraphics(Agnode_t *np, attrs_t *alist, agxbuf *xb, agxbuf *unk)
static void addEdgePoint(Agedge_t *ep, attrs_t *alist, agxbuf *xb)
static void addEdgePos(Agedge_t *ep, attrs_t *alist, agxbuf *xb)
hdr body DIRECTED INTEGER
static void deparseList(attrs_t *alist, agxbuf *xb)
Agraph_t * gml_to_gv(char *name, FILE *fp, int cnt, int *errors)
static int cnt(Dict_t *d, Dtlink_t **set)
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
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
Agdesc_t Agundirected
undirected
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Agdesc_t Agdirected
directed
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
Agraph_t * graph(char *name)
textitem scanner parser str
#define DEFINE_LIST_WITH_DTOR(name, type, dtor)
a generic header of Agraph_s, Agnode_s and Agedge_s
void * lp
actually an attrs_t *
void * graphlist
actually a graphs_t *