Adding User-Written Code

Adding User-Written Code

 

This section describes supplementing Rational Statemate-generated code with handwritten code (also called “user-written” code) You may include handwritten code as part of your Rational Statemate model, and this code become part of the generated code, as well as part of simulation.

In cases where most of the code you are using is handwritten or from third parties, refer to Adding STM Code Modules.

The Code Generator enables you to extend the Rational Statemate model by supplementing the model with handwritten code. This means that you can implement those elements and aspects of the system’s behavior that have not been explicitly defined by the controlling Statecharts and mini-specs.

You may want to use this feature to accomplish the following:

There are several ways to supplement the generated code:

Attach existing code to the model through the Properties Editor and select one or more languages in which to implement it (K&R C, ANSI C, or Ada).

These methods enable you to add code that is used by both the Simulator and the Code Generator. Rational Statemate stores the code in the model’s database and automatically includes it when you run simulation or code generation.