This section describes how the Code Generator implements subroutines in the model’s database.
For information on how to supplement generated code with subroutines, refer to Adding User-Written Code.
For each subroutine that the model uses (i.e., either called or referenced in the callback or user-added code bindings), a separate file is generated. This file, named
<subroutine_name>_ sc.c
contains a code that implements the subroutine.The Code Generator implements the subroutine in one of the following ways:
● Translation of Rational Statemate Action Language, Procedural Statechart, or Truth Table (when a subroutine is implemented using one of these languages)In the following cases, the Code Generator only produces a template for the subroutine:
● Some implementation exists, but it is disabled by setting the “Select Implementation” option in the Properties window to “None.”
● Selected implementation does not match the Code Generator’s target language. For example, if your model has a C-code implementation of a subroutine and you are generating Ada, the Code Generator will ignore it.In addition to
*_sc.c
files, the Code Generator creates a file called<profile_name>_envelopes.c
. This file contains “envelopes” for all the subroutines in the scope. The envelopes ensure that the Rational Statemate execution rules are properly mapped into those of C or Ada.