21%define api.prefix {aag}
35static const char Key[] =
"key";
68static void attrstmt(
int tkind,
char *macroname);
69static void startgraph(
char *name,
bool directed,
bool strict);
73static void appendattr(
char *name,
char *value);
80static char*
concat(
char*,
char*);
104%type <i> optstrict graphtype
rcompound attrtype
105%type <str> optsubghdr optgraphname optmacroname atom
qatom
126optstmtlist : stmtlist | ;
128stmtlist : stmtlist stmt | stmt ;
163optmacroname : atom
'=' {
$$ =
$1;}
171optattrdefs : optattrdefs attrdefs
174attrdefs : attrassignment optseparator
191optseparator :
';' |
',' | ;
205 rv->tag = tag; rv->u.name = (
char*)p0; rv->str = p1;
241 for (p = ilist; p; p = pn) {
268 assert(value !=
NULL);
278 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next) {
279 assert(aptr->tag ==
T_atom);
294 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next) {
295 if (aptr->tag ==
T_attr) {
297 agxset(obj,aptr->u.asym,aptr->str);
302 assert(aptr->tag ==
T_atom);
310 agwarningf(
"attribute macros not implemented");
326 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next)
336 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next) {
338 if (aptr->tag ==
T_atom)
continue;
339 if (!(aptr->u.asym->fixed) || (
S->g !=
G))
340 sym =
agattr(
S->g,
kind,aptr->u.asym->name,aptr->str);
373 for (ptr =
S->nodelist.first; ptr; ptr = ptr->next)
387 if (
S->nodelist.first) {
389 S->nodelist.first =
S->nodelist.last =
NULL;
391 else {
if (
S->subg) v =
cons_subg(
S->subg);
S->subg = 0;}
408 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next) {
414 for (p =
S->edgelist.first; p->next; p = p->next) {
421 for (tptr = p->u.list; tptr; tptr = tptr->next)
439 size_t len = strlen(
s1) + strlen(s2) + 1;
441 if (
len <= BUFSIZ) sym = buf;
448 if (sym != buf)
free (sym);
473 subg = hlist->u.subg;
478 for (hptr = hlist->u.list; hptr; hptr = hptr->next)
504 temp = tp; tp = hp; hp = temp;
515static void startgraph(
char *name,
bool directed,
bool strict)
static void agxbfree(agxbuf *xb)
free any malloced resources
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
static char * agxbuse(agxbuf *xb)
Memory allocation wrappers that exit on failure.
static void * gv_alloc(size_t size)
void aglexinit(Agdisc_t *disc, void *ifile)
void error(int level, const char *s,...)
static double len(glCompPoint p)
void aagerror(const char *)
static void freestack(void)
static gstack_t * push(gstack_t *s, Agraph_t *subg)
static void appendattr(char *name, char *value)
static char * concat(char *s1, char *s2)
static void delete_items(item *ilist)
static void bindattrs(int kind)
static void newedge(Agnode_t *t, char *tport, Agnode_t *h, char *hport, char *key)
static void applyattrs(void *obj)
static void getedgeitems(void)
static item * cons_attr(char *name, char *value)
static void opensubg(char *name)
static void endgraph(void)
static void appendnode(char *name, char *port, char *sport)
static item * cons_subg(Agraph_t *subg)
static void endedge(void)
static void closesubg(void)
static item * cons_node(Agnode_t *n, char *port)
static item * cons_list(item *list)
static void mkport(Agedge_t *e, char *name, char *val)
static item * newitem(int tag, void *p0, char *p1)
static void listapp(list_t *list, item *v)
static char * concatPort(char *s1, char *s2)
static void attrstmt(int tkind, char *macroname)
static void edgerhs(Agnode_t *tail, char *tport, item *hlist, char *key)
static void nomacros(void)
static void startgraph(char *name, bool directed, bool strict)
static void deletelist(list_t *list)
void * agalloc(Agraph_t *g, size_t size)
void agfree(Agraph_t *g, void *ptr)
void aginternalmapclearlocalnames(Agraph_t *g)
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
int agxset(void *obj, Agsym_t *sym, const char *value)
Agedge_t * agedge(Agraph_t *g, Agnode_t *t, Agnode_t *h, char *name, int createflag)
void agwarningf(const char *fmt,...)
void agerrorf(const char *fmt,...)
int agclose(Agraph_t *g)
deletes a graph, freeing its associated storage
Agraph_t * agconcat(Agraph_t *g, void *chan, Agdisc_t *disc)
merges the file contents with a pre-existing graph
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Agraph_t * agread(void *fp, Agdisc_t *disc)
constructs a new graph
Agnode_t * agnode(Agraph_t *g, char *name, int createflag)
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Agnode_t * agfstnode(Agraph_t *g)
Agnode_t * agsubnode(Agraph_t *g, Agnode_t *n, int createflag)
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
int agstrfree(Agraph_t *, const char *)
char * agstrdup(Agraph_t *, const char *)
returns a pointer to a reference-counted copy of the argument string, creating one if necessary
Agraph_t * agsubg(Agraph_t *g, char *name, int cflag)
Agraph_t * graph(char *name)
NEATOPROCS_API void s1(graph_t *, node_t *)
static bool streq(const char *a, const char *b)
are a and b equal?