Software
Crestron
SIMPL+
#SYMBOL_NAME
- Allows the user to specify the name that SIMPL Windows
uses for this module. If this directive is left out, the filename will be used by default.
#HINT
- Provides text that appears in the SIMPL Windows status bar whenever the
module icon is clicked on.
#CATEGORY
– (SIMPL+ 3.0 and later) Specifies the SIMPL Windows symbol
tree category number for this SIMPL+ module, which controls where the SIMPL+
module is listed in the symbol tree in Program Manager. Selecting
Edit | Insert
Category
from the menu will display a list of available categories to choose from
and automatically insert the selected category in to the program module.
#DEFAULT_VOLATILE –
(SIMPL+ 3.0 and later) Specifies that all program
variables will retain their values if hardware power is lost. If neither the
#DEFAULT_VOLATILE nor #DEFAULT_NONVOLATILE are specified, the
compiler will default all variables declared within the SIMPL+ module as
nonvolatile.
#DEFAULT_VOLATILE –
(SIMPL+ 3.0 and later) Program variables will not
retain their value if hardware power is lost.
#HELP_BEGIN / #HELP_END
- Allows on-line help to be entered for this
module. This text appears when the user selects the module and presses F1 from
within SIMPL Windows.
#DEFINE_CONSTANT
- Allows constant numeric/string values to be assigned to
alphanumeric names. This is extremely useful for writing changeable and readable
code.
This last compiler directive deserves more discussion, since using constant
definitions are a very important part of writing readable code. To illustrate this,
examine the following example.
PUSH vcr_select
{
switcher_input = 3;
switcher_output = 2; // video projector
}
PUSH dvd_select
{
switcher_input = 4;
switcher_output = 2; // video projector
}
In this example it should be clear that the value of a variable,
switcher_input
, is
being set to 3 if the vcr button is pressed or 4 if the dvd button is pressed. In both
cases, the variable,
switcher_output
, is set to 2, which is the output connected to the
video projector. Presumably, these variables would be used somewhere else in the
program to generate a command string to control a switcher. Using numbers in a
small and simple program like this still produces a relatively readable program. Even
so, a couple of problems should become evident. For one thing, if the switcher
configuration is changed, and the inputs and outputs are rearranged, the user must
carefully go through the program and change all the appropriate values for the
switcher input and output. Secondly, in a larger program this technique becomes
very hard to read. After all, the number 3 has no intrinsic relationship to a VCR.
Examine the following equivalent program, which uses constant definitions in place
of actual numbers.
6
•
SIMPL+
Programming Guide – DOC. 5789A