next up previous contents index
Next: Variable arguments Up: Module's header Previous: Needed arguments   Contents   Index


Optional arguments

The definition of optional arguments and needed arguments differs only in the fact that the first are enclosed into { and }. In addition, optional arguments must be defined after needed arguments. When they are several optional arguments, they are linked in the sense that the selection of the first leads the need of the selection of the others.


H_id - >C_id

defines an optional argument with input value. C_id is a C variable of type pointer to a scalar (e.g. char *), or a C variable of MegaWave2 type (e.g. Cmovie). If C_id = NULL, then the argument has not been selected.


H_id - >C_id [Min,Max]

defines an optional argument with input value and with interval checking (an error is send if the input value does not fit into the given interval [Min,Max]). MegaWave2 types are not allowed. Min and Max must be constant of same type than C_id with Max > Min.


[H_id = Val] - >C_id

defines an optional argument with default input value. When the argument is not set by the user then *C_id= Val that is, one can never have C_id = NULL. MegaWave2 types are not allowed. Val must be a constant of same type than C_id. Warning: no implicit conversions are made (e.g. if C_id is of type float, Val = 1.0 is allowed but not Val = 1).


[H_id = Val ] - >C_id [Min,Max]

defines an optional argument with input value and with interval checking (an error is send if the input value does not fit into the given interval [Min,Max]). MegaWave2 types are not allowed. Min and Max must be constant of same type than C_id with Max > Min.


H_id < -C_id

defines an optional argument with output value. The argument has been given by the user if and only if C_id $ \not=$ NULL. If C_id $ \not=$ NULL, MegaWave2 writes the output value at the end of the module from the content of *C_id. C_id is a C variable of MegaWave2 type only (e.g. Cmovie). If C_id $ \not=$ NULL, you must allocate the structure to the right size using functions of the system library, before doing any computation with this variable (see Volume two: ``MegaWave2 System Library'').

Restriction: C_id cannot be a function (return value of the module), whereas this is allowed with needed arguments (see section 4.3).


next up previous contents index
Next: Variable arguments Up: Module's header Previous: Needed arguments   Contents   Index
mw 2004-05-05