 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michał Błaszak Guest
|
Posted: Wed Oct 27, 2004 2:39 pm Post subject: C++ to C++ transformer |
|
|
Hello,
I 'm trying to convert my C++ sources by inserting something just at the
beginning and in the end of each function/method.
Do anyone know a way/tool how to do it efficiently. The preffered
environment is Linux.
Thanx in advance
Michal Blaszak
|
|
| Back to top |
|
 |
Thomas Matthews Guest
|
Posted: Wed Oct 27, 2004 3:54 pm Post subject: Re: C++ to C++ transformer |
|
|
Micha? B?aszak wrote:
| Quote: | Hello,
I 'm trying to convert my C++ sources by inserting something just at the
beginning and in the end of each function/method.
What are you converting to? |
Your subject line implies there is no transformation, or perhaps
a redundant transformation.
| Quote: | Do anyone know a way/tool how to do it efficiently. The preffered
environment is Linux.
Have you tried sed or awk, python or perl? |
| Quote: |
Thanx in advance
Michal Blaszak
Perhaps if you give more details, we can give better |
responses.
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
|
|
| Back to top |
|
 |
Jacek Dziedzic Guest
|
Posted: Wed Oct 27, 2004 8:34 pm Post subject: Re: C++ to C++ transformer |
|
|
Thomas Matthews wrote:
| Quote: | Micha? B?aszak wrote:
Hello,
I 'm trying to convert my C++ sources by inserting something just at the
beginning and in the end of each function/method.
What are you converting to?
Your subject line implies there is no transformation, or perhaps
a redundant transformation.
|
I believe he means that a C++ source is to be transformed by
inserting a bit of code or perhaps a comment into the body all
functions, producing a C++ output.
- J.
|
|
| Back to top |
|
 |
Michał Błaszak Guest
|
Posted: Thu Oct 28, 2004 6:39 am Post subject: Re: C++ to C++ transformer |
|
|
Jacek Dziedzic wrote:
| Quote: | Thomas Matthews wrote:
Micha? B?aszak wrote:
Hello,
I 'm trying to convert my C++ sources by inserting something just at the
beginning and in the end of each function/method.
What are you converting to?
Your subject line implies there is no transformation, or perhaps
a redundant transformation.
I believe he means that a C++ source is to be transformed by
inserting a bit of code or perhaps a comment into the body all
functions, producing a C++ output.
- J.
|
That's right. I have a C++ source in the input and want to produce another
C++ changed a little bit. The goal is to insert a piece of code just at the
beginning and at the end of each function. Unfortunately it is advanced C++
source (classes, templates, macros, ... everything) so solving the problem
is as complicated as parsing sources against the full C++ syntax. This is
why I look for a tool which is capable of doing the task for me. Doing it
manually requires to much effort.
Thanx for your help
Michal Blaszak
|
|
| Back to top |
|
 |
Jacek Dziedzic Guest
|
Posted: Thu Oct 28, 2004 9:40 am Post subject: Re: C++ to C++ transformer |
|
|
Micha³ B³aszak wrote:
| Quote: | That's right. I have a C++ source in the input and want to produce another
C++ changed a little bit. The goal is to insert a piece of code just atthe
beginning and at the end of each function. Unfortunately it is advancedC++
source (classes, templates, macros, ... everything) so solving the problem
is as complicated as parsing sources against the full C++ syntax. This is
why I look for a tool which is capable of doing the task for me. Doing it
manually requires to much effort.
|
I think you'd have more luck in a different newsgroup (unfortunately
I can't recommend you any), because people around here discuss only
the C++ as in "C++ standard" and are quite strict about doing this
and only this. I also don't know how to solve your problem.
- J.
|
|
| Back to top |
|
 |
Ira Baxter Guest
|
Posted: Sat Oct 30, 2004 9:43 pm Post subject: Re: C++ to C++ transformer |
|
|
"MichaÅ, BÅ,aszak" <mblaszak (AT) gryfsoft (DOT) pl> wrote
| Quote: | I 'm trying to convert my C++ sources by inserting something just at
the
beginning and in the end of each function/method.
That's right. I have a C++ source in the input and want to produce another
C++ changed a little bit. The goal is to insert a piece of code just at
the
beginning and at the end of each function. Unfortunately it is advanced
C++
source (classes, templates, macros, ... everything) so solving the problem
is as complicated as parsing sources against the full C++ syntax. This is
why I look for a tool which is capable of doing the task for me. Doing it
manually requires to much effort.
|
Yes, you need to parse the full C++ syntax.
You also need to be able to write rules stating what you want done.
The DMS Software Reengineering toolkit is a source-to-source
transformation tool that can do this, and has a full
C++ front end parser to support it.
See http://www.semanticdesigns.com/Products/CppFrontEnd.html
and follow the link there to read about DMS.
A white paper showing how to instrument code using DMS,
e.g., something almost exactly like you requested, can be found the the web
page
www.semanticdesigns.com/Products/TestCoverage
--
Ira D. Baxter, Ph.D., CTO 512-250-1018
Semantic Designs, Inc. www.semdesigns.com
|
|
| Back to top |
|
 |
Cedric LEMAIRE Guest
|
Posted: Sun Oct 31, 2004 10:18 am Post subject: Re: C++ to C++ transformer |
|
|
"Ira Baxter" <idbaxter (AT) semdesigns (DOT) com> wrote
| Quote: | "MichaÅ, BÅ,aszak" <mblaszak (AT) gryfsoft (DOT) pl> wrote in message
news:clq46o$kb0$1 (AT) korweta (DOT) task.gda.pl...
I 'm trying to convert my C++ sources by inserting something just at
the
beginning and in the end of each function/method.
That's right. I have a C++ source in the input and want to produce another
C++ changed a little bit. The goal is to insert a piece of code just at
the
beginning and at the end of each function. Unfortunately it is advanced
C++
source (classes, templates, macros, ... everything) so solving the problem
is as complicated as parsing sources against the full C++ syntax. This is
why I look for a tool which is capable of doing the task for me. Doing it
manually requires to much effort.
Yes, you need to parse the full C++ syntax.
I don't agree. You can recognize function definitions without having |
to parse the full C++ syntax.
I have an example here:
http://www.codeworker.org/ScriptsRepository.html#Program_transformation
You need to use CodeWorker (http://www.codeworker.org, distributed
under LGPL), a parsing tool and a universal source code generation,
which notably allows the transformation of source files.
It is an old script. I'm not sure whether it works on template or not.
If you try it and if it doesn't work on a function, tell me and I'll
correct it.
|
|
| Back to top |
|
 |
Lothar Werzinger Guest
|
Posted: Sun Oct 31, 2004 6:08 pm Post subject: Re: C++ to C++ transformer |
|
|
Michał Błaszak wrote:
| Quote: | Hello,
I 'm trying to convert my C++ sources by inserting something just at the
beginning and in the end of each function/method.
Do anyone know a way/tool how to do it efficiently. The preffered
environment is Linux.
Thanx in advance
Michal Blaszak
|
If you only want to execute a special peace of code at the entry and exit of
your function/method then the gcc option -finstrument-functions may be of
interest.
Lothar
|
|
| Back to top |
|
 |
Oliver Brandt Guest
|
Posted: Mon Nov 01, 2004 10:08 pm Post subject: Re: C++ to C++ transformer |
|
|
Michał Błaszak wrote:
| Quote: | Hello,
I 'm trying to convert my C++ sources by inserting something just at the
beginning and in the end of each function/method.
Do anyone know a way/tool how to do it efficiently. The preffered
environment is Linux.
Perhaps www.aspectc.org comes close to what you want.... |
HTH,
Oliver
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|