Cet énoncé, placé dans le preamble , définit les sous-programmes de type routine , et permet d’avoir un contrôle sur le nombre de paramètres entre le call et la routine . Ceet énoncé n’est pas obligatoire, contrairement au define ... function .
Syntaxe :
define
n
o
m
c
as
[
a
]
[
fortran
nonsimscript
]
routine
[
s
]
[
{
with
given
yielding
}
n
[
k
-
dim
[
ensional
]
]
[
integer
real
double
alpha
text
pointer
subprogram
]
{
argument
[
s
]
value
[
s
]
}
]
{\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]\color {blue}{\text{routine}}\left[{\text{s}}\right]\\&\color {black}\left[\left\{{\begin{matrix}\color {blue}{\text{with}}\\\color {blue}{\text{given}}\\\color {blue}{\text{yielding}}\\\end{matrix}}\color {black}\right\}n{\text{ }}\left[k{\text{-}}\color {blue}{\text{dim}}\color {black}\left[\color {blue}{\text{ensional}}\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}}\\\color {blue}{\text{subprogram}}\\\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\}\color {black}\right]\\\end{aligned}}}
Exemples :
define Compter_Points as a routine with 0 argument ‘‘ Compter les points dans chaque main
define Imprimer_Histogramme as a routine with 1 text argument ,
1 1 - dim integer argument ,
3 real arguments
define ResetMinmax as a nonsimscript routine with 1 GLenum argument
define GetMinmax as a nonsimscript routine with 1 GLenum argument ,
1 GLboolean argument ,
2 GLenum arguments ,
1 pointer argument
define GetBooleanv as a nonsimscript routine giving 1 GLenum argument ,
yielding 1 GLboolean argument