next up previous contents index
Next: 4.3.2 Once Timed Transition Up: 4.3.1 Macros Previous: 4.3.1.3 Pre-defined Macros   Contents   Index

4.3.1.4 Importation Parameters (Macro Redefinition)

Macros in a submodel are interpreted before the submodel is imported. They have no effect on the importing model. The importing model is allowed to modify the behavior of the submodel by redefining its macros. All the macros that are defined in the submodel and all the pre-defined macros can be redefined by the importing model. They act as parameters to the submodel.

This mechanism enhances the expressiveness of DCharts 1.0. It is the only means by which the behavior of submodels is modified. This is necessary for model reuse. Moreover, model reuse with macro redefinition protects the well-defined behavior of submodels. Only the macros defined in them (or pre-defined macros) are allowed to be modified. The importing model cannot change other parts of the submodels. [26]

To redefine macros as parameters for a submodel, the importing model imports the submodel into one of its states as described in section 4.2.9. The macro redefinitions are specified as properties of the importation state in the state hierarchy. Redefining a macro is similar to macro definition under the MACRO descriptor, except that it is placed between square brackets following the name of the state.


Table 4.14: An example of the textual representation of a macro redefinition
\begin{table}\begin{center}
\begin{minipage}{10cm}
\begin{verbatim}
IMPORTATIO...
...ITION:
S: A
N: B
E: e\end{verbatim}
\end{minipage} \end{center}
\end{table}


For example, the model in Table 4.14 imports submodel submodel0.des and assigns ID sub0 to it. It is imported into state B. The importing model redefines macro DUMP of the submodel. DUMP is originally a pre-defined macro to display a message. It is redefined to print the message to the console with prefix ``sub0 says: ''. Multiple macro redefinitions can be written on the same line.


next up previous contents index
Next: 4.3.2 Once Timed Transition Up: 4.3.1 Macros Previous: 4.3.1.3 Pre-defined Macros   Contents   Index
Thomas Huining Feng 2004-04-28