Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > Ada Code > Generating Ada code > Mapping information for generation > Mapping information for SPARK 83 generation scheme > Operation mapping for generating SPARK 83 (Ada code)
  
Operation mapping for generating SPARK 83 (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.
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:
Whether ACS generates the Body property is determined by the ACS settings. For more information about maintaining operation bodies through ACS, see Strategy for maintaining reversible properties (ACS).
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 the text of Operation Body property references a basic type, that basic type may be mapped to a different type when generated. For more information, see Basic type mapping for generating Ada 83 (Ada code).
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 is stereotyped by the «Ada Main» stereotype, ACS generates the Operation as the main procedure file.
If the Operation is stereotyped by the «Ada Create» stereotype, ACS generates the text of the Operation's Body property as the body code of the package that is generated for the Operation's owning Package, Class or Data Type.
* 
The Operation name must match the name of the owning Package, Class or Data Type.
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 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 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:
Abstract
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.
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.
For more information about modeling dependencies to packages in the Model, see Modeling with, use and use type clauses in Modeler (Ada code).
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.