Mercurial > octave
changeset 33143:980bd18d962c bytecode-interpreter
maint: Merge default to bytecode-interpreter
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Mon, 04 Mar 2024 15:34:19 -0500 |
parents | 801e5f2f84f3 (current diff) 440ef081efd8 (diff) |
children | 4035a1f71e07 |
files | |
diffstat | 3 files changed, 60 insertions(+), 56 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/preface.txi Sun Mar 03 20:13:08 2024 -0500 +++ b/doc/interpreter/preface.txi Mon Mar 04 15:34:19 2024 -0500 @@ -179,22 +179,7 @@ available for development and support. Donations supporting Octave development may be made on the web at -@url{https://my.fsf.org/donate/working-together/octave}. These -donations also help to support the Free Software Foundation - -If you'd prefer to pay by check or money order, you can do so by sending -a check to the FSF at the following address: - -@quotation -Free Software Foundation@* -51 Franklin Street, Suite 500@* -Boston, MA 02110-1335@* -USA -@end quotation - -@noindent -If you pay by check, please be sure to write ``GNU Octave'' in the memo -field of your check. +@url{https://www.octave.org/donate}. If you cannot provide funding or contribute code, you can still help make Octave better and more reliable by reporting any bugs you find and
--- a/libinterp/corefcn/help.cc Sun Mar 03 20:13:08 2024 -0500 +++ b/libinterp/corefcn/help.cc Mon Mar 04 15:34:19 2024 -0500 @@ -684,6 +684,52 @@ return symbol_found; } +bool +help_system::raw_help_for_class (const cdef_class& cls, + const std::string& name, + std::string& help, std::string& what, + bool& symbol_found) const +{ + if (cls.ok ()) + { + // Is the class documented? + help = cls.doc_string (); + + if (! help.empty ()) + { + what = "class"; + + symbol_found = true; + return true; + } + + // Look for constructor. + std::size_t pos = name.rfind ('.'); + + if (pos != std::string::npos) + { + std::string nm = name.substr (pos+1); + + octave_value ov_meth = cls.get_method (nm); + + if (get_help_from_fcn (nm, ov_meth, help, what, symbol_found)) + { + what = "constructor"; + return true; + } + } + + // We found a class, but no docstring for it or its constructor. + // Create a generic doc string. + help = name + " is an undocumented class"; + what = "class"; + symbol_found = true; + return true; + } + + return false; +} + // FIXME: There is a lot of duplication between the following function // and help_system::which. Some refactoring would probably be useful. @@ -734,45 +780,8 @@ cdef_class cls = cdm.find_class (name, false, true); - if (cls.ok ()) - { - // Is the class documented? - - help = cls.doc_string (); - - if (! help.empty ()) - { - what = "class"; - - symbol_found = true; - return true; - } - - // Look for constructor. - - pos = name.rfind ('.'); - - if (pos != std::string::npos) - { - std::string nm = name.substr (pos+1); - - octave_value ov_meth = cls.get_method (nm); - - if (get_help_from_fcn (nm, ov_meth, help, what, symbol_found)) - { - what = "constructor"; - return true; - } - } - - // We found a class but no doc string for it or its constructor. - // Create a generic doc string. - - help = name + " is an undocumented class"; - what = "class"; - symbol_found = true; - return true; - } + if (raw_help_for_class (cls, name, help, what, symbol_found)) + return true; cdef_package pkg = cdm.find_package (name, false, true); @@ -795,7 +804,9 @@ cls = cdm.find_class (prefix, false, true); - if (cls.ok ()) + bool found_class = cls.ok (); + + if (found_class) { // FIXME: Should we only find public methods here? @@ -833,6 +844,9 @@ return true; } + if (nm == "m" && raw_help_for_class (cls, prefix, help, what, symbol_found)) + return true; + return false; }
--- a/libinterp/corefcn/help.h Sun Mar 03 20:13:08 2024 -0500 +++ b/libinterp/corefcn/help.h Mon Mar 04 15:34:19 2024 -0500 @@ -38,6 +38,7 @@ OCTAVE_BEGIN_NAMESPACE(octave) +class cdef_class; class interpreter; class help_system @@ -191,6 +192,10 @@ string_vector local_functions () const; + bool raw_help_for_class (const cdef_class& cls, const std::string& nm, + std::string& h, std::string& w, + bool& symbol_found) const; + bool raw_help_from_symbol_table (const std::string& nm, std::string& h, std::string& w, bool& symbol_found) const;