Function invocations
A function invocation runs an EGL-generated function or a system function, with these effects:
- Any arguments that are variables are passed by reference, which means that changes to the corresponding parameter change the area of memory available to the invoker
- When the invoked function ends, processing continues with the statement that follows the invocation
- qualifier
- One of the following symbols:
- The name of the library in which the function resides; or
- The name of the package in which the function resides, optionally followed by a period and the name of the library in which the function resides.
- this (identifies a function in the current program)
For details on the circumstances in which the qualifier is unnecessary, see References to parts.
- function name
- Name of the invoked function.
- argument
- One of the following:
- Literal
- Constant
- Data item
- Record
- Dynamic array of records or data items
- A more complex numeric, text, or datetime expression
If the invoked function returns a value, the function invocation can be used only as the source value in an assignment statement. Regardless of whether the function returns a value, the invocation is followed by a semicolon, as in these examples:
biggestNumber = maxOf(firstNumber,secondNumber); readNumbers();The following rules apply:
- If a function parameter is based on a primitive type, loose type, or a dataItem part, you can pass a literal, a constant, or an item. The arguments in the invocation must correspond to the number, order, and types of parameters in the function parameter list. The function invocation fails at run time in the case of a type mismatch, but in the case of a loose type, the test of a mismatch is less strict than in other cases, as described in Function part.
- If a function parameter is a record, the function argument must be a record.
- The structure in the argument record must correspond to the structure in the parameter record.
The following rules apply to literals and constants:
- A numeric literal or constant can be passed only if the receiving parameter is a numeric type
- A literal or constant that includes only single-byte characters may be passed to a parameter of type CHAR or MBCHAR
- A literal or constant that includes only double-byte characters may be passed only to a parameter of type DBCHAR
- A literal or constant that includes a combination of single- and double-byte characters may be passed to a parameter of type MBCHAR
- A literal or constant cannot be passed to a parameter of type HEX
Related concepts
Function part
References to parts
Syntax diagram
Related tasks
Assignments
Related reference
EGL statements
Function part in EGL source format
Primitive types
System words
System words in alphabetical order