MCPcopy Create free account
hub / github.com/F-Stack/f-stack / xo_anchor_start

Function xo_anchor_start

tools/libxo/libxo/libxo.c:5230–5247  ·  view source on GitHub ↗

* An anchor is a marker used to delay field width implications. * Imagine the format string "{[:10}{min:%d}/{cur:%d}/{max:%d}{:]}". * We are looking for output like " 1/4/5" * * To make this work, we record the anchor and then return to * format it when the end anchor tag is seen. */

Source from the content-addressed store, hash-verified

5228 * format it when the end anchor tag is seen.
5229 */
5230static void
5231xo_anchor_start (xo_handle_t *xop, xo_field_info_t *xfip,
5232 const char *value, ssize_t vlen)
5233{
5234 if (XOIF_ISSET(xop, XOIF_ANCHOR))
5235 xo_failure(xop, "the anchor already recording is discarded");
5236
5237 XOIF_SET(xop, XOIF_ANCHOR);
5238 xo_buffer_t *xbp = &xop->xo_data;
5239 xop->xo_anchor_offset = xbp->xb_curp - xbp->xb_bufp;
5240 xop->xo_anchor_columns = 0;
5241
5242 /*
5243 * Now we find the width, if possible. If it's not there,
5244 * we'll get it on the end anchor.
5245 */
5246 xop->xo_anchor_min_width = xo_find_width(xop, xfip, value, vlen);
5247}
5248
5249static void
5250xo_anchor_stop (xo_handle_t *xop, xo_field_info_t *xfip,

Callers 1

xo_do_emit_fieldsFunction · 0.85

Calls 2

xo_failureFunction · 0.85
xo_find_widthFunction · 0.85

Tested by

no test coverage detected