A script is given words, and keeps them

"do build.sh cosmos.asm" looked for a file called "build.sh cosmos.asm",
because scriptOpen copied the whole rest of the line into the name. So a
script could be told nothing, and a launcher - a script whose entire job
is to hand on what it was told - could not exist.

Now the name is cut off the front and what follows is kept whole. $1 to
$9 are the words of it, walked out on demand, and $args is all of them.
Nothing is stored per parameter, so there is no limit on how many a
script may be handed and no second number to keep in step. Both ways of
starting a script pass them on: "do" and typing the name.

A word that was not given is an error that stops the script, like every
other name this shell does not know. Expanding it to nothing would let a
command run with an argument missing and then report success, which is
what stop-on-failure exists to prevent. $args is always set inside a
script, empty if it was given nothing, so "if same $args" can be asked.

---- And the count that describes the block was already wrong ----

Found while adding a field to it. The state one script keeps for another
is saved by a single copy of a fixed number of bytes, and that number was
71 against a block of 77: six bytes of line position had been added in
the middle of it years after the count was written. So the tail of every
saved script was never saved, and #quiet in a helper stayed behind in the
script that called it - the opposite of what this file's own comment
promises and the README documents.

The unsaved line position turned out not to matter, because a loop keeps
its own copy in the block record. Nothing said so. Three numbers describe
this block and all three now say so in a comment, and cosmosScriptNest
ends on a helper that goes quiet and a caller that must not stay that
way.

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-06 15:06:32 -04:00
co-authored by Claude Opus 5
parent 06af7e7fbb
commit d9ebc76cf5
25 changed files with 441 additions and 25 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ run [words] start what was loaded, and tell it those words
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
do <file> run the lines in a file, which must start with #!
do <file> [words] run the lines in a file, which must start with #!
echo [words] say them
clear empty the screen
delete <file> take it off the disk
+6 -1
View File
@@ -44,8 +44,13 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
crossed.txt 560
32 files, 1 directory
37 files, 1 directory
> exit
halted
Execution halted.
+1 -1
View File
@@ -15,7 +15,7 @@ run [words] start what was loaded, and tell it those words
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
do <file> run the lines in a file, which must start with #!
do <file> [words] run the lines in a file, which must start with #!
echo [words] say them
clear empty the screen
delete <file> take it off the disk
+6 -1
View File
@@ -34,7 +34,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> drive 1
> dir
other.txt 28
+6 -1
View File
@@ -51,7 +51,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> exit
halted
Execution halted.
+6 -1
View File
@@ -41,7 +41,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> exit
halted
Execution halted.
+6 -1
View File
@@ -41,7 +41,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> exit
halted
Execution halted.
+1 -1
View File
@@ -46,7 +46,7 @@ run [words] start what was loaded, and tell it those words
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
do <file> run the lines in a file, which must start with #!
do <file> [words] run the lines in a file, which must start with #!
echo [words] say them
clear empty the screen
delete <file> take it off the disk
+6 -1
View File
@@ -127,7 +127,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> exit
halted
Execution halted.
+6 -1
View File
@@ -46,7 +46,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> exit
halted
Execution halted.
+6 -1
View File
@@ -34,7 +34,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> load
load what?
> load nosuch.sbx
+43
View File
@@ -0,0 +1,43 @@
CosmOS
> do args.script red green
> echo one is $1
one is red
> echo two is $2
two is green
> echo all of it is $args
all of it is red green
> args.script blue yellow
> echo one is $1
one is blue
> echo two is $2
two is yellow
> echo all of it is $args
all of it is blue yellow
> pass.script hello there
> Say $args
it says: hello there
finished
> do holds.script top level
> echo outer has $1
outer has top
> do args.script deep down
> echo one is $1
one is deep
> echo two is $2
two is down
> echo all of it is $args
all of it is deep down
> echo outer still has $1 and $args
outer still has top and top level
> do args.script only
> echo one is $1
one is only
> echo two is $2
nothing is set called 2
stopped: that line did not work
> $1
nothing is set called 1
> exit
halted
Execution halted.
[exit 0]
+7
View File
@@ -24,6 +24,13 @@ self
> do loop.script
do: scripts are only four deep
stopped: that line did not work
> do aloud.script
> echo aloud first
aloud first
> do hush.script
the helper is quiet
> echo aloud again
aloud again
> exit
halted
Execution halted.
+6 -1
View File
@@ -32,7 +32,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> load Say.sbx
loaded, starting at 5000
> run the disk took its time
+6 -1
View File
@@ -41,7 +41,12 @@ nonl.script 38
outer.script 376
inner.script 44
loop.script 35
31 files, 1 directory
hush.script 42
aloud.script 59
args.script 64
pass.script 20
holds.script 87
36 files, 1 directory
> exit
halted
Execution halted.
+1 -1
View File
@@ -7,7 +7,7 @@ run [words] start what was loaded, and tell it those words
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
do <file> run the lines in a file, which must start with #!
do <file> [words] run the lines in a file, which must start with #!
echo [words] say them
clear empty the screen
delete <file> take it off the disk