|
From: | John W. Eaton |
Subject: | Re: What to do with builtin functions not in libinterp subdirectory |
Date: | Mon, 18 Mar 2013 12:38:38 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:10.0.11) Gecko/20121122 Icedove/10.0.11 |
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_listderived_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.
jwe
[Prev in Thread] | Current Thread | [Next in Thread] |