77 agerrorf(
"agdictof: unknown kind %d\n", kind);
87 bool is_html,
int id,
int kind) {
89 sym->
kind = (
unsigned char) kind;
100 assert(
dtsize(dest) == 0);
121 assert(dd != parent_dd);
202 for (sym =
dtfirst(datadict); sym; sym =
dtnext(datadict, sym)) {
210 assert(rec->
dict == datadict);
222 for (i = 0; i < sz; i++)
245 assert(attr !=
NULL);
281 char *
const value =
agxget(subg, psym);
288static int agxset_(
void *obj,
Agsym_t *sym,
const char *value,
bool is_html);
294 Agsym_t *lsym, *psym, *rsym, *rv;
305 if (g != root &&
streq(name,
"layout"))
306 agwarningf(
"layout attribute is invalid except on the root graph\n");
316 lsym =
agnewsym(g, name, value, is_html, psym->
id, kind);
344 agxset_(g, rv, value, is_html);
365 rv =
setattr(g, kind, name, value, is_html);
372 return agattr_(g, kind, name, value,
false);
376 return agattr_(g, kind, name, value,
true);
492int agset(
void *obj,
char *name,
const char *value) {
500 rv =
agxset(obj, sym, value);
533 return agxset_(obj, sym, value,
false);
537 return agxset_(obj, sym, value,
true);
540int agsafeset(
void *obj,
char *name,
const char *value,
const char *def) {
546 return agxset(obj, a, value);
598 val =
agxget(oldobj, sym);
602 r =
agxset(newobj, newsym, val);
Memory allocation wrappers that exit on failure.
static void * gv_recalloc(void *ptr, size_t old_nmemb, size_t new_nmemb, size_t size)
static void * gv_calloc(size_t nmemb, size_t size)
static void * gv_alloc(size_t size)
int agapply(Agraph_t *g, Agobj_t *obj, agobjfn_t fn, void *arg, int preorder)
static void agraphattr_init_wrapper(Agraph_t *g, Agobj_t *ignored1, void *ignored2)
static Agsym_t * agdictsym(Dict_t *dict, char *name)
static int agxset_(void *obj, Agsym_t *sym, const char *value, bool is_html)
static void freeattr(Agobj_t *obj, Agattr_t *attr)
static Agdatadict_t * agmakedatadict(Agraph_t *g)
static Agraph_t * ProtoGraph
static Agsym_t * setattr(Agraph_t *g, int kind, char *name, const char *value, bool is_html)
static int topdictsize(Agobj_t *obj)
static Agdesc_t ProtoDesc
static Dict_t * agdictof(Agraph_t *g, int kind)
static void init_all_attrs(Agraph_t *g)
static Agsym_t * agnewsym(Agraph_t *g, const char *name, const char *value, bool is_html, int id, int kind)
static void addattr(Agraph_t *g, Agobj_t *obj, Agsym_t *sym)
static Agrec_t * agmakeattrs(Agraph_t *context, void *obj)
static void unviewsubgraphsattr(Agraph_t *parent, char *name)
static Agsym_t * aglocaldictsym(Dict_t *dict, char *name)
static void agcopydict(Dict_t *src, Dict_t *dest, Agraph_t *g, int kind)
static void freesym(void *obj)
static Agsym_t * agattr_(Agraph_t *g, int kind, char *name, const char *value, bool is_html)
static char DataDictName[]
static Agsym_t * getattr(Agraph_t *g, int kind, char *name)
CDT_API int dtsize(Dt_t *)
CDT_API Dt_t * dtview(Dt_t *, Dt_t *)
CDT_API Dtmethod_t * Dttree
Dict_t * agdtopen(Dtdisc_t *disc, Dtmethod_t *method)
int agdtclose(Agraph_t *g, Dict_t *dict)
Agattr_t * agattrrec(void *obj)
void agnodeattr_init(Agraph_t *g, Agnode_t *n)
void agnodeattr_delete(Agnode_t *n)
Agsym_t * agattrsym(void *obj, char *name)
looks up a string attribute for a graph object given as an argument
Agsym_t * agattr(Agraph_t *g, int kind, char *name, const char *value)
creates or looks up attributes of a graph
int agset(void *obj, char *name, const char *value)
Agsym_t * agnxtattr(Agraph_t *g, int kind, Agsym_t *attr)
permits traversing the list of attributes of a given type
void agedgeattr_init(Agraph_t *g, Agedge_t *e)
int agxset(void *obj, Agsym_t *sym, const char *value)
void agraphattr_init(Agraph_t *g)
int agxset_html(void *obj, Agsym_t *sym, const char *value)
char * agget(void *obj, char *name)
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
void agedgeattr_delete(Agedge_t *e)
Agdatadict_t * agdatadict(Agraph_t *g, bool cflag)
char * agxget(void *obj, Agsym_t *sym)
int agcopyattr(void *oldobj, void *newobj)
copies all of the attributes from one object to another
int agraphattr_delete(Agraph_t *g)
Agsym_t * agattr_html(Agraph_t *g, int kind, char *name, const char *value)
agattr, but creates HTML-like values
void agmethod_upd(Agraph_t *g, void *obj, Agsym_t *sym)
Agedge_t * agfstout(Agraph_t *g, Agnode_t *n)
Agedge_t * agnxtout(Agraph_t *g, Agedge_t *e)
void agwarningf(const char *fmt,...)
void agerrorf(const char *fmt,...)
void(* agobjfn_t)(Agraph_t *g, Agobj_t *obj, void *arg)
Agraph_t * agopen(char *name, Agdesc_t desc, Agdisc_t *disc)
creates a new graph with the given name and kind
Agnode_t * agnxtnode(Agraph_t *g, Agnode_t *n)
Agnode_t * agfstnode(Agraph_t *g)
Agraph_t * agraphof(void *obj)
#define AGTYPE(obj)
returns AGRAPH, AGNODE, or AGEDGE depending on the type of the object
Agraph_t * agroot(void *obj)
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
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
int agdelrec(void *obj, const char *name)
deletes a named record from one object
int aghtmlstr(const char *)
int agstrfree(Agraph_t *, const char *, bool is_html)
char * agstrdup(Agraph_t *, const char *)
returns a pointer to a reference-counted copy of the argument string, creating one if necessary
char * agstrdup_html(Agraph_t *, const char *)
Agraph_t * agparent(Agraph_t *g)
Agraph_t * agfstsubg(Agraph_t *g)
Agraph_t * agnxtsubg(Agraph_t *subg)
static bool streq(const char *a, const char *b)
are a and b equal?
string attribute container
char ** str
the attribute string values indexed by Agsym_s.id
Dict_t * dict
shared dict of Agsym_s to interpret Agattr_s.str
struct Agdatadict_s::@64 dict
Agrec_t h
< set of dictionaries per graph
a generic header of Agraph_s, Agnode_s and Agedge_s
Agtag_t tag
access with AGTAG
implementation of Agrec_t
unsigned objtype
access with AGTYPE