17%define api.prefix {gml}
43static char *
sortToStr(
unsigned short sort);
96 attrs_t *
const lp =
gv_alloc(
sizeof(attrs_t));
156static gmlattr *
mkAttr(
char* name,
unsigned short sort,
unsigned short kind,
157 char*
str, attrs_t* list) {
160 assert (name || sort);
185 if (dir < 0) dir = -1;
186 else if (dir > 0) dir = 1;
191 for (g =
G->parent; g; g = g->
parent) {
241glist : glist glistitem
250 yyerror(
"mixed directed and undirected graphs");
262nlist : nlist nlistitem
354 for (
size_t i = 0; alist !=
NULL && i <
LIST_SIZE(alist); ++i) {
384 for (
size_t i = 0; i <
LIST_SIZE(alist); ++i) {
426 for (
size_t i = 0; i <
LIST_SIZE(alist); ++i) {
476 for (
size_t i = 0; alist !=
NULL && i <
LIST_SIZE(alist); ++i) {
486 snprintf(buf,
sizeof(buf),
"%.04f", d/72.0);
491 snprintf(buf,
sizeof(buf),
"%.04f", d/72.0);
535 for (
size_t i = 0; alist !=
NULL && i <
LIST_SIZE(alist); ++i) {
544 fprintf (stderr,
"non-X/Y field in point attribute");
555 for (
size_t i = 0; i <
LIST_SIZE(alist); ++i) {
561 fprintf (stderr,
"non-point field in line attribute");
572 for (
size_t i = 0; alist !=
NULL && i <
LIST_SIZE(alist); ++i) {
606 for (
size_t i = 0; i <
LIST_SIZE(alist); ++i) {
639 else if (
graph->directed >= 1)
650 fprintf (stderr,
"node without an id attribute");
660 fprintf (stderr,
"edge without an source attribute");
664 fprintf (stderr,
"node without an target attribute");
725 s =
"directed";
break;
743 s =
"graphics";
break;
745 s =
"labelGraphics";
break;
751 s =
"outline";
break;
753 s =
"outlineStyle";
break;
755 s =
"outlineWidth";
break;
767 s =
"fontSize";
break;
769 s =
"fontName";
break;
773 s =
"integer";
break;
Dynamically expanding string buffers.
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)
static void free_attrs(attrs_t *a)
static void cleanup(void)
static gmlnode * mkNode(void)
static int setDir(char *d)
static void free_edge(gmledge *p)
static void free_node(gmlnode *p)
static gmledge * mkEdge(void)
static void pushAlist(void)
static void free_graph(gmlgraph *p)
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)
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)
static void free_attr(gmlattr *p)
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)
set an attribute’s value and default, ensuring it is declared before setting it locally
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
type-generic dynamically expanding list
#define LIST_APPEND(list, item)
#define LIST_POP_BACK(list)
#define LIST_IS_EMPTY(list)
#define LIST_PUSH_BACK(list, item)
#define LIST_GET(list, index)
a generic header of Agraph_s, Agnode_s and Agedge_s
void * lp
actually an attrs_t *