Download User Control Language (UCL) Reference Manual
Transcript
Dok.-Nr/Doc. No.: COL–RIBRE–STD–0010
Daimler–Benz Aerospace
Ausgabe/Issue:
Überarbtg./Rev.:
Seite/Page:
Raumfahrt-Infrastruktur
4
–
4–50
Datum/Date : 13.03.1998
Datum/Date:
von/of
4–71
ation type or constrained statecode type). The different values that may be taken by this selector appear
in the case statement as case labels or case label ranges.
The branches in a case statement must be uniquely identified by its labels, i.e. a label may appear only
once in a case statement. The union of labels and label ranges in a case statements must cover all
possible values of the selector type, either explicitly or implicitly by an else branch that collects all
label values not explicitly specified in previous branches. If there is an else branch, it must be the
last branch in the case statement.
The case labels must be constants or constant expressions; and they must be unique within a particular
case statement (i.e. no label may occur more than once). When the same action is required for several
different values of the case selector, these values may be written in a list, separated by commas. Ranges
of contiguous values may be written in range notation (lower .. upper). Statecode labels cannot form
ranges, because statecode types are unordered. The type of all case labels must be compatible with the
type of the case selector.
When the case statement is executed, the selector is first evaluated. If there is a case label with the
same value as the case selector, the corresponding statement sequence is executed. Otherwise the statement sequence specified in the else clause, if present, is executed. The else clause is optional; if
omitted, however, the specified case labels must cover the entire value range of the case selector type.
Formal Syntax
Case_Statement
= ”case” Expression
Case
{ Case }
[ ”else” Statement_Sequence ]
”end” ”case” ”;”
Case
= ”when” Case_Label_List ”:” Statement_Sequence
Case_Label_List
= Case_Labels { ”,” Case_Labels } |
Statecode_List
Case_Labels
= Constant_Expression [ ”..” Constant_Expression ]
Statecode_List
= Statecode { ”,” Statecode }
Statecode
= see 4.5.1.8
Constant_Expression = see 4.9
Expression
= see 4.9
Statement_Sequence = see 4.10
Examples
case Traffic_Light
when Red
: Stop_Car;
when Green : Go_Ahead; Turn_Right;
else
No_Traffic_Light;
end case;
case Code
when $LOW
: ... ;
when $MEDIUM : ...;
when $HIGH
: ...;
end case;
Daimler–Benz Aerospace AG, D–28199 Bremen – All Rights reserved – Copyright per DIN 34