Component (Domain) Specializations

Within MC-3020 component level customizations can be applied. The marking file domain.mark is the place to tag the customizations.

Identifying Initialization Functions

Initialization functions provide the analyst a means to specify preexisting instances for production bring-up. They also serves to set up test scenarios. Domain functions also can be activated/deactivated with marking. Through marking, specific initialization functions can be chosen for system bring-up while others are marked (or erased as the case may be) as not to be translated.

Marking a function for initialization does not change the function. The function remains available for invocation by any of the action semantics that could normally call it. If more than one function is tagged as an initialization function, each will be invoked. The order of invocation is alphabetical by function name.

Identify a function in the component to be used as the an initialization function by invoking the following rule file function in the domain.mark marking file.

MarkInitializationFunction(string "component",
 string "function_name");
 

Where the input parameters are:

component>

is the name of the component (domain) containing the initialization function.

function_name

is the name of the function (synchronous service) to be invoking during bring-up.

Example 4.28. Marking Initialization Functions

.invoke MarkInitializationFunction( "*", "CreateAndPopulate" )
.invoke MarkInitializationFunction( "SeatHeater", "test" )
        


Identifying Initialization Objects

Initialization objects represent an obsolete means for the analyst to specify preexisting instances for production bring-up. All of the functionality of the obsolete TagInitializationObject is now provided in functions which can be activated/deactivated and marked for initialization. Use functions instead of initialization objects. See MarkInitializationFunction.

Excluding Classes

MC-3020 can be directed to skip code generation for classes marked with the MarkExcludeObjectFromCodeGen invocation. Combined with selective marking of initialization functions, class exclusion allows for a simple method of providing multiple bring-up scenarios. Exclude a class from code generation by marking it thusly:

MarkExcludeObjectFromCodeGen(string "component",
 string "key_letters");
 

Where the input parameters are:

component

name of component (domain) being marked

key_letters

key letters of the excluded class

Example 4.29. Marking Excluded Classes

.invoke MarkExcludeObjectFromCodeGen( "*", "TST_OBJ" )
.invoke MarkExcludeObjectFromCodeGen( "MicrowaveOven", "Test" )
        


Excluding Subsystems

To indicate to the model compiler that all classes in a specified subsystem should be excluded from implementation code generation, use the following invocation (one for each excluded subsystem):

MarkExcludeSubsystemFromCodeGen(string "component",
 string "subsystem");
 

Where the input parameters are:

component

name of the component (domain) being marked

subsystem

name of the excluded subsystem

Example 4.30. Tagging Excluded Subsystems

.invoke MarkExcludeSubsystemFromCodeGen( "*", "MyVerifierUnitTests" )
.invoke MarkExcludeSubsystemFromCodeGen( "GPS", "UI" )
        


Disabling Function Translation

To indicate to the model compiler that the semantic action of a function should not be translated, mark the function with the MarkFunctionTranslationOff marking function. This is useful for selectively disabling functions used to set up test scenarios. This is also key for disabling initialization functions after preexisting instances have been created and saved in XML data.

MarkFunctionTranslationOff(string "component",
 string "function_name");
 

Where the input parameters are:

component

name of the component being marked

function_name

name of the excluded function (synchronous service)

Example 4.31. Not Translating a Function

.invoke MarkFunctionTranslationOff( "*", "CreateRelateInit" )
.invoke MarkFunctionTranslationOff( "Test", "TestScenarioFive" )
        


State Transition Trace

To instruct the model compiler to generate state transition tracing information, invoke the following rule file function:

MarkStateTransitionTracingOn(string "component");
 

Where the input parameters are:

component

name of the component being marked

Example 4.32. Enabling State Transition Tracing

.invoke MarkStateTransitionTracingOn( "*" )
.invoke MarkStateTransitionTracingOn( "Location" )
        


Action Language Trace

To instruct the model compiler to generate tracing information at the action language statement level, invoke the following rule file function:

MarkActionStatementTracingOn(string "component");
 

Where the input parameters are:

component

name of the component being marked

Example 4.33. Enabling Action Language Tracing

.invoke MarkActionStatementTracingOn( "*" )
        


Empty Handle Usage

It is possible to develop xtUML models that incorrectly attempt to use instance reference variables that are empty (null). This can occur under several sets of circumstances. For example, selection across a conditional relationship chain may return an empty instance reference or empty instance reference set. Using such a reference without testing for empty can lead to an invalid operation. (MC-3020 does not enforce relationship conditionality at model compilation time.) It is possible to build models that attempt to send events to empty instance references, or relate or unrelate (link/unlink) instance when one or both references are empty.

MC-3020 provides a markable debug option for detecting and potentially recovering from such empty ``handle'' references. To steer the model compiler into generating debug code that detects the use of empty instance references and instance set references (handles), invoke the following rule file function:

MarkEmptyHandleDetectionOn(string "component");
 

Where the input parameters are:

component

name of the component being marked

Example 4.34. Enabling Empty Reference Usage Detection

.invoke MarkEmptyHandleDetectionOn( "*" )
        


MC-3020 will generate detection code and invoke a macro when an improper handle usage is detected. The macro defaults to invocation of a user callout function, UserEmptyHandleDetectedCallout. The body of this callout function can be (re)defined by the user.

Disabling First Pass Optimizations

At times it is necessary to carefully study the generated code. This may be the case when enhancing or extending the default functionality of MC-3020. Under such circumstances, it may be desirable to see the code in its unoptimized format. Note that MC-3020 has several optimizations that eliminate unused code. During design, sometimes it is desirable to see what this unused code looks like. Using MarkFirstPassOptimizationsOff(), it is possible to force MC-3020 to generate the code in its unoptimized form.

MarkFirstPassOptimizationsOff(string "component");
 

Where the input parameters are:

component

name of the component being marked

Example 4.35. Forcing Generation Non-Optimal Code

.invoke MarkFirstPassOptimizationsOff( "ship" )
        


MC-3020 will generate all code, even if it is not expected to be executed during normal operation.

Miscellaneous Domain Marking

Additional marking adjustments are available in the domain.mark marking file. Marking options that manipulate the style and appearance of the generated code and that control optimizations can be enabled. See documentation in the marking file for these detailed options.

Marking commands for these aesthetic purposes include:

  • MarkStateActionCommentBlocksEnabled( component_name )

  • MarkStateActionStatementCommentsDisabled( component_name )

  • TagStateActionVariableNamesEnabled()

  • TagVerboseReflexivePhrasesEnabled()