Chapter 5
Generated Code Architecture
5-40
ni.com
BREAK Block
The WHILE construct indefinitely iterates unless a BREAK Block is
executed within the loop. You are responsible for properly detecting an exit
condition and using it as an input to a BREAK Block inside the loop. If the
input to the BREAK Block is TRUE, then the loop that is immediately
enclosing the BREAK Block is exited. This block is implemented as a
break statement in C and as an exit statement in Ada.
CONTINUE Block
A CONTINUE Block provides another way to control the execution of
blocks within a loop. By using a CONTINUE Block, the execution can be
immediately continued with the next iteration, instead of executing blocks
that follow the CONTINUE Block. You are responsible for detecting a
continue condition and using it as an input to a CONTINUE Block inside
the loop. The CONTINUE Block continues execution with the next
iteration if its input evaluates to TRUE. This construct is implemented as a
continue statement in C, while a
goto
statement is used in Ada, and the
target of the goto is the first statement in the loop.
Like the IfThenElse Block, the requirements for an iteration mechanism are
varied, and our design allows for the most flexible algorithm design at the
expense of increased diagram complexity to specify all of the details about
the sequencing and termination within the loop.
Local Variable Block
Local Variable Blocks are implemented as automatic variables in the
generated code. They are strictly temporary and are used to pass data from
one computation to another. The Scope of a local variable block is local to
that of the enclosing subsystem or procedure. The local variable block is
active only when the enclosing procedure or subsystem is invoked.
Thus, Local Variable Blocks cannot be used to communicate data between
procedures or subsystems, but could be used to communicate data from one
SuperBlock to another if both SuperBlocks are mapped to a single
subsystem. Refer to subsystem mapping information described in the
section. Also, the recommended way of passing data from one
software construct to another, or from a software construct to the
SuperBlock in which it is contained, is through local variables.