MMgr v2.3.0
Zero-heap memory manager in C11. One borrowed buffer, carved by asserted offset.
Loading...
Searching...
No Matches
verba_linea.h File Reference

A line written into a caller's buffer and passed on as it fills, one field at a time. More...

#include "mmgr.h"

Go to the source code of this file.

Data Structures

struct  VerbaLinea
 A line written into out, at bytes so far, and passed to flush as it fills. More...

Typedefs

typedef int(*) VerbaLineaFlush(void *context, const char *bytes, size_t size)
 Where a line passes the size bytes at bytes it holds once it is full.

Functions

EMBED_HOST_DEVICE VerbaLinea mmgr_line_over (char *out, size_t capacity)
 Makes a line over a buffer, of no capacity where the buffer is NULL.
EMBED_HOST_DEVICE embed_bool mmgr_line_flush (VerbaLinea *line)
 Passes what the line holds to its flush and empties it.
EMBED_HOST_DEVICE size_t mmgr_line_put_n (VerbaLinea *line, const char *text, size_t length)
 Writes length bytes of text.
EMBED_HOST_DEVICE size_t mmgr_line_put (VerbaLinea *line, const char *text)
 Writes a terminated text.
EMBED_HOST_DEVICE size_t mmgr_line_put_max (VerbaLinea *line, const char *text, size_t max)
 Writes a terminated text, at max max bytes of it.
EMBED_HOST_DEVICE void mmgr_line_put_columns (VerbaLinea *line, const char *text, unsigned int columns)
 Writes a terminated text and spaces after it out to columns.
EMBED_HOST_DEVICE void mmgr_line_put_right (VerbaLinea *line, const char *text, unsigned int columns)
 Writes spaces out to columns and then a terminated text, and so the text is right aligned.
EMBED_HOST_DEVICE void mmgr_line_ch (VerbaLinea *line, char character)
 Writes one character.
EMBED_HOST_DEVICE void mmgr_line_decimal (VerbaLinea *line, uint64_t value, unsigned int digits_least)
 Writes value in base ten, padded on the left with zeros to digits_least digits.
EMBED_HOST_DEVICE void mmgr_line_decimal_columns (VerbaLinea *line, uint64_t value, unsigned int columns)
 Writes value in base ten, right aligned in columns with spaces before it.
EMBED_HOST_DEVICE void mmgr_line_decimal_signed (VerbaLinea *line, int64_t value)
 Writes a signed value in base ten, a minus sign before a negative one.
EMBED_HOST_DEVICE void mmgr_line_hex (VerbaLinea *line, uint64_t value, unsigned int digits_least)
 Writes value in lower case base sixteen, padded on the left with zeros to digits_least digits.
EMBED_HOST_DEVICE void mmgr_line_fixed (VerbaLinea *line, double value, unsigned int decimals, unsigned int columns, embed_bool plus)
 Writes a double with decimals digits after the point, right aligned in columns with spaces before it.
EMBED_HOST_DEVICE void mmgr_line_exponent (VerbaLinea *line, double value, unsigned int decimals, unsigned int columns, embed_bool plus)
 Writes a double as one digit, a point, decimals digits, e, a sign and a power of two digits or more, right aligned in columns with spaces before it.
EMBED_HOST_DEVICE void mmgr_line_general (VerbaLinea *line, double value, unsigned int significant, unsigned int columns, embed_bool plus)
 Writes a double to significant digits in the shorter form that printf's g chooses, right aligned in columns with spaces before it.
EMBED_HOST_DEVICE size_t mmgr_line_finish (VerbaLinea *line)
 Stores the terminator, the one store a line no write reached yet still needs.
EMBED_HOST_DEVICE embed_bool mmgr_line_ok (const VerbaLinea *line)
 Reports whether every write fit.

Detailed Description

A line written into a caller's buffer and passed on as it fills, one field at a time.

Author
dstroy0 (Douglas Quigg) dquig.nosp@m.g123.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
2026-10-23
Note
Every entry takes the line and the value it writes as plain arguments, and therefore a C++ translation unit calls them as they are. This header includes mmgr.h alone and defines no table, which retains it free of the designated initializers verba_scribo.h carries.
A write that does not fit a line with no flush writes what fits and leaves at at capacity. Every later write then finds no room. A line with a flush passes what it holds to the flush as it fills and goes on.
Every write leaves the buffer terminated: at at while the line has room, in its last byte once a write did not fit. A written line whose buffer holds no terminator took damage from something other than the line. A line no write reached yet has what its buffer contained until mmgr_line_finish runs.
A text entry answers the bytes of the text the line took. Where that is fewer than the text holds, the line filled. Text plus the answer is where the caller goes on from, in the same room with at set to zero once those bytes are out.

Definition in file verba_linea.h.