Mercurial > octave-nkf
diff src/ov-fcn-handle.cc @ 15005:74c7265c057a
fix failure with function handles caused by changeset ea6997657614
* ov-fcn-handle.cc (octave_fcn_handle::set_fcn): Undo previous change.
* ov-fcn.h (octave_function::src_file_name): New virtual function.
* ov-builtin.h (octave_builtin::src_file_name): Rename from
octave_builtin::fcn_file_name.
* help.cc (do_which): Return source file name for built-in functions.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 23 Jul 2012 15:23:41 -0400 |
parents | ea6997657614 |
children |
line wrap: on
line diff
--- a/src/ov-fcn-handle.cc Mon Jul 23 12:59:44 2012 -0400 +++ b/src/ov-fcn-handle.cc Mon Jul 23 15:23:41 2012 -0400 @@ -313,11 +313,7 @@ } else { - size_t fpath_len = fpath.length (); - - if ((fpath_len > 4 && fpath.substr (fpath_len-4) == ".oct") - || (fpath_len > 4 && fpath.substr (fpath_len-4) == ".mex") - || (fpath_len > 2 && fpath.substr (fpath_len-4) == ".m")) + if (fpath.length () > 0) { size_t xpos = fpath.find_last_of (file_ops::dir_sep_chars ()); @@ -331,6 +327,11 @@ fcn = octave_value (new octave_fcn_handle (tmp, nm)); } + else + { + error ("function handle points to non-existent function"); + success = false; + } } else { @@ -383,10 +384,9 @@ { octave_function *f = function_value (); std::string fnm = f ? f->fcn_file_name () : std::string (); - bool is_builtin = f && f->is_builtin_function (); os << "# octaveroot: " << OCTAVE_EXEC_PREFIX << "\n"; - if (! (is_builtin || fnm.empty ())) + if (! fnm.empty ()) os << "# path: " << fnm << "\n"; os << nm << "\n"; }