Graphviz  2.35.20130930.0449
Data Structures | Macros | Functions
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
 

Macros

#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)
 
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, int flags)
 
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)
 

Macro Definition Documentation

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

Definition at line 1148 of file utils.c.

#define MAXENTLEN   8

Definition at line 1406 of file utils.c.

Referenced by scanEntity().

#define PATHSEP   ":"

Definition at line 335 of file utils.c.

#define W_DEGREE   5

Definition at line 209 of file utils.c.

Referenced by Bezier().

Function Documentation

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

Definition at line 218 of file utils.c.

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

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

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 ND_pos, pointf_s::x, 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::limit, NULL, nodequeue::store, and nodequeue::tail.

Referenced by build_ranks().

pointf dotneato_closest ( splines spl,
pointf  pt 
)

Definition at line 476 of file utils.c.

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

Referenced by addEdgeLabels(), and edgeMidpoint().

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

Definition at line 1779 of file utils.c.

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

Referenced by setEdgeType().

Agedgeinfo_t* einf ( Agedge_t e)

Definition at line 2163 of file utils.c.

void enqueue ( nodequeue q,
node_t n 
)

Definition at line 49 of file utils.c.

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

Referenced by build_ranks(), and enqueue_neighbors().

char* Fgets ( FILE *  fp)

Definition at line 281 of file utils.c.

References grealloc().

Referenced by cat_libfile().

Agraph_t* findCluster ( Dt_t map,
char *  name 
)

Definition at line 2150 of file utils.c.

References clust_t::clp, dtmatch, and NULL.

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,
int  flags 
)

Definition at line 1894 of file utils.c.

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

Agraphinfo_t* ginf ( Agraph_t g)

Definition at line 2162 of file utils.c.

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

Definition at line 2030 of file utils.c.

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

void gv_free_splines ( edge_t e)

Definition at line 2002 of file utils.c.

References ED_spl, free(), i, and NULL.

Referenced by gv_cleanup_edge().

void gv_nodesize ( node_t n,
boolean  flip 
)

Definition at line 2045 of file utils.c.

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

Referenced by neato_init_node().

void gvToggle ( int  s)

Definition at line 609 of file utils.c.

References gvToggle().

Referenced by gvToggle(), and main().

char* htmlEntityUTF8 ( char *  s,
graph_t g 
)

Definition at line 1534 of file utils.c.

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

Referenced by make_html_label(), and make_label().

int is_a_cluster ( Agraph_t g)

Definition at line 932 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 agxget(), mapbool(), and NULL.

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 ag_xget, and NULL.

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

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

Definition at line 113 of file utils.c.

References late_string().

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

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

Definition at line 102 of file utils.c.

References agxget().

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

char* latin1ToUTF8 ( char *  s)

Definition at line 1626 of file utils.c.

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

Referenced by make_html_label(), and make_label().

boolean mapBool ( char *  p,
boolean  dflt 
)

Definition at line 453 of file utils.c.

References FALSE, strcasecmp(), and TRUE.

Referenced by mapbool().

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

Definition at line 442 of file utils.c.

References i, and streq.

Referenced by graph_init().

Dt_t* mkClustMap ( Agraph_t g)

Definition at line 2140 of file utils.c.

References dtopen(), and Dtoset.

Referenced by dot_compoundEdges(), and processClusterEdges().

pointf neato_closest ( splines spl,
pointf  p 
)

Definition at line 601 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 nodequeue::head, nodequeue::limit, N_NEW, NEW, nodequeue::store, and nodequeue::tail.

Referenced by build_ranks().

Agnodeinfo_t* ninf ( Agnode_t n)

Definition at line 2161 of file utils.c.

boolean overlap_edge ( edge_t e,
boxf  b 
)

Definition at line 1757 of file utils.c.

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

boolean overlap_label ( textlabel_t lp,
boxf  b 
)

Definition at line 1710 of file utils.c.

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

Referenced by overlap_edge().

boolean overlap_node ( node_t n,
boxf  b 
)

Definition at line 1693 of file utils.c.

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

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

Definition at line 1393 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 1413 of file utils.c.

References agxbput(), agxbputc, MAXENTLEN, and NR_OF_ENTITIES.

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 1869 of file utils.c.

References agget(), edgeType(), ET_NONE, 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 536 of file utils.c.

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

Referenced by neato_closest().

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

Definition at line 1963 of file utils.c.

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

Definition at line 1983 of file utils.c.

int test_toggle ( void  )

Definition at line 617 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 class1(), class2(), decompose(), nonconstraint_edge(), UF_setname(), and UF_union().

void UF_remove ( node_t u,
node_t v 
)

Definition at line 178 of file utils.c.

References assert, ND_UF_parent, and ND_UF_size.

void UF_setname ( node_t u,
node_t v 
)

Definition at line 192 of file utils.c.

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

Referenced by mark_clusters().

void UF_singleton ( node_t u)

Definition at line 185 of file utils.c.

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

Referenced by mark_clusters().

node_t* UF_union ( node_t u,
node_t v 
)

Definition at line 149 of file utils.c.

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

void undoClusterEdges ( graph_t g)

Definition at line 1353 of file utils.c.

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

Referenced by attach_attrs_and_arrows().

void updateBB ( graph_t g,
textlabel_t lp 
)

Definition at line 855 of file utils.c.

References GD_bb, and GD_flip.

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

char* utf8ToLatin1 ( char *  s)

Definition at line 1667 of file utils.c.

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

Referenced by ps_string().