User Guide

Crestron SIMPL+
®
Software
Language Reference Guide - DOC. 5797G SIMPL+
®
z 271
R: Read access allowed. W: Write access allowed.
(E1): Generates a RunTime Error, not allowed to be write to INPUT values. The
ReadOnlyByRef generates a compile error instead of a RunTime Error.
An example of a function declaration that has no parameters and returns no value
would be:
FUNCTION PrintText()
{
// Code
}
The following is an example of a function declaration that takes an INTEGER and
returns a STRING. The INTEGER is passed by value, so it cannot be modified.
STRING_FUNCTION ComputeDate(ByVal INTEGER TheMonth)
{
STRING Month$[20];
// Code to compute Month$…
RETURN(Month$);
}
The following is an example of a function declaration that takes a STRING array and
sorts it and an integer that takes the actual number of elements that are contained in
the array. It returns an INTEGER error code:
INTEGER_FUNCTION SortNameInDatabase(STRING
Name[],INTEGER NumElements)
{
INTEGER Error;
// Code to sort Names[] and setError…
RETURN(Error);
}
VARIABLE TYPE
ByVal
[LOCAL
COPY]
ByRef
[SOURCE]
ReadOnlyByRef
[SOURCE]
STRING_OUTPUT array
-- -
STRING_OUTPUT array element
- - -
STRUCTURE
-R, W R
STRUCTURE element (INTEGER)
R, W - -
STRUCTURE element (LONG_INTEGER)
R, W - -
STRUCTURE element (SIGNED_INTEGER)
R, W - -
STRUCTURE element (SIGNED_LONG_INTEGER)
R, W - -
STRUCTURE element (STRING)
- - -
NOTE: It is not strictly necessary to use the “ByVal” keyword here. ByVal can be
used to make sure that no modifications to the original variable are done by accident
within the function.