Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
gvrender_core_dot.c File Reference
#include "config.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <common/macros.h>
#include <common/const.h>
#include <gvc/gvplugin_render.h>
#include <gvc/gvplugin_device.h>
#include <cgraph/alloc.h>
#include <cgraph/agxbuf.h>
#include <cgraph/gv_ctype.h>
#include <cgraph/prisize_t.h>
#include <cgraph/streq.h>
#include <cgraph/unreachable.h>
#include <common/utils.h>
#include <gvc/gvc.h>
#include <gvc/gvio.h>
#include "core_loadimage_xdot.h"
Include dependency graph for gvrender_core_dot.c:

Go to the source code of this file.

Data Structures

struct  xdot_state_t
 

Macros

#define XDOTVERSION   "1.7"
 
#define NUMXBUFS   (EMIT_HLABEL+1)
 

Typedefs

typedef int(* putstrfn) (void *chan, const char *str)
 
typedef int(* flushfn) (void *chan)
 

Enumerations

enum  format_type {
  FORMAT_DOT , FORMAT_CANON , FORMAT_PLAIN , FORMAT_PLAIN_EXT ,
  FORMAT_XDOT , FORMAT_XDOT12 , FORMAT_XDOT14
}
 

Functions

static void xdot_str_xbuf (agxbuf *xb, char *pfx, const char *s)
 
static void xdot_str (GVJ_t *job, char *pfx, const char *s)
 
static void xdot_fmt_num (agxbuf *buf, double v)
 
static void xdot_point (agxbuf *xb, pointf p)
 
static void xdot_num (agxbuf *xb, double v)
 
static void xdot_points (GVJ_t *job, char c, pointf *A, size_t n)
 
static char * color2str (unsigned char rgba[4])
 
static void xdot_pencolor (GVJ_t *job)
 
static void xdot_fillcolor (GVJ_t *job)
 
static void xdot_style (GVJ_t *job)
 
static void put_escaping_backslashes (Agobj_t *n, Agsym_t *sym, const char *value)
 
static void xdot_end_node (GVJ_t *job)
 
static void xdot_end_edge (GVJ_t *job)
 
static void xdot_end_cluster (GVJ_t *job)
 
static unsigned short versionStr2Version (const char *str)
 
static void xdot_begin_graph (graph_t *g, bool s_arrows, bool e_arrows, format_type id)
 
static void dot_begin_graph (GVJ_t *job)
 
static void xdot_end_graph (graph_t *g)
 
static void dot_end_graph (GVJ_t *job)
 
static void xdot_textspan (GVJ_t *job, pointf p, textspan_t *span)
 
static void xdot_color_stop (agxbuf *xb, double v, gvcolor_t *clr)
 
static void xdot_gradient_fillcolor (GVJ_t *job, int filled, pointf *A, size_t n)
 
static void xdot_ellipse (GVJ_t *job, pointf *A, int filled)
 
static void xdot_bezier (GVJ_t *job, pointf *A, size_t n, int filled)
 
static void xdot_polygon (GVJ_t *job, pointf *A, size_t n, int filled)
 
static void xdot_polyline (GVJ_t *job, pointf *A, size_t n)
 
void core_loadimage_xdot (GVJ_t *job, usershape_t *us, boxf b, bool filled)
 

Variables

static agxbuf xbuf [NUMXBUFS]
 
static agxbufxbufs []
 
static double penwidth []
 
static unsigned int textflags [EMIT_ELABEL+1]
 
static xdot_state_txd
 
static const unsigned int flag_masks [] = {0x1F, 0x3F, 0x7F}
 
gvrender_engine_t dot_engine
 
gvrender_engine_t xdot_engine
 
gvrender_features_t render_features_dot
 
gvrender_features_t render_features_xdot
 
gvdevice_features_t device_features_canon
 
gvdevice_features_t device_features_dot
 
gvplugin_installed_t gvrender_dot_types []
 
gvplugin_installed_t gvdevice_dot_types []
 

Macro Definition Documentation

◆ NUMXBUFS

#define NUMXBUFS   (EMIT_HLABEL+1)

Definition at line 46 of file gvrender_core_dot.c.

◆ XDOTVERSION

#define XDOTVERSION   "1.7"

Definition at line 44 of file gvrender_core_dot.c.

Typedef Documentation

◆ flushfn

typedef int(* flushfn) (void *chan)

Definition at line 427 of file gvrender_core_dot.c.

◆ putstrfn

typedef int(* putstrfn) (void *chan, const char *str)

Definition at line 426 of file gvrender_core_dot.c.

Enumeration Type Documentation

◆ format_type

Enumerator
FORMAT_DOT 
FORMAT_CANON 
FORMAT_PLAIN 
FORMAT_PLAIN_EXT 
FORMAT_XDOT 
FORMAT_XDOT12 
FORMAT_XDOT14 

Definition at line 34 of file gvrender_core_dot.c.

Function Documentation

◆ color2str()

static char * color2str ( unsigned char  rgba[4])
static

Definition at line 120 of file gvrender_core_dot.c.

Referenced by xdot_color_stop(), xdot_fillcolor(), and xdot_pencolor().

Here is the caller graph for this function:

◆ core_loadimage_xdot()

void core_loadimage_xdot ( GVJ_t job,
usershape_t us,
boxf  b,
bool  filled 
)

Definition at line 636 of file gvrender_core_dot.c.

References agxbput(), obj_state_s::emit_state, boxf::LL, usershape_s::name, GVJ_s::obj, boxf::UR, pointf_s::x, xbufs, xdot_fmt_num(), xdot_str(), and pointf_s::y.

Here is the call graph for this function:

◆ dot_begin_graph()

static void dot_begin_graph ( GVJ_t job)
static

Definition at line 375 of file gvrender_core_dot.c.

References attach_attrs(), attach_attrs_and_arrows(), FORMAT_CANON, FORMAT_DOT, FORMAT_PLAIN, FORMAT_PLAIN_EXT, FORMAT_XDOT, FORMAT_XDOT12, FORMAT_XDOT14, obj_state_s::g, HAS_CLUST_EDGE, gvplugin_active_render_s::id, GVJ_s::obj, GVJ_s::render, obj_state_s::u, undoClusterEdges(), UNREACHABLE, and xdot_begin_graph().

Here is the call graph for this function:

◆ dot_end_graph()

static void dot_end_graph ( GVJ_t job)
static

◆ put_escaping_backslashes()

static void put_escaping_backslashes ( Agobj_t n,
Agsym_t sym,
const char *  value 
)
static

set the value of a symbol within a node, escaping backslashes

The back ends that output certain text-based formats, e.g. xdot, assume that all characters that have special meaning within a string have already been escaped, with the exception of double quote ("). Hence, any string being constructed from user-provided input needs to be escaped for other problematic characters (namely ) beforehand. This is a little utility function to do such.

Parameters
nNode to operate on
symSymbol to set
valueUnescaped string

Definition at line 199 of file gvrender_core_dot.c.

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

Referenced by xdot_end_edge(), xdot_end_graph(), and xdot_end_node().

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

◆ versionStr2Version()

static unsigned short versionStr2Version ( const char *  str)
static

Definition at line 274 of file gvrender_core_dot.c.

References agwarningf(), gv_isdigit(), and str.

Referenced by xdot_begin_graph().

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

◆ xdot_begin_graph()

static void xdot_begin_graph ( graph_t g,
bool  s_arrows,
bool  e_arrows,
format_type  id 
)
static

Definition at line 312 of file gvrender_core_dot.c.

References AGEDGE, agget(), AGNODE, AGRAPH, xdot_state_t::e_draw, xdot_state_t::e_l_draw, EDGE_LABEL, EDGE_XLABEL, FORMAT_XDOT12, FORMAT_XDOT14, xdot_state_t::g_draw, xdot_state_t::g_l_draw, GD_has_labels, GD_n_cluster, GRAPH_LABEL, gv_alloc(), xdot_state_t::h_draw, HEAD_LABEL, xdot_state_t::hl_draw, xdot_state_t::n_draw, xdot_state_t::n_l_draw, NULL, NUMXBUFS, safe_dcl(), xdot_state_t::t_draw, TAIL_LABEL, xdot_state_t::tl_draw, xdot_state_t::version, xdot_state_t::version_s, versionStr2Version(), xbuf, xd, and XDOTVERSION.

Referenced by dot_begin_graph().

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

◆ xdot_bezier()

static void xdot_bezier ( GVJ_t job,
pointf A,
size_t  n,
int  filled 
)
static

Definition at line 600 of file gvrender_core_dot.c.

References A, GRADIENT, RGRADIENT, xdot_fillcolor(), xdot_gradient_fillcolor(), xdot_pencolor(), xdot_points(), and xdot_style().

Here is the call graph for this function:

◆ xdot_color_stop()

static void xdot_color_stop ( agxbuf xb,
double  v,
gvcolor_t clr 
)
static

Definition at line 514 of file gvrender_core_dot.c.

References agxbprint(), agxbputc(), agxbuf_trim_zeros(), color2str(), color_s::rgba, color_s::u, and xdot_str_xbuf().

Here is the call graph for this function:

◆ xdot_ellipse()

static void xdot_ellipse ( GVJ_t job,
pointf A,
int  filled 
)
static

Definition at line 579 of file gvrender_core_dot.c.

References A, agxbput(), obj_state_s::emit_state, GRADIENT, GVJ_s::obj, RGRADIENT, xbufs, xdot_fillcolor(), xdot_fmt_num(), xdot_gradient_fillcolor(), xdot_pencolor(), and xdot_style().

Here is the call graph for this function:

◆ xdot_end_cluster()

static void xdot_end_cluster ( GVJ_t job)
static

Definition at line 261 of file gvrender_core_dot.c.

References agxbuse(), agxset(), EMIT_CDRAW, EMIT_CLABEL, xdot_state_t::g_draw, xdot_state_t::g_l_draw, GD_label, GVJ_s::obj, penwidth, obj_state_s::sg, textflags, obj_state_s::u, xbufs, and xd.

Here is the call graph for this function:

◆ xdot_end_edge()

static void xdot_end_edge ( GVJ_t job)
static

Definition at line 231 of file gvrender_core_dot.c.

References agxblen(), agxbuse(), agxset(), Agedge_s::base, obj_state_s::e, xdot_state_t::e_draw, xdot_state_t::e_l_draw, EMIT_EDRAW, EMIT_ELABEL, EMIT_HDRAW, EMIT_HLABEL, EMIT_TDRAW, EMIT_TLABEL, xdot_state_t::h_draw, xdot_state_t::hl_draw, GVJ_s::obj, penwidth, put_escaping_backslashes(), xdot_state_t::t_draw, textflags, xdot_state_t::tl_draw, obj_state_s::u, xbufs, and xd.

Here is the call graph for this function:

◆ xdot_end_graph()

static void xdot_end_graph ( graph_t g)
static

Definition at line 404 of file gvrender_core_dot.c.

References AGRAPH, agsafeset(), agxbfree(), agxblen(), agxbuse(), agxset(), Agraph_s::base, EMIT_GDRAW, EMIT_GLABEL, free(), xdot_state_t::g_draw, xdot_state_t::g_l_draw, GD_label, NUMXBUFS, penwidth, put_escaping_backslashes(), safe_dcl(), textflags, xdot_state_t::version_s, xbuf, xbufs, and xd.

Referenced by dot_end_graph().

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

◆ xdot_end_node()

static void xdot_end_node ( GVJ_t job)
static

Definition at line 218 of file gvrender_core_dot.c.

References agxblen(), agxbuse(), agxset(), Agnode_s::base, EMIT_NDRAW, EMIT_NLABEL, obj_state_s::n, xdot_state_t::n_draw, xdot_state_t::n_l_draw, GVJ_s::obj, penwidth, put_escaping_backslashes(), textflags, obj_state_s::u, xbufs, and xd.

Here is the call graph for this function:

◆ xdot_fillcolor()

static void xdot_fillcolor ( GVJ_t job)
static

Definition at line 137 of file gvrender_core_dot.c.

References color2str(), obj_state_s::fillcolor, GVJ_s::obj, color_s::rgba, color_s::u, and xdot_str().

Referenced by xdot_bezier(), xdot_ellipse(), xdot_gradient_fillcolor(), and xdot_polygon().

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

◆ xdot_fmt_num()

static void xdot_fmt_num ( agxbuf buf,
double  v 
)
static

Definition at line 95 of file gvrender_core_dot.c.

References agxbprint(), agxbputc(), and agxbuf_trim_zeros().

Referenced by core_loadimage_xdot(), xdot_ellipse(), xdot_num(), xdot_point(), and xdot_textspan().

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

◆ xdot_gradient_fillcolor()

static void xdot_gradient_fillcolor ( GVJ_t job,
int  filled,
pointf A,
size_t  n 
)
static

Definition at line 521 of file gvrender_core_dot.c.

References A, agxbfree(), agxbpop(), agxbput(), agxbputc(), agxbuse(), obj_state_s::fillcolor, G, get_gradient_points(), GRADIENT, obj_state_s::gradient_angle, obj_state_s::gradient_frac, M_PI, GVJ_s::obj, obj_state_s::stopcolor, xdot_state_t::version, pointf_s::x, xd, xdot_fillcolor(), xdot_num(), xdot_str(), and pointf_s::y.

Referenced by xdot_bezier(), xdot_ellipse(), and xdot_polygon().

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

◆ xdot_num()

static void xdot_num ( agxbuf xb,
double  v 
)
static

Definition at line 107 of file gvrender_core_dot.c.

References xdot_fmt_num().

Referenced by xdot_gradient_fillcolor().

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

◆ xdot_pencolor()

static void xdot_pencolor ( GVJ_t job)
static

Definition at line 132 of file gvrender_core_dot.c.

References color2str(), GVJ_s::obj, obj_state_s::pencolor, color_s::rgba, color_s::u, and xdot_str().

Referenced by xdot_bezier(), xdot_ellipse(), xdot_polygon(), xdot_polyline(), and xdot_textspan().

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

◆ xdot_point()

static void xdot_point ( agxbuf xb,
pointf  p 
)
static

Definition at line 101 of file gvrender_core_dot.c.

References pointf_s::x, xdot_fmt_num(), pointf_s::y, and yDir().

Here is the call graph for this function:

◆ xdot_points()

static void xdot_points ( GVJ_t job,
char  c,
pointf A,
size_t  n 
)
static

Definition at line 112 of file gvrender_core_dot.c.

References A, agxbprint(), obj_state_s::emit_state, GVJ_s::obj, PRISIZE_T, and xbufs.

Referenced by xdot_bezier(), xdot_polygon(), and xdot_polyline().

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

◆ xdot_polygon()

static void xdot_polygon ( GVJ_t job,
pointf A,
size_t  n,
int  filled 
)
static

Definition at line 615 of file gvrender_core_dot.c.

References A, GRADIENT, RGRADIENT, xdot_fillcolor(), xdot_gradient_fillcolor(), xdot_pencolor(), xdot_points(), and xdot_style().

Here is the call graph for this function:

◆ xdot_polyline()

static void xdot_polyline ( GVJ_t job,
pointf A,
size_t  n 
)
static

Definition at line 630 of file gvrender_core_dot.c.

References A, xdot_pencolor(), xdot_points(), and xdot_style().

Here is the call graph for this function:

◆ xdot_str()

static void xdot_str ( GVJ_t job,
char *  pfx,
const char *  s 
)
static

Definition at line 85 of file gvrender_core_dot.c.

References obj_state_s::emit_state, GVJ_s::obj, xbufs, and xdot_str_xbuf().

Referenced by core_loadimage_xdot(), xdot_fillcolor(), xdot_gradient_fillcolor(), xdot_pencolor(), xdot_style(), and xdot_textspan().

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

◆ xdot_str_xbuf()

static void xdot_str_xbuf ( agxbuf xb,
char *  pfx,
const char *  s 
)
static

Definition at line 80 of file gvrender_core_dot.c.

References agxbprint(), and PRISIZE_T.

Referenced by xdot_color_stop(), and xdot_str().

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

◆ xdot_style()

static void xdot_style ( GVJ_t job)
static

Definition at line 142 of file gvrender_core_dot.c.

References agxbfree(), agxbprint(), agxbput(), agxbputc(), agxbuf_trim_zeros(), agxbuse(), obj_state_s::emit_state, GVJ_s::obj, obj_state_s::penwidth, penwidth, obj_state_s::rawstyle, streq(), and xdot_str().

Referenced by xdot_bezier(), xdot_ellipse(), xdot_polygon(), and xdot_polyline().

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

◆ xdot_textspan()

static void xdot_textspan ( GVJ_t job,
pointf  p,
textspan_t span 
)
static

Definition at line 469 of file gvrender_core_dot.c.

References agxbprint(), agxbput(), obj_state_s::emit_state, flag_masks, flags, textfont_t::flags, textspan_t::font, textspan_t::just, textfont_t::name, GVJ_s::obj, textfont_t::size, textspan_t::size, textspan_t::str, textflags, xdot_state_t::version, pointf_s::x, xbufs, xd, xdot_fmt_num(), xdot_pencolor(), xdot_str(), pointf_s::y, and textspan_t::yoffset_centerline.

Here is the call graph for this function:

Variable Documentation

◆ device_features_canon

gvdevice_features_t device_features_canon
Initial value:
= {
{0.,0.},
{0.,0.},
{72.,72.},
}
#define LAYOUT_NOT_REQUIRED
Definition gvcjob.h:107

Definition at line 734 of file gvrender_core_dot.c.

◆ device_features_dot

gvdevice_features_t device_features_dot
Initial value:
= {
0,
{0.,0.},
{0.,0.},
{72.,72.},
}

Definition at line 741 of file gvrender_core_dot.c.

◆ dot_engine

gvrender_engine_t dot_engine

Definition at line 649 of file gvrender_core_dot.c.

◆ flag_masks

const unsigned int flag_masks[] = {0x1F, 0x3F, 0x7F}
static

Definition at line 467 of file gvrender_core_dot.c.

Referenced by xdot_textspan().

◆ gvdevice_dot_types

gvplugin_installed_t gvdevice_dot_types[]
Initial value:
= {
{FORMAT_DOT, "dot:dot", 1, NULL, &device_features_dot},
{FORMAT_DOT, "gv:dot", 1, NULL, &device_features_dot},
{FORMAT_CANON, "canon:dot", 1, NULL, &device_features_canon},
{FORMAT_PLAIN, "plain:dot", 1, NULL, &device_features_dot},
{FORMAT_PLAIN_EXT, "plain-ext:dot", 1, NULL, &device_features_dot},
{FORMAT_XDOT, "xdot:xdot", 1, NULL, &device_features_dot},
{FORMAT_XDOT12, "xdot1.2:xdot", 1, NULL, &device_features_dot},
{FORMAT_XDOT14, "xdot1.4:xdot", 1, NULL, &device_features_dot},
{0, NULL, 0, NULL, NULL}
}
node NULL
Definition grammar.y:149
gvdevice_features_t device_features_canon
gvdevice_features_t device_features_dot
@ FORMAT_PLAIN
@ FORMAT_XDOT12
@ FORMAT_DOT
@ FORMAT_XDOT
@ FORMAT_PLAIN_EXT
@ FORMAT_XDOT14
@ FORMAT_CANON

Definition at line 754 of file gvrender_core_dot.c.

◆ gvrender_dot_types

gvplugin_installed_t gvrender_dot_types[]
Initial value:
= {
{0, NULL, 0, NULL, NULL}
}
gvrender_engine_t dot_engine
gvrender_features_t render_features_dot
gvrender_features_t render_features_xdot
gvrender_engine_t xdot_engine

Definition at line 748 of file gvrender_core_dot.c.

◆ penwidth

◆ render_features_dot

gvrender_features_t render_features_dot
Initial value:
= {
0.,
NULL,
0,
}
@ COLOR_STRING
Definition color.h:27
#define GVRENDER_DOES_TRANSFORM
Definition gvcjob.h:95

Definition at line 715 of file gvrender_core_dot.c.

◆ render_features_xdot

gvrender_features_t render_features_xdot
Initial value:
= {
0.,
NULL,
0,
}
@ RGBA_BYTE
Definition color.h:26
#define GVRENDER_DOES_TOOLTIPS
Definition gvcjob.h:103
#define GVRENDER_DOES_MAPS
Definition gvcjob.h:97
#define GVRENDER_DOES_TARGETS
Definition gvcjob.h:104

Definition at line 723 of file gvrender_core_dot.c.

◆ textflags

unsigned int textflags[EMIT_ELABEL+1]
static

◆ xbuf

agxbuf xbuf[NUMXBUFS]
static

Definition at line 51 of file gvrender_core_dot.c.

Referenced by on_gvprbuttonload_clicked(), xdot_begin_graph(), and xdot_end_graph().

◆ xbufs

agxbuf* xbufs[]
static
Initial value:
= {
}
@ EMIT_CDRAW
Definition gvcjob.h:174
@ EMIT_TDRAW
Definition gvcjob.h:174
@ EMIT_HDRAW
Definition gvcjob.h:174
@ EMIT_HLABEL
Definition gvcjob.h:175
@ EMIT_GDRAW
Definition gvcjob.h:174
@ EMIT_GLABEL
Definition gvcjob.h:175
@ EMIT_CLABEL
Definition gvcjob.h:175
@ EMIT_TLABEL
Definition gvcjob.h:175
static agxbuf xbuf[NUMXBUFS]

Definition at line 52 of file gvrender_core_dot.c.

Referenced by core_loadimage_xdot(), xdot_ellipse(), xdot_end_cluster(), xdot_end_edge(), xdot_end_graph(), xdot_end_node(), xdot_points(), xdot_str(), and xdot_textspan().

◆ xd

◆ xdot_engine

gvrender_engine_t xdot_engine

Definition at line 682 of file gvrender_core_dot.c.