yudiannlu has asked for the wisdom of the Perl Monks concerning the following question:

Hi:

the C++ function call need to replace to a different call,

the function call as follow:
m_pCTrace->Trace(TRACE_DEVICE, " CBikeRackMgr::OnRecvMsg(): Bike +Sensor 1=%u (not stopped)", pSDiscCtlsMsg->bValue);
I did some perl script to replace it to the function all as:
DEBUGMSG(TRACE_DEVICE, (TEXT(" CBikeRackMgr::OnRecvMsg(): Bike Sensor + 1=%u (not stopped)"\n), pSDiscCtlsMsg->bValue));
but script very straight forward.

I want to scan multiple lines, and back-reference all of parameters. So what is perlish script to scan a C function call, and back reference all of parameters?

Thanks Lu

Replies are listed 'Best First'.
Re: C++ Function substitute
by kyle (Abbot) on Apr 14, 2008 at 17:47 UTC

    If I understand your question correctly, you want to change this:

    m_pCTrace->Trace(TRACE_DEVICE, " CBikeRackMgr::OnRecvMsg(): Bike Senso +r 1=%u (not stopped)", pSDiscCtlsMsg->bValue);

    ...into this:

    DEBUGMSG(TRACE_DEVICE, (TEXT(" CBikeRackMgr::OnRecvMsg(): Bike Sensor +1=%u (not stopped)"\n), pSDiscCtlsMsg->bValue));

    Is that right? It sounds as if you're specifically concerned with a case in which m_pCTrace->Trace() takes more parameters than the example you've given. Is that correct also? It looks as if you wrote something already. Can you show what work you've done so far so we're not repeating the steps you've already taken? It might help to look at How do I post a question effectively?.

    Also, in the future, wrap your code in <code>...</code> tags. See Writeup Formatting Tips.