The shell's own words, as a table and not just a chain

The dispatch is a run of "is the line this name" comparisons. That is fine to
execute and impossible to WALK, and completing a half typed command needs to
walk them - so the names have to be data as well as code.

They nearly were already: DirName through ExitName were fourteen zero
terminated strings sitting back to back, which is a table by accident of layout.
This makes it deliberate. MonitorName joins them, the run is labelled, and a
count goes underneath because a run of strings does not say where it stops.

WHAT MAKES IT A TABLE IS THE ZEROES. Each name ends in one, so the next begins
after it: no pointers, no lengths, and adding a command costs a line.

Tests/docs.sh reads both the dispatch and the run and compares them, because the
two can disagree and every way they do is quiet. A command added to the dispatch
and not to the run simply never completes, which nobody would think to check by
hand. Something put BETWEEN the strings is worse: the walk ends there and takes
every command after it, and the machine goes on working perfectly except that
Tab knows about six things instead of fifteen.

All three break that way and say something useful. Putting one byte in the
middle of the run reports that it holds ten names against the fifteen claimed,
which points at roughly where.

Groundwork for Tab completion. Nothing uses it yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
Anachronaut
2026-09-01 17:21:30 -04:00
co-authored by Claude Opus 5
parent b04e4b7d1c
commit 749fef8ce2
2 changed files with 61 additions and 2 deletions
+17 -2
View File
@@ -5568,8 +5568,6 @@ MonitorPrompt:
UnknownText:
" ?
"
MonitorName:
"monitor"
MonitorHelp:
"x examine, d disassemble, a assemble, s set, b bank, g go, exit leaves"
ExamineName:
@@ -5604,6 +5602,17 @@ NoSuchOp:
"no such instruction"
NeedsValue:
"that one needs a value after it"
; ---- The shell's own words, packed ----
;
; Fifteen names with nothing between them, which is a TABLE and not an accident of layout.
; Each is a string ending in a zero, so the next one begins after that zero and walking them
; needs no pointers and no lengths - which is what makes completing a half typed command
; possible at all, since the dispatch below is a chain of comparisons and cannot be walked.
;
; NOTHING MAY BE PUT BETWEEN THEM. Tests/docs.sh checks that this run holds exactly the names
; the dispatch tests and that the count below agrees, so a command added without a name here
; is caught rather than silently left out of what Tab knows about.
ShellNames:
DirName:
"dir"
DoName:
@@ -5632,6 +5641,12 @@ HelpName:
"help"
ExitName:
"exit"
MonitorName:
"monitor"
; How many of them, since a run of strings does not say where it stops.
ShellNameCount:
0d15
; Where the machine is, written out for the prompt, and where in the buffer it begins.
; Built from the end backwards, so it starts somewhere in the middle.