This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

HELP:How to define a complex MACRO?

I had searched in the Discussion Forum for the whole moring but I couldn't find the right way to solve the problem I met,so I send this message hoping you guys can help me!Thanks in advance:-)My problem is as follows:

1.I want to define a macro,which is similar like function.It will be used in my communction interrupt service routine(so you can see that why I don't choose to call a function to realize it)

2.here's the definition of this macro:
#define Macro_TestRxEnd(sbit Header_flag,uchar Header,uchar Tailer) \
{ \
Return_flag = 0; \
if (!Header_flag) \
{ \
if (Rxbuf == Header) \
{ \
Header_flag = 1; \
ptRxBuf++; \
} \
else \
{ ptRxBuf = xBuf; } \
else \
{ \
if (Rxbuf == Tailer) \
{ Return_flag = 1; } \
}

3.then the compile result is :
Error C304: Bad Macro Parameter List

so can anyone help me find out the right way to define such a long macro? I'm waiting for your good ideas earnestly!