Only primitive operations and global functions for which the Inline property is set to in_header can be generated as macros. The Inline property does not work for constructors or destructors. There is no instrumentation for inline operations.
The macro is defined in the specification file of the owner object as follows:
#define OperationName(ArgumentList) \
The return type and argument types or the operation are ignored. Each generated line of the macro ends with " \". Curly braces ("{" and "}") are not generated around user code. Using the curly braces, you can write short macros that return a value. The following example shows a macro definition:
(#define isEqual(arg1, arg2) (arg1)==(arg2))
If a macro is roundtripped, a backslash (" \") is added at the end of the line. The next code generation adds a second backslash " \ \", which cause compilation errors. The extra backslash must be removed manually.
Error highlighting shows the line of the calling operation (macro call).
The following example is code generated for a primitive operation op() of an object A. The operation's Inline property is set to in_header. The macro definition is generated in A's specification file (A.h). This operation calls the global function Global_F(), which can also be generated inline, before exiting:
#define A_op(me) \
/*#[ operation op() */ \
int i; \
for(i = 0; i < 3; i++) { \
printf("LOOP\n"); \
} \
Global_F(); \
/*#] */