Skip to content

OIL 41, chapter Types: the host code - #130

Merged
theAndreas merged 2 commits into
mainfrom
oil-41-types-host
Nov 17, 2026
Merged

theAndreas merged 2 commits into
mainfrom
oil-41-types-host

Conversation

@theAndreas

Copy link
Copy Markdown
Owner

Nothing changes for a sketch or for whoever uses the simulator or the control program. The library is untouched, and every example has the same flash and RAM as on main.

The second pull request of the review of the chapter Types in OIL item 41, for the simulator, the control program and DocuPictures:

  • T-14, one side effect per statement: no assignment stands in a condition any more, as the accept loops of both hosts and the cutting into lines had one, and where several calls that change something were chained in one condition, setting up a listener, a serial port or a WebSocket client, each is a named step now.
  • T-13: a variable stands where it is first needed, and one that held two meanings, the length field of a WebSocket frame and its payload's length, is two.
  • T-18: conditions and sums of several parts are named steps.
  • T-8 and T-1: a range-for names its element's type, and a count that could reach 256 is no longer a byte.
  • On the way, as the line was changed anyway: the control program's stroke rounds with integers as before, without the double the coding style forbids (H-7).

Checked:

  • make check passes: lint, clang-tidy, every host and AVR test, coverage at 100 % of lines, branches and conditions.
  • The control program's window builds; it was not clicked through, so a stroke painted with the mouse was not tried, and its Windows half was not compiled, as there is no MinGW in the dev container; there two variables only got their initializers.
  • Not run on hardware; the library does not change.

No assignment or second side effect stands in a condition any more
(T-14): the hosts accept in a loop that declares what it accepted, the
link finds each line end in a statement of its own, and the setup of a
listener, a serial port and a WebSocket client is a named step per call.
A variable stands where it is first needed, and the length field of a
WebSocket frame and its payload's length are two (T-13). Conditions and
sums of several parts are named steps (T-18), a range-for names its
element's type (T-8), and the count of lit LEDs in DocuPictures is a
uint16_t, as all 256 would wrap a byte (T-1). The control program's
stroke rounds with integers as lround() did, without its double (H-7).

The library and its sizes do not change.
@theAndreas
theAndreas merged commit 23f628f into main Nov 17, 2026
12 checks passed
@theAndreas
theAndreas deleted the oil-41-types-host branch November 17, 2026 16:00
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.

2 participants