Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
attr.c File Reference

implementation of dynamic attributes More...

#include <cgraph/cghdr.h>
#include <cgraph/streq.h>
#include <cgraph/unreachable.h>
#include <stddef.h>
#include <stdbool.h>
Include dependency graph for attr.c:

Go to the source code of this file.

Macros

#define MINATTR   4 /* minimum allocation */
 

Functions

static void freesym (void *obj)
 
static void init_all_attrs (Agraph_t *g)
 
Agdatadict_tagdatadict (Agraph_t *g, bool cflag)
 
static Dict_tagdictof (Agraph_t *g, int kind)
 
static Agsym_tagnewsym (Agraph_t *g, const char *name, const char *value, int id, int kind)
 
static void agcopydict (Dict_t *src, Dict_t *dest, Agraph_t *g, int kind)
 
static Agdatadict_tagmakedatadict (Agraph_t *g)
 
static Agsym_tagdictsym (Dict_t *dict, char *name)
 
static Agsym_taglocaldictsym (Dict_t *dict, char *name)
 
Agsym_tagattrsym (void *obj, char *name)
 looks up a string attribute for a graph object given as an argument
 
static int topdictsize (Agobj_t *obj)
 
static Agrec_tagmakeattrs (Agraph_t *context, void *obj)
 
static void freeattr (Agobj_t *obj, Agattr_t *attr)
 
Agattr_tagattrrec (void *obj)
 
static void addattr (Agraph_t *g, Agobj_t *obj, Agsym_t *sym)
 
static Agsym_tgetattr (Agraph_t *g, int kind, char *name)
 
static void unviewsubgraphsattr (Agraph_t *parent, char *name)
 
static Agsym_tsetattr (Agraph_t *g, int kind, char *name, const char *value)
 
Agsym_tagattr (Agraph_t *g, int kind, char *name, const char *value)
 creates or looks up attributes of a graph
 
Agsym_tagnxtattr (Agraph_t *g, int kind, Agsym_t *attr)
 permits traversing the list of attributes of a given type
 
void agraphattr_init (Agraph_t *g)
 
int agraphattr_delete (Agraph_t *g)
 
void agnodeattr_init (Agraph_t *g, Agnode_t *n)
 
void agnodeattr_delete (Agnode_t *n)
 
void agedgeattr_init (Agraph_t *g, Agedge_t *e)
 
void agedgeattr_delete (Agedge_t *e)
 
char * agget (void *obj, char *name)
 
char * agxget (void *obj, Agsym_t *sym)
 
int agset (void *obj, char *name, const char *value)
 
int agxset (void *obj, Agsym_t *sym, const char *value)
 
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
 
static void agraphattr_init_wrapper (Agraph_t *g, Agobj_t *ignored1, void *ignored2)
 
int agcopyattr (void *oldobj, void *newobj)
 copies all of the attributes from one object to another
 

Variables

Dtdisc_t AgDataDictDisc
 
static char DataDictName [] = "_AG_datadict"
 
static Agdesc_t ProtoDesc
 
static Agraph_tProtoGraph
 
char * AgDataRecName = "_AG_strdata"
 

Macro Definition Documentation

◆ MINATTR

#define MINATTR   4 /* minimum allocation */

Definition at line 29 of file attr.c.

Function Documentation

◆ addattr()

static void addattr ( Agraph_t g,
Agobj_t obj,
Agsym_t sym 
)
static

Definition at line 235 of file attr.c.

References agattrrec(), agrealloc(), agstrdup(), Agsym_s::defval, Agsym_s::id, MINATTR, NULL, and Agattr_s::str.

Referenced by setattr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agcopydict()

static void agcopydict ( Dict_t src,
Dict_t dest,
Agraph_t g,
int  kind 
)
static

Definition at line 95 of file attr.c.

References agnewsym(), Agsym_s::defval, dtfirst, dtinsert, dtnext, dtsize(), Agsym_s::fixed, Agsym_s::id, kind, Agsym_s::name, and Agsym_s::print.

Referenced by agmakedatadict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agdictof()

static Dict_t * agdictof ( Agraph_t g,
int  kind 
)
static

Definition at line 57 of file attr.c.

References agdatadict(), agerrorf(), AGINEDGE, AGNODE, AGOUTEDGE, AGRAPH, Agdatadict_s::dict, Agdatadict_s::e, Agdatadict_s::g, kind, Agdatadict_s::n, and NULL.

Referenced by agmakeattrs(), agnxtattr(), getattr(), setattr(), and topdictsize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agdictsym()

static Agsym_t * agdictsym ( Dict_t dict,
char *  name 
)
static

Definition at line 137 of file attr.c.

References dtsearch, key, and Agsym_s::name.

Referenced by agattrsym(), aglocaldictsym(), getattr(), and setattr().

Here is the caller graph for this function:

◆ aglocaldictsym()

static Agsym_t * aglocaldictsym ( Dict_t dict,
char *  name 
)
static

Definition at line 145 of file attr.c.

References agdictsym(), dtview(), NULL, and view.

Referenced by agxset(), setattr(), and unviewsubgraphsattr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agmakeattrs()

static Agrec_t * agmakeattrs ( Agraph_t context,
void *  obj 
)
static

Definition at line 182 of file attr.c.

References agalloc(), agbindrec(), AgDataRecName, agdictof(), agraphof(), agroot(), agstrdup(), AGTYPE, Agsym_s::defval, Agattr_s::dict, dtfirst, dtnext, Agsym_s::id, MINATTR, NULL, Agattr_s::str, and topdictsize().

Referenced by agedgeattr_init(), agnodeattr_init(), and agraphattr_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agmakedatadict()

static Agdatadict_t * agmakedatadict ( Agraph_t g)
static

Definition at line 108 of file attr.c.

References agbindrec(), agcopydict(), agdatadict(), AgDataDictDisc, agdtopen(), AGEDGE, AGNODE, agparent(), AGRAPH, DataDictName, Agdatadict_s::dict, Dttree, dtview(), Agdatadict_s::e, Agdatadict_s::g, Agdatadict_s::n, and ProtoGraph.

Referenced by agraphattr_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agnewsym()

static Agsym_t * agnewsym ( Agraph_t g,
const char *  name,
const char *  value,
int  id,
int  kind 
)
static

Definition at line 84 of file attr.c.

References agalloc(), agstrdup(), Agsym_s::defval, id, Agsym_s::id, kind, Agsym_s::kind, and Agsym_s::name.

Referenced by agcopydict(), agxset(), setattr(), and unviewsubgraphsattr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agraphattr_init_wrapper()

static void agraphattr_init_wrapper ( Agraph_t g,
Agobj_t ignored1,
void *  ignored2 
)
static

Definition at line 519 of file attr.c.

References agraphattr_init().

Referenced by init_all_attrs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeattr()

static void freeattr ( Agobj_t obj,
Agattr_t attr 
)
static

Definition at line 208 of file attr.c.

References agfree(), agraphof(), agstrfree(), Agattr_s::str, and topdictsize().

Referenced by agedgeattr_delete(), agnodeattr_delete(), and agraphattr_delete().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freesym()

static void freesym ( void *  obj)
static

Definition at line 220 of file attr.c.

References Ag_G_global, agfree(), agstrfree(), Agsym_s::defval, and Agsym_s::name.

Here is the call graph for this function:

◆ getattr()

static Agsym_t * getattr ( Agraph_t g,
int  kind,
char *  name 
)
static

Definition at line 248 of file attr.c.

References agdictof(), agdictsym(), and kind.

Referenced by agattr(), and unviewsubgraphsattr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_all_attrs()

static void init_all_attrs ( Agraph_t g)
static

Definition at line 532 of file attr.c.

References agapply(), agedgeattr_init(), agfstnode(), agfstout(), agnodeattr_init(), agnxtnode(), agnxtout(), agraphattr_init_wrapper(), agroot(), and NULL.

Referenced by agdatadict().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setattr()

static Agsym_t * setattr ( Agraph_t g,
int  kind,
char *  name,
const char *  value 
)
static

Definition at line 278 of file attr.c.

References addattr(), agapply(), agdatadict(), agdictof(), agdictsym(), agfstnode(), agfstout(), AGINEDGE, aglocaldictsym(), agmethod_upd(), agnewsym(), AGNODE, agnxtnode(), agnxtout(), AGOUTEDGE, AGRAPH, agroot(), agstrdup(), agstrfree(), agwarningf(), agxset(), Agsym_s::defval, dtinsert, dtsize(), Agsym_s::id, kind, streq(), UNREACHABLE, and unviewsubgraphsattr().

Referenced by agattr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ topdictsize()

static int topdictsize ( Agobj_t obj)
static

Definition at line 173 of file attr.c.

References agdictof(), agraphof(), agroot(), AGTYPE, and dtsize().

Referenced by agmakeattrs(), agxget(), agxset(), and freeattr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unviewsubgraphsattr()

static void unviewsubgraphsattr ( Agraph_t parent,
char *  name 
)
static

Definition at line 258 of file attr.c.

References agdatadict(), agfstsubg(), aglocaldictsym(), agnewsym(), agnxtsubg(), AGRAPH, agroot(), agxget(), Agdatadict_s::dict, dtinsert, Agdatadict_s::g, getattr(), Agsym_s::id, and parent.

Referenced by setattr().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ AgDataDictDisc

Dtdisc_t AgDataDictDisc
Initial value:
= {
(int) offsetof(Agsym_t, name),
-1,
(int) offsetof(Agsym_t, link),
}
static void freesym(void *obj)
Definition attr.c:220
node NULL
Definition grammar.y:149
string attribute descriptor symbol in Agattr_s.dict
Definition cgraph.h:639

Definition at line 33 of file attr.c.

Referenced by agmakedatadict().

◆ AgDataRecName

char* AgDataRecName = "_AG_strdata"

Definition at line 171 of file attr.c.

Referenced by agattrrec(), agedgeattr_delete(), agmakeattrs(), agnodeattr_delete(), newedge(), and newnode().

◆ DataDictName

char DataDictName[] = "_AG_datadict"
static

Definition at line 42 of file attr.c.

Referenced by agdatadict(), and agmakedatadict().

◆ ProtoDesc

Agdesc_t ProtoDesc
static
Initial value:
= {.directed = true, .no_loop = true,
.no_write = true}

Definition at line 44 of file attr.c.

Referenced by agattr().

◆ ProtoGraph

Agraph_t* ProtoGraph
static

Definition at line 46 of file attr.c.

Referenced by agattr(), and agmakedatadict().