Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > C Code > Generating C Code > Overview of generating C code (C code) > Overview of modeling C code (C code) > Overview of modeling C code (C code) > Enumeration literal mapping for C (C code)
  
Enumeration literal mapping for C (C code)
Enumeration literals are generated inside the enumeration declaration.
The generation of an enumeration literals is derived from the properties of the Enumeration Literal and the values set for the C Expression Tag Definition applied by the «C Enum Literal» stereotype.
Properties:
If the Description property has a value, ACS generates the description as an inline comment after the enumeration literal.
Example code:
enum Colors
{
Colors_red, /*this is red*/
Colors_green, /*this is green*/
Colors_blue /*this is blue*/
};
The Name property is generated as the name of the enumeration literal in the code.
Example code:
enum Colors
{
Colors_red,
Colors_green,
Colors_blue
};
* 
ACS may modify the enumeration literal name that is added to the code to make it valid for C. You can specify the exact enumeration literal name to add to the code through the CODE_GENERATION_NAME property of an Enumeration Literal. Tell me more...
Tag Definitions:
The following tag definitions are applied to an Enumeration Literal by the «CEnum Literal» stereotype:
If the tagged value of the C Expression tag definition has been set, the value is generated as the expression of the enumeration literal.
Example code:
enum Colors
{
red = 1,
green = 5,
blue = green + 1
};
* 
When reverse engineering Enumeration Literals, the Reverser applies the «C Enumeration» stereotype to each Enumeration Literal and records the value of the expression in the text of the C Expression tag definition.
If the tagged value of the C Prefix is set to TRUE, each enumeration literal is prefixed with the name of the owning typedef suffixed by an underscore.
Example code:
enum Colors
{
Colors_red,
Colors_green,
Colors_blue
};