Give the shell an echo, so a script can say what it is doing
Say.sbx has printed words since long before there were scripts, and is the wrong shape for one. It is a program: it has to be found on the disk, loaded and started, it prefixes what it was told with "it says:", and the system prints "finished" after it. Three lines of noise around one line of narration, and a load off the disk to produce them. echo is a command, so it costs a comparison. With nothing after it, a blank line - which is what anybody expects and is worth having to space a long script out. Not called "say", although that is the better word. Built-in commands are tried before the disk and always win, so a built-in say would shadow Say.sbx and quietly change what every existing script and test meant by it. Also puts "do" in the help, which the commit that added it forgot, and splits the help text: the new lines pushed it over the assembler's 255 character limit for one string. That failure was hidden for a few minutes by a 'make' whose errors were going to /dev/null - the build kept the disk it already had, and the machine cheerfully reported "I do not know: echo" from a system assembled before echo existed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
2466d79d9c
commit
a12d61fb80
@@ -249,6 +249,11 @@ promptSay:
|
||||
CALL textSame
|
||||
BRQ doRename
|
||||
|
||||
SETD.0 CommandLine
|
||||
SETD.1 EchoName
|
||||
CALL textSame
|
||||
BRQ doEcho
|
||||
|
||||
SETD.0 CommandLine
|
||||
SETD.1 DoName
|
||||
CALL textSame
|
||||
@@ -1580,6 +1585,23 @@ fileComplain:
|
||||
CALL newLine
|
||||
BRI commandFailed
|
||||
|
||||
; ---- echo ----
|
||||
;
|
||||
; Says the rest of the line and nothing else. Say.sbx has done this since before there were
|
||||
; scripts, and is the wrong shape for one: it is a program, so it has to be found on the
|
||||
; disk and loaded and started, it prefixes what it was told with "it says:", and the system
|
||||
; prints "finished" after it. That is three lines of noise around one line of narration.
|
||||
;
|
||||
; A script telling you what it is doing is the ordinary case now, so it costs a command
|
||||
; rather than a program. With nothing after it, a blank line - which is what anybody will
|
||||
; expect and is worth having for spacing a long script out.
|
||||
doEcho:
|
||||
SETD.1 TextRest
|
||||
LDD.0.1
|
||||
CALL printString
|
||||
CALL newLine
|
||||
BRI prompt
|
||||
|
||||
; ---- do ----
|
||||
;
|
||||
; Runs the lines in a file as though they had been typed. What makes a file one of these is
|
||||
@@ -3562,6 +3584,9 @@ doHelp:
|
||||
SETD.0 HelpCdText
|
||||
CALL printString
|
||||
CALL newLine
|
||||
SETD.0 HelpScriptText
|
||||
CALL printString
|
||||
CALL newLine
|
||||
SETD.0 HelpMoreText
|
||||
CALL printString
|
||||
CALL newLine
|
||||
@@ -3661,6 +3686,9 @@ HelpCdText:
|
||||
"cd [path] go to a directory, or to the root with nothing after it
|
||||
mkdir <path> make a directory
|
||||
rmdir <path> remove an empty one"
|
||||
HelpScriptText:
|
||||
"do <file> run the lines in a file, which must start with #!
|
||||
echo [words] say them"
|
||||
HelpMoreText:
|
||||
"delete <file> take it off the disk
|
||||
rename <file> <to> call it something else
|
||||
@@ -3786,6 +3814,8 @@ DirName:
|
||||
"dir"
|
||||
DoName:
|
||||
"do"
|
||||
EchoName:
|
||||
"echo"
|
||||
LoadName:
|
||||
"load"
|
||||
RunName:
|
||||
|
||||
Reference in New Issue
Block a user