Skip to main content

Crate expanse

Crate expanse 

Source
Expand description

§expanse-capi — libexpanse, the drop-in C ABI for libjudy

Exports the classic Judy.h surface (Judy1* backed by ExpanseSet, JudyL* backed by ExpanseMap) with matching symbol names, calling convention, and documented semantics, so existing consumers of the C library link-swap or LD_PRELOAD libexpanse in place of libJudy without source changes. The contract — target surface, guarantees, non-goals, doc-gap resolutions, acceptance gates — is docs/COMPAT.md; the shipped header is include/Judy.h.

Array-handle convention: a Pvoid_t array word is null when the array is empty and otherwise holds a pointer to the boxed tree. Removing the last key returns the word to null, matching the classic representation of an empty array.

JudySL* is backed by ExpanseStrMap (a meta-trie of word maps); JudyHS* lands with ExpanseShortBytesMap.

Modules§

blobmap
The modern expanse_blob_map_* C API exports.
modern
The modern expanse_* C API (header: include/expanse.h).

Structs§

CExpanseStats
C-compatible diagnostic statistics for an Expanse trie.
CNodeCounts
C-compatible counts of nodes by their specific form.
JError
The classic JError_t error record (see COMPAT.md doc-gap D2).

Constants§

JU_ERRNO_NOMEM
Out of memory (see COMPAT.md doc-gap D3: allocation failure aborts).
JU_ERRNO_NONE
No error.
JU_ERRNO_NULLPINDEX
A null PIndex was passed where one is required.
JU_ERRNO_NULLPPARRAY
A null PPArray was passed where one is required.

Functions§

Judy1ByCount⚠
Locates the nth (1-based) set index; 1 on success with *pindex updated, 0 if the population is smaller.
Judy1Count⚠
Number of set indexes in index1..=index2; 0 for a reversed range. A zero count writes JU_ERRNO_NONE to pj (see [count_result]).
Judy1First⚠
Smallest set index >= *pindex.
Judy1FirstEmpty⚠
Smallest unset index >= *pindex.
Judy1FreeArray⚠
Frees the whole array; returns the bytes freed and nulls the word.
Judy1Last⚠
Largest set index <= *pindex.
Judy1LastEmpty⚠
Largest unset index <= *pindex.
Judy1MemUsed⚠
Heap bytes used by the array (order-of-magnitude contract; see COMPAT.md non-goals).
Judy1Next⚠
Smallest set index > *pindex.
Judy1NextEmpty⚠
Smallest unset index > *pindex.
Judy1Prev⚠
Largest set index < *pindex.
Judy1PrevEmpty⚠
Largest unset index < *pindex.
Judy1Set⚠
Sets index; returns 1 if newly set, 0 if it was already set.
Judy1Test⚠
Membership test: 1 if index is set.
Judy1Unset⚠
Unsets index; returns 1 if it was present. An emptied array word returns to null.
JudyHSDel⚠
Deletes the byte string; returns 1 if it was present. An emptied array word returns to null.
JudyHSFreeArray⚠
Frees the whole array; returns the bytes freed (implementation- defined here — see docs/COMPAT.md doc-gap D4) and nulls the word.
JudyHSGet⚠
Returns the value slot of the byte string, or null if absent.
JudyHSIns⚠
Inserts the byte string (value slot zero-initialized if new) and returns a writable pointer to its value slot; PJERR on error.
JudyLByCount⚠
Locates the nth (1-based) key; returns its value slot and updates *pindex, or null if the population is smaller.
JudyLCount⚠
Number of keys in index1..=index2; 0 for a reversed range. A zero count writes JU_ERRNO_NONE to pj (see [count_result]).
JudyLDel⚠
Deletes index; returns 1 if it was present. An emptied array word returns to null.
JudyLFirst⚠
Smallest key >= *pindex; returns its value slot.
JudyLFirstEmpty⚠
Smallest absent key >= *pindex.
JudyLFreeArray⚠
Frees the whole array; returns the bytes freed and nulls the word.
JudyLGet⚠
Returns a writable pointer to index’s value slot, or null if absent.
JudyLIns⚠
Inserts index (value slot zero-initialized if new) and returns a writable pointer to its value slot; PJERR on error. The slot stays valid until the next structural mutation.
JudyLLast⚠
Largest key <= *pindex; returns its value slot.
JudyLLastEmpty⚠
Largest absent key <= *pindex.
JudyLMemUsed⚠
Heap bytes used by the array (order-of-magnitude contract).
JudyLNext⚠
Smallest key > *pindex; returns its value slot.
JudyLNextEmpty⚠
Smallest absent key > *pindex.
JudyLPrev⚠
Largest key < *pindex; returns its value slot.
JudyLPrevEmpty⚠
Largest absent key < *pindex.
JudySLDel⚠
Deletes index; returns 1 if it was present. An emptied array word returns to null.
JudySLFirst⚠
Smallest stored string >= *index; returns its value slot.
JudySLFreeArray⚠
Frees the whole array; returns the bytes freed and nulls the word.
JudySLGet⚠
Returns a writable pointer to index’s value slot, or null if absent.
JudySLIns⚠
Inserts index (value slot zero-initialized if new) and returns a writable pointer to its value slot; PJERR on error.
JudySLLast⚠
Largest stored string <= *index; returns its value slot.
JudySLNext⚠
Smallest stored string > *index; returns its value slot.
JudySLPrev⚠
Largest stored string < *index; returns its value slot.
expanse_stats⚠
Gathers structural statistics of the trie.
expanse_validate⚠
Defensively validates a Judy1 or JudyL array structure.

Type Aliases§

Word
Word_t: pointer-width unsigned integer (see COMPAT.md doc-gap D1).