octave-maintainers
[Top][All Lists]
Advanced

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

Re: What to do with builtin functions not in libinterp subdirectory


From: Daniel J Sebald
Subject: Re: What to do with builtin functions not in libinterp subdirectory
Date: Mon, 18 Mar 2013 11:50:27 -0500
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16

On 03/18/2013 11:38 AM, John W. Eaton wrote:
On 03/18/2013 12:25 PM, Jordi GutiƩrrez Hermoso wrote:
On 18 March 2013 12:14, Daniel J Sebald<address@hidden> wrote:

once you have a prototype function designed in C++, one could
write an Octave script that scans the source tree replacing all XDEFUNs,
then DEFUNs, etc. with the new prototype.

I like the idea in principle of replacing CPP macros with C++ classes,
and I have undertaken such macro-slaying quests in the past. However,
I think in this case writing some script to do the conversion cleanly
might be more work than ad-hoc methods. Don't let that discourage you,
though. I like this idea a lot.

- Jordi G. H.

Why can't you just have the DEFUN macro expand to the thing you want?
Shouldn't it be possible to write it as follows?

class derived_builtin_fcn_class : public base_builtin_fcn_class
{
...
};

derived_builtin_fcn_class instance;

octave_value_list
derived_builtin_fcn_class::eval (const octave_value_list& args, int
nargout = 0)
{
FUNCTION BODY...
}

Everything except the function body can be generated by the DEFUN macro
using the present arguments to the macro, which already directly
precedes the '{ FUNCTION BODY ... }' text in the sources.

So you should just have to change the build process, the definition of
the DEFUN macro, and the mechanism that installs built-in functions.

You are thinking then that the DEFUN family can remain in the code? Or eventually change that over? I suppose it really isn't the use of the DEFUN that creates a challenge; it's the macro pre-processing.

Dan


reply via email to

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