case construction is used in a project file to effect conditional
Here is a typical example:
project MyProj is type OS_Type is ("GNU/Linux", "Unix", "NT", "VMS"); OS : OS_Type := external ("OS", "GNU/Linux"); package Compiler is case OS is when "GNU/Linux" | "Unix" => for Default_Switches ("Ada") use ("-gnath"); when "NT" => for Default_Switches ("Ada") use ("-gnatP"); when others => end case; end Compiler; end MyProj;
The syntax of a
case construction is based on the Ada case statement
(although there is no
null construction for empty alternatives).
The case expression must a typed string variable.
Each alternative comprises the reserved word
when, either a list of
literal strings separated by the
"|" character or the reserved word
others, and the
Each literal string must belong to the string type that is the type of the
others alternative, if present, must occur last.
=>, there are zero or more constructions. The only
constructions allowed in a case construction are other case constructions and
attribute declarations. String type declarations, variable declarations and
package declarations are not allowed.
The value of the case variable is often given by an external reference (see External References in Project Files).