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§
- CExpanse
Stats - C-compatible diagnostic statistics for an Expanse trie.
- CNode
Counts - C-compatible counts of nodes by their specific form.
- JError
- The classic
JError_terror 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
PIndexwas passed where one is required. - JU_
ERRNO_ NULLPPARRAY - A null
PPArraywas passed where one is required.
Functions§
- Judy1
ByCount ⚠ - Locates the
nth(1-based) set index; 1 on success with*pindexupdated, 0 if the population is smaller. - Judy1
Count ⚠ - Number of set indexes in
index1..=index2; 0 for a reversed range. A zero count writesJU_ERRNO_NONEtopj(see [count_result]). - Judy1
First ⚠ - Smallest set index >= *pindex.
- Judy1
First ⚠Empty - Smallest unset index >= *pindex.
- Judy1
Free ⚠Array - Frees the whole array; returns the bytes freed and nulls the word.
- Judy1
Last ⚠ - Largest set index <= *pindex.
- Judy1
Last ⚠Empty - Largest unset index <= *pindex.
- Judy1
MemUsed ⚠ - Heap bytes used by the array (order-of-magnitude contract; see COMPAT.md non-goals).
- Judy1
Next ⚠ - Smallest set index > *pindex.
- Judy1
Next ⚠Empty - Smallest unset index > *pindex.
- Judy1
Prev ⚠ - Largest set index < *pindex.
- Judy1
Prev ⚠Empty - Largest unset index < *pindex.
- Judy1
Set ⚠ - Sets
index; returns 1 if newly set, 0 if it was already set. - Judy1
Test ⚠ - Membership test: 1 if
indexis set. - Judy1
Unset ⚠ - Unsets
index; returns 1 if it was present. An emptied array word returns to null. - JudyHS
Del ⚠ - Deletes the byte string; returns 1 if it was present. An emptied array word returns to null.
- JudyHS
Free ⚠Array - Frees the whole array; returns the bytes freed (implementation- defined here — see docs/COMPAT.md doc-gap D4) and nulls the word.
- JudyHS
Get ⚠ - Returns the value slot of the byte string, or null if absent.
- JudyHS
Ins ⚠ - Inserts the byte string (value slot zero-initialized if new) and
returns a writable pointer to its value slot;
PJERRon error. - JudyL
ByCount ⚠ - Locates the
nth(1-based) key; returns its value slot and updates*pindex, or null if the population is smaller. - JudyL
Count ⚠ - Number of keys in
index1..=index2; 0 for a reversed range. A zero count writesJU_ERRNO_NONEtopj(see [count_result]). - JudyL
Del ⚠ - Deletes
index; returns 1 if it was present. An emptied array word returns to null. - JudyL
First ⚠ - Smallest key >= *pindex; returns its value slot.
- JudyL
First ⚠Empty - Smallest absent key >= *pindex.
- JudyL
Free ⚠Array - Frees the whole array; returns the bytes freed and nulls the word.
- JudyL
Get ⚠ - Returns a writable pointer to
index’s value slot, or null if absent. - JudyL
Ins ⚠ - Inserts
index(value slot zero-initialized if new) and returns a writable pointer to its value slot;PJERRon error. The slot stays valid until the next structural mutation. - JudyL
Last ⚠ - Largest key <= *pindex; returns its value slot.
- JudyL
Last ⚠Empty - Largest absent key <= *pindex.
- JudyL
MemUsed ⚠ - Heap bytes used by the array (order-of-magnitude contract).
- JudyL
Next ⚠ - Smallest key > *pindex; returns its value slot.
- JudyL
Next ⚠Empty - Smallest absent key > *pindex.
- JudyL
Prev ⚠ - Largest key < *pindex; returns its value slot.
- JudyL
Prev ⚠Empty - Largest absent key < *pindex.
- JudySL
Del ⚠ - Deletes
index; returns 1 if it was present. An emptied array word returns to null. - JudySL
First ⚠ - Smallest stored string >= *index; returns its value slot.
- JudySL
Free ⚠Array - Frees the whole array; returns the bytes freed and nulls the word.
- JudySL
Get ⚠ - Returns a writable pointer to
index’s value slot, or null if absent. - JudySL
Ins ⚠ - Inserts
index(value slot zero-initialized if new) and returns a writable pointer to its value slot;PJERRon error. - JudySL
Last ⚠ - Largest stored string <= *index; returns its value slot.
- JudySL
Next ⚠ - Smallest stored string > *index; returns its value slot.
- JudySL
Prev ⚠ - 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).