Reputation: 105
I am trying to find a way of creating a custom function macro in Enterprise Architect to "override" the built-in CSTYLE_COMMENT
macro with a custom version of it that creates comments differently to use for operation headers when generating code.
EA's built-in CSTYLE_COMMENT
generates comments like this:
/**
* Name: OperationA
* Inputs: int int
* Outputs: -
* Description: It doesn't do stuff
*/
I want to create some custom template that generates comments like this:
/***********************************
* Name: OperationA
* Inputs: int int
* Outputs: -
* Description: It doesn't do stuff
***********************************/
Is this possible? If so, how would I go about doing so? My efforts on finding any detailed guide on syntax online have been futile. Even though SparX systems has the exact search term that I looked for here: https://sparxsystems.com/enterprise_architect_user_guide/14.0/model_domains/codetemplatesyntax.html there is no useful information on how to do what I want.
Upvotes: 1
Views: 134
Reputation: 105
I found a way of doing this but I am not sure it is the best and it does not work well with reverse engineering and synchronization of the model. I could not find how to write my own macro as there is literally no documentation anywhere I looked.
This is how I did it: Instead of
%CSTYLE_COMMENT($wrapLen)%
I wrote
/***************************************\n
%WRAP_COMMENT(opNotes,$wrapLen, "", "*")%
\n***************************************/
It worked exactly as I intended it to.
EDIT: I found what was missing to be able to correctly reverse engineer this commenting format. In EA 14, I navigated to START->Preferences->Source Code Engineering and I unchecked the option "Remove hard breaks from comments on import". This made the reverse engineering work correctly and update comments in the Element Notes field without losing their layout.
Upvotes: 1