Graphviz 12.0.1~dev.20240716.0800
Loading...
Searching...
No Matches
gvdevice.c File Reference
#include "config.h"
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <errno.h>
#include <unistd.h>
#include <assert.h>
#include <cgraph/agxbuf.h>
#include <cgraph/startswith.h>
#include <cgraph/exit.h>
#include <common/const.h>
#include <gvc/gvplugin_device.h>
#include <gvc/gvcjob.h>
#include <gvc/gvcint.h>
#include <gvc/gvcproc.h>
#include <common/utils.h>
#include <gvc/gvio.h>
Include dependency graph for gvdevice.c:

Go to the source code of this file.

Macros

#define val_str(n, x)   static double n = x; static char n##str[] = #x;
 

Functions

static size_t gvwrite_no_z (GVJ_t *job, const void *s, size_t len)
 
static void auto_output_filename (GVJ_t *job)
 
int gvdevice_initialize (GVJ_t *job)
 
size_t gvwrite (GVJ_t *job, const char *s, size_t len)
 
int gvferror (FILE *stream)
 
int gvputs (GVJ_t *job, const char *s)
 
int gvputs_xml (GVJ_t *job, const char *s)
 
void gvputs_nonascii (GVJ_t *job, const char *s)
 
int gvputc (GVJ_t *job, int c)
 
int gvflush (GVJ_t *job)
 
static void gvdevice_close (GVJ_t *job)
 
void gvdevice_format (GVJ_t *job)
 
void gvdevice_finalize (GVJ_t *job)
 
void gvprintf (GVJ_t *job, const char *format,...)
 
 val_str (maxnegnum, -999999999999999.99) static void gvprintnum(agxbuf *xb
 
 agxbuf_trim_zeros (xb)
 
 if (startswith(staging, "0."))
 
else if (startswith(staging, "-0."))
 
 agxbput (xb, staging)
 
 free (staging)
 
static size_t gv_trim_zeros (const char *buf)
 
void gvprintdouble (GVJ_t *job, double num)
 
void gvprintpointf (GVJ_t *job, pointf p)
 
void gvprintpointflist (GVJ_t *job, pointf *p, size_t n)
 

Variables

double number
 

Macro Definition Documentation

◆ val_str

#define val_str (   n,
 
)    static double n = x; static char n##str[] = #x;

Definition at line 418 of file gvdevice.c.

Function Documentation

◆ agxbput()

agxbput ( xb  ,
staging   
)

Referenced by auto_output_filename().

Here is the caller graph for this function:

◆ agxbuf_trim_zeros()

agxbuf_trim_zeros ( xb  )

◆ auto_output_filename()

static void auto_output_filename ( GVJ_t job)
static

Definition at line 82 of file gvdevice.c.

References agxbprint(), agxbput(), agxbputc(), agxbuse(), GVJ_s::graph_index, GVJ_s::input_filename, GVJ_s::output_filename, and GVJ_s::output_langname.

Referenced by gvdevice_initialize().

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

◆ free()

free ( staging  )

◆ gv_trim_zeros()

static size_t gv_trim_zeros ( const char *  buf)
static

Definition at line 486 of file gvdevice.c.

References NULL.

Referenced by gvprintdouble().

Here is the caller graph for this function:

◆ gvdevice_close()

static void gvdevice_close ( GVJ_t job)
static

Definition at line 311 of file gvdevice.c.

References GVJ_s::external_context, NULL, GVJ_s::output_file, and GVJ_s::output_filename.

Referenced by gvdevice_finalize().

Here is the caller graph for this function:

◆ gvdevice_finalize()

void gvdevice_finalize ( GVJ_t job)

Definition at line 333 of file gvdevice.c.

References cnt(), GVJ_s::common, GVJ_s::device, gvplugin_active_device_s::engine, GVCOMMON_s::errorfn, gvdevice_engine_s::finalize, GVJ_s::flags, graphviz_exit(), gvdevice_close(), GVDEVICE_COMPRESSED_FORMAT, gvflush(), gvwrite_no_z(), out(), and z.

Referenced by gvrender_end_job(), gvRenderContext(), and gvRenderFilename().

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

◆ gvdevice_format()

void gvdevice_format ( GVJ_t job)

Definition at line 324 of file gvdevice.c.

References GVJ_s::device, gvplugin_active_device_s::engine, gvdevice_engine_s::format, and gvflush().

Referenced by gvrender_end_graph().

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

◆ gvdevice_initialize()

int gvdevice_initialize ( GVJ_t job)

Definition at line 115 of file gvdevice.c.

References GVCOMMON_s::auto_outfile_names, auto_output_filename(), GVC_s::common, GVJ_s::common, GVJ_s::device, gvplugin_active_device_s::engine, GVCOMMON_s::errorfn, GVJ_s::flags, gvc, GVJ_s::gvc, GVDEVICE_BINARY_FORMAT, GVDEVICE_COMPRESSED_FORMAT, gvwrite_no_z(), gvdevice_engine_s::initialize, L, NULL, GVJ_s::output_data, GVJ_s::output_file, GVJ_s::output_filename, and z.

Referenced by gvrender_begin_job().

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

◆ gvferror()

int gvferror ( FILE *  stream)

Definition at line 253 of file gvdevice.c.

References GVJ_s::gvc, GVJ_s::output_data, GVJ_s::output_file, and GVC_s::write_fn.

◆ gvflush()

int gvflush ( GVJ_t job)

Definition at line 300 of file gvdevice.c.

References GVJ_s::external_context, GVJ_s::gvc, GVJ_s::output_file, and GVC_s::write_fn.

Referenced by dot_end_graph(), gvdevice_finalize(), gvdevice_format(), and json_end_graph().

Here is the caller graph for this function:

◆ gvprintdouble()

void gvprintdouble ( GVJ_t job,
double  num 
)

Definition at line 506 of file gvdevice.c.

References gv_trim_zeros(), gvwrite(), and len().

Referenced by ps_set_pen_style(), ps_set_pen_style(), psgen_textspan(), svg_begin_page(), svg_bzptarray(), svg_ellipse(), svg_gradstyle(), svg_grstyle(), svg_polygon(), svg_polyline(), svg_textspan(), tkgen_bezier(), tkgen_ellipse(), and tkgen_polygon().

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

◆ gvprintf()

void gvprintf ( GVJ_t job,
const char *  format,
  ... 
)

Definition at line 394 of file gvdevice.c.

References agerrorf(), agxbfree(), agxbuse(), format, gvwrite(), len(), and vagxbprint().

Referenced by core_loadimage_fig(), core_loadimage_ps(), core_loadimage_pslib(), core_loadimage_svg(), core_loadimage_tk(), core_loadimage_vrml(), epsf_define(), fig_begin_graph(), fig_bezier(), fig_comment(), fig_ellipse(), fig_polygon(), fig_polyline(), fig_resolve_color(), fig_textspan(), figptarray(), gd_loadimage_ps(), gvputs_nonascii(), lasi_begin_anchor(), lasi_begin_cluster(), lasi_begin_graph(), lasi_begin_job(), lasi_begin_layer(), lasi_begin_page(), lasi_end_job(), lasi_end_page(), lasi_library_shape(), lasi_loadimage_ps(), map_output_shape(), pango_loadimage_ps(), pic_begin_graph(), pic_begin_page(), pic_bezier(), pic_comment(), pic_ellipse(), pic_end_graph(), pic_end_page(), pic_textspan(), picptarray(), pov_begin_edge(), pov_begin_graph(), pov_begin_job(), pov_begin_layer(), pov_begin_node(), pov_bezier(), pov_color_as_str(), pov_comment(), pov_ellipse(), pov_end_edge(), pov_polygon(), pov_polyline(), pov_textspan(), process(), ps_set_color(), ps_set_color(), ps_set_pen_style(), ps_set_pen_style(), psgen_begin_anchor(), psgen_begin_cluster(), psgen_begin_graph(), psgen_begin_job(), psgen_begin_layer(), psgen_begin_page(), psgen_end_job(), psgen_end_page(), psgen_library_shape(), psgen_textspan(), svg_begin_graph(), svg_begin_page(), svg_gradstyle(), svg_grstyle(), svg_print_gradient_color(), svg_print_id_class(), svg_print_paint(), svg_print_stop(), svg_rgradstyle(), svg_textspan(), tkgen_begin_graph(), tkgen_begin_job(), tkgen_comment(), tkgen_print_color(), tkgen_print_tags(), tkgen_textspan(), write_edge(), write_graph(), write_hdr(), write_linear_grad(), write_node(), write_polyline(), write_radial_grad(), write_stops(), write_subgs(), and write_xdot().

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

◆ gvprintpointf()

void gvprintpointf ( GVJ_t job,
pointf  p 
)

Definition at line 523 of file gvdevice.c.

References agxbfree(), agxbuse(), gvwrite(), pointf_s::x, and pointf_s::y.

Referenced by gvprintpointflist(), lasi_bezier(), lasi_library_shape(), lasi_polygon(), lasi_polyline(), lasi_textspan(), psgen_bezier(), psgen_library_shape(), psgen_polygon(), psgen_polyline(), psgen_textspan(), and tkgen_textspan().

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

◆ gvprintpointflist()

void gvprintpointflist ( GVJ_t job,
pointf p,
size_t  n 
)

Definition at line 537 of file gvdevice.c.

References gvprintpointf(), and gvputs().

Referenced by lasi_begin_anchor(), lasi_bezier(), lasi_ellipse(), lasi_library_shape(), psgen_begin_anchor(), psgen_bezier(), psgen_ellipse(), psgen_library_shape(), tkgen_bezier(), tkgen_ellipse(), tkgen_polygon(), and tkgen_polyline().

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

◆ gvputc()

int gvputc ( GVJ_t job,
int  c 
)

Definition at line 290 of file gvdevice.c.

References gvwrite().

Referenced by epsf_emit_body(), gvputs_nonascii(), pic_textspan(), stoj(), svg_begin_anchor(), svg_begin_page(), svg_bzptarray(), svg_gradstyle(), svg_grstyle(), svg_polygon(), svg_polyline(), svg_print_id_class(), svg_rgradstyle(), svg_textspan(), write_stops(), and write_xdot().

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

◆ gvputs()

int gvputs ( GVJ_t job,
const char *  s 
)

Definition at line 263 of file gvdevice.c.

References gvwrite(), and len().

Referenced by cat_libfile(), core_loadimage_svg(), dot_end_graph(), epsf_define(), fig_begin_graph(), fig_bezier(), fig_end_graph(), fig_textspan(), figptarray(), gd_loadimage_ps(), gvprintpointflist(), gvputs_nonascii(), gvputs_xml(), indent(), json_end_graph(), lasi_begin_anchor(), lasi_begin_cluster(), lasi_begin_edge(), lasi_begin_graph(), lasi_begin_node(), lasi_bezier(), lasi_comment(), lasi_ellipse(), lasi_end_cluster(), lasi_end_edge(), lasi_end_job(), lasi_end_node(), lasi_end_page(), lasi_library_shape(), lasi_polygon(), lasi_polyline(), lasi_textspan(), map_begin_page(), map_end_page(), map_output_shape(), pango_loadimage_ps(), pic_bezier(), picptarray(), pov_begin_cluster(), pov_begin_edge(), pov_begin_graph(), pov_begin_job(), pov_begin_page(), pov_bezier(), pov_ellipse(), pov_end_cluster(), pov_end_edge(), pov_end_graph(), pov_end_layer(), pov_end_node(), pov_end_page(), pov_polygon(), pov_polyline(), pov_textspan(), ps_set_pen_style(), ps_set_pen_style(), psgen_begin_anchor(), psgen_begin_cluster(), psgen_begin_edge(), psgen_begin_graph(), psgen_begin_job(), psgen_begin_node(), psgen_bezier(), psgen_comment(), psgen_ellipse(), psgen_end_cluster(), psgen_end_edge(), psgen_end_job(), psgen_end_node(), psgen_end_page(), psgen_library_shape(), psgen_polygon(), psgen_polyline(), psgen_textspan(), stoj(), svg_begin_anchor(), svg_begin_cluster(), svg_begin_edge(), svg_begin_graph(), svg_begin_job(), svg_begin_layer(), svg_begin_node(), svg_begin_page(), svg_bezier(), svg_comment(), svg_ellipse(), svg_end_anchor(), svg_end_cluster(), svg_end_edge(), svg_end_graph(), svg_end_layer(), svg_end_node(), svg_end_page(), svg_gradstyle(), svg_grstyle(), svg_polygon(), svg_polyline(), svg_print_gradient_color(), svg_print_id_class(), svg_print_paint(), svg_print_stop(), svg_rgradstyle(), svg_textspan(), tkgen_begin_graph(), tkgen_bezier(), tkgen_canvas(), tkgen_ellipse(), tkgen_polygon(), tkgen_polyline(), tkgen_print_color(), tkgen_textspan(), write_attrs(), write_edge(), write_edges(), write_graph(), write_hdr(), write_node(), write_nodes(), write_subg(), write_subgs(), write_xdot(), write_xdots(), and xml_url_puts().

Here is the call graph for this function:

◆ gvputs_nonascii()

void gvputs_nonascii ( GVJ_t job,
const char *  s 
)

Definition at line 278 of file gvdevice.c.

References gvprintf(), gvputc(), and gvputs().

Referenced by fig_textspan(), and pic_textspan().

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

◆ gvputs_xml()

int gvputs_xml ( GVJ_t job,
const char *  s 
)

Definition at line 273 of file gvdevice.c.

References xml_flags_t::dash, flags, gvputs(), and xml_escape().

Referenced by map_begin_page(), map_output_shape(), svg_begin_anchor(), svg_begin_cluster(), svg_begin_edge(), svg_begin_graph(), svg_begin_job(), svg_begin_node(), svg_begin_page(), svg_bezier(), svg_comment(), svg_gradstyle(), svg_grstyle(), svg_print_id_class(), svg_rgradstyle(), and svg_textspan().

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

◆ gvwrite()

size_t gvwrite ( GVJ_t job,
const char *  s,
size_t  len 
)

Definition at line 179 of file gvdevice.c.

References GVJ_s::common, GVCOMMON_s::errorfn, GVJ_s::flags, graphviz_exit(), GVDEVICE_COMPRESSED_FORMAT, gvwrite_no_z(), len(), offset, and z.

Referenced by cat_libfile(), device_data_consumer_put_bytes(), gdiplus_format(), gdiplusgen_end_job(), gvdevice_gd_putBuf(), gvdevice_gd_putC(), gvprintdouble(), gvprintf(), gvprintpointf(), gvputc(), gvputs(), svg_bzptarray(), and writer().

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

◆ gvwrite_no_z()

static size_t gvwrite_no_z ( GVJ_t job,
const void *  s,
size_t  len 
)
static

Definition at line 60 of file gvdevice.c.

References GVJ_s::common, GVCOMMON_s::errorfn, graphviz_exit(), GVJ_s::gvc, len(), NULL, GVJ_s::output_data, GVJ_s::output_data_allocated, GVJ_s::output_data_position, GVJ_s::output_file, and GVC_s::write_fn.

Referenced by gvdevice_finalize(), gvdevice_initialize(), and gvwrite().

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

◆ if() [1/2]

else if ( startswith(staging, "-0.")  )

Definition at line 444 of file gvdevice.c.

◆ if() [2/2]

if ( startswith(staging, "0.")  )

Definition at line 442 of file gvdevice.c.

◆ val_str()

val_str ( maxnegnum  ,
-999999999999999.  99 
)

Variable Documentation

◆ number

double number
Initial value:
{
if (number < maxnegnum) {
agxbput(xb, maxnegnumstr);
return;
}
if (number > -maxnegnum) {
agxbput(xb, maxnegnumstr + 1);
return;
}
agxbprint(xb, "%.03f", number)
static int agxbprint(agxbuf *xb, const char *fmt,...)
Printf-style output to an agxbuf.
Definition agxbuf.h:213
double number
Definition gvdevice.c:421
agxbput(xb, staging)

Definition at line 421 of file gvdevice.c.