htoprs — Documentation
Description: htoprs — a faithful Rust port of htop, the interactive process viewer. The htop 3.5.1 C source is the spec; every function under src/ported/ ports a specific htop C function, cited by File.c:line, enforced by a build-time port-purity gate.

## >_HTOPRS

The htop C source is the spec. htoprs is a faithful Rust port of htop, the interactive process viewer. The upstream C is translated function-for-function, never reimplemented from scratch. Every function under `src/ported/` ports a specific htop C function and cites its origin (`<File>.c:<line>`) in its doc comment.

## Porting methodology

Spec | htop 3.5.1 at `~/forkedRepos/htop` (131 `.c` files, platform-split darwin / linux / freebsd / …)
Port tree | `src/ported/<file>.rs` — one Rust module per C file; each `fn` cites `/// Port of` its `<File>.c:<line>` origin
Port-purity gate | `build.rs` checks every free `fn` name under `src/ported/` against the htop C-function snapshot; a name with no C counterpart fails the build. Cannot be bypassed by `cargo test --test X`
C-name snapshot | `tests/data/htop_c_fn_names.txt`, regenerated by `tests/data/extract_c_fn_names.sh` after pulling upstream htop
Allowlist | `tests/data/fake_fn_allowlist.txt` — genuine Rust-only architectural helpers only, each justified
Port report | `scripts/gen_port_report.py` → port_report.html, per-file + overall coverage derived from source at run time

## Ported so far — `891 / 1093` C functions (81.5%)

121 of htop's 131 C files are started; 31 stubs remain. The authoritative per-file, per-function breakdown is the port report, generated from source. By subsystem:

Core model | `Process` / `ProcessTable` / `Table` / `Row` / `Machine` / `Object` / `Settings`
Containers & utils | `Vector`, `Hashtable`, `RichString`, `XUtils`
Meters | `Meter` + CPU / Memory / Swap / Load / Battery / Network / DiskIO / GPU / ZFS / dynamic
UI panels | `Panel` / `ScreenManager` / `MainPanel` / `FunctionBar` / `Header` + setup panels
Screens & input | `Action`, `IncSet`, `LineEditor`, trace / env / open-files / process-locks screens
ncurses shim | `CRT` — crossterm-backed colors, mouse, key decode
Platforms | darwin / linux / freebsd / netbsd / openbsd / dragonflybsd / solaris

## htoprs-original extensions

On top of the faithful port, an `src/extensions/` layer (18 modules, exempt from the port-purity gate) adds capabilities htop lacks — htoprs-original, not translations of htop C.

Theming | 31 named color schemes, live chooser / editor overlay (`c` / `C`), 256-color UI recolor, persisted to prefs
Monitoring | Per-PID history rings, threshold alerts (`A`), fuzzy finder (`f`), regex filters (`r`), snapshot diffs (`d`), JSON/CSV export (`o`)
Braille graphs | Full CPU history graph (`G`) and an inline per-process CPU graph whose height scales with load (`v`)
Chrome | Themed help overlay (`h`/`?`), border toggle (`B`), bar-fill-glyph cycler (`b`)

## Build & test

    cargo build          # runs the port-purity gate
    cargo test           # hand-crafted unit tests pin the C edge behavior
    python3 scripts/gen_port_report.py   # regenerate docs/port_report.html

The snapshot is regenerated with `HTOP_C_SOURCE=~/forkedRepos/htop tests/data/extract_c_fn_names.sh` after pulling new upstream htop commits.

## The MenkeTechnologies stack

htoprs follows the same faithful-port precedent as zshrs (the first compiled Unix shell, a 1:1 port of zsh's C). Browse the rest via the MenkeTechnologiesMeta umbrella repo.