Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

Define WPP custom data type

Arie_ElazarArie_Elazar Member - All Emails Posts: 1
Hi,

I'm trying to enable WPP tracing, while the requirement is to be backward compatible to existing trace format.
I have the next print macro that should work with WPP

Existing Format:

#define MAC_ADDRESS_PRINTF_FORMAT "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC_ADDRESS_PRINTF(addr) \
addr[0], \
addr[1], \
addr[2], \
addr[3], \
addr[4], \
addr[5]

Print(MODULE_A, TRACE_ERROR, "RX PeerMacAddr=" MAC_ADDRESS_PRINTF_FORMAT, MAC_ADDRESS_PRINTF(peer_address));

For printing the same log with WPP infrastructure I used the WPP DEFINE_CPLX_TYPE and defined MAC_ADDRESS_PRINTF_FORMAT MAC_ADDRESS_PRINTF.
// begin_wpp config
// DEFINE_CPLX_TYPE(MACADDRESS, WPP_LOGMACADDRESSDUMP, const unsigned char*, ItemMacAddr, "s", _MAC_ADDR_, 0, 1);
// WPP_FLAGS(-DWPP_LOGMACADDRESSDUMP(addr) WPP_LOGPAIR(6, (addr)) );
// end_wpp

#define MAC_ADDRESS_PRINTF_FORMAT "%!MACADDRESS!"
#define MAC_ADDRESS_PRINTF(_addr) _addr

Unfortunately I'm getting following error wpp: (parseLegacy) 0 argument(s) expected, argument(s) supplied: 1

It seems like WPP preprocessor is not taking into account my define for MAC_ADDRESS_PRINTF_FORMAT.
While replacing MAC_ADDRESS_PRINTF_FORMAT with "%!MACADDRESS! it is working fine.

Any suggestion on how something like this could be achieved would be
appreciated.

Thanks.

Comments

  • Tim_RobertsTim_Roberts Member - All Emails Posts: 12,725
    xxxxx@perasotech.com wrote:
    >  
    >
    > I’m trying to enable WPP tracing, while the requirement is to be
    > backward compatible to existing trace format.
    >
    > ...
    >  
    >
    > For printing the same log with WPP infrastructure I used the WPP
    >  DEFINE_CPLX_TYPE and defined MAC_ADDRESS_PRINTF_FORMAT
    > MAC_ADDRESS_PRINTF.
    >
    > // begin_wpp config
    >
    > // DEFINE_CPLX_TYPE(MACADDRESS, WPP_LOGMACADDRESSDUMP, const unsigned
    > char*, ItemMacAddr, "s", _MAC_ADDR_, 0, 1);
    >
    > // WPP_FLAGS(-DWPP_LOGMACADDRESSDUMP(addr) WPP_LOGPAIR(6, (addr)) );
    >
    > // end_wpp
    >
    >  
    >
    > #define MAC_ADDRESS_PRINTF_FORMAT “%!MACADDRESS!”
    >
    > #define MAC_ADDRESS_PRINTF(_addr) _addr
    >
    >  
    >
    > Unfortunately I’m getting following error wpp: (parseLegacy) 0
    > argument(s) expected, argument(s) supplied: 1
    >
    >  
    >
    > It seems like WPP preprocessor is not taking into account my define
    > for MAC_ADDRESS_PRINTF_FORMAT.
    >
    > While replacing MAC_ADDRESS_PRINTF_FORMAT with “%!MACADDRESS! it is
    > working fine.
    >
    >  
    >
    > Any suggestion on how something like this could be achieved would be
    > appreciated.
    >

    As the name implies, WPP is a pre-processor.  It does its work before
    compilation starts, which means it is scanning your code before the C
    pre-processor has done its thing.  It does not do the same string
    substitution that the C pre-processor does, so it's not expanding your
    macro.  You will probably need to supply the string instead of the symbol.

    --
    Tim Roberts, xxxxx@probo.com
    Providenza & Boekelheide, Inc.

    Tim Roberts, [email protected]
    Providenza & Boekelheide, Inc.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!