The commands available in this section are

GOSUB <label>
RETURN

SCRIPT <path_name_of_script_file>
EXIT

CHAIN

QUIT

When Scripta encounters a GOSUB command, it searches forwards
through the current script looking for <label>.

A Scripta label is any name prefixed with a colon (:) character.

A label may appear anywhere in a Scripta script and has no
significance except to GOSUB commands (there is no GOTO command in
the Scripta language). The label must appear on a line on its own
but may be preceded by any number of space characters.

The label search starts at the current position in the script file
and continues forwards. If the end of the script file is reached,
the search continues from the start of the file. If the current
position is reached again without finding the label then the GOSUB
command fails.

When the label is found, Scripta continues processing with the
command which follows the label but remembers the position of the
GOSUB command.

The next time a RETURN statement is encountered, Scripta switches
back to the command which follows the GOSUB command.

For example, supposing that you have a routine for processing a date
field which you want to execute at several points within your
script. It would be very wasteful of space, as well as hard to
follow or amend, to insert multiple copies of the routine within the
script.

What you do instead is to place a single copy of the routine at the
end of your script, prefixed with a label and terminated by a RETURN
command. You then insert GOSUB commands at the points within the
script where you want the date process to be executed.

e.g.,

...
GOSUB :Date
...
...
GOSUB :Date
...
...
...
:Date
...date routine commands...
RETURN

This poses the problem that Scripta can not tell a GOSUB subroutine
from any other sequence of commands so, when the last 'real' command
in the script had been processed, Scripta would simply continue
processing through the :Date routine. To stop this happening, the
end of the 'real' commands should be marked with a STOP command:

...
GOSUB :Date
...
...
GOSUB :Date
...
...
...
STOP
:Date
...date routine commands...
RETURN

The STOP command may in fact appear anywhere within a script and
simply tells Scripta to finish processing the current script file.

If the current file is being processed as the result of executing a
SCRIPT command (see below) then Scripta returns to the script which
issued the SCRIPT command, just as though the STOP command were an
EXIT command. If the current script is ALWAYS called from another
script then EXIT could be used instead of STOP but if the script is
sometimes run free-standing, then STOP should be used as the EXIT
command generates an error message when there is no outer script to
return to.

The SCRIPT command is very similar to the GOSUB command except that
instead of passing control to a label within the current script,
Scripta switches to a completely new script file, remembering the
position of the SCRIPT command within the old script file. When the
new script file completes (or executes an EXIT command) Scripta
reverts to the original script and continues processing with the
command following the SCRIPT command.

SCRIPT and GOSUB commands may be nested to an arbitrary depth of
complexity, limited only by the memory needed to store the return
point information.

CHAIN is exactly like SCRIPT except that Scripta does not register
the return point (and any already-registered return points are
lost).

Control passes to the CHAINed script and never returns.
