Download Bound-T User Manual - Bound

Transcript
If the buffering module contains another subprogram initialize that has its own local variable i, this would be “buffering|initialize|i”. If another module sink contains another subprogram initialize that has its own local variable i, this would be “sink|initialize|i”.
Unique suffix suffices
You can always use the fully qualified name to identify a subprogram or a variable, but it is enough to give those scope levels (starting from the bottom) that make the name unambiguous.
In the examples above, the variable name “i” is clearly ambiguous. The partially qualified name “initialize|i” is also ambiguous because it occurs in two modules, buffering and sink, so you must use the fully qualified names “buffering|initialize|i” and “sink|
initialize|i” to refer to these two i variables.
The partially qualified variable name “fill_buffer|i” is enough to identify the i in fill_buffer because (in this example) there is only one subprogram called fill_buffer.
The unqualified subprogram name “fill_buffer” is also unambiguous for the same reason. The two initialize subprograms have to be qualified as “ buffering|initialize” and “sink|initialize” respectively.
Default scope
The assertion language provides the keyword within to let you set a default scope that is prefixed to all names. Continuing on the examples above, after the default scope definition
within "buffering|initialize";
you can write just “i” instead of “buffering|initialize|i”.
When a default scope is defined it applies to all name strings that start with a normal character. Here the name “fill_buffer|i” would be interpreted as “buffering|
initialize|fill_buffer|i” which would probably not be a valid name. To ignore (escape) the current default scope, put the delimiter character at the start of the name, as in “ | fill_buffer|i”.
The default scope can be cleared by defining a null string as the default scope: within "".
Different delimiters
Some target compilers may use the vertical bar character '|' within names which means that it cannot be used to delimit scope levels. The assertion language provides the keyword delimiter for changing the scope delimiter, for example to a diagonal slash as follows:
delimiter '/';
Afterwards you would write for example “fill_buffer/i” to refer to the variable i in the subprogram fill_buffer.
5.13 Naming Subprograms
When writing assertions you may need to write a subprogram name in four places:
•
60
To define a subprogram context: subprogram "Foo" .. end "Foo";
Writing Assertions
Bound­T User Manual