Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
bounded_ini.h File Reference

Allocation-free flat key=value mechanics; callers own schemas and storage. More...

#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for bounded_ini.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef bool(* ini_field_handler) (void *context, const char *key, const char *value)

Functions

static char * ini_trim (char *text)
 Trim surrounding whitespace in a mutable INI field.
static bool ini_uint (const char *text, uint64_t *number)
 Parse digits-only uint64; overflow and signs are rejected.
static bool ini_real (const char *text, double *number)
 Parse finite decimal/exponent notation, rejecting range errors and suffixes.
static bool ini_read_file (const char *filename, char *buffer, size_t capacity, size_t *length)
 Read a nonempty regular file smaller than capacity and append NUL.
static bool ini_parse (char *buffer, size_t length, ini_field_handler handler, void *context)
 Destructively parse flat fields with blank lines and #/; comment lines.

Detailed Description

Allocation-free flat key=value mechanics; callers own schemas and storage.

Definition in file bounded_ini.h.

Typedef Documentation

◆ ini_field_handler

typedef bool(* ini_field_handler) (void *context, const char *key, const char *value)

Definition at line 35 of file bounded_ini.h.

Function Documentation

◆ ini_parse()

bool ini_parse ( char * buffer,
size_t length,
ini_field_handler handler,
void * context )
inlinestatic

Destructively parse flat fields with blank lines and #/; comment lines.

Precondition
Buffer has at least length+1 writable bytes; callbacks retain no pointers.

Rejects embedded NUL, sections and empty keys/values. The handler must reject unknown/duplicate keys and validate completeness after successful parsing. There are no quoting, escaping, multiline or inline-comment rules.

Definition at line 132 of file bounded_ini.h.

◆ ini_read_file()

bool ini_read_file ( const char * filename,
char * buffer,
size_t capacity,
size_t * length )
inlinestatic

Read a nonempty regular file smaller than capacity and append NUL.

Checks descriptor size/mtime across reading. Outputs are usable only on true; callers supply stable paths and validate exposure identity separately.

Definition at line 98 of file bounded_ini.h.

◆ ini_real()

bool ini_real ( const char * text,
double * number )
inlinestatic

Parse finite decimal/exponent notation, rejecting range errors and suffixes.

Definition at line 67 of file bounded_ini.h.

◆ ini_trim()

char * ini_trim ( char * text)
inlinestatic

Trim surrounding whitespace in a mutable INI field.

Parameters
[in,out]textNull-terminated field storage.
Returns
Borrowed pointer into text.

Terminate the field in place so the parser need not allocate storage for individual keys or values.

Definition at line 42 of file bounded_ini.h.

◆ ini_uint()

bool ini_uint ( const char * text,
uint64_t * number )
inlinestatic

Parse digits-only uint64; overflow and signs are rejected.

Definition at line 52 of file bounded_ini.h.