[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

caller function? function to get dependencies?

From: John W. Eaton
Subject: caller function? function to get dependencies?
Date: Fri, 20 Apr 2007 03:35:04 -0400

On 20-Apr-2007, Andreas Romeyke wrote:

| exists there a function to get function dependencies or access to
| function stack similar to depfun() from within of octave interpreter?

Starting with Octave 2.9.6 it is possible to get the call stack in C++
using the octave_call_stack class defined in src/

| I did not found such a function or variable.
| My idea is to use a combination of functions clear() and who() to
| emulate depfun(), but the problem will be that the dependency graph
| will be flatten:
| 1. call who() to find actual used functions
| 2. call function which should be tested
| 3. call who() again to get new compiled/used functions
| 4. compare function list from 1. with function list from 3. The
| intersection set is the list of functions called by the tested
| function (in 2.)
| 5. clear all functions from intersection set
| 6. repeat 2. ... 6. until all functions tested

What information are you really looking for?  For a particular call to
a function, not all functions that could be called are called.

| It would be very helpful to use such a function because in a testing
| tool we could weight the order of testing. If there is not such a
| possibility to get function dependencies from within of octave, where
| is the best place to have a look into Octave code to write an
| extension for octave in C++?

Octave's interpreter does not currently decide whether an identifier
is a function or a variable until the code is executed.  If I
understand correctly what depfun does, then writing a complete depfun
function for Octave would require some significant changes to the
Octave parser.  Also, if a function uses eval, then I don't think it
is possible for depfun to be completely reliable since a call to eval
can create a variable that hides a function name and there is no way
to know that until the function is called.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]