Creating a C Language Dialect for Code Generation

71 views
Skip to first unread message

TWirtgen

unread,
May 29, 2014, 4:56:54 AM5/29/14
to sparx-enterprise-archite...@googlegroups.com
Hello,

I have started to create my own C Language dialect for Code generation by copying the template from the built-in C language in the Code Template Editor. I've modified the templates just a bit to verify that the generated code for the *.c and *.h-files is now really coming from my templates. This part is working. :)

As known, the generation of code-files starts with the classes found directly below a selected package.

My understanding is that the initial/root-templates are "File" and "File Impl" and that "File" would usually generate the *.h file and "File Impl" would generate the *.c file. For the built-in languages, then menu -> Tools -> Options -> Source Code Engineering provides a way to customize the file extensions for "File" and "File Impl".

However, I don't understand how I can tell the code generator which file-extension to create for custom languages, as they do not appear in the menu mentioned above. I've looked in the EA help files and in the forum, but wasn't successful. With my C dialect, EA first generated both *.c and *.h files, then after some editing only the *.h file and after some other changes it generates a file named according to the class name, but without any file-extension. I'm unaware that my editing was influencing the file extension, but deducing from the changed behaviour, there must be a way to tell EA which files and file-extensions to generate for the initial template in invokes.

Is it also possible to configure EA to generate additional files from the initial class, e.g. "%fileName%.xyz" and invoke a custom root template to generate it's contents or are the root templates "File" and "File Impl" hardcoded in EA?

I'd really appreciate helpful comments. ::)

best regards

Thomas

[original message]

M@localhost Simon M

unread,
May 29, 2014, 7:05:58 PM5/29/14
to sparx-enterprise-archite...@googlegroups.com
See the following page for how to set the extensions.

http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/define_code_options.html

File and File Impl are hard coded. You won't get more than those two files out of a single generation of a class.

[original message]

TWirtgen

unread,
Jun 4, 2014, 5:35:47 PM6/4/14
to sparx-enterprise-archite...@googlegroups.com

M@localhost Simon M

unread,
Jun 4, 2014, 7:16:03 PM6/4/14
to sparx-enterprise-archite...@googlegroups.com
No, you've got the options right.

Have you put something in the File Impl template and tried generating?

[original message]
Reply all
Reply to author
Forward
0 new messages