Operation mapping for generating Ada 95 (Ada code)
For each Operation, ACS generates a function, procedure, main procedure or entry:
• If the Operation has a return type, ACS generates a function subprogram with a default return statement.
• If an Operation has no return type, ACS generates a procedure subprogram.
• If the Operation is stereotyped by the «Ada Main» stereotype, ACS generates the Operation as the main procedure file. See the Main Procedure section that follows.
• If the Operation is stereotyped by the «Ada Entry» stereotype, ACS generates the Operation as an entryof the task, protected type or protected object that is generated for the owning Class or Data Type.
The Visibility property of the Operation determines where the function or procedure subprogram declaration is generated:
• If the Operation's Visibility property set to Public or Package, ACS generates the subprogram declaration within the package specification.
• If the Operation's Visibility property set to Private, ACS generates the subprogram declaration within the package body.
• If the Operation's Visibility property set to Protected, ACS generates the subprogram declaration within the private area of the package specification.
• Subprogram bodies are always generated within the package body. The text specified in the Body property of the Operation may be generated as the function or procedure body code:
Reverser Notes: When reverse engineering, the Reverser updates the Operation Body property in Modeler as follows:
◦ If the Reverse Engineer Code Bodies check box (Reverse Engineering Options 1 page) is cleared, the Reverser does not update the Operation Body property in the Model.
◦ If the Reverse Engineer Code Bodies check box (Reverse Engineering Options 1 page) is selected, the Reverser updates the Operation Body property with the associated function body code. Note that blank function body code will result in the associated Operation's Body property being made blank.
When updating Operation Body properties, the Reverser attempts to preserve model object references.
If you want Operation members to be generated in a specific order, apply the
«Ada Source» stereotype to the Operation and then use the
Ada Generation Order tag definition to order the members in the required order. Within the appropriate part of a generated file, members referenced through the Ada Generation Order tag definition are ordered accordingly and are generated before members that are not referenced by the Ada Generation Order tag definition. For more information about ordering an Operation's members through the Ada Generation Order tag definition, see
Specifying the generation order of model, package, class or data type members (Ada code).
The generation of a function or procedure is derived from the properties of the Operation and the Stereotypes and Tag Definitions that are applied to it:
• If the Operation's Abstract property is selected, ACS generates the Operation as an abstract subprogram.
• If the Operation is related to any exceptions, ACS generates default exception handler code.
• If the Operation is stereotyped by the «Ada Create» stereotype, ACS generates the following.
◦ If the Operation's owning Package, Class or Data Type is being generated as an Ada package, the Operation Body property is generated as the body code of that Ada package.
◦ If the Operation's owning Class or Data Type is being generated as a task or task type, the Operation Body property is generated as the body code of that task or task type.
• If the Operation is stereotyped by the «Ada Entry» stereotype, ACS generates the Operation as an entry of the task, task type, protected type or protected object that is generated for the owning Class or Data Type. If the entry is a protected entry, the tagged value of the Ada Entry Barrier tag definition (applied by the «Ada Entry» stereotype) is generated as the entry barrier text, that is, the text after the 'when' and before the 'is'. The «Ada Entry» stereotype's other tag definitions are used to generate Ada Entries that use an array.
For more information about setting up an Operation to represent a task or task type, see
• If the Operation is stereotyped by the «Ada Declaration» stereotype, the tagged value of the Ada Declaration Text tag definition is generated as the subprogram declarative part.
• If the Operation is stereotyped by the «Ada Generic Instance» stereotype, ACS generates an instantiated generic subprogram. The «Ada Generic Instance» stereotype applies three Tag Definitions:
◦ The tagged value of the Ada Generic Parameters tag definition is generated as the instantiated generic subprogram parameters.
◦ If the associated generic subprogram is modeled in the Model, the tagged value of the Ada Generic Parent tag definition identifies the Operation that is generated as the associated generic subprogram.
◦ If the associated generic subprogram is not modeled in the Model, the tagged value of the Ada Generic Parent Text tag definition specifies the name of the associated generic subprogram.
• If the Operation is stereotyped by the «Ada Pragma» stereotype, the tagged value of the Ada Pragma Text tag definition (applied by the «Ada Pragma» stereotype) is used to generate the pragmas. If the tagged value contains an Import or Interface statement, the Body property is ignored and no body code is generated.
• If the Operation is stereotyped by the «Ada Renames» stereotype, the Operation is generated as a renames declaration.
◦ If the Ada Rename Target Text tag definition (applied by the «Ada Renames» stereotype) specifies the name of a target function or procedure, the renames declaration renames the specified function or procedure
◦ If the Ada Rename Target Text tag definition is blank and the Ada Rename Target tag definition (applied by the «Ada Renames» stereotype) references an Operation in the Model, the renames declaration renames the function or procedure that is generated from the referenced Operation.
• If the Operation is stereotyped by the «Ada Representation» stereotype, the tagged value of the Ada Representation Text tag definition (applied by the «Ada Representation» stereotype) is used to generate the representation clauses.
• If the Operation is stereotyped by the «Ada Separate» stereotype, ACS generates the body of the subprogram in a separate file. A body stub is generated in the parent package body.
The tagged value of the Ada Parent Subprogram tag definition (applied by the «Ada Separate» stereotype) specifies which subprogram owns the separate.
• If the Operation is stereotyped by the «Ada Source» stereotype, the tagged value of the Ada Library Unit tag definition determines whether the Operation is generated in its own file (set to TRUE) or nested inside its parent (set to FALSE). If the «Ada Separate» or «Ada Main» stereotypes are applied to the Operation , the Ada Library Unit tag definition is ignored.
|
The following properties are ignored:
• Asynchronous
• Binding
• Data usage
• Duration
• Immutable
• Synchronous
|
Inherited operation
Inherited operations are renamed in package specifications that represent the inheriting class, provided their signatures are not duplicated in the inheriting class. If an inherited operation does have the same name and signature, it is not renamed and a warning is added to the Log.
|
The following generalization properties are ignored:
• Overlapping generalization
• Private access
• Virtual base class
|
Operators
Typically, the Ada_mangle.ini file deletes or replaces operator characters such as +, -, /, * and < with an underscore.
If you want to set up an Operation as an operator, prefix and suffix the operator with quotation marks in the Operation name. ACS will then not delete or replace the invalid character.
For example, for a + operator, name the Operation "+".
Main procedure
The generation of the main procedure is derived from the properties of the Operation and the Stereotypes and Tag Definitions that are applied to it:
• If the Operation is stereotyped by the «Ada Main» stereotype, ACS generates the Operation as the main procedure file. Note that ACS ignores the «Ada Main» stereotype's tag definitions.
• If the Operation is stereotyped by the «Ada Context» stereotype, ACS can generate with, use and use type clauses to packages. The «Ada Context» stereotype applies the Ada_Declaration_Dependencies and Ada_Implementation_Dependencies tag definitions:
◦ The tagged value of the Ada_Implementation_Dependencies tag definition is generated in the main procedure.
◦ The tagged value of the Ada_Declaration_Dependencies tag definition is ignored.
• If the Operation is stereotyped by the «Ada Configuration Pragma» stereotype, the tagged value of the Ada Configuration Pragma Text tag definition (applied by the «Ada Configuration Pragma» stereotype) is used to generate file scoped pragmas.
|
ACS uses the tagged value of the Ada_Body tag definition (applied by the «Ada Source» stereotype) to record the location of the associated main procedure file.
|