Chapter 5
Generated Code Architecture
5-20
ni.com
however, is to create additional space when declaring a variable of the
info
structure’s type and for the new code generated with the
-epi
option,
which assumes the field exists in all procedure
info
structures. However,
the old procedure cannot call a procedure generated with the extended field
in the
info
structure. Also, if attempting to mix procedures with and
without the extended structure, it is not possible to generate valid code if
the
-vbco
option is used in conjunction with
-epi
.
Macro Procedure
Macro Procedure SuperBlocks are intended to provide an in-line code
generation capability like C-macros provide. However, AutoCode does not
generate the definition of the macro procedure. AutoCode only generates a
call to the macro, assuming that the macro is implemented elsewhere. Of
course, the name generated for the Macro Procedure can be the name of the
function rather than a macro, as would always be the case for Ada.
Interface
The interface generated to a Macro Procedure is very similar to the unrolled
Standard procedure interface in that inputs and outputs are actual
arguments to the procedure.
•
Macro Name
—The name of macro is generated exactly as entered in
the macro string in the block form.
•
Additional Arguments
—The macro string can contain additional
arguments as specified in the macro string. These arguments are
generated before the explicit inputs and outputs of the block.
•
Input
—Each of the inputs to the Macro Procedure are listed in pin
order.
•
Output
—Each of the outputs of the Macro Procedure are listed
following the inputs in pin order. Notice that outputs are
not
passed by
reference.
Example 5-4 is the generated code for a Macro Procedure. Assume that the
name of the macro is
printf
; there are two inputs and an optional
argument.
Example 5-4
Sample call generated for a Macro Procedure
/* ---------------------------- User Macro Block */
/* {mac.22} */
printf(“%d %d\n”, U->data_1, U->data_2);