473,414 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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
Jul 22 '05 #1
8 2169
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.

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?

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

Jul 22 '05 #2
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.
Jul 22 '05 #3
Jacek Dziedzic wrote:
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
Jul 22 '05 #4
Micha³ B³aszak wrote:
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.
Jul 22 '05 #5
"MichaÅ, BÅ,aszak" <mb******@gryfsoft.pl> wrote in message
news:cl**********@korweta.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.
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/Produ...pFrontEnd.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
Jul 22 '05 #6
"Ira Baxter" <id******@semdesigns.com> wrote in message news:<cm********@enews1.newsguy.com>...
"MichaÅ, BÅ,aszak" <mb******@gryfsoft.pl> wrote in message
news:cl**********@korweta.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/ScriptsRep...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.
Jul 22 '05 #7
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.

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
Jul 22 '05 #8
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.

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
Jul 22 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Johannes Lebek | last post by:
Hi there, somehow, I cannot access nodes that are stored in a variable. I'm using Xalan 2.5.1 and the following commands: ================ BEGIN ==================== <xsl:variable...
2
by: Angus Parvis | last post by:
Hi, I've already posted this in comp.lang.java.programmer, but it doesn't seem like the ppl there can help. I hope you guys here know more about it, altough my question is more java than xml...
2
by: Martijn | last post by:
Because XSD (XML Schema Document) is a definition of the XML document, there must be a parser that can read a XSD file and give the complete XML file as a result. Is there something like this,...
0
by: | last post by:
hi I wanna import javax.xml.transform.Transformer into my J# project is it possible? how can it be done? regards sam
0
by: phil.a.jenkins | last post by:
Hopefully someone can provide a solution to this rather annoying problem - we have a Cocoon pipeline which ends thus: <!-- build the sql for insert and final stage of select --> T1 ...
2
by: venkatbo | last post by:
Hi all, I have python2.4 running on ppc-linux 2.6.17. I'm attempting to get a TurboGears 0.9a9 (using CherryPy 2.2.1) based app running on it. During the TG-app startup sequence, it reaches...
3
by: moralbarometer | last post by:
Please i intend to make an XML document from a string using tranformer as shown below. It returns an error which trace is given below as well. please help. public org.w3c.dom.Node getTextXML()...
0
by: subhash9 | last post by:
Hi, Have an XML file with this element <File Name="" Description="" CreatedBy="" CreatedDate="" LastModifiedBy="" ModifiedDate=""> i converted DOm to string using : TransformerFactory...
1
by: killy971 | last post by:
I am using the following syntax, with Xalan, to process xml transformations in java: StreamSource xml = new StreamSource(xmlFile); StreamSource xsl = new StreamSource(xslFile); StreamResult out...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.