Previous | Next | Contents | Index |
The if...then...else... statements in the recipe language are akin to those of the C programming language.
Braces can be used to group statements.
A loop construct is available, with the syntax:
loop { ... exitif (expression); ... } |
exitif
statements.
Assignment statements are akin to those of the C programming language.
The #
character indicates that the rest of a line is a
comment.
Template statements require a more detailed discussion, provided in Section 37.8.4.1.
37.8.4.1 Template Statements
A template...endtemplate statement is a multiline statement,
essentially providing a "picture" of the directory output.
Template statements consist of one directory attribute assignment per
line. The format is:
template output-attribute-name-1: value-1 output-attribute-name-2: value-2 . . . . . . endtemplate; |
value-1
,
value-2
, etc., will consist of some
combination or function of the input directory attributes.
To simply insert the value of a directory attribute, enclose the directory attribute name in single quotes:
output-attribute-name: 'input-attribute-name' |
In a cook recipe, the purpose is to describe how to construct
"canonical" attributes from the input "foreign" or
"raw" attributes. So the template statement for a cook recipe
will consist of assigning values obtained from "raw"
attributes to "canonical" attributes. That is, the left hand
side of each template line, the
output-attribute-name-n
portion, will be the name
of a "canonical" attribute, and the right hand side of each
template name, the value-n
portion, will be a
"raw" directory attribute or some function of such
"raw" attributes.
In a serve recipe, the purpose is to describe how to convert
"canonical" attributes back into a foreign directory's native
"raw" attributes. So the template statement for a serve
recipe will consist of assigning values obtained from
"canonical" attributes to "raw" attributes. That
is, the left hand side of each template line, the
output-attribute-name-n
portion, will be the name
of a "raw" attribute, and the right hand side of each
template name, the value-n
portion, will be a
"canonical" attribute or some function of such
"canonical" attributes.
Note that there is a special purpose attribute which can be placed in
an entry via a template, the ignore_for
attribute. This
attribute takes a directory name as its value; the entire entry in
which the attribute appears will be ignored (omitted) when performing
differencing with the specified directory. Multiple
ignore_for
attributes can be specified in an entry, in
which case the entry will be ignored when differencing with any of the
specified directories. Figure 37-4 shows an example of an entry for
"Invisible Person" which is to be ignored when performing
differencing with directory "Dir2".
Figure 37-4 Ignoring an Entry
Previous | Next | Contents | Index |