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

Formatted output: the field kinds, the value union, the macros that build both, and the numer table. More...

Go to the source code of this file.

Data Structures

struct  mmgr_field
 One field of a spec. More...
struct  mmgr_fval
 One value, tagged with the kind that selects which arm of as holds it. More...
struct  NumerosCfg
 Arguments for the four numer calls. More...
struct  NumerosScriboNs
 Type of the numer dispatch table. More...

Macros

#define MMGR_STR
 Expands to an mmgr_field of kind MMGR_FK_STR, with width 0, bytes 0 and literal NULL.
#define MMGR_U32
 Expands to an mmgr_field of kind MMGR_FK_U32, with width 0, bytes 0 and literal NULL.
#define MMGR_U64
 Expands to an mmgr_field of kind MMGR_FK_U64, with width 0, bytes 0 and literal NULL.
#define MMGR_I64
 Expands to an mmgr_field of kind MMGR_FK_I64, with width 0, bytes 0 and literal NULL.
#define MMGR_CH
 Expands to an mmgr_field of kind MMGR_FK_CH, with width 0, bytes 0 and literal NULL.
#define MMGR_JSON
 Expands to an mmgr_field of kind MMGR_FK_JSON, with width 0, bytes 0 and literal NULL.
#define MMGR_XML
 Expands to an mmgr_field of kind MMGR_FK_XML, with width 0, bytes 0 and literal NULL.
#define MMGR_END
 Expands to an mmgr_field of kind MMGR_FK_END, with width 0, bytes 0 and literal NULL.
#define MMGR_VSTR(text_)
 Expands to an mmgr_fval of kind MMGR_FK_STR, with text_ in as.text and width 0.
#define MMGR_VU32(value_)
 Expands to an mmgr_fval of kind MMGR_FK_U32, with value_ in as.u32 and width 0.
#define MMGR_VU64(value_)
 Expands to an mmgr_fval of kind MMGR_FK_U64, with value_ in as.u64 and width 0.
#define MMGR_VI64(value_)
 Expands to an mmgr_fval of kind MMGR_FK_I64, with value_ in as.i64 and width 0.
#define MMGR_VDEC(value_)
 Expands to an mmgr_fval of kind MMGR_FK_DEC, with value_ in as.u32 and width 0.
#define MMGR_VHEX(value_)
 Expands to an mmgr_fval of kind MMGR_FK_HEX, with value_ in as.u64 and width 0.
#define MMGR_VOCT(value_)
 Expands to an mmgr_fval of kind MMGR_FK_OCT, with value_ in as.u64 and width 0.
#define MMGR_VG(value_)
 Expands to an mmgr_fval of kind MMGR_FK_G, with value_ in as.real and width 0.
#define MMGR_VFIX(value_)
 Expands to an mmgr_fval of kind MMGR_FK_FIX, with value_ in as.real and width 0.
#define MMGR_VCH(character_)
 Expands to an mmgr_fval of kind MMGR_FK_CH, with character_ in as.character and width 0.
#define MMGR_VJSON(text_)
 Expands to an mmgr_fval of kind MMGR_FK_JSON, with text_ in as.text and width 0.
#define MMGR_VXML(text_)
 Expands to an mmgr_fval of kind MMGR_FK_XML, with text_ in as.text and width 0.
#define MMGR_VDECW(value_, width_)
 Expands to an mmgr_fval of kind MMGR_FK_DEC, with value_ in as.u32 and width_ in width.
#define MMGR_VHEXW(value_, width_)
 Expands to an mmgr_fval of kind MMGR_FK_HEX, with value_ in as.u64 and width_ in width.
#define MMGR_VOCTW(value_, width_)
 Expands to an mmgr_fval of kind MMGR_FK_OCT, with value_ in as.u64 and width_ in width.
#define MMGR_VGW(value_, width_)
 Expands to an mmgr_fval of kind MMGR_FK_G, with value_ in as.real and width_ in width.
#define MMGR_VFIXW(value_, width_)
 Expands to an mmgr_fval of kind MMGR_FK_FIX, with value_ in as.real and width_ in width.

Enumerations

enum  mmgr_fk {
  MMGR_FK_END ,
  MMGR_FK_LIT ,
  MMGR_FK_STR ,
  MMGR_FK_U32 ,
  MMGR_FK_U64 ,
  MMGR_FK_I64 ,
  MMGR_FK_DEC ,
  MMGR_FK_HEX ,
  MMGR_FK_OCT ,
  MMGR_FK_G ,
  MMGR_FK_FIX ,
  MMGR_FK_CH ,
  MMGR_FK_JSON ,
  MMGR_FK_XML
}
 What one field formats, and which mmgr_fval arm it reads. More...

Functions

size_t mmgr_numer_build (const NumerosCfg *args)
 Writes args->spec and args->vals into args->out, starting at args->at.
size_t mmgr_numer_append (const NumerosCfg *args)
 Writes args->spec and args->vals into args->out after the string already there.
size_t mmgr_numer_emit (const NumerosCfg *args)
 Writes args->vals into args->out, starting at args->at and reading no field list.
size_t mmgr_numer_emit_append (const NumerosCfg *args)
 Writes args->vals into args->out after the string already there, reading no field list.

Variables

static const NumerosScriboNs numer
 Dispatch table instance named numer.

Detailed Description

Formatted output: the field kinds, the value union, the macros that build both, and the numer table.

Author
dstroy0 (Douglas Quigg) dquig.nosp@m.g123.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
2026-08-29
Note
A spec is an mmgr_field array ending at MMGR_FK_END. Every field but MMGR_FK_LIT takes one mmgr_fval.
Includes verba_scribo.h, which is where mmgr_config.h and the verba table come from.

Definition in file numeros_scribo.h.

Macro Definition Documentation

◆ MMGR_STR

#define MMGR_STR

Expands to an mmgr_field of kind MMGR_FK_STR, with width 0, bytes 0 and literal NULL.

Definition at line 60 of file numeros_scribo.h.

◆ MMGR_U32

#define MMGR_U32

Expands to an mmgr_field of kind MMGR_FK_U32, with width 0, bytes 0 and literal NULL.

Definition at line 63 of file numeros_scribo.h.

◆ MMGR_U64

#define MMGR_U64

Expands to an mmgr_field of kind MMGR_FK_U64, with width 0, bytes 0 and literal NULL.

Definition at line 66 of file numeros_scribo.h.

◆ MMGR_I64

#define MMGR_I64

Expands to an mmgr_field of kind MMGR_FK_I64, with width 0, bytes 0 and literal NULL.

Definition at line 69 of file numeros_scribo.h.

◆ MMGR_CH

#define MMGR_CH

Expands to an mmgr_field of kind MMGR_FK_CH, with width 0, bytes 0 and literal NULL.

Definition at line 72 of file numeros_scribo.h.

◆ MMGR_JSON

#define MMGR_JSON

Expands to an mmgr_field of kind MMGR_FK_JSON, with width 0, bytes 0 and literal NULL.

Definition at line 75 of file numeros_scribo.h.

◆ MMGR_XML

#define MMGR_XML

Expands to an mmgr_field of kind MMGR_FK_XML, with width 0, bytes 0 and literal NULL.

Definition at line 78 of file numeros_scribo.h.

◆ MMGR_END

#define MMGR_END

Expands to an mmgr_field of kind MMGR_FK_END, with width 0, bytes 0 and literal NULL.

Note
numer_build stops at this field, and so every spec array needs one as its last entry.

Definition at line 85 of file numeros_scribo.h.

◆ MMGR_VSTR

#define MMGR_VSTR ( text_)

Expands to an mmgr_fval of kind MMGR_FK_STR, with text_ in as.text and width 0.

Parameters
[in]text_String placed in as.text [BORROWS].

Definition at line 114 of file numeros_scribo.h.

◆ MMGR_VU32

#define MMGR_VU32 ( value_)

Expands to an mmgr_fval of kind MMGR_FK_U32, with value_ in as.u32 and width 0.

Parameters
[in]value_Value placed in as.u32.

Definition at line 121 of file numeros_scribo.h.

◆ MMGR_VU64

#define MMGR_VU64 ( value_)

Expands to an mmgr_fval of kind MMGR_FK_U64, with value_ in as.u64 and width 0.

Parameters
[in]value_Value placed in as.u64.

Definition at line 128 of file numeros_scribo.h.

◆ MMGR_VI64

#define MMGR_VI64 ( value_)

Expands to an mmgr_fval of kind MMGR_FK_I64, with value_ in as.i64 and width 0.

Parameters
[in]value_Value placed in as.i64.

Definition at line 135 of file numeros_scribo.h.

◆ MMGR_VDEC

#define MMGR_VDEC ( value_)

Expands to an mmgr_fval of kind MMGR_FK_DEC, with value_ in as.u32 and width 0.

Parameters
[in]value_Value placed in as.u32.

Definition at line 142 of file numeros_scribo.h.

◆ MMGR_VHEX

#define MMGR_VHEX ( value_)

Expands to an mmgr_fval of kind MMGR_FK_HEX, with value_ in as.u64 and width 0.

Parameters
[in]value_Value placed in as.u64.

Definition at line 149 of file numeros_scribo.h.

◆ MMGR_VOCT

#define MMGR_VOCT ( value_)

Expands to an mmgr_fval of kind MMGR_FK_OCT, with value_ in as.u64 and width 0.

Parameters
[in]value_Value placed in as.u64.

Definition at line 156 of file numeros_scribo.h.

◆ MMGR_VG

#define MMGR_VG ( value_)

Expands to an mmgr_fval of kind MMGR_FK_G, with value_ in as.real and width 0.

Parameters
[in]value_Value placed in as.real.

Definition at line 163 of file numeros_scribo.h.

◆ MMGR_VFIX

#define MMGR_VFIX ( value_)

Expands to an mmgr_fval of kind MMGR_FK_FIX, with value_ in as.real and width 0.

Parameters
[in]value_Value placed in as.real.

Definition at line 170 of file numeros_scribo.h.

◆ MMGR_VCH

#define MMGR_VCH ( character_)

Expands to an mmgr_fval of kind MMGR_FK_CH, with character_ in as.character and width 0.

Parameters
[in]character_Character placed in as.character.

Definition at line 177 of file numeros_scribo.h.

◆ MMGR_VJSON

#define MMGR_VJSON ( text_)

Expands to an mmgr_fval of kind MMGR_FK_JSON, with text_ in as.text and width 0.

Parameters
[in]text_String placed in as.text [BORROWS].

Definition at line 184 of file numeros_scribo.h.

◆ MMGR_VXML

#define MMGR_VXML ( text_)

Expands to an mmgr_fval of kind MMGR_FK_XML, with text_ in as.text and width 0.

Parameters
[in]text_String placed in as.text [BORROWS].

Definition at line 191 of file numeros_scribo.h.

◆ MMGR_VDECW

#define MMGR_VDECW ( value_,
width_ )

Expands to an mmgr_fval of kind MMGR_FK_DEC, with value_ in as.u32 and width_ in width.

Parameters
[in]value_Value placed in as.u32.
[in]width_Width placed in the width member.
Note
numer_emit uses that width. numer_build takes the width from the field instead.

Definition at line 200 of file numeros_scribo.h.

◆ MMGR_VHEXW

#define MMGR_VHEXW ( value_,
width_ )

Expands to an mmgr_fval of kind MMGR_FK_HEX, with value_ in as.u64 and width_ in width.

Parameters
[in]value_Value placed in as.u64.
[in]width_Width placed in the width member.
Note
numer_emit uses that width. numer_build takes the width from the field instead.

Definition at line 209 of file numeros_scribo.h.

◆ MMGR_VOCTW

#define MMGR_VOCTW ( value_,
width_ )

Expands to an mmgr_fval of kind MMGR_FK_OCT, with value_ in as.u64 and width_ in width.

Parameters
[in]value_Value placed in as.u64.
[in]width_Width placed in the width member.
Note
numer_emit uses that width. numer_build takes the width from the field instead.

Definition at line 218 of file numeros_scribo.h.

◆ MMGR_VGW

#define MMGR_VGW ( value_,
width_ )

Expands to an mmgr_fval of kind MMGR_FK_G, with value_ in as.real and width_ in width.

Parameters
[in]value_Value placed in as.real.
[in]width_Width placed in the width member.
Note
numer_emit_one hands that width to mmgr_verba_g as VerbaFractioCfg::sig, the significant digits it keeps.
numer_emit uses it. numer_build takes the width from the field instead.

Definition at line 229 of file numeros_scribo.h.

◆ MMGR_VFIXW

#define MMGR_VFIXW ( value_,
width_ )

Expands to an mmgr_fval of kind MMGR_FK_FIX, with value_ in as.real and width_ in width.

Parameters
[in]value_Value placed in as.real.
[in]width_Width placed in the width member.
Note
numer_emit_one hands that width to mmgr_verba_fixed as VerbaFractioCfg::decimals, the digits it writes after the point.
numer_emit uses it. numer_build takes the width from the field instead.

Definition at line 240 of file numeros_scribo.h.

Enumeration Type Documentation

◆ mmgr_fk

enum mmgr_fk

What one field formats, and which mmgr_fval arm it reads.

Note
numeros_scribo.c indexes s_kind by this value, and so MMGR_FK_XML is the largest one it accepts.
One byte on every compiler, through EMBED_ENUM_BYTE.
Enumerator
MMGR_FK_END 

Ends a spec. numer_build stops at this field.

MMGR_FK_LIT 

Literal text, taken from mmgr_field::lit and mmgr_field::len.

MMGR_FK_STR 

String from as.s, through mmgr_verba_put.

MMGR_FK_U32 

Unsigned 32-bit from as.u32, base 10, through mmgr_verba_u32.

MMGR_FK_U64 

Unsigned 64-bit from as.u64, base 10, through mmgr_verba_u64.

MMGR_FK_I64 

Signed 64-bit from as.i64, base 10, through mmgr_verba_i64.

MMGR_FK_DEC 

Unsigned 32-bit from as.u32, base 10, through mmgr_verba_u32w.

MMGR_FK_HEX 

Unsigned 64-bit from as.u64, base 16, through mmgr_verba_hex.

MMGR_FK_OCT 

Unsigned 64-bit from as.u64, base 8, through mmgr_verba_uint.

MMGR_FK_G 

Double from as.d, through mmgr_verba_g, defaulting to six significant digits.

MMGR_FK_FIX 

Double from as.d, through mmgr_verba_fixed.

MMGR_FK_CH 

Single character from as.c, through mmgr_verba_ch.

MMGR_FK_JSON 

String from as.s, through mmgr_verba_json.

MMGR_FK_XML 

String from as.s, through mmgr_verba_xml.

Definition at line 44 of file numeros_scribo.h.

Function Documentation

◆ mmgr_numer_build()

size_t mmgr_numer_build ( const NumerosCfg * args)

Writes args->spec and args->vals into args->out, starting at args->at.

Parameters
[in]argsBuffer, capacity, the field list and the values [BORROWS].
Returns
Length of the whole string in args->out, not counting its terminator, or 0 when nothing was written.
Note
An MMGR_FK_LIT field writes its own text. Every other field consumes the next value in args->vals.
Returns 0 and puts the terminator back at args->at when a value is missing, when a kind differs, or when values are left over, which leaves the text written before this call whole.
Warning
args->spec must reach an MMGR_FK_END field, and args->vals must hold args->nvals values.

References mmgr_numer_build().

Referenced by mmgr_numer_build().

◆ mmgr_numer_append()

size_t mmgr_numer_append ( const NumerosCfg * args)

Writes args->spec and args->vals into args->out after the string already there.

Parameters
[in]argsBuffer, capacity, the field list and the values [BORROWS].
Returns
Length of the whole string in args->out, or 0 when nothing was added.
Note
Carries on at args->at when the caller threaded one, and measures the existing string with cellul.len only when args->at is 0. Either way the build gets the whole of args->cap and that offset.
Puts the terminator back at the offset it began from and returns 0 when the build writes nothing.
Warning
args->spec must reach an MMGR_FK_END field, and args->out must hold a terminated string when args->at is 0, since that is the only time the length is measured.

References mmgr_numer_append().

Referenced by mmgr_numer_append().

◆ mmgr_numer_emit()

size_t mmgr_numer_emit ( const NumerosCfg * args)

Writes args->vals into args->out, starting at args->at and reading no field list.

Parameters
[in]argsBuffer, capacity and the values [BORROWS].
Returns
Length of the whole string in args->out, not counting its terminator, or 0 when nothing was written.
Note
Each value carries its own width, and no kind is matched, since there are no fields to match against.
Warning
args->vals must hold args->nvals values.
A value of kind MMGR_FK_END or MMGR_FK_LIT formats nothing, which abandons the write and returns 0.

References mmgr_numer_emit().

Referenced by mmgr_numer_emit().

◆ mmgr_numer_emit_append()

size_t mmgr_numer_emit_append ( const NumerosCfg * args)

Writes args->vals into args->out after the string already there, reading no field list.

Parameters
[in]argsBuffer, capacity and the values [BORROWS].
Returns
Length of the whole string in args->out, or 0 when nothing was added.
Note
Carries on at args->at when the caller threaded one, and measures the existing string with cellul.len only when args->at is 0. Either way the emit gets the whole of args->cap and that offset.
Puts the terminator back at the offset it began from and returns 0 when the emit writes nothing.
Warning
args->vals must hold args->nvals values, and args->out must hold a terminated string when args->at is 0, since that is the only time the length is measured.

References mmgr_numer_emit_append().

Referenced by mmgr_numer_emit_append().

Variable Documentation

◆ numer

const NumerosScriboNs numer
static

Dispatch table instance named numer.

Note
Each member calls the matching mmgr_numer_ function, one to one.
mmgr_numer_append reaches build through this table, and mmgr_numer_emit_append reaches emit.

Definition at line 337 of file numeros_scribo.h.