Sparx Systems Forum

Enterprise Architect => Bugs and Issues => Topic started by: andreas_w. on July 01, 2014, 07:27:43 pm

Title: Language Macros for C
Post by: andreas_w. on July 01, 2014, 07:27:43 pm
Hello,
I work with EA version 10.0.1004. I have synchronized some C source to my EA repository. I see that EA has set on operation level a tagged value called DeclMacro1 with the value __inline, which is fine. :)

I believe I must set this value as preprocessor macro for the language C. I choose the menu "Setting-->Preprocessor Macros ..."  and I get the dialog "Language Macros". I see the default language is C++, but I'm not able to select C.  :-?

The code generation doesn't take the __inline value into consideration.  :(
Title: Re: Language Macros for C
Post by: Eve on July 02, 2014, 10:19:56 am
C++ and C are sharing the macros.
Title: Re: Language Macros for C
Post by: andreas_w. on July 02, 2014, 10:25:44 pm
Thanks for you clarification.But I have now some doubts which I would like to describe.

1. I have in "C" a method declared like this:
 static __inline void acq_lock(TP_Thread_Data_T *thread_data)
2. I synchronize the file with EA and I find a operation with a tagged value called DeclMacro1 and the value __inline :)
3. I define in the Language Macros dialog the value __inline  :)
4. When I generate the UML class as C source I get static void acq_lock(TP_Thread_Data_T *thread_data), without the __inline  :(
5. When I generate the UML class as C++ source I get static __inline void acq_lock(TP_Thread_Data_T *thread_data) with __inline :-?

What shall I change that it works for step 4 with the C language ? Every hint is very welcome.
Title: Re: Language Macros for C
Post by: Eve on July 03, 2014, 08:54:49 am
I'm not sure.

I looked at the template for Operation Declaration, expecting to find %opMacros% missing, but everything is in order.

Would it be safe to assume you haven't modified the templates?
Title: Re: Language Macros for C
Post by: andreas_w. on July 03, 2014, 04:00:30 pm
I believe, I have use the default "Operation Declaration" template for C as language.
The %opMacros% is in, but because the operation is static the %opMacros% isn't reached.
I get the __inline, if I deactivate the static check box.  

This is the snipped:

%PI=" "%


%if opTag:"define" == "true"%
#define %opName%(%list="Parameter" @separator=", "%) %opCode%
%endTemplate%

%if opStatic=="T"%
%endTemplate%

%opConst=="T" ? "const" : ""%

%opReturnType%
%opMacros%
%PI=""%
%opName%(%list="Parameter" @separator=", "%)
$bodyLoc = %opTag:"bodyLocation"%
%if opTag:"inline" != "true" and $bodyLoc != "header" and $bodyLoc != "classDec"%
;
%endIf%


I'm not a C expert, are there good reasons for this static exclusion?
%if opStatic=="T"%
%endTemplate%