Expand description
Global state management (§57, §85 Phase 1).
Manages all library-wide global state:
- Parser defaults (validity checking, entity substitution, blanks, etc.)
- Generic and structured error callbacks
- Catalog defaults
- Memory hooks (connects to allocator.rs)
- Thread-local state for errors
- Initialization/cleanup reference counting
§UPSTREAM-PARITY
libxml2 has many global variables that control default parser behavior. These are exposed as public ABI symbols that applications can read/write directly. We use atomic operations for thread safety while maintaining the same observable semantics.
§Thread safety
All global state uses atomic operations or parking_lot locks.
Error state is thread-local via thread_local!.
§Phase 1 status
Complete — all global state management is implemented. Future phases may add historical version-specific behavior.
Functions§
- cleanup_
parser ⚠ - Clean up the parser library.
- cleanup_
threads - Clean up threading support.
- get_
catalog_ defaults - Get the catalog default allow value.
- get_
do_ warnings_ default - Get the default warnings value.
- get_
generic_ error_ ctx - Get the generic error handler context.
- get_
generic_ error_ func - Get the generic error handler function pointer.
- get_
get_ warnings_ default - Get the get warnings default.
- get_
indent_ tree_ output - Get the indent tree output default.
- get_
keep_ blanks_ default - Get the keep blanks default value.
- get_
last_ error - Get the last error for this thread.
- get_
load_ ext_ dtd_ default - Get the load external DTD default value.
- get_
pedantic_ parser_ default - Get the pedantic parser default.
- get_
save_ no_ empty_ tags - Get the save no empty tags default.
- get_
structured_ error_ ctx - Get the structured error handler context.
- get_
structured_ error_ func - Get the structured error handler function pointer.
- get_
substitute_ entities_ default - Get the substitute entities default.
- get_
validity_ checking_ default - Get the default validity checking value.
- init_
parser ⚠ - Initialize the parser library.
- init_
ref_ count - Get the current initialization reference count.
- init_
threads - Initialize threading support.
- reset_
last_ error - Reset the last error for this thread.
- set_
catalog_ defaults - Set the catalog default allow value.
- set_
do_ warnings_ default - Set the default warnings value.
- set_
generic_ ⚠error_ func - Set the generic error handler.
- set_
get_ warnings_ default - Set the get warnings default.
- set_
indent_ tree_ output - Set the indent tree output default.
- set_
keep_ blanks_ default - Set the keep blanks default value.
- set_
last_ error - Set the last error for this thread.
- set_
load_ ext_ dtd_ default - Set the load external DTD default value.
- set_
pedantic_ parser_ default - Set the pedantic parser default.
- set_
save_ no_ empty_ tags - Set the save no empty tags default.
- set_
structured_ ⚠error_ func - Set the structured error handler.
- set_
substitute_ entities_ default - Set the substitute entities default.
- set_
validity_ checking_ default - Set the default validity checking value.
- threads_
initialized - Check whether threads have been initialized.
- with_
last_ error - Get a reference to the last error (for structured error callback).