Mercurial > hg > octave-jordi
changeset 11225:8d8e10058df6
move builtin function from dispatch.cc to oct-parse.yy
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Nov 2010 16:09:07 -0500 |
parents | e0db3f9e9267 |
children | 16d744cce38c |
files | src/ChangeLog src/DLD-FUNCTIONS/dispatch.cc src/oct-parse.yy |
diffstat | 3 files changed, 39 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2010-11-10 John W. Eaton <jwe@octave.org> + + * oct-parse.yy (Fbuiltin): Move here from DLD-FUNCTIONS/dispatch.cc. + 2010-11-10 Kai Habel <kai.habel@gmx.de> * fltk-backend.cc (update_accelerator), (update_callback), (update_enable),
--- a/src/DLD-FUNCTIONS/dispatch.cc +++ b/src/DLD-FUNCTIONS/dispatch.cc @@ -40,41 +40,6 @@ #include "symtab.h" #include "variables.h" -DEFUN_DLD (builtin, args, nargout, - "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {[@dots{}]} builtin (@var{f}, @dots{})\n\ -Call the base function @var{f} even if @var{f} is overloaded to\n\ -some other function for the given type signature.\n\ -@seealso{dispatch}\n\ -@end deftypefn") -{ - octave_value_list retval; - - int nargin = args.length (); - - if (nargin > 0) - { - const std::string name (args(0).string_value ()); - - if (! error_state) - { - octave_value fcn = symbol_table::builtin_find (name); - - if (fcn.is_defined ()) - retval = feval (fcn.function_value (), args.splice (0, 1), - nargout); - else - error ("builtin: lookup for symbol `%s' failed", name.c_str ()); - } - else - error ("builtin: expecting function name as first argument"); - } - else - print_usage (); - - return retval; -} - DEFUN_DLD (dispatch, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {} dispatch (@var{f}, @var{r}, @var{type})\n\
--- a/src/oct-parse.yy +++ b/src/oct-parse.yy @@ -4231,6 +4231,41 @@ return retval; } +DEFUN (builtin, args, nargout, + "-*- texinfo -*-\n\ +@deftypefn {Loadable Function} {[@dots{}]} builtin (@var{f}, @dots{})\n\ +Call the base function @var{f} even if @var{f} is overloaded to\n\ +some other function for the given type signature.\n\ +@seealso{dispatch}\n\ +@end deftypefn") +{ + octave_value_list retval; + + int nargin = args.length (); + + if (nargin > 0) + { + const std::string name (args(0).string_value ()); + + if (! error_state) + { + octave_value fcn = symbol_table::builtin_find (name); + + if (fcn.is_defined ()) + retval = feval (fcn.function_value (), args.splice (0, 1), + nargout); + else + error ("builtin: lookup for symbol `%s' failed", name.c_str ()); + } + else + error ("builtin: expecting function name as first argument"); + } + else + print_usage (); + + return retval; +} + octave_value_list eval_string (const std::string& s, bool silent, int& parse_status, int nargout) {