You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add flat inverse / Bragg-peak convenience wrappers to dedx_wrappers.h #122
Part of #118 (dedx_extra.c migration) · Phase D. Depends on Phase C (#121) landing first.
Problem
The core inverse functions (dedx_get_inverse_csda, dedx_get_inverse_stp in dedx_tools.h) require a caller-managed dedx_workspace* + dedx_config* (allocate → set ion_a → dedx_load_config → call → free). That lifecycle cannot be driven safely from JavaScript/WASM, so dedx_web wraps it in wasm/dedx_extra.c as "flat" one-call functions.
libdedx already ships this convenience style in dedx_wrappers.h (dedx_get_simple_stp_for_program, dedx_get_stp_table, dedx_get_csda_range_table, …). The flat inverse wrappers belong right next to them.
Proposed change
Add to include/dedx_wrappers.h (handling workspace/config lifecycle internally):
(Names to match the existing *_simple_* convention — final call by a maintainer. dedx_web currently names them *_flat.)
These set cfg.ion_a from the nucleon-number accessor (Phase A, #119) before dedx_load_config, which is the subtle bit the inverse functions require.
Acceptance criteria
Declarations + Doxygen in dedx_wrappers.h; each wrapper is self-contained and re-entrant (fresh workspace per call — note for thread-safety make library thread-safe #86).
Tests mirroring an existing wrapper test.
dedx_web deletes dedx_get_inverse_csda_flat / dedx_get_inverse_stp_flat / dedx_get_bragg_peak_stp from wasm/dedx_extra.c and updates wasm/contract-manifest.json + docs/06-wasm-api-contract.md.
Reference
dedx_web wasm/dedx_extra.c (lines ~221–455).
Filed via Claude Code as part of the dedx_extra.c → libdedx migration plan.
Activity
test/docs: address review feedback on #122