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.