5. Parameters and Value Files

The values of parameters that can be referred to by the templates are often specified in value files (configuration files). Format of such files is described below. Note that the term whitespace characters refers only to spaces and tab characters in this section.

A value file has the following format. The file may contain blank lines (1), comments (2), and parameter definitions (3, 4).

(1) Blank lines, that is, the lines containing only whitespace charaters, are ignored.

(2) A comment is a line, the first non-whitespace character in which is '#'. Comments are also ignored.

Parameter definitions can be single-line and multiline.

(3) A definition of a single-line parameter has the following form:

    <Name> = <Value>

Whitespace characters surrounding <Name> and <Value> are ignored.

<Name> must not contain whitespace characters.

<Value> can be empty. It may also contain '=' characters. Example:

    CFLAGS = -std=c99 -O2

Here, the name of the parameter is CFLAGS and its value is -std=c99 -O2.

A backslash character ('\') can be used to split long <Value> strings into several logical lines (logical because all of them will be combined into a single line when the file is loaded). Leading and trailing whitespace characters will be removed from each logical line. Single space characters will be inserted between the lines when combining.

For example, the above definition of CFLAGS can be written equivalently as follows:

    CFLAGS = \
        -std=c99 -O2

or as follows:

    CFLAGS = -std=c99 \ 
        -O2

A backslash must not occur between <Name> and '='. The following example is not allowed:

    CFLAGS \ 
        = -std=c99 -O2

Note that the logical lines that begin with '#' or contain only whitespace characters are considered to be the part of <Value> and hence are not ignored. Consider the following definition:

    CFLAGS = -std=c99 \ 
       \ 
    # foo 

It is is interpreted as follows:

    CFLAGS = -std=c99  # foo

The value of CFLAGS parameter is -std=c99 # foo in this case.

(4) A definition of a multiline parameter has the following form:

    <Name> =>> 
        <line1>
        <line2>
        ...
        <lineN>
    <<

The value of this parameter is the part of the file between <Name> =>> and << (excluding the newline characters before <line1> and after <lineN>).

These lines are taken as is: no trimming of whitespace characters, no comment and blank line recognition, no special meaning of the trailing backslash characters like in (3) above, etc.

The resulting value will contain newline characters between <line1>...<lineN>, so the value of the parameter can be multiline indeed.

Non-whitespace characters are not allowed after =>> marker at the same line.

If and only if a line contains just << and, optionally, whitespace characters, it is considered an end marker for the value of this parameter. That is, it is allowed to specify multiline parameters like this:

    CFLAGS =>>
        -O2
        -D"_FOO=<<"
        -g
    <<

<< in -D"_FOO=<<" is not considered an end marker for this value because apart from <<, there are non-whitespace characters on the line.

Shown below is an example of a file in the format described here:

############################################################################
# mysuite.cfg 
############################################################################

# Name of the test suite
TEST_SUITE_NAME = mysuite-t2c

# Version of the test suite
TEST_SUITE_VERSION = 0.1.0_alpha2

# Bug report address of the test suite (typically, email or web address)
TEST_SUITE_BUGREPORT = http://bugtracker.somesite.org/sample-tests/

# Copyright holder
COPYRIGHT_HOLDER = Some Company Ltd

# Extra options for the compiler and linker common for all the tests in the 
# suite. 
COMMON_COMPILER_FLAGS = -DCHECK_EXT_REQS \
    `pkg-config --cflags MySuperLibrary-3.1 \
    gtk+-2.0`
COMMON_LINKER_FLAGS = 
COMMON_LIBS = `pkg-config --libs MySuperLibrary-3.1 gtk+-2.0`

# A boilerplate notice.
NOTICE =>>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
<<

If there are several Name = Value records with the same Name in the file, all the values defined this way will be associated with the corresponding parameter. The parameter will be multi-valued as a result. The order of its values will be the same as the order of the respective records in the file.