1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Rust-only utility (NOT a port — lives outside `src/ported/` by design).
//!
//! C cuts a subscripted scalar once, inline, at the tail of `getstrvalue`
//! (`Src/params.c:2510-2532`). The port needs the same cut at three sites:
//! `ported::params::getstrvalue` itself, and two `ported::subst::paramsubst`
//! paths that hold a character slice rather than a `value` struct. C has no
//! function to port for it, so the shared body lives here, with each line
//! citing the C it comes from.
/// Cut a scalar to the range `[start, end)` exactly as `getstrvalue`'s
/// subscripted-scalar tail does (`Src/params.c:2510-2532`).
///
/// `start` is C's `v->start` (0-based; a negative value counts from the
/// end and clamps to 0, so `${s[-10,2]}` is the first two characters,
/// not empty). `end` is C's `v->end` (exclusive; negative counts from the
/// end, `-1` is the whole tail). Offsets are characters — the port's
/// stand-in for C's `MB_METACHARLEN` byte walk.