The offset the walk never reaches, and a stat that was running sixty times a second

This commit is contained in:
Joseph Ferano 2026-09-13 23:36:03 +07:00
parent 69e5a777e7
commit ce72f03a0d
4 changed files with 24 additions and 1 deletions

View File

@ -791,6 +791,14 @@ pointer-and-count apart itself, and uses a zeroed `defvar` as the null pointer t
"the default ASCII set". It was written for this call before anything called it, and the
call fit it exactly.
**`and` short-circuits, which `step-back` depends on.** The backward walk's loop condition
is `(and (> i 0) (continuation? (at b i)))`, and at the start of the text `i` is -1 — so if
`and` were a strict function rather than a form, the guard would not save the `(at b -1)`
beside it and the first press of LEFT would signal `BoundsError`. It is a form and it does
short-circuit; `test/programs/raylib-codepoints.flan` has a row for it, because the walk
itself never reaches that offset and the claim is about the language rather than about the
example.
**Fixed arrays were the right shape for both.** A codepoint table with a count, a
`[9 Rectangle]` of toggle buttons, a `[9 string]` of labels. The §3 finding from the
siam-farmer report — a global cannot hold a `Vec`, and fixed arrays with counts are usually

View File

@ -173,6 +173,11 @@
(if (< i 0) 0 i)))
(defvar font rl/Font)
;; Whether the TTF was there, asked once. A `defvar` and not the call itself
;; in the draw loop: path-file? is a stat, and a syscall per frame to answer a
;; question whose answer cannot change while the program runs is exactly what
;; the per-frame rule in PORTING.md is about.
(defvar font-present bool)
(defvar show-font-atlas bool)
(defvar cursor i32)
(defvar codepoint-count i32)
@ -204,6 +209,7 @@
;; nothing else in this program does.
(rl/set-text-line-spacing 20)
(set font-present (rl/path-file? font-path))
(set show-font-atlas false)
(set cursor 0)
@ -249,7 +255,7 @@
;; The line the C does not have, and the reason it is here is in the
;; header comment: without the TTF this program draws boxes, and a
;; program that draws boxes without saying why reads as broken.
(when (not (rl/path-file? font-path))
(when (not font-present)
(d/draw-piece "No font at examples/resources/ — glyphs will be boxes."
10 (- screen-height 55) 20 rl/maroon))

View File

@ -108,6 +108,14 @@
(set mirrored false)))
(print "walks mirror ") (println (yes-no mirrored)))
;; The one call walk-backward never makes: step-back at the very start.
;; It is where the example goes the moment anybody presses LEFT before
;; pressing RIGHT, and it is the one offset where the continuation-byte
;; loop is asked to step off the front of the buffer. `and` short-circuits,
;; so the (> i 0) guard is what keeps (at b -1) from being evaluated at
;; all — which is a claim about the language and so is worth a row.
(show "back at start" (cp/step-back 0))
;; Item 3: and the forward walk is what raylib said the text contains.
(let [agrees (= forward-n total)
all (slice-from-ptr raw total)]

View File

@ -1065,6 +1065,7 @@ let () =
forward 54\n\
backward 54\n\
walks mirror yes\n\
back at start 0\n\
walk matches raylib yes\n"
in
if Sys.command "ldconfig -p 2>/dev/null | grep -q libraylib" = 0 then begin