Graphviz 13.0.0~dev.20241220.2304
|
#include "config.h"
#include <assert.h>
#include <math.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 <common/utils.h>
#include <gvc/gvc.h>
#include <gvc/gvio.h>
#include <util/agxbuf.h>
#include <util/alloc.h>
#include <util/gv_ctype.h>
#include <util/prisize_t.h>
#include <util/streq.h>
#include <util/unreachable.h>
#include "core_loadimage_xdot.h"
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_str_color_xbuf (agxbuf *xb, const char *prefix, const unsigned char rgba[4]) |
static void | xdot_str_color (GVJ_t *job, const char *prefix, const unsigned char rgba[4]) |
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 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, double yOff) |
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 agxbuf * | xbufs [] |
static double | penwidth [] |
static unsigned int | textflags [EMIT_ELABEL+1] |
static xdot_state_t * | xd |
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 [] |
#define NUMXBUFS (EMIT_HLABEL+1) |
Definition at line 48 of file gvrender_core_dot.c.
#define XDOTVERSION "1.7" |
Definition at line 46 of file gvrender_core_dot.c.
typedef int(* flushfn) (void *chan) |
Definition at line 450 of file gvrender_core_dot.c.
typedef int(* putstrfn) (void *chan, const char *str) |
Definition at line 449 of file gvrender_core_dot.c.
enum format_type |
Enumerator | |
---|---|
FORMAT_DOT | |
FORMAT_CANON | |
FORMAT_PLAIN | |
FORMAT_PLAIN_EXT | |
FORMAT_XDOT | |
FORMAT_XDOT12 | |
FORMAT_XDOT14 |
Definition at line 36 of file gvrender_core_dot.c.
void core_loadimage_xdot | ( | GVJ_t * | job, |
usershape_t * | us, | ||
boxf | b, | ||
bool | filled | ||
) |
Definition at line 659 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.
|
static |
Definition at line 398 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().
|
static |
Definition at line 451 of file gvrender_core_dot.c.
References Agiodisc_s::afread, AgIoDisc, agwrite(), Agraph_s::clos, Agclos_s::disc, Agiodisc_s::flush, FORMAT_CANON, FORMAT_DOT, FORMAT_PLAIN, FORMAT_PLAIN_EXT, FORMAT_XDOT, FORMAT_XDOT12, FORMAT_XDOT14, obj_state_s::g, gvflush(), gvputs(), gvplugin_active_render_s::id, Agdisc_s::io, NULL, GVJ_s::obj, OUTPUT_NOT_REQUIRED, Agiodisc_s::putstr, GVJ_s::render, obj_state_s::u, UNREACHABLE, write_plain(), and xdot_end_graph().
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.
n | Node to operate on |
sym | Symbol to set |
value | Unescaped string |
Definition at line 218 of file gvrender_core_dot.c.
References agxbfree(), agxbputc(), agxbuse(), and agxset().
Referenced by xdot_end_edge(), xdot_end_graph(), and xdot_end_node().
|
static |
Definition at line 293 of file gvrender_core_dot.c.
References agwarningf(), gv_isdigit(), and str.
Referenced by xdot_begin_graph().
|
static |
Definition at line 333 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, XDOTVERSION, and xdot_state_t::yOff.
Referenced by dot_begin_graph().
Definition at line 623 of file gvrender_core_dot.c.
References A, GRADIENT, RGRADIENT, xdot_fillcolor(), xdot_gradient_fillcolor(), xdot_pencolor(), xdot_points(), and xdot_style().
|
static |
Definition at line 537 of file gvrender_core_dot.c.
References agxbprint(), agxbputc(), agxbuf_trim_zeros(), color_s::rgba, color_s::u, and xdot_str_color_xbuf().
Definition at line 602 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().
|
static |
Definition at line 280 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.
|
static |
Definition at line 250 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.
|
static |
Definition at line 427 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().
|
static |
Definition at line 237 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.
|
static |
Definition at line 156 of file gvrender_core_dot.c.
References obj_state_s::fillcolor, GVJ_s::obj, color_s::rgba, color_s::u, and xdot_str_color().
Referenced by xdot_bezier(), xdot_ellipse(), xdot_gradient_fillcolor(), and xdot_polygon().
|
static |
Definition at line 126 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().
Definition at line 544 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().
|
static |
Definition at line 139 of file gvrender_core_dot.c.
References xdot_fmt_num().
Referenced by xdot_gradient_fillcolor().
|
static |
Definition at line 151 of file gvrender_core_dot.c.
References GVJ_s::obj, obj_state_s::pencolor, color_s::rgba, color_s::u, and xdot_str_color().
Referenced by xdot_bezier(), xdot_ellipse(), xdot_polygon(), xdot_polyline(), and xdot_textspan().
|
static |
Definition at line 132 of file gvrender_core_dot.c.
References NULL, pointf_s::x, xd, xdot_fmt_num(), pointf_s::y, yDir(), and xdot_state_t::yOff.
Definition at line 144 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().
Definition at line 638 of file gvrender_core_dot.c.
References A, GRADIENT, RGRADIENT, xdot_fillcolor(), xdot_gradient_fillcolor(), xdot_pencolor(), xdot_points(), and xdot_style().
|
static |
Definition at line 653 of file gvrender_core_dot.c.
References A, xdot_pencolor(), xdot_points(), and xdot_style().
|
static |
Definition at line 88 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_gradient_fillcolor(), xdot_style(), and xdot_textspan().
|
static |
output a color
job | Job indicating which state buffer to write to |
prefix | String prefix to prepend |
rgba | Color in RGBA format |
Definition at line 115 of file gvrender_core_dot.c.
References obj_state_s::emit_state, GVJ_s::obj, prefix, xbufs, and xdot_str_color_xbuf().
Referenced by xdot_fillcolor(), and xdot_pencolor().
|
static |
output a color
xb | Buffer to write to |
String | prefix to prepend |
rgba | Color in RGBA format |
Definition at line 99 of file gvrender_core_dot.c.
References agxbprint(), prefix, and PRISIZE_T.
Referenced by xdot_color_stop(), and xdot_str_color().
|
static |
Definition at line 83 of file gvrender_core_dot.c.
References agxbprint(), and PRISIZE_T.
Referenced by xdot_str().
|
static |
Definition at line 161 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().
|
static |
Definition at line 492 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.
gvdevice_features_t device_features_canon |
Definition at line 757 of file gvrender_core_dot.c.
gvdevice_features_t device_features_dot |
Definition at line 764 of file gvrender_core_dot.c.
gvrender_engine_t dot_engine |
Definition at line 672 of file gvrender_core_dot.c.
|
static |
Definition at line 490 of file gvrender_core_dot.c.
Referenced by xdot_textspan().
gvplugin_installed_t gvdevice_dot_types[] |
Definition at line 777 of file gvrender_core_dot.c.
gvplugin_installed_t gvrender_dot_types[] |
Definition at line 771 of file gvrender_core_dot.c.
|
static |
Definition at line 59 of file gvrender_core_dot.c.
Referenced by arrow_gen(), arrow_gen_type(), arrow_length(), arrow_length_box(), arrow_length_crow(), arrow_length_curve(), arrow_length_diamond(), arrow_length_dot(), arrow_length_generic(), arrow_length_normal(), arrow_length_tee(), arrow_type_box(), arrow_type_crow(), arrow_type_crow0(), arrow_type_curve(), arrow_type_diamond(), arrow_type_diamond0(), arrow_type_dot(), arrow_type_gap(), arrow_type_normal(), arrow_type_normal0(), arrow_type_tee(), emit_begin_edge(), emit_clusters(), emit_edge_graphics(), gvrender_set_penwidth(), makeObstacle(), miter_shape(), multicolor(), point_init(), point_inside(), poly_init(), poly_inside(), ps_set_pen_style(), ps_set_pen_style(), record_inside(), setClustNodes(), star_inside(), stylenode(), xdot_end_cluster(), xdot_end_edge(), xdot_end_graph(), xdot_end_node(), and xdot_style().
gvrender_features_t render_features_dot |
Definition at line 738 of file gvrender_core_dot.c.
gvrender_features_t render_features_xdot |
Definition at line 746 of file gvrender_core_dot.c.
|
static |
Definition at line 64 of file gvrender_core_dot.c.
Referenced by xdot_end_cluster(), xdot_end_edge(), xdot_end_graph(), xdot_end_node(), and xdot_textspan().
Definition at line 53 of file gvrender_core_dot.c.
Referenced by on_gvprbuttonload_clicked(), xdot_begin_graph(), and xdot_end_graph().
|
static |
Definition at line 54 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(), xdot_str_color(), and xdot_textspan().
|
static |
Definition at line 81 of file gvrender_core_dot.c.
Referenced by emit_background(), emit_xdot(), init_xdot(), makeXDotSpline(), xdot_begin_graph(), xdot_end_cluster(), xdot_end_edge(), xdot_end_graph(), xdot_end_node(), xdot_gradient_fillcolor(), xdot_point(), xdot_textspan(), and xdotBB().
gvrender_engine_t xdot_engine |
Definition at line 705 of file gvrender_core_dot.c.