473,378 Members | 1,417 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,378 software developers and data experts.

Program to backtrack function calls in source code?

Hi,

many mistakes in programming arise when one changes the code and
forgets to adjustment somewhere where it is used. Is there a program
that can extract all place in the source code where a variable is
accessed or a function called?
For example in the simplest case I want to change the name of a
function everywhere in the source...

Anton

Sep 2 '06 #1
3 1993
On 2 Sep 2006 13:53:21 -0700, fo***@anton.e4ward.com
<fo***@anton.e4ward.comwrote:
Hi,
Dear Anton,
Is there a program
that can extract all place in the source code where a variable is
accessed or a function called?
I've been dealing with these issues lately too. You might want to
check pypesrc (http://www.jimbrooks.org/web/hypersrc/pypersrc.php).
Alternatively, and especially if you want to use these utilities from
vim or emacs, and want support for other languages in addition to
Python, you can use exuberant ctags and idutils (I've just added some
python support to idutils). I have some additional information on
these issues at http://ligarto.org/rdiaz/idutils-et-al.html.

HTH,

R.

--
Ramon Diaz-Uriarte
Bioinformatics Unit
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz
Sep 2 '06 #2
fo***@anton.e4ward.com schrieb:
Hi,

many mistakes in programming arise when one changes the code and
forgets to adjustment somewhere where it is used. Is there a program
that can extract all place in the source code where a variable is
accessed or a function called?
For example in the simplest case I want to change the name of a
function everywhere in the source...
Others have given you answers that point to concrete, yet partial
solutions to your problem.

I just want to shed some light to the broader scope. There are limits to
what can be done in a dynamic language like python.

Lots of code (and very valuable one) in python lives from the fact that
e.g.

a = getattr(b, some_computed_name)

works. So, ultimately you will always encounter situations where a
simple name-replace won't catch all possible access/modification spots.

So, a language like e.g. java together with an ide like eclipse
shines in refactoring.

The fun fact is: having the compiler grok your code means close to
nothing - without proper testing, things can and will easily break.

The answer to this is: testing, as automated as possible. And funny
enough, that should (and will in most cases) catch whatever errors
resulted from that renaming.

So: use the mentioned tool, use pycheker and/or pylint to gain some
pre-running confidence in code changes.

But ultimately: test!

Diez
Sep 2 '06 #3
Yu-Xi Lim wrote:
fo***@anton.e4ward.com wrote:
>many mistakes in programming arise when one changes the code and
forgets to adjustment somewhere where it is used. Is there a program
that can extract all place in the source code where a variable is
accessed or a function called?
For example in the simplest case I want to change the name of a
function everywhere in the source...

The process you describe (renaming a function or variable) is part of
refactoring. Many good IDEs provide extensive automated support for
this, though this functionality seems less common in Python IDEs, likely
due to Python's duck typing.

Bicycle Repair Man supports the ability to rename functions and
variables at multiple locations, along with other common refactoring
operations. Various Python IDEs and editors can be configured to use
BRM. I personally prefer Eclipse, a Java-based IDE but with good Python
support via PyDev.
PyScripter, which is Windows based, provides the ability to link back
to the definition of some identifier or to get function references.
http://mail.python.org/pipermail/pyt...ch/004782.html

Colin W.

Sep 2 '06 #4

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

Similar topics

9
by: TCMA | last post by:
I am looking for some tools to help me understand source code of a program written in C++ by someone else. Are there any non-commercial, open source C or C++ tools to reverse engineer C or C++...
7
by: Richard Hayden | last post by:
Hi, I've just upgraded my gcc and I'm currently trying to compile some code for my own operating system kernel, but I am getting an error of "Undefined reference to `memcpy`" when I try to link...
5
by: Matt | last post by:
I will be grateful if someone explians this part colfree = FALSE; upfree = FALSE; downfree = FALSE; of the code below. I don't understand how this marks the downward and upward diagonals....
5
by: Ham | last post by:
Hi I am looking for a function call tree program to map the function calls of my project. I however do not want to compile my project. All the programs I have found for this require you to...
20
by: Francine.Neary | last post by:
I am learning C, having fun with strings & pointers at the moment! The following program is my solution to an exercise to take an input, strip the first word, and output the rest. It works fine...
23
by: mike3 | last post by:
Hi. I seem to have made some progress on finding that bug in my program. I deactivated everything in the bignum package that was used except for the returning of BigFloat objects. I even...
4
by: sulekhasweety | last post by:
Hi, can any one give a brief outline of the different stages in the execution of a C program , in terms of compilation, pre-processing, linking etc
38
by: abasili | last post by:
Hi everyone, I'm trying to compile a C++ function and then call it from a C program. Since Google is my friend I've ended up to this link which seems very clear: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.