Update of bug #62692 (project groff): Status: In Progress => Fixed Open/Closed: Open => Closed Planned Release: None => 1.24.0
_______________________________________________________ Follow-up Comment #2: commit 3c7c02e20006011b838d49930998bbf0ad324912 Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Sat Aug 26 11:18:22 2023 -0500 [eqn]: Implement "reset" primitive/command (3/3). * src/preproc/eqn/tests/parameters-can-be-set-and-reset.sh: Test it. * src/preproc/eqn/eqn.am (eqn_TESTS): Run test. commit 9e709d64f7aa5f3c706ef9154e596fbb6a87637a Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Sat Aug 26 11:02:04 2023 -0500 [eqn]: Implement "reset" primitive/command (2/3). * src/preproc/eqn/eqn.1.man (Customization): Document it. * NEWS: Add item. commit 661dafc33b393b5191abade8fa5c25873d1f56e8 Author: G. Branden Robinson <g.branden.robin...@gmail.com> Date: Sat Aug 26 07:14:53 2023 -0500 [eqn]: Implement "reset" primitive/command (1/3). * src/preproc/eqn/box.cpp: Use `static` storage class for parametric defaults, moving them to file scope from global. Rename `param_table` array of structs to `default_param_table`. Use the length of this array for iteration since it is known at compile time. Convert `param_table` to a null pointer. (set_param): Update diagnostic message text. (reset_param): New function restores a rendering parameter in `param_table` to its corresponding value in `default_param_table`. (get_param): New function accesses `param_table` entries via a C string rather than integer lvalues. Use `assert()` to dump core; this function is never called by the parser, but only by static logic. Add `fatal()` under this same circumstance, in case anyone `#define`s `NDEBUG`. (init_param_table): New function populates the (mutable) `param_table` from the (immutable) `default_param_table` using heap storage. (free_param_table): New function avoids memory leak by freeing the heap storage allocated for `param_table`. * src/preproc/eqn/eqn.h: Drop external declaration of `nroff`. * src/preproc/eqn/eqn.ypp: Add new token `RESET`. * src/preproc/eqn/lex.cpp: Map C string "reset" to token `RESET` in untagged struct `token_table`. (do_reset): Handle new keyword; if argument valid, call `reset_param()` with it. (yylex): Hook up token `RESET` to `do_reset()`. * src/preproc/eqn/box.h: Declare `reset_param()`, `get_param()`, `init_param_table()`, and `free_param_table()`. * src/preproc/eqn/main.cpp (main): Call `init_param_table()` when starting up. Register `free_param_table()` with `std::atexit()`. * src/preproc/eqn/pbox.h: Drop external declarations of rendering parameters. * src/preproc/eqn/delim.cpp (build_extensible) (define_extensible_string, delim_box::compute_metrics): * src/preproc/eqn/lex.cpp (yylex): * src/preproc/eqn/limit.cpp (limit_box::compute_metrics): * src/preproc/eqn/list.cpp (compute_spacing): * src/preproc/eqn/other.cpp (accent_box::compute_metrics) (overline_char_box::overline_char_box): (overline_box::compute_metrics, overline_box::output): (underline_char_box::underline_char_box): (underline_box::compute_metrics, underline_box::output): (fat_box::compute_metrics, fat_box::output): (vcenter_box::compute_metrics): * src/preproc/eqn/over.cpp (over_box::compute_metrics): (over_box::output): * src/preproc/eqn/pile.cpp (pile_box::compute_metrics): (matrix_box::compute_metrics, matrix_box::output): * src/preproc/eqn/script.cpp (script_box::compute_metrics): * src/preproc/eqn/sqrt.cpp (sqrt_box::compute_metrics): Migrate from lvalue access to `get_param()` for parameter retrieval. Fixes <https://savannah.gnu.org/bugs/?62692>. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?62692> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/