Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
agxbuf.h File Reference
#include <assert.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <util/alloc.h>
#include <util/unused.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 WUR 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 230 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 29 of file agxbuf.h.

Function Documentation

◆ agxbclear()

static void agxbclear ( agxbuf xb)
inlinestatic

Definition at line 294 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(), extoken_fn(), and pango_textlayout().

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 327 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(), appendFItemList(), buildBindings(), compile(), concat(), fmtquote(), getName(), getName(), gv_get_font(), gv_postprocess(), gvconfig(), gvpr_select(), htmlEntityUTF8(), latin1ToUTF8(), lexname(), make_simple_label(), pango_psfontResolve(), parseBracket(), parseString(), pov_color_as_str(), sprintXDot(), strdup_and_subst_obj0(), 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 78 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(), cairogen_begin_anchor(), 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_graphics(), emit_edge_label(), emit_page(), expandPercentsEval(), 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(), 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(), setSeed(), setval(), spanning_tree(), stringOf(), svg_size(), traverse(), vgpane(), 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 89 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(), agxbuse(), beginstr(), beginstr(), dgsprintxy(), 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 131 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 156 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 111 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 234 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(), cairogen_begin_anchor(), cccomps(), ccomps(), checkLabelOrder(), chkGraphName(), clone_graph(), cloneNode(), clustNode(), color_string(), colorx(), colorxlate(), compile(), concat(), concatPort(), concatPort(), createEdgeId(), createGraphId(), createNodeId(), createOneBlock(), default_pencolor(), deparseAttr(), deparseAttr(), dgsprintxy(), dot_polygon(), emit_edge_label(), exdump(), expandPercentsEval(), fig_bezier(), findCComp(), findPath(), fullColor(), gen(), get_avail_faces(), get_metrics_for_font_family(), getName(), getName(), getObjId(), 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(), mkBlock(), mkStmts(), nameOf(), pango_psfontResolve(), pango_textlayout(), 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(), setSeed(), spanning_tree(), sprintXDot(), strdup_and_subst_obj0(), toGradString(), traverse(), vgpane(), writeHdr(), xdot_color_stop(), xdot_fmt_num(), xdot_points(), xdot_str_color_xbuf(), 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 270 of file agxbuf.h.

References agxbput_n().

Here is the call graph for this function:

◆ agxbput_n()

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

Definition at line 250 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(), expandPercentsEval(), 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 103 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 84 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 70 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(), agxbuse(), 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 364 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.

Here is the call graph for this function:

◆ agxbuse()

static WUR char * agxbuse ( agxbuf xb)
inlinestatic

Definition at line 307 of file agxbuf.h.

References agxbclear(), agxblen(), agxbputc(), agxbstart(), AGXBUF_INLINE_SIZE_0, agxbuf_is_inline(), agxbuf::store, and agxbuf::u.

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(), cairogen_begin_anchor(), 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(), expandPercentsEval(), 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(), 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(), setSeed(), spanning_tree(), svg_size(), traverse(), unknown(), unknown(), vgpane(), writeHdr(), xdot_end_cluster(), xdot_end_edge(), xdot_end_graph(), xdot_end_node(), xdot_gradient_fillcolor(), xdot_style(), and yyparse().

Here is the call graph for this function:

◆ vagxbprint()

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

Definition at line 162 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: