Program Arguments and Entry Points
Some programs accept additional information when they are started.
This information is supplied as arguments.
The documentation for a program should tell you whether it accepts arguments and what they mean.
Running a program with arguments
Place arguments after the program name:
> RUN PROGRAM argument1 argument2
Arguments are passed to the program in the order given.
For example, a program might accept a name:
> RUN GREET Emma
or an option:
> RUN GAME hard
Exactly what an argument means depends on the program receiving it.
RUN can provide up to sixteen arguments.
Arguments with queued programs
QUEUE and NEXT accept arguments in the same way:
> QUEUE PROGRAM argument1 argument2
> NEXT PROGRAM argument1 argument2
The arguments are kept with the program while it waits in the execution queue and are provided when the program eventually starts.
QUEUE and NEXT can each provide up to sixteen arguments.
See The Execution Queue for more information about queued programs.
Accessing arguments from NCL
Inside an NCL program, arguments are available as numbered constants.
The first argument is #0, followed by #1, and so on.
For example:
> RUN PROGRAM first second third
provides:
| Constant | Value |
|---|---|
#0 |
"first" |
#1 |
"second" |
#2 |
"third" |
RUN, QUEUE, and NEXT can provide up to sixteen arguments, available as #0 through #15.
See System & Program Control for the complete NCL reference.
Starting at another entry point
RUNA starts a program at a specific label or line number instead of its normal entry point.
RUNA <program> <entry> [arguments...]
For example:
> RUNA THEME :green
or:
> RUNA PROGRAM 42
Include the : when specifying a label.
The entry point is separate from the program arguments. RUNA can provide up to sixteen arguments in addition to the entry point.
As with RUN, arguments are available as #0 through #15. The entry point itself is not passed to the program as an argument.
RUNA is primarily useful when developing, debugging, or deliberately starting a program at an alternate entry point.
See System & Program Control for complete details.