An example of a basic program is as follows:
program myCalledProgram type basicProgram
(buttonPressed int, returnMessage char(25))
function main()
returnMessage = "";
if (buttonPressed == 1)
returnMessage = "Message1";
end
if (buttonPressed == 2)
returnMessage = "Message2";
end
end
end
The syntax diagram for a program part of type basicProgram is as follows:
- Program programPartName ... end
- Identifies the part as a program part and specifies the name and type.
If the program name is followed by a left parenthesis, the program is a called
basic program.
If you do not set the alias property
(as described in Program part properties), the name of the generated
program is programPartName.
For
other rules, see Naming conventions.
- mainBasicProperties
- The properties for a main basic program are optional:
- alias
- allowUnqualifiedItemReferences
- handleHardIOErrors
- includeReferencedFunctions
- inputRecord
- localSQLScope
- msgTablePrefix
- throwNrfEofExceptions
For details, see Program properties.
- parameter
- Specifies the name of a parameter, which may be a data item, record, or
form; or a dynamic array of records or data items. For rules, see naming
conventions.
If the caller's argument is a variable (not a constant
or literal), any changes to the parameter change the area of memory available
to the caller.
Each parameter is separated from the next by a comma.
For other details, see Program parameters.
- calledProperties
- The called properties are optional:
- alias
- allowUnqualifiedItemReferences
- handleHardIOErrors
- includeReferencedFunctions
- localSQLScope
- msgTablePrefix
- throwNrfEofExceptions
For details, see Program properties.
- programData
- Variable and use declarations, as described in Program data other than
parameters.
- mainFunctionPart
- A required function named main, which takes
no parameters. (The only program code that can take parameters is the program
itself and functions other than main.)
For details on writing a function,
see Function part in EGL source format.
- functionPart
- An embedded function, which is private to this program. For details on
writing a function, see Function part in EGL source format.