Cet énoncé, placé dans le preamble , définit les sous-programmes de type function , en précisant le type du résultat fourni et le nombre d’arguments d’entrée. Elle est obligatoire.
Syntaxe :
define
n
o
m
c
as
[
a
]
[
fortran
nonsimscript
]
[
integer
real
double
alpha
text
pointer
subprogram
N
o
m
_
C
l
a
s
s
e
reference
]
function
[
s
]
[
{
with
given
yielding
}
[
n
[
k
-
dim
[
sional
]
]
[
integer
real
double
alpha
text
pointer
subprogram
N
o
m
_
C
l
a
s
s
e
reference
]
{
argument
[
s
]
value
[
s
]
}
]
c
]
{\displaystyle {\begin{aligned}&\color {blue}{\text{define }}\color {black}nom^{c}\color {blue}{\text{ as }}\color {black}\left[\color {blue}{\text{a}}\color {black}\right]\left[{\begin{matrix}\color {blue}{\text{fortran}}\\\color {blue}{\text{nonsimscript}}\\\end{matrix}}\color {black}\right]\left[{\begin{matrix}\color {blue}{\text{integer}}\\\color {blue}{\text{real}}\\\color {blue}{\text{double}}\\\color {blue}{\text{alpha}}\\\color {blue}{\text{text}}\\\color {blue}{\text{pointer}}\\{\begin{aligned}&\color {blue}{\text{ subprogram}}\\&\color {black}Nom\_Classe\color {blue}{\text{ reference}}\\\end{aligned}}\\\end{matrix}}\color {black}\right]\color {blue}{\text{function}}\left[{\text{s}}\color {black}\right]\\&\left[\left\{{\begin{matrix}\color {blue}{\text{with}}\\\color {blue}{\text{given}}\\\color {blue}{\text{yielding}}\\\end{matrix}}\color {black}\right\}\color {blue}\left[\color {black}n{\text{ }}\left[k{\text{-}}\color {blue}{\text{dim}}\color {black}\left[\color {blue}{\text{sional}}\color {black}\right]\right]\left[{\begin{matrix}\color {blue}{\text{integer}}\\\color {blue}{\text{real}}\\\color {blue}{\text{double}}\\\color {blue}{\text{alpha}}\\\color {blue}{\text{text}}\\\color {blue}{\text{pointer}}\\{\begin{aligned}&\color {blue}{\text{ subprogram}}\\&Nom\_Classe\color {blue}{\text{ reference}}\\\end{aligned}}\\\end{matrix}}\color {black}\right]{\text{ }}\color {blue}\left\{{\begin{matrix}{\text{argument}}\left[{\text{s}}\right]\\{\text{value}}\left[{\text{s}}\right]\\\end{matrix}}\right\}\right]^{c}\color {black}\right]{\text{ }}\\\end{aligned}}}
Exemples :
define IsEnabled as a nonsimscript GLboolean function with 1 GLenum argument
define Factorielle as an integer function with 1 integer argument
define Lancer_Dé_F as an integer method ‘‘ méthode fonction
define toShort as an integer function with 1 1 - dim alpha argument
define toHexa as an integer function with 4 alpha arguments
define mt19937_MP_grnd as a real fortran function with 0 argument ;