Graphviz  2.31.20130525.0447
Data Structures | Defines | Functions
lib/common/utils.c File Reference
#include "render.h"
#include "agxbuf.h"
#include "htmltable.h"
#include "entities.h"
#include "logic.h"
#include "gvc.h"
#include <unistd.h>
#include <ctype.h>
#include <pwd.h>
#include <string.h>
Include dependency graph for utils.c:

Go to the source code of this file.

Data Structures

struct  fontinfo
struct  item
struct  clust_t

Defines

#define W_DEGREE   5
#define PATHSEP   ":"
#define MAPC(n)   (strncmp(agnameof(n),"cluster",7)?NULL:findCluster(cmap,agnameof(n)))
#define MAXENTLEN   8

Functions

nodequeuenew_queue (int sz)
void free_queue (nodequeue *q)
void enqueue (nodequeue *q, node_t *n)
node_tdequeue (nodequeue *q)
int late_int (void *obj, attrsym_t *attr, int def, int low)
double late_double (void *obj, attrsym_t *attr, double def, double low)
char * late_string (void *obj, attrsym_t *attr, char *def)
char * late_nnstring (void *obj, attrsym_t *attr, char *def)
boolean late_bool (void *obj, attrsym_t *attr, int def)
node_tUF_find (node_t *n)
node_tUF_union (node_t *u, node_t *v)
void UF_remove (node_t *u, node_t *v)
void UF_singleton (node_t *u)
void UF_setname (node_t *u, node_t *v)
pointf coord (node_t *n)
boolean findStopColor (char *colorlist, char *clrs[2])
pointf Bezier (pointf *V, int degree, double t, pointf *Left, pointf *Right)
char * Fgets (FILE *fp)
const char * safefile (const char *filename)
int maptoken (char *p, char **name, int *val)
boolean mapBool (char *p, boolean dflt)
boolean mapbool (char *p)
pointf dotneato_closest (splines *spl, pointf pt)
pointf spline_at_y (splines *spl, double y)
pointf neato_closest (splines *spl, pointf p)
void gvToggle (int s)
int test_toggle ()
void common_init_node (node_t *n)
int common_init_edge (edge_t *e)
void updateBB (graph_t *g, textlabel_t *lp)
void compute_bb (graph_t *g)
int is_a_cluster (Agraph_t *g)
Agsym_tsetAttr (graph_t *g, void *obj, char *name, char *value, Agsym_t *ap)
int processClusterEdges (graph_t *g)
void undoClusterEdges (graph_t *g)
attrsym_tsafe_dcl (graph_t *g, int obj_kind, char *name, char *def)
char * scanEntity (char *t, agxbuf *xb)
char * htmlEntityUTF8 (char *s, graph_t *g)
char * latin1ToUTF8 (char *s)
char * utf8ToLatin1 (char *s)
boolean overlap_node (node_t *n, boxf b)
boolean overlap_label (textlabel_t *lp, boxf b)
boolean overlap_edge (edge_t *e, boxf b)
int edgeType (char *s, int dflt)
void setEdgeType (graph_t *g, int dflt)
void get_gradient_points (pointf *A, pointf *G, int n, float angle, boolean isRadial)
int strcasecmp (const char *s1, const char *s2)
int strncasecmp (const char *s1, const char *s2, unsigned int n)
void gv_free_splines (edge_t *e)
void gv_cleanup_edge (edge_t *e)
void gv_cleanup_node (node_t *n)
void gv_nodesize (node_t *n, boolean flip)
double drand48 (void)
Dt_tmkClustMap (Agraph_t *g)
Agraph_tfindCluster (Dt_t *map, char *name)
Agnodeinfo_tninf (Agnode_t *n)
Agraphinfo_tginf (Agraph_t *g)
Agedgeinfo_teinf (Agedge_t *e)

Define Documentation

#define MAPC (   n)    (strncmp(agnameof(n),"cluster",7)?NULL:findCluster(cmap,agnameof(n)))

Definition at line 1180 of file utils.c.

#define MAXENTLEN   8

Definition at line 1438 of file utils.c.

Referenced by scanEntity().

#define PATHSEP   ":"

Definition at line 379 of file utils.c.

#define W_DEGREE   5

Definition at line 253 of file utils.c.

Referenced by Bezier().


Function Documentation

pointf Bezier ( pointf V,
int  degree,
double  t,
pointf Left,
pointf Right 
)

Definition at line 262 of file utils.c.

References W_DEGREE, pointf_s::x, pointf_s::y, and NULL.

Referenced by update_bb_bz(), bezier_clip(), place_portlabel(), dotneato_closest(), and spline_at_y().

int common_init_edge ( edge_t e)
void common_init_node ( node_t n)
void compute_bb ( graph_t g)
pointf coord ( node_t n)

Definition at line 199 of file utils.c.

References pointf_s::x, ND_pos, and pointf_s::y.

Referenced by compute_bb(), and right_of().

node_t* dequeue ( nodequeue q)

Definition at line 56 of file utils.c.

References nodequeue::head, nodequeue::tail, NULL, nodequeue::limit, and nodequeue::store.

Referenced by build_ranks().

pointf dotneato_closest ( splines spl,
pointf  pt 
)

Definition at line 520 of file utils.c.

References splines::size, splines::list, bezier::size, pointf_s::x, bezier::list, pointf_s::y, Bezier(), and NULL.

Referenced by edgeMidpoint(), and addEdgeLabels().

double drand48 ( void  )
int edgeType ( char *  s,
int  dflt 
)

Definition at line 1811 of file utils.c.

References ET_NONE, ET_LINE, ET_SPLINE, strcasecmp(), ET_CURVED, ET_COMPOUND, ET_ORTHO, ET_PLINE, agerr(), and AGWARN.

Referenced by setEdgeType().

Agedgeinfo_t* einf ( Agedge_t e)

Definition at line 2176 of file utils.c.

void enqueue ( nodequeue q,
node_t n 
)

Definition at line 49 of file utils.c.

References nodequeue::tail, nodequeue::limit, and nodequeue::store.

Referenced by build_ranks(), and enqueue_neighbors().

char* Fgets ( FILE *  fp)

Definition at line 325 of file utils.c.

References grealloc().

Referenced by cat_libfile().

Agraph_t* findCluster ( Dt_t map,
char *  name 
)

Definition at line 2163 of file utils.c.

References dtmatch, clust_t::clp, and NULL.

boolean findStopColor ( char *  colorlist,
char *  clrs[2] 
)

Definition at line 220 of file utils.c.

References NULL, FALSE, N_GNEW, and TRUE.

Referenced by emit_clusters().

void free_queue ( nodequeue q)

Definition at line 43 of file utils.c.

References free(), and nodequeue::store.

Referenced by build_ranks().

void get_gradient_points ( pointf A,
pointf G,
int  n,
float  angle,
boolean  isRadial 
)

Definition at line 1924 of file utils.c.

References max, pointf_s::x, pointf_s::y, MIN, and MAX.

Agraphinfo_t* ginf ( Agraph_t g)

Definition at line 2175 of file utils.c.

void gv_cleanup_edge ( edge_t e)
void gv_cleanup_node ( node_t n)

Definition at line 2043 of file utils.c.

References ND_pos, free(), ND_shape, free_label(), ND_label, and ND_xlabel.

void gv_free_splines ( edge_t e)

Definition at line 2015 of file utils.c.

References ED_spl, free(), and NULL.

Referenced by gv_cleanup_edge().

void gv_nodesize ( node_t n,
boolean  flip 
)

Definition at line 2058 of file utils.c.

References ND_height, ND_lw, ND_rw, ND_ht, and ND_width.

Referenced by neato_init_node().

void gvToggle ( int  s)

Definition at line 653 of file utils.c.

References gvToggle().

Referenced by main(), and gvToggle().

char* htmlEntityUTF8 ( char *  s,
graph_t g 
)

Definition at line 1566 of file utils.c.

References agxbinit(), agxbputc, agerr(), AGWARN, agxbuse, and agxbfree().

Referenced by make_html_label(), and make_label().

int is_a_cluster ( Agraph_t g)

Definition at line 964 of file utils.c.

References Agraph_t::root, and strncasecmp().

boolean late_bool ( void *  obj,
attrsym_t attr,
int  def 
)

Definition at line 121 of file utils.c.

References NULL, mapbool(), and agxget().

double late_double ( void *  obj,
attrsym_t attr,
double  def,
double  low 
)
int late_int ( void *  obj,
attrsym_t attr,
int  def,
int  low 
)

Definition at line 69 of file utils.c.

References NULL, and ag_xget.

Referenced by emit_clusters(), graph_init(), common_init_node(), dot_layout(), fdp_init_graph(), and fdp_initParams().

char* late_nnstring ( void *  obj,
attrsym_t attr,
char *  def 
)

Definition at line 113 of file utils.c.

References late_string().

Referenced by emit_clusters(), do_graph_label(), write_plain(), findAttrColor(), and common_init_node().

char* late_string ( void *  obj,
attrsym_t attr,
char *  def 
)

Definition at line 102 of file utils.c.

References agxget().

Referenced by emit_graph(), graph_init(), late_nnstring(), and common_init_edge().

char* latin1ToUTF8 ( char *  s)

Definition at line 1658 of file utils.c.

References agxbinit(), agxbputc, agxbuse, and agxbfree().

Referenced by make_html_label(), and make_label().

boolean mapBool ( char *  p,
boolean  dflt 
)

Definition at line 497 of file utils.c.

References strcasecmp(), FALSE, and TRUE.

Referenced by mapbool().

boolean mapbool ( char *  p)
int maptoken ( char *  p,
char **  name,
int *  val 
)

Definition at line 486 of file utils.c.

References streq.

Referenced by graph_init().

Dt_t* mkClustMap ( Agraph_t g)

Definition at line 2153 of file utils.c.

References dtopen(), and Dtoset.

Referenced by processClusterEdges(), and dot_compoundEdges().

pointf neato_closest ( splines spl,
pointf  p 
)

Definition at line 645 of file utils.c.

References spline_at_y(), and pointf_s::y.

nodequeue* new_queue ( int  sz)

Definition at line 32 of file utils.c.

References NEW, nodequeue::head, nodequeue::tail, nodequeue::store, N_NEW, and nodequeue::limit.

Referenced by build_ranks().

Agnodeinfo_t* ninf ( Agnode_t n)

Definition at line 2174 of file utils.c.

boolean overlap_edge ( edge_t e,
boxf  b 
)

Definition at line 1789 of file utils.c.

References ED_spl, splines::bb, splines::size, splines::list, TRUE, ED_label, overlap_label(), and FALSE.

boolean overlap_label ( textlabel_t lp,
boxf  b 
)

Definition at line 1742 of file utils.c.

References pointf_s::x, textlabel_t::dimen, pointf_s::y, boxf::LL, textlabel_t::pos, and boxf::UR.

Referenced by overlap_edge().

boolean overlap_node ( node_t n,
boxf  b 
)

Definition at line 1725 of file utils.c.

References ND_bb, FALSE, ND_coord, boxf::UR, boxf::LL, inside_t::s, inside_t::n, inside_t::bp, NULL, and ND_shape.

int processClusterEdges ( graph_t g)
attrsym_t* safe_dcl ( graph_t g,
int  obj_kind,
char *  name,
char *  def 
)

Definition at line 1425 of file utils.c.

References agattr(), and NULL.

Referenced by attach_attrs_and_arrows().

const char* safefile ( const char *  filename)
char* scanEntity ( char *  t,
agxbuf xb 
)

Definition at line 1445 of file utils.c.

References MAXENTLEN, agxbputc, entities_s::name, NR_OF_ENTITIES, entities_s::value, and agxbput().

Agsym_t* setAttr ( graph_t g,
void *  obj,
char *  name,
char *  value,
Agsym_t ap 
)
void setEdgeType ( graph_t g,
int  dflt 
)

Definition at line 1901 of file utils.c.

References agget(), ET_NONE, edgeType(), and GD_flags.

Referenced by circo_init_graph(), dot_layout(), fdp_init_graph(), neato_layout(), and twopi_init_graph().

pointf spline_at_y ( splines spl,
double  y 
)

Definition at line 580 of file utils.c.

References NULL, splines::size, splines::list, BETWEEN, bezier::list, bezier::size, pointf_s::y, assert, pointf_s::x, Bezier(), and ABS.

Referenced by neato_closest().

int strcasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 1976 of file utils.c.

int strncasecmp ( const char *  s1,
const char *  s2,
unsigned int  n 
)

Definition at line 1996 of file utils.c.

int test_toggle ( void  )

Definition at line 661 of file utils.c.

Referenced by move_node().

node_t* UF_find ( node_t n)

Definition at line 134 of file utils.c.

References ND_UF_parent.

Referenced by UF_union(), UF_setname(), nonconstraint_edge(), class1(), class2(), and decompose().

void UF_remove ( node_t u,
node_t v 
)

Definition at line 178 of file utils.c.

References assert, ND_UF_size, and ND_UF_parent.

void UF_setname ( node_t u,
node_t v 
)

Definition at line 192 of file utils.c.

References assert, UF_find(), ND_UF_parent, and ND_UF_size.

Referenced by mark_clusters().

void UF_singleton ( node_t u)

Definition at line 185 of file utils.c.

References ND_UF_size, ND_UF_parent, NULL, ND_ranktype, and NORMAL.

Referenced by mark_clusters().

node_t* UF_union ( node_t u,
node_t v 
)

Definition at line 149 of file utils.c.

References ND_UF_parent, NULL, ND_UF_size, UF_find(), and ND_id.

void undoClusterEdges ( graph_t g)

Definition at line 1385 of file utils.c.

References agsubg(), TRUE, agfstnode(), agnxtnode(), agfstout(), agnxtout(), agdelete(), and agclose().

Referenced by attach_attrs_and_arrows().

void updateBB ( graph_t g,
textlabel_t lp 
)

Definition at line 899 of file utils.c.

References GD_bb, and GD_flip.

Referenced by makePortLabels(), addEdgeLabels(), and makeSelfArcs().

char* utf8ToLatin1 ( char *  s)

Definition at line 1699 of file utils.c.

References agxbinit(), agxbputc, agxbuse, and agxbfree().

Referenced by ps_string().