* 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. */
| 5228 | * format it when the end anchor tag is seen. |
| 5229 | */ |
| 5230 | static void |
| 5231 | xo_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 | |
| 5249 | static void |
| 5250 | xo_anchor_stop (xo_handle_t *xop, xo_field_info_t *xfip, |
no test coverage detected