Previous: Preprocessor Usage, Up: Preprocessor [Contents][Index]
The identifier must be the name of an optional abstract
argument to the function. This macro must be used only within a function
definition. It expands to the MFL expression that yields
true
if the actual parameter is supplied for identifier.
For example:
func rcut(string text; number num) returns string do if (defined(num)) return substr(text, length(text) - num) else return text fi done
This function will return last num characters of text if num is supplied, and entire text otherwise, e.g.:
rcut("text string") ⇒ "text string" rcut("text string", 3) ⇒ "ing"
Invoking the defined
macro with the name of a mandatory argument
yields true
Provides a printf
statement, that formats its optional
parameters in accordance with format and sends the resulting
string to the current log output (see Logging and Debugging).
See String formatting, for a description of format.
Example usage:
printf('Function %s returned %d', funcname, retcode)
A convenience macro. Expands to a call to gettext
(see NLS Functions).
This macro intends to compensate for the lack of array data type in MFL. It splits the string list into segments delimited by string delim. For each segment, the MFL code code is executed. The code can use the variable var to refer to the segment string.
For example, the following fragment prints names of all existing
directories listed in the PATH
environment variable:
string path getenv("PATH") string seg string_list_iterate(path, ":", seg, ` if access(seg, F_OK) echo "%seg exists" fi')
Care should be taken to properly quote its arguments. In the code
below the string str
is treated as a comma-separated list of
values. To avoid interpreting the comma as argument delimiter the
second argument must be quoted:
string_list_iterate(str, `","', seg, ` echo "next segment: " . seg')
A convenience macro, that expands to msgid verbatim. It is
intended to mark the literal strings that should appear in the
.po file, where actual call to gettext
(see NLS Functions) cannot be used. For example:
/* Mark the variable for translation: cannot use gettext here */ string message N_("Mail accepted") prog envfrom do … /* Translate and log the message */ echo gettext(message)
Previous: Preprocessor Usage, Up: Preprocessor [Contents][Index]