21%define api.prefix {aag}
49static const char Key[] =
"key";
82static void attrstmt(
int tkind,
char *macroname);
83static void startgraph(
char *name,
bool directed,
bool strict);
87static void appendattr(
char *name,
char *value);
94static char*
concat(
char*,
char*);
118%type <i> optstrict graphtype
rcompound attrtype
119%type <str> optsubghdr optgraphname optmacroname atom
qatom
140optstmtlist : stmtlist | ;
142stmtlist : stmtlist stmt | stmt ;
177optmacroname : atom
'=' {
$$ =
$1;}
185optattrdefs : optattrdefs attrdefs
188attrdefs : attrassignment optseparator
205optseparator :
';' |
',' | ;
256 for (p = ilist; p; p = pn) {
283 assert(value !=
NULL);
293 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next) {
294 assert(aptr->tag ==
T_atom);
298 aptr->u.asym =
agattr(
S->g,kind,name,
"");
309 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next) {
310 if (aptr->tag ==
T_attr) {
312 agxset(obj,aptr->u.asym,aptr->str);
317 assert(aptr->tag ==
T_atom);
325 agwarningf(
"attribute macros not implemented");
341 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next)
351 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next) {
353 if (aptr->tag ==
T_atom)
continue;
354 if (!aptr->u.asym->fixed ||
S->g !=
G)
355 sym =
agattr(
S->g,kind,aptr->u.asym->name,aptr->str);
388 for (ptr =
S->nodelist.first; ptr; ptr = ptr->next)
402 if (
S->nodelist.first) {
404 S->nodelist.first =
S->nodelist.last =
NULL;
406 else {
if (
S->subg) v =
cons_subg(
S->subg);
S->subg = 0;}
423 for (aptr =
S->attrlist.first; aptr; aptr = aptr->next) {
429 for (p =
S->edgelist.first; p->next; p = p->next) {
436 for (tptr = p->u.list; tptr; tptr = tptr->next)
437 edgerhs(tptr->u.n,tptr->str,p->next,key);
454 size_t len = strlen(
s1) + strlen(s2) + 1;
456 if (
len <= BUFSIZ) sym = buf;
463 if (sym != buf)
free (sym);
488 subg = hlist->u.subg;
493 for (hptr = hlist->u.list; hptr; hptr = hptr->next)
512 e =
agedge(
S->g, t, h, key, 1);
519 temp = tp; tp = hp; hp = temp;
530static 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 WUR 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)
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 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)
textitem scanner parser str
NEATOPROCS_API void s1(graph_t *, node_t *)
static bool streq(const char *a, const char *b)
are a and b equal?