Next: , Previous: Attributes, Up: Project File Syntax

11.3.7 Associative Array Attributes

Some attributes are defined as associative arrays. An associative array may be regarded as a function that takes a string as a parameter and delivers a string or string list value as its result.

Here are some examples of single associative array attribute associations:

        for Body ("main") use "Main.ada";
        for Switches ("main.ada")
            use ("-v",
        for Switches ("main.ada")
                 use Builder'Switches ("main.ada")
                   & "-g";

Like untyped variables and simple attributes, associative array attributes may be declared several times. Each declaration supplies a new value for the attribute, and replaces the previous setting.

An associative array attribute may be declared as a full associative array declaration, with the value of the same attribute in an imported or extended project.

        package Builder is
           for Default_Switches use Default.Builder'Default_Switches;
        end Builder;

In this example, Default must be either an project imported by the current project, or the project that the current project extends. If the attribute is in a package (in this case, in package Builder), the same package needs to be specified.

A full associative array declaration replaces any other declaration for the attribute, including other full associative array declaration. Single associative array associations may be declare after a full associative declaration, modifying the value for a single association of the attribute.