# HG changeset patch # User David Bateman # Date 1272230328 -7200 # Node ID a61d7248627c4f9f76a6933b26c36cf59a3ea2e8 # Parent 4f2e46473153764656e5ac35d6e17bfa07ef42bb When loading a mex-file temporarily load the m-file version to get the help string (bug #29427) diff -r 4f2e46473153 -r a61d7248627c src/ChangeLog --- a/src/ChangeLog Sun Apr 25 20:04:02 2010 +0200 +++ b/src/ChangeLog Sun Apr 25 23:18:48 2010 +0200 @@ -1,3 +1,10 @@ +2010-04-25 David Bateman + + * oct-parse.yy (octave_function * load_fcn_from_file + (const std::string&, const std::string&, const std::string&) + (const std::string&, bool)): When loading a mex-file attempt + to load the m-file first to get the help string. + 2010-04-24 Ben Abbott * graphics.h.in: Have figure color property support a radio value, diff -r 4f2e46473153 -r a61d7248627c src/oct-parse.yy --- a/src/oct-parse.yy Sun Apr 25 20:04:02 2010 +0200 +++ b/src/oct-parse.yy Sun Apr 25 23:18:48 2010 +0200 @@ -3721,7 +3721,25 @@ retval = octave_dynamic_loader::load_oct (nm, file, fcn_file_from_relative_lookup); } else if (len > 4 && file.substr (len-4, len-1) == ".mex") - retval = octave_dynamic_loader::load_mex (nm, file, fcn_file_from_relative_lookup); + { + // Temporarily load m-file version of mex-file, if it exists, + // to get the help-string to use. + frame.protect_var (curr_fcn_file_name); + frame.protect_var (curr_fcn_file_full_name); + + curr_fcn_file_name = nm; + curr_fcn_file_full_name = file.substr (0, len - 2); + + octave_function *tmpfcn = parse_fcn_file (file.substr (0, len - 2), + dispatch_type, autoloading, + false); + + retval = octave_dynamic_loader::load_mex (nm, file, fcn_file_from_relative_lookup); + + if (tmpfcn) + retval->document (tmpfcn->doc_string ()); + delete tmpfcn; + } else if (len > 2) { // These are needed by yyparse.