EXEC: Executes a pre-written calculator program saved in a file.
All calculator program files must have the extension ".prg"
The name of the program passed to the EXEC command is simply the file
name excluding the extension, so if you want to execute the program in
the file "sample.prg" for example, you enter "EXEC sample" into the
calculator
syntax: EXEC name OR
EXEC name.in OR
EXEC name.in,pause OR
EXEC name.in,nopause
Each command of the calculator program must be preceded by a colon ":" before
anything else is entered. Note, unlike calculator input files, line termination
with a semi-colon ";" is not necessary for program files.
Optionally, a short one line description of the input or program file can be written
at the beginning of the input or program file to provide a short description line in
the table of available calculator programs shown in the GUI version of the calculator.
The description line must start with "# description=" before the actual
description phrase in order for the program to recognize it as a description line.
If the executed file is an input data file rather than a calculator program file then
the entire file name including the ".in" extension must be specified.
Qmcalc will reserve the following characters to use in calculator script files
for special purposes: : ; # = &
So in comment lines that are indicated with the "#" character at the start
of the line, some specific characters must be replaced with their associated
escape sequences for qmcalc to recognize and process them correctly:
To display these characters while reading from a calculator script file ".prg"
or input data file ".in", the following escape sequences must be used instead:
- & or & for the ampersand character: &
- ≻ or ; for the semicolon character: ;
- &hash; or # for the number sign or hash character: #
- &col; or : for the colon character: :
- &eq; or = for the equal character: =
When executing input data files you have the option of either pausing the calculator
after each line completed or executing all lines without pause or interruption through
to the end of the file. The default setting is to pause after each line completed.
To specify no pause in execution until the completion of the input data file, you need
to specify the "nopause" option after entering a comma after the file name.
Valid commands recognized by the calculator includes any normally entered
functions, operators, values and variables as well as the following additional
program control and program input/output instructions
Program Control Instructions:
- IF
- conditional execution of a single command.
- IF-THEN
- Conditional execution of program segment.
- IF-THEN-ELSE
- Conditional execution of a two-branch program segment.
- FOR
- Repeated execution at a specified number of iterations of a program
segment.
- WHILE
- Repeated execution of a program segment while a specified condition
is true. Testing of condition is done prior to the execution of the
program segment.
- REPEAT
- Repeated execution of a program segment until a specified condition
becomes true. Testing of condition is done after the execution of
the program segment.
- END
- Identifies the end of a group of commands.
- PAUSE
- Suspends execution of the program so you can see answers or program
output.
- LBL
- Label used by goto command.
- GOTO
- Go to a specified location in the program indicated by a LBL label tag.
- IS>
- Increment and skip command. See command specific help for more details.
- DS<
- Decrement and skip command. See command specific help for more details.
- MENU
- Displays menu with choices shown as multiple branches to different
locations within the program.
- PRGM
- The PRGM command is used to execute other programs from the currently
running program as subroutines. Syntax and accepted input is same as the EXEC command.
- RETURN
- Quits the subroutine and returns to the calling program.
- STOP
- Stops execution of currently running program including from within any
subroutines and returns to calculator display.
The message "<program ended>" will also be displayed when the calculator is in interactive
text or GUI mode. This message can be customized by supplying the STOP command with an argument string.
Program Input/Output Instructions:
- PROMPT
- Displays each variable one at a time and prompts user to enter data
for each one with a "=?" prompt.
- INPUT
- Prompts user to input into a variable with a "?" prompt without any
preceeding text or displays some preceeding text followed by the "?" prompt.
- DISP
- Displays one or more strings or variables. Expression arguments are
evaluated and the results displayed.
- DISP_PARTS
- Displays one or more strings or variables in parts. Expression
arguments are evaluated and the results displayed. The output file is not closed and the GUI client program
of the calculator is not notified of the newly entered contents until the END_DISPLAY program command is
executed. This is useful when displaying large amounts of text data all at once rather than one piece
at a time.
- END_DISP
- End displaying of text content parts by closing output file and
notifying GUI client program of the new contents contained in the output file.
- GRAPH
- Displays a two dimensional cartesian graph of an expression or the
results of a function performed on an expression (not available in text mode).