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
Reading and Validation

Strict/relaxed reads, allocation-free checks and caller-owned storage. More...

Functions

JSONBOURNE_API struct jsonbourne_read_limits jsonbourne_read_limits_default (void)
 Create default budgets using the linked implementation's reader limit.
JSONBOURNE_API int jsonbourne_read_measure (const void *src, size_t len, jsonbourne_read_flag flg, const jsonbourne_read_limits *limits, size_t *required, jsonbourne_read_err *err)
 Validate input and measure the exact single-allocation DOM size.
JSONBOURNE_API int jsonbourne_read_validate (const void *src, size_t len, jsonbourne_read_flag flg, const jsonbourne_read_limits *limits, jsonbourne_read_err *err)
 Validate the entire extent without allocating a DOM or changing input.
JSONBOURNE_API jsonbourne_val * jsonbourne_read_buf (const void *src, size_t len, jsonbourne_read_flag flg, const jsonbourne_read_limits *limits, void *buf, size_t cap, size_t *required, jsonbourne_read_err *err)
 Read a DOM into aligned caller storage without heap allocation.
JSONBOURNE_API jsonbourne_val * jsonbourne_read_opts_with_limits (const void *src, size_t len, jsonbourne_read_flag flg, const jsonbourne_read_limits *limits, void *(*alc_fn)(void *, size_t), void *alc_ctx, jsonbourne_read_err *err)
 Validate against explicit budgets, then allocate the entire DOM once.
JSONBOURNE_API jsonbourne_val * jsonbourne_read_opts (const void *src, size_t len, jsonbourne_read_flag flg, void *(*alc_fn)(void *, size_t), void *alc_ctx, jsonbourne_read_err *err)
 Read with named options and the linked implementation's default limits.
JSONBOURNE_API jsonbourne_val * jsonbourne_read (const void *src, size_t len)
 Read strict JSON with default limits and malloc-backed ownership.

Detailed Description

Strict/relaxed reads, allocation-free checks and caller-owned storage.

Function Documentation

◆ jsonbourne_read()

JSONBOURNE_API jsonbourne_val * jsonbourne_read ( const void * src,
size_t len )

Read strict JSON with default limits and malloc-backed ownership.

Parameters
[in]srcImmutable input bytes; no trailing NUL or padding is required.
[in]lenExact input byte count.
Returns
Owning root released once with free(), or NULL on failure.
See also
jsonbourne_read_opts() when a diagnostic or relaxed syntax is needed.

Definition at line 1180 of file jsonbourne.c.

◆ jsonbourne_read_buf()

JSONBOURNE_API jsonbourne_val * jsonbourne_read_buf ( const void * src,
size_t len,
jsonbourne_read_flag flg,
const jsonbourne_read_limits * limits,
void * buf,
size_t cap,
size_t * required,
jsonbourne_read_err * err )

Read a DOM into aligned caller storage without heap allocation.

Parameters
[in]srcImmutable input bytes, disjoint from buf.
[in]lenInput extent in bytes.
[in]flgNamed read-option mask.
[in]limitsOptional budgets; NULL selects linked defaults.
[out]bufStorage with malloc-compatible alignment; NULL probes capacity.
[in]capAvailable bytes at buf.
[out]requiredOptional exact size after successful validation, even if storage is too small; zero if validation fails.
[out]errOptional diagnostic, including storage/alignment failures.
Returns
Root in buf, or NULL on failure; never free this root separately.
Note
A missing/short buffer reports MEMORY_ALLOCATION and is not written. The arena must outlive all returned nodes, strings and borrowed views.

Parse into aligned caller storage. On insufficient capacity, required is set.

Definition at line 1123 of file jsonbourne.c.

◆ jsonbourne_read_limits_default()

JSONBOURNE_API struct jsonbourne_read_limits jsonbourne_read_limits_default ( void )

Create default budgets using the linked implementation's reader limit.

Returns
Fully initialized limits with pointer-safe byte bounds and no tighter application policy for value count or individual string length.
Note
These defaults are not a whole-application memory budget; reduce them for inputs that must fit a particular arena or embedded workload.

Definition at line 106 of file jsonbourne.c.

◆ jsonbourne_read_measure()

JSONBOURNE_API int jsonbourne_read_measure ( const void * src,
size_t len,
jsonbourne_read_flag flg,
const jsonbourne_read_limits * limits,
size_t * required,
jsonbourne_read_err * err )

Validate input and measure the exact single-allocation DOM size.

Parameters
[in]srcInput bytes; NULL is permitted only when len is zero.
[in]lenInput byte count, including any trailing trivia.
[in]flgNamed read options combined with bitwise OR.
[in]limitsOptional budgets; NULL selects linked defaults.
[out]requiredOptional exact allocation size; zero on failure.
[out]errOptional diagnostic; populated on success and failure.
Return values
1The complete input is valid within all effective limits.
0Syntax, encoding, arguments or resource checks failed.
Note
Does not allocate or retain input pointers. The same parser is used for sizing and materialization so resource checks cannot disagree with allocation.

Validate and return the exact single-allocation size without allocating.

Definition at line 1043 of file jsonbourne.c.

◆ jsonbourne_read_opts()

JSONBOURNE_API jsonbourne_val * jsonbourne_read_opts ( const void * src,
size_t len,
jsonbourne_read_flag flg,
void *(* alc_fn )(void *, size_t),
void * alc_ctx,
jsonbourne_read_err * err )

Read with named options and the linked implementation's default limits.

Parameters
[in]srcImmutable input bytes.
[in]lenInput byte count.
[in]flgNamed read-option mask.
[in]alc_fnOptional malloc-aligned allocator; NULL uses malloc.
[in]alc_ctxOpaque allocation context.
[out]errOptional diagnostic.
Returns
Root owning one allocation, or NULL on failure.
See also
jsonbourne_read_opts_with_limits() for custom allocator lifetime rules.

Definition at line 1174 of file jsonbourne.c.

◆ jsonbourne_read_opts_with_limits()

JSONBOURNE_API jsonbourne_val * jsonbourne_read_opts_with_limits ( const void * src,
size_t len,
jsonbourne_read_flag flg,
const jsonbourne_read_limits * limits,
void *(* alc_fn )(void *, size_t),
void * alc_ctx,
jsonbourne_read_err * err )

Validate against explicit budgets, then allocate the entire DOM once.

Parameters
[in]srcImmutable input extent; never retained by the returned tree.
[in]lenInput size in bytes.
[in]flgNamed read-option mask.
[in]limitsOptional budgets; NULL selects linked defaults.
[in]alc_fnOptional allocator called as alc_fn(alc_ctx, byte_count); NULL uses malloc. Returned storage must have malloc-compatible alignment.
[in]alc_ctxOpaque allocator context, forwarded unchanged.
[out]errOptional read diagnostic.
Returns
Owning root, or NULL on failure; default-allocated roots use free().
Note
Custom allocators own their release policy, including rejected storage; no custom deallocator is available on this read interface.

Definition at line 1147 of file jsonbourne.c.

◆ jsonbourne_read_validate()

JSONBOURNE_API int jsonbourne_read_validate ( const void * src,
size_t len,
jsonbourne_read_flag flg,
const jsonbourne_read_limits * limits,
jsonbourne_read_err * err )

Validate the entire extent without allocating a DOM or changing input.

Parameters
[in]srcInput bytes; NULL is permitted only for a zero-length extent.
[in]lenNumber of input bytes to inspect.
[in]flgNamed read-option mask.
[in]limitsOptional budgets; NULL selects linked defaults.
[out]errOptional read diagnostic.
Return values
1Valid complete input within the selected budgets.
0Invalid input, arguments, encoding or resource usage.
See also
jsonbourne_read_measure()

Definition at line 1060 of file jsonbourne.c.