Look at this long expression of function declaration

Look at this long expression of function declaration

extern FUNC( Std_ReturnType, FEE_CODE ) Fee_Write(
VAR( uint16, AUTOMATIC ) BlockNumber,
P2VAR( uint8, AUTOMATIC, FEE_APPL_DATA ) DataBufferPtr);

There are four macro in this expression: FUNC, VAR, P2VAR, Std_ReturnType, these definition

/*
* @violates @ref Compiler_h_REF_4 In the definition of a function-like macro each instance of a
* parameter shall be enclosed in parentheses
*/
#define FUNC(rettype, memclass) rettype

/*
* @violates @ref Compiler_h_REF_4 In the definition of a function-like macro each instance of a
* parameter shall be enclosed in parentheses
*/
#define VAR(vartype, memclass) vartype

/*
* @violates @ref Compiler_h_REF_4 In the definition of a function-like macro each instance of a
* parameter shall be enclosed in parentheses
*/
#define P2VAR(ptrtype, memclass, ptrclass) ptrtype *

/**
* @brief This type can be used as standard API return type which is shared between the RTE and the
* BSW modules.
* @implements DBASE12002
*/
typedef uint8 Std_ReturnType;

So the long declaration expression should look like this after precompile :

extern uint8 Fee_Write(uint16 BlockNumber, uint8* DataBufferPtr);

It’s simple, So don’t be scared by the long expression.

PS: AUTOSAR <Specification of Compiler Abstraction> defined how to implement the Complier.h file.

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注