UML 2.1 to C
From AcceleoWiki
| Module UML 2.1 to C | |
| |
| Status: | Incubation |
| Licence: | EPL |
| Target: | C |
| Metamodel: | UML 2.1 |
| Inital contributor: | CEA Obeo |
| Contact: | Gonzague Reydet |
This project aims to generate C applications from UML 2.1 models.
Contents |
Guidelines
- Embedded field
- Easy to use
- Simple C code generation (no C Object)
- Standard UML input model (no complex UML profile)
Features
- Header files generated from model elements:
- Classes
- Datatype
- Enumeration
- Source files generated from model classes
- Generated files respect the package structure
- Comments generated from comment model elements
- Function declaration and definition
- Global variables
- Visibility management for function declarations and global variables
- In header file, if public
- In source file, if private
- Multiplicity management for variables and parameters
- Import management
- Structure and enumeration generation
Installation
The installation process is described on the installing a module web page.
Contribute!
- Access to the project sources using the Team Project Set file of the UML 2.1 to C generator module. Understand how to use this file reading the tutorial: how to get and modify generator module sources.
- To report a bug, use the Acceleo module tracker.
How to use the generator?
Create a Module Launcher Chain
In a project (C project), containing the input UML model, clic on "New > Other..." and select "Module Launcher" on the Acceleo folder:

Then, select the UML 2.1 to C generation module:

Then, give a name to your new chain:

Finally, enter the 3 parameters required by this generation module:
- The error log file
- The output source folder
- The input UML model
Launch the generation
To launch the generation process, right click on the chain, then "Launch":
Upon the generation process completed, the generated sources should appear on the specified output folder.
Optional parameters
Several parameters can be set to personalize the generation:
| Property name | Description | Default value |
|---|---|---|
| gen.comment.date | Enable/disable the date/time generation in code heading comments | true |
| tuple.array.length | Set the default array length for attributes with unlimited multiplicity (*) | 20 |
| tuple.string.length | Set the default String length for string attributes without default value | 20 |
To precise such parameters to the generation module, add a property file (with .properties extension) next to the chain you created to launch the generation. For example, you can create a file UML2C.properties with the following content:
# Remove the generation date in the generated file heading gen.comment.date=true # Default array length for attributes with unlimited multiplicity (*) tuple.array.length=200 # Default String length for String attributes without default value tuple.string.length=75


