// HTOPRS — ENGINEERING REPORT

Faithful port · htop 3.5.1 is the spec · function-for-function, cited File.c:line · build-time port-purity gate

Docs Port report

>_EXECUTIVE SUMMARY

htoprs is a faithful Rust port of htop 3.5.1, the interactive process viewer. The upstream C source is the specification — the port is translated function-for-function, never reimplemented from scratch, the same precedent as zshrs.

Fidelity is enforced mechanically: a build-time port-purity gate rejects any free fn under src/ported/ whose name has no counterpart in the htop C source. The port is at an early stage — XUtils.c's string/math utility layer is the first file landed.

v0.1.0
Version
3.5.1
htop spec
131
C source files
1093
C fns defined
16
Fns ported
1.46%
Coverage
7
src .rs files
797
Source lines

~PORTING METHODOLOGY

The C source is the spec. Ports are faithful; the original C is translated function-for-function. The gate keeps the port from drifting into a reimplementation.

LayerImplementation
Spechtop 3.5.1 at ~/forkedRepos/htop — 131 .c files, platform-split (darwin / linux / freebsd / netbsd / openbsd / dragonflybsd / solaris / pcp)
Port treesrc/ported/<file>.rs, one Rust module per C file; every fn carries a /// Port of citation naming its <File>.c:<line> origin
Port-purity gatebuild.rs (std-only) scans src/ported/ on every cargo build / test / check; a free fn whose name is absent from tests/data/htop_c_fn_names.txt and the allowlist fails the build — cannot be bypassed by cargo test --test X
C-name snapshottests/data/htop_c_fn_names.txt, regenerated by tests/data/extract_c_fn_names.sh (HTOP_C_SOURCE=~/forkedRepos/htop) after pulling upstream htop
Allowlisttests/data/fake_fn_allowlist.txt — genuine Rust-only architectural helpers only, each justified inline; currently empty
Port reportscripts/gen_port_report.pyport_report.html, per-file + overall coverage derived from source at run time (nothing hardcoded)

&PORTED FILES

The pure-logic layers are ported first. The live per-function breakdown and coverage are in the port report, derived from source at generation time; this table is the file-level summary.

C filePorted layer
XUtils.cstring / math utilities — String_cat / _trim / _split / _splitFirst / _contains_i, compareRealNumbers, sumPositiveValues, countDigits, countTrailingZeros
Vector.ccontainer sort / search core — swap, partition, quickSort, insertionSort, Vector_indexOf (generics over a slice with a C-int comparator)
Hashtable.cprime-table math — nextPrime
Meter.cvalue formatting — Meter_humanUnit

The C allocation / memory machinery (the xMalloc family and String_freeArray; the Object** dynamic array — Vector_new / _insert / _resizeIfNecessary …; the open-addressing bucket table — Hashtable_new / _put / _get …), the null-terminated-string helpers, and the varargs formatters have no faithful safe-Rust analog (Rust's Vec / HashMap / String own allocation, bounds, probing, and lifetimes) and are intentionally not ported.


$CI GATES

GateCommand
port-puritycargo build (build.rs rejects any non-htop fn under src/ported/)
testcargo test — hand-crafted unit tests pin the C edge behavior
fmtcargo fmt --all --check

#PROJECT METADATA

ItemValue
Version0.1.0
LicenseGPL-2.0-or-later (matching htop)
Spechtop 3.5.1 — github.com/htop-dev/htop
Precedentzshrs — the faithful-port + port-purity-gate pattern
AuthorMenkeTechnologies
Repositorygithub.com/MenkeTechnologies/htoprs
Meta umbrellaMenkeTechnologiesMeta