Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
xdot.c File Reference
#include <cgraph/agxbuf.h>
#include <cgraph/alloc.h>
#include <cgraph/gv_ctype.h>
#include <cgraph/prisize_t.h>
#include <cgraph/unreachable.h>
#include <xdot/xdot.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for xdot.c:

Go to the source code of this file.

Macros

#define CHK(s)   if(!s){*error=1;return 0;}
 
#define XDBSIZE   100
 
#define CHK1(s)   if(!s){free(stops);return NULL;}
 

Typedefs

typedef int(* pf) (void *, char *,...)
 
typedef void(* print_op) (xdot_op *op, pf print, void *info, int more)
 

Functions

static char * parseReal (char *s, double *fp)
 
static char * parseInt (char *s, int *ip)
 
static char * parseUInt (char *s, unsigned int *ip)
 
static char * parseRect (char *s, xdot_rect *rp)
 
static char * parsePolyline (char *s, xdot_polyline *pp)
 
static char * parseString (char *s, char **sp)
 
static char * parseAlign (char *s, xdot_align *ap)
 
static char * parseOp (xdot_op *op, char *s, drawfunc_t ops[], int *error)
 
xdotparseXDotFOn (char *s, drawfunc_t fns[], size_t sz, xdot *x)
 
xdotparseXDotF (char *s, drawfunc_t fns[], size_t sz)
 
xdotparseXDot (char *s)
 
static void printRect (xdot_rect *r, pf print, void *info)
 
static void printPolyline (xdot_polyline *p, pf print, void *info)
 
static void printString (char *p, pf print, void *info)
 
static void printFloat (double f, pf print, void *info, int space)
 
static void printAlign (xdot_align a, pf print, void *info)
 
static void toGradString (agxbuf *xb, xdot_color *cp)
 
static void printXDot_Op (xdot_op *op, pf print, void *info, int more)
 
static void jsonRect (xdot_rect *r, pf print, void *info)
 
static void jsonPolyline (xdot_polyline *p, pf print, void *info)
 
static void jsonString (char *p, pf print, void *info)
 
static void jsonXDot_Op (xdot_op *op, pf print, void *info, int more)
 
static void _printXDot (xdot *x, pf print, void *info, print_op ofn)
 
char * sprintXDot (xdot *x)
 
void fprintXDot (FILE *fp, xdot *x)
 
void jsonXDot (FILE *fp, xdot *x)
 
static void freeXOpData (xdot_op *x)
 
void freeXDot (xdot *x)
 
int statXDot (xdot *x, xdot_stats *sp)
 
static char * radGradient (char *cp, xdot_color *clr)
 
static char * linGradient (char *cp, xdot_color *clr)
 
char * parseXDotColor (char *cp, xdot_color *clr)
 
void freeXDotColor (xdot_color *cp)
 

Macro Definition Documentation

◆ CHK

#define CHK (   s)    if(!s){*error=1;return 0;}

Definition at line 167 of file xdot.c.

◆ CHK1

#define CHK1 (   s)    if(!s){free(stops);return NULL;}

Definition at line 860 of file xdot.c.

◆ XDBSIZE

#define XDBSIZE   100

Definition at line 337 of file xdot.c.

Typedef Documentation

◆ pf

typedef int(* pf) (void *, char *,...)

Definition at line 405 of file xdot.c.

◆ print_op

typedef void(* print_op) (xdot_op *op, pf print, void *info, int more)

Definition at line 514 of file xdot.c.

Function Documentation

◆ _printXDot()

static void _printXDot ( xdot x,
pf  print,
void *  info,
print_op  ofn 
)
static

Definition at line 714 of file xdot.c.

References cnt(), xdot::cnt, xdot::ops, print(), and xdot::sz.

Referenced by fprintXDot(), jsonXDot(), and sprintXDot().

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

◆ fprintXDot()

void fprintXDot ( FILE *  fp,
xdot x 
)

Definition at line 731 of file xdot.c.

References _printXDot(), and printXDot_Op().

Here is the call graph for this function:

◆ freeXDot()

void freeXDot ( xdot x)

Definition at line 782 of file xdot.c.

References xdot::cnt, free(), xdot::freefunc, freeXOpData(), xdot::ops, and xdot::sz.

Referenced by edge_spline(), edge_xdot(), graph_cleanup(), renderNodes(), renderSelectedEdges(), renderSelectedNodes(), and write_xdots().

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

◆ freeXDotColor()

void freeXDotColor ( xdot_color cp)

Definition at line 974 of file xdot.c.

References xdot_color_stop::color, free(), xdot_color::ling, xdot_linear_grad::n_stops, xdot_radial_grad::n_stops, xdot_color::ring, xdot_linear_grad::stops, xdot_radial_grad::stops, xdot_color::type, xdot_color::u, xd_linear, and xd_radial.

Referenced by freeXOpData().

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

◆ freeXOpData()

static void freeXOpData ( xdot_op x)
static

Definition at line 743 of file xdot.c.

References _xdot_op::color, _xdot_op::font, free(), freeXDotColor(), _xdot_op::grad_color, _xdot_op::image, _xdot_op::kind, xdot_image::name, xdot_font::name, _xdot_op::polyline, xdot_polyline::pts, _xdot_op::style, xdot_text::text, _xdot_op::text, _xdot_op::u, xd_fill_color, xd_filled_bezier, xd_filled_polygon, xd_font, xd_grad_fill_color, xd_grad_pen_color, xd_image, xd_pen_color, xd_polyline, xd_style, xd_text, xd_unfilled_bezier, and xd_unfilled_polygon.

Referenced by freeXDot().

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

◆ jsonPolyline()

static void jsonPolyline ( xdot_polyline p,
pf  print,
void *  info 
)
static

Definition at line 602 of file xdot.c.

References cnt(), xdot_polyline::cnt, print(), xdot_polyline::pts, xdot_point::x, and xdot_point::y.

Referenced by jsonXDot_Op().

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

◆ jsonRect()

static void jsonRect ( xdot_rect r,
pf  print,
void *  info 
)
static

Definition at line 597 of file xdot.c.

References xdot_rect::h, print(), xdot_rect::w, xdot_rect::x, and xdot_rect::y.

Referenced by jsonXDot_Op().

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

◆ jsonString()

static void jsonString ( char *  p,
pf  print,
void *  info 
)
static

Definition at line 612 of file xdot.c.

References print().

Referenced by jsonXDot_Op().

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

◆ jsonXDot()

void jsonXDot ( FILE *  fp,
xdot x 
)

Definition at line 736 of file xdot.c.

References _printXDot(), and jsonXDot_Op().

Here is the call graph for this function:

◆ jsonXDot_Op()

static void jsonXDot_Op ( xdot_op op,
pf  print,
void *  info,
int  more 
)
static

◆ linGradient()

static char * linGradient ( char *  cp,
xdot_color clr 
)
static

Definition at line 908 of file xdot.c.

References CHK1, color(), xdot_color_stop::frac, gv_calloc(), xdot_color::ling, xdot_linear_grad::n_stops, NULL, parseInt(), parseReal(), parseString(), xdot_linear_grad::stops, xdot_color::type, xdot_color::u, xdot_linear_grad::x0, xdot_linear_grad::x1, xd_linear, xdot_linear_grad::y0, and xdot_linear_grad::y1.

Referenced by parseXDotColor().

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

◆ parseAlign()

static char * parseAlign ( char *  s,
xdot_align ap 
)
static

Definition at line 153 of file xdot.c.

References parseInt(), xd_center, xd_left, and xd_right.

Referenced by parseOp().

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

◆ parseInt()

static char * parseInt ( char *  s,
int *  ip 
)
static

Definition at line 34 of file xdot.c.

Referenced by linGradient(), parseAlign(), parseString(), and radGradient().

Here is the caller graph for this function:

◆ parseOp()

◆ parsePolyline()

static char * parsePolyline ( char *  s,
xdot_polyline pp 
)
static

Definition at line 87 of file xdot.c.

References xdot_polyline::cnt, free(), gv_calloc(), NULL, parseUInt(), ps, and xdot_polyline::pts.

Referenced by parseOp().

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

◆ parseReal()

static char * parseReal ( char *  s,
double *  fp 
)
static

Definition at line 21 of file xdot.c.

Referenced by linGradient(), parseOp(), and radGradient().

Here is the caller graph for this function:

◆ parseRect()

static char * parseRect ( char *  s,
xdot_rect rp 
)
static

Definition at line 56 of file xdot.c.

References xdot_rect::h, xdot_rect::w, xdot_rect::x, and xdot_rect::y.

Referenced by parseOp().

Here is the caller graph for this function:

◆ parseString()

static char * parseString ( char *  s,
char **  sp 
)
static

Definition at line 120 of file xdot.c.

References agxbdisown(), agxbfree(), agxbputc(), and parseInt().

Referenced by linGradient(), parseOp(), and radGradient().

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

◆ parseUInt()

static char * parseUInt ( char *  s,
unsigned int *  ip 
)
static

Definition at line 45 of file xdot.c.

Referenced by parseOp(), and parsePolyline().

Here is the caller graph for this function:

◆ parseXDot()

xdot * parseXDot ( char *  s)

Definition at line 400 of file xdot.c.

References parseXDotF().

Referenced by write_xdots().

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

◆ parseXDotColor()

char * parseXDotColor ( char *  cp,
xdot_color clr 
)

Definition at line 946 of file xdot.c.

References xdot_color::clr, gv_isalnum(), linGradient(), NULL, radGradient(), xdot_color::type, xdot_color::u, and xd_none.

Referenced by parseOp().

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

◆ parseXDotF()

xdot * parseXDotF ( char *  s,
drawfunc_t  fns[],
size_t  sz 
)

Definition at line 396 of file xdot.c.

References NULL, and parseXDotFOn().

Referenced by init_xdot(), and parseXDot().

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

◆ parseXDotFOn()

xdot * parseXDotFOn ( char *  s,
drawfunc_t  fns[],
size_t  sz,
xdot x 
)

Definition at line 343 of file xdot.c.

References xdot::cnt, error(), xdot::flags, free(), gv_alloc(), gv_calloc(), gv_recalloc(), NULL, ops, xdot::ops, parseOp(), xdot::sz, XDBSIZE, and XDOT_PARSE_ERROR.

Referenced by parseXDotF(), and parseXdotwithattrs().

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

◆ printAlign()

static void printAlign ( xdot_align  a,
pf  print,
void *  info 
)
static

Definition at line 459 of file xdot.c.

References print(), UNREACHABLE, xd_center, xd_left, and xd_right.

Referenced by jsonXDot_Op(), and printXDot_Op().

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

◆ printFloat()

static void printFloat ( double  f,
pf  print,
void *  info,
int  space 
)
static

Definition at line 447 of file xdot.c.

References agxbfree(), agxbprint(), agxbuf_trim_zeros(), agxbuse(), and print().

Referenced by jsonXDot_Op(), printXDot_Op(), and toGradString().

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

◆ printPolyline()

static void printPolyline ( xdot_polyline p,
pf  print,
void *  info 
)
static

Definition at line 426 of file xdot.c.

References agxbfree(), agxbprint(), agxbuf_trim_zeros(), agxbuse(), xdot_polyline::cnt, print(), PRISIZE_T, xdot_polyline::pts, xdot_point::x, and xdot_point::y.

Referenced by printXDot_Op().

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

◆ printRect()

static void printRect ( xdot_rect r,
pf  print,
void *  info 
)
static

Definition at line 407 of file xdot.c.

References agxbfree(), agxbprint(), agxbuf_trim_zeros(), agxbuse(), xdot_rect::h, print(), xdot_rect::w, xdot_rect::x, and xdot_rect::y.

Referenced by printXDot_Op().

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

◆ printString()

static void printString ( char *  p,
pf  print,
void *  info 
)
static

Definition at line 442 of file xdot.c.

References print(), and PRISIZE_T.

Referenced by printXDot_Op(), and toGradString().

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

◆ printXDot_Op()

static void printXDot_Op ( xdot_op op,
pf  print,
void *  info,
int  more 
)
static

◆ radGradient()

static char * radGradient ( char *  cp,
xdot_color clr 
)
static

Definition at line 867 of file xdot.c.

References CHK1, color(), xdot_color_stop::frac, gv_calloc(), xdot_radial_grad::n_stops, NULL, parseInt(), parseReal(), parseString(), xdot_radial_grad::r0, xdot_radial_grad::r1, xdot_color::ring, xdot_radial_grad::stops, xdot_color::type, xdot_color::u, xdot_radial_grad::x0, xdot_radial_grad::x1, xd_radial, xdot_radial_grad::y0, and xdot_radial_grad::y1.

Referenced by parseXDotColor().

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

◆ sprintXDot()

char * sprintXDot ( xdot x)

Definition at line 724 of file xdot.c.

References _printXDot(), agxbdisown(), agxbprint(), and printXDot_Op().

Here is the call graph for this function:

◆ statXDot()

◆ toGradString()

static void toGradString ( agxbuf xb,
xdot_color cp 
)
static

Definition at line 477 of file xdot.c.

References agxbprint(), agxbputc(), color(), xdot_color::ling, xdot_linear_grad::n_stops, xdot_radial_grad::n_stops, printFloat(), printString(), xdot_radial_grad::r0, xdot_radial_grad::r1, xdot_color::ring, xdot_linear_grad::stops, xdot_radial_grad::stops, xdot_color::type, xdot_color::u, xdot_linear_grad::x0, xdot_radial_grad::x0, xdot_linear_grad::x1, xdot_radial_grad::x1, xd_linear, xdot_linear_grad::y0, xdot_radial_grad::y0, xdot_linear_grad::y1, and xdot_radial_grad::y1.

Referenced by jsonXDot_Op(), and printXDot_Op().

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