Graphviz 12.0.1~dev.20240715.2254
Loading...
Searching...
No Matches
agxbuf.h File Reference
#include <assert.h>
#include <cgraph/alloc.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for agxbuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  agxbuf
 

Macros

#define PRINTF_LIKE(index, first)   /* nothing */
 

Enumerations

enum  agxbuf_loc_t { AGXBUF_INLINE_SIZE_0 = 0 , AGXBUF_ON_HEAP = 255 }
 a description of where a buffer is located More...
 

Functions

static bool agxbuf_is_inline (const agxbuf *xb)
 
static void agxbfree (agxbuf *xb)
 free any malloced resources
 
static char * agxbstart (agxbuf *xb)
 return pointer to beginning of buffer
 
static size_t agxblen (const agxbuf *xb)
 return number of characters currently stored
 
static size_t agxbsizeof (const agxbuf *xb)
 
static int agxbpop (agxbuf *xb)
 removes last character added, if any
 
static void agxbmore (agxbuf *xb, size_t ssz)
 expand buffer to hold at least ssz more bytes
 
static char * agxbnext (agxbuf *xb)
 next position for writing
 
static int vagxbprint (agxbuf *xb, const char *fmt, va_list ap)
 vprintf-style output to an agxbuf
 
static int agxbprint (agxbuf *xb, const char *fmt,...)
 Printf-style output to an agxbuf.
 
static size_t agxbput_n (agxbuf *xb, const char *s, size_t ssz)
 append string s of length ssz into xb
 
static size_t agxbput (agxbuf *xb, const char *s)
 append string s into xb
 
static int agxbputc (agxbuf *xb, char c)
 add character to buffer
 
static void agxbclear (agxbuf *xb)
 resets pointer to data
 
static char * agxbuse (agxbuf *xb)
 
static char * agxbdisown (agxbuf *xb)
 
static void agxbuf_trim_zeros (agxbuf *xb)
 

Macro Definition Documentation

◆ PRINTF_LIKE

#define PRINTF_LIKE (   index,
  first 
)    /* nothing */

Definition at line 209 of file agxbuf.h.

Enumeration Type Documentation

◆ agxbuf_loc_t

Enumerator
AGXBUF_INLINE_SIZE_0 
AGXBUF_ON_HEAP 

buffer is dynamically allocated

Definition at line 28 of file agxbuf.h.

Function Documentation

◆ agxbclear()

static void agxbclear ( agxbuf xb)
inlinestatic

Definition at line 273 of file agxbuf.h.

References AGXBUF_INLINE_SIZE_0, agxbuf_is_inline(), agxbuf::located, agxbuf::s, agxbuf::size, and agxbuf::u.

Referenced by addEdgeGraphics(), addEdgeGraphics(), addEdgeLabelGraphics(), addEdgeLabelGraphics(), addNodeGraphics(), addNodeGraphics(), addNodeLabelGraphics(), addNodeLabelGraphics(), agerr_va(), agxbuse(), error_context(), and extoken_fn().

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

◆ agxbdisown()

static char * agxbdisown ( agxbuf xb)
inlinestatic

Definition at line 299 of file agxbuf.h.

References agxblen(), agxbputc(), agxbuf_is_inline(), agxbuf::buf, gv_strndup(), agxbuf::s, agxbuf::store, and agxbuf::u.

Referenced by aglasterr(), appendFItemList(), buildBindings(), canontoken(), compile(), concat(), fmtquote(), getName(), gv_get_font(), gv_postprocess(), gvconfig(), gvpr_select(), htmlEntityUTF8(), latin1ToUTF8(), lexname(), make_simple_label(), parseBracket(), parseString(), pov_color_as_str(), sprintXDot(), strdup_and_subst_obj0(), tclhandleAlloc(), and utf8ToLatin1().

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

◆ agxbfree()

static void agxbfree ( agxbuf xb)
inlinestatic

Definition at line 77 of file agxbuf.h.

References AGXBUF_ON_HEAP, agxbuf::buf, free(), agxbuf::located, agxbuf::s, and agxbuf::u.

Referenced by aagerror(), aagerror(), attach_attrs_and_arrows(), attach_edge_colors(), attach_phase_attrs(), attached_clustering(), cccomps(), ccomps(), checkLabelOrder(), clearHTMLlexer(), clone_graph(), cloneNode(), colorx(), colorxlate(), colorxlate(), concatPort(), concatPort(), createEdgeId(), createGraphId(), createNodeId(), createOneBlock(), deref(), Dot_SetClusterColor(), emit_begin_edge(), emit_edge(), emit_edge_label(), emit_page(), exsub(), fig_bezier(), findCComp(), get_font_mapping(), get_metrics_for_font_family(), getval(), global_def(), gml_to_gv(), gml_to_gv(), graph_init(), gvloadimage(), gvplugin_graph(), gvplugin_library_load(), gvplugin_load(), gvprintf(), gvprintpointf(), gvrender_resolve_color(), initAnchor(), initObjMapData(), jsonXDot_Op(), lookup(), main(), make_html_label(), make_simple_label(), makeBlockGraph(), makeDotGraph(), makeGraphs(), mkBlock(), mkBlock(), mkStmts(), on_gvprbuttonload_clicked(), pango_textlayout(), parseCase(), parseHTML(), parseString(), pccomps(), plot_dot_map(), plot_dot_polygons(), pov_bezier(), pov_color_as_str(), pov_ellipse(), pov_textspan(), printdouble(), printFloat(), printint(), printPolyline(), printRect(), printXDot_Op(), process(), processClusterEdges(), processClusters(), put_escaping_backslashes(), readLine(), rec_attach_bb(), refval(), resolve(), resolveColor(), run_gvpr(), setcolor(), setval(), spanning_tree(), stringOf(), svg_size(), traverse(), writeHdr(), xdot_end_graph(), xdot_gradient_fillcolor(), and xdot_style().

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

◆ agxblen()

static size_t agxblen ( const agxbuf xb)
inlinestatic

Definition at line 88 of file agxbuf.h.

References AGXBUF_INLINE_SIZE_0, agxbuf_is_inline(), agxbuf::located, agxbuf::s, agxbuf::size, and agxbuf::u.

Referenced by aagerror(), aagerror(), addEdgePoint(), addEdgePoint(), agxbdisown(), agxbmore(), agxbnext(), agxbpop(), agxbput_n(), agxbputc(), agxbuf_trim_zeros(), beginstr(), beginstr(), htmllex(), make_simple_label(), parse_style(), vagxbprint(), 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:

◆ agxbmore()

static void agxbmore ( agxbuf xb,
size_t  ssz 
)
inlinestatic

Definition at line 130 of file agxbuf.h.

References agxblen(), agxbsizeof(), AGXBUF_ON_HEAP, agxbuf::buf, agxbuf::capacity, cnt(), gv_calloc(), gv_recalloc(), agxbuf::located, agxbuf::s, agxbuf::size, agxbuf::store, and agxbuf::u.

Referenced by agxbput_n(), agxbputc(), and vagxbprint().

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

◆ agxbnext()

static char * agxbnext ( agxbuf xb)
inlinestatic

Definition at line 155 of file agxbuf.h.

References agxblen(), agxbuf_is_inline(), agxbuf::buf, len(), agxbuf::s, agxbuf::store, and agxbuf::u.

Referenced by vagxbprint().

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

◆ agxbpop()

static int agxbpop ( agxbuf xb)
inlinestatic

Definition at line 110 of file agxbuf.h.

References agxblen(), AGXBUF_INLINE_SIZE_0, agxbuf_is_inline(), agxbuf::buf, len(), agxbuf::located, agxbuf::s, agxbuf::size, agxbuf::store, and agxbuf::u.

Referenced by attach_attrs_and_arrows(), and xdot_gradient_fillcolor().

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

◆ agxbprint()

static int agxbprint ( agxbuf xb,
const char *  fmt,
  ... 
)
inlinestatic

Definition at line 213 of file agxbuf.h.

References vagxbprint().

Referenced by aagerror(), aagerror(), addEdgeLabelGraphics(), addEdgeLabelGraphics(), addEdgePoint(), addEdgePoint(), addNodeGraphics(), addNodeGraphics(), attach_attrs_and_arrows(), attach_phase_attrs(), attached_clustering(), auto_output_filename(), blockName(), buildBindings(), cccomps(), ccomps(), checkLabelOrder(), chkGraphName(), clone_graph(), cloneNode(), clustNode(), color_string(), colorx(), colorxlate(), compile(), concat(), concatPort(), concatPort(), createEdgeId(), createGraphId(), createNodeId(), createOneBlock(), default_pencolor(), deparseAttr(), deparseAttr(), dot_polygon(), emit_edge_label(), exccopen(), exdump(), fig_bezier(), findCComp(), findPath(), fullColor(), gen(), get_avail_faces(), get_metrics_for_font_family(), getName(), getObjId(), global(), graph_init(), gv_get_font(), gv_postprocess(), gvconfig(), gvloadimage(), gvplugin_graph(), gvplugin_library_load(), gvplugin_list(), gvplugin_load(), gvpr_select(), gvrender_resolve_color(), hue2rgb(), initAnchor(), layerPagePrefix(), lexname(), makeBlockGraph(), makeDotGraph(), makeGraphs(), mkBlock(), mkStmts(), nameOf(), pccomps(), pov_bezier(), pov_color_as_str(), pov_ellipse(), pov_textspan(), print(), printdouble(), printFloat(), printint(), printPolyline(), printRect(), process(), processClusters(), rec_attach_bb(), resolve(), rgb2hex(), run_gvpr(), scan(), scanEntity(), set_record_rects(), spanning_tree(), sprintXDot(), strdup_and_subst_obj0(), tclhandleAlloc(), toGradString(), traverse(), writeHdr(), xdot_color_stop(), xdot_fmt_num(), xdot_points(), xdot_str_xbuf(), xdot_style(), and xdot_textspan().

Here is the call graph for this function:

◆ agxbput()

static size_t agxbput ( agxbuf xb,
const char *  s 
)
inlinestatic

Definition at line 249 of file agxbuf.h.

References agxbput_n().

Referenced by addEdgeGraphics(), addEdgeGraphics(), addEdgeLabelGraphics(), addEdgeLabelGraphics(), addNodeGraphics(), addNodeGraphics(), addNodeLabelGraphics(), addNodeLabelGraphics(), addstr(), addstr(), aglasterr(), agxbput_int(), agxbput_move(), colorxlate(), core_loadimage_xdot(), default_pencolor(), deparseList(), deparseList(), emit_edge(), emit_page(), exccopen(), exsub(), extoken_fn(), fmtquote(), gen(), getName(), getObjId(), global_def(), gv_get_font(), gvplugin_library_load(), nameOf(), nameOf(), on_gvprbuttonload_clicked(), pango_textlayout(), plot_dot_polygons(), print(), resolve(), scan(), setPrefix(), strdup_and_subst_obj0(), xdot_ellipse(), xdot_gradient_fillcolor(), xdot_style(), and xdot_textspan().

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

◆ agxbput_n()

static size_t agxbput_n ( agxbuf xb,
const char *  s,
size_t  ssz 
)
inlinestatic

Definition at line 229 of file agxbuf.h.

References agxblen(), agxbmore(), agxbsizeof(), agxbuf_is_inline(), agxbuf::buf, len(), agxbuf::located, agxbuf::s, agxbuf::size, agxbuf::store, and agxbuf::u.

Referenced by agxbput(), error_context(), exsub(), global_def(), parse_style(), replace(), resolve(), and rgb2hex().

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

◆ agxbputc()

◆ agxbsizeof()

static size_t agxbsizeof ( const agxbuf xb)
inlinestatic

get the capacity of the backing memory of a buffer

In contrast to agxblen, this is the total number of usable bytes in the backing store, not the total number of currently stored bytes.

Parameters
xbBuffer to operate on
Returns
Number of usable bytes in the backing store

Definition at line 102 of file agxbuf.h.

References agxbuf_is_inline(), agxbuf::capacity, agxbuf::s, agxbuf::store, and agxbuf::u.

Referenced by agxbmore(), agxbput_n(), agxbputc(), and vagxbprint().

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

◆ agxbstart()

static char * agxbstart ( agxbuf xb)
inlinestatic

Definition at line 83 of file agxbuf.h.

References agxbuf_is_inline(), agxbuf::buf, agxbuf::s, agxbuf::store, and agxbuf::u.

Referenced by agxbuf_trim_zeros(), and agxbuse().

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

◆ agxbuf_is_inline()

static bool agxbuf_is_inline ( const agxbuf xb)
inlinestatic

Definition at line 69 of file agxbuf.h.

References AGXBUF_ON_HEAP, agxbuf::located, agxbuf::s, agxbuf::store, and agxbuf::u.

Referenced by agxbclear(), agxbdisown(), agxblen(), agxbnext(), agxbpop(), agxbput_n(), agxbputc(), agxbsizeof(), agxbstart(), agxbuf_trim_zeros(), and vagxbprint().

Here is the caller graph for this function:

◆ agxbuf_trim_zeros()

static void agxbuf_trim_zeros ( agxbuf xb)
inlinestatic

trim extraneous trailing information from a printed floating point value

tl;dr:

  • “42.00” → “42”
  • “42.01” → “42.01”
  • “42.10” → “42.1”
  • “-0.0” → “0”

Printing a double or float via, for example, agxbprint("%.02f", 42.003) can result in output like “42.00”. If this data is destined for something that does generalized floating point parsing/decoding (e.g. SVG viewers) the “.00” is unnecessary. “42” would be interpreted identically. This function can be called after such a agxbprint to normalize data.

Parameters
xbBuffer to operate on

Definition at line 336 of file agxbuf.h.

References agxblen(), agxbstart(), AGXBUF_INLINE_SIZE_0, agxbuf_is_inline(), len(), agxbuf::located, agxbuf::s, agxbuf::size, SIZE_MAX, and agxbuf::u.

Referenced by printFloat(), printPolyline(), printRect(), xdot_color_stop(), xdot_fmt_num(), and xdot_style().

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

◆ agxbuse()

static char * agxbuse ( agxbuf xb)
inlinestatic

Definition at line 286 of file agxbuf.h.

References agxbclear(), agxbputc(), and agxbstart().

Referenced by aagerror(), aagerror(), addEdgeGraphics(), addEdgeGraphics(), addEdgeLabelGraphics(), addEdgeLabelGraphics(), addEdgePos(), addEdgePos(), addNodeGraphics(), addNodeGraphics(), addNodeLabelGraphics(), addNodeLabelGraphics(), attach_attrs_and_arrows(), attach_edge_colors(), attach_phase_attrs(), attached_clustering(), auto_output_filename(), blockName(), cccomps(), ccomps(), checkLabelOrder(), chkGraphName(), clone_graph(), cloneNode(), clustNode(), colorx(), colorxlate(), colorxlate(), concatPort(), concatPort(), createEdgeId(), createGraphId(), createNodeId(), createOneBlock(), default_pencolor(), deparse(), Dot_SetClusterColor(), emit_edge(), emit_edge_label(), emit_page(), endstr(), endstr(), endstr_html(), endstr_html(), error_context(), exccclose(), exsub(), extoken_fn(), fig_bezier(), findCComp(), findPath(), fullColor(), get_avail_faces(), get_metrics_for_font_family(), getObjId(), global_def(), graph_init(), gvloadimage(), gvplugin_graph(), gvplugin_library_load(), gvplugin_list(), gvplugin_load(), gvprintf(), gvprintpointf(), gvrender_resolve_color(), htmllex(), hue2rgb(), initAnchor(), jsonXDot_Op(), makeBlockGraph(), makeDotGraph(), makeGraphs(), mkBlock(), mkStmts(), nameOf(), nameOf(), nameOf(), on_gvprbuttonload_clicked(), pango_textlayout(), parse_style(), pccomps(), plot_dot_map(), plot_dot_polygons(), pov_bezier(), pov_color_as_str(), pov_ellipse(), pov_textspan(), printdouble(), printFloat(), printint(), printPolyline(), printRect(), printXDot_Op(), process(), processClusters(), ps_string(), put_escaping_backslashes(), readLine(), rec_attach_bb(), resolve(), run_gvpr(), setcolor(), spanning_tree(), svg_size(), traverse(), unknown(), unknown(), writeHdr(), xdot_end_cluster(), xdot_end_edge(), xdot_end_graph(), xdot_end_node(), xdot_gradient_fillcolor(), and xdot_style().

Here is the call graph for this function:

◆ vagxbprint()

static int vagxbprint ( agxbuf xb,
const char *  fmt,
va_list  ap 
)
inlinestatic

Definition at line 161 of file agxbuf.h.

References agxblen(), agxbmore(), agxbnext(), agxbsizeof(), agxbuf_is_inline(), agxbuf::located, NULL, agxbuf::s, agxbuf::size, agxbuf::store, and agxbuf::u.

Referenced by agerr_va(), agxbprint(), and gvprintf().

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