Skip to content

role: value, scale and unit lines in the machine description - #24

Merged
neu-rah merged 2 commits into
mainfrom
describe-values
Oct 8, 2026
Merged

neu-rah merged 2 commits into
mainfrom
describe-values

Conversation

@neu-rah

@neu-rah neu-rah commented Oct 8, 2026

Copy link
Copy Markdown
Member

A kind can now print three more lines in the machine description, through `Params` (`role/face.h`), all inside the machine hash:

```
value mode 0 off a value the role takes, with an optional label
scale vin raw 5 1023 presented = raw * num / den, for a field of the role
unit vin raw V the unit symbol of a field of the role
```

  • `python/onemachine` reads them (`RoleInfo.values/scales/units`) and refuses a bad label (1-32 of `A-Za-z0-9_-`), a unit symbol outside `[A-Za-z0-9/*^.%-]{1,16}`, a zero denominator and a line for a role not declared above it.
  • A kind that calls none of them prints exactly what it printed before: an S5-era sketch rebuilt against this branch gives a byte-identical firmware image and byte-identical descriptions.
  • `%` is accepted in a unit symbol (second commit).
  • `test/role/values_check.cpp` and `.py` (wired into `test/role/build.sh`): a select with labels, a report-only kind (empty `Command`), scale and unit, accepted and refused lines. `docs/role.md` describes the lines.

`role/build.sh`: 33 ok; the one failure, `role_link_avr` (baseline comparison), fails identically on `main` before this change.

🤖 Generated with Claude Code

neu-rah and others added 2 commits October 8, 2026 15:21
…cription

Params (role/face.h) gains value(raw[, label]), scale(field, num, den) and unit(field, symbol); each prints one description line, inside
the machine hash. python/onemachine reads them (RoleInfo.values/scales/units) and refuses a bad label, a zero denominator and a line
for an undeclared role. Kinds that call none of them print what they printed before (role_link_avr: same size on avr-gcc 7.3).
test/role/values_check.cpp and .py cover the lines, a select with labels and a report-only kind (empty Command).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
python/onemachine's SYMBOL class gains '%' (a percent scale: `unit duty raw %`). values_check.py: an accepted line (% and V/s^2, kept as written)
and two refusals (a quote, 17 characters). docs/role.md states the character class.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@neu-rah
neu-rah merged commit 6914a65 into main Oct 8, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant