changeset 5931:25da9a7d5f6d

[project @ 2006-08-16 06:52:19 by jwe]
author jwe
date Wed, 16 Aug 2006 06:52:19 +0000
parents a703198cb8b8
children 51cbaa2539f4
files scripts/miscellaneous/ans.m src/ChangeLog src/help.cc src/parse.h src/parse.y
diffstat 5 files changed, 26 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/ans.m
+++ b/scripts/miscellaneous/ans.m
@@ -13,5 +13,5 @@
 
 ## FIXME -- we should be able to get formatted help for empty scripts,
 ## not just functions.
-function ans ()
-endfunction
+##function ans ()
+##endfunction
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,12 @@
 2006-08-15  John W. Eaton  <jwe@octave.org>
 
+	* help.cc (help_from_file): Call get_help_from_file with new file
+	arg.  Print file info here.
+
+	* parse.y (get_help_from_file): Delete include_file_info arg.
+	Provide two versions, one that returns the file found in a
+	reference arg and one that does not.
+
 	* variables.cc (do_isglobal): New function.
 	(Fisglobal): Use it.
 	(Fis_global): New function.
--- a/src/help.cc
+++ b/src/help.cc
@@ -1002,10 +1002,13 @@
 {
   bool retval = false;
 
-  std::string h = get_help_from_file (nm, symbol_found, true);
+  std::string file;
+
+  std::string h = get_help_from_file (nm, symbol_found, file);
 
   if (h.length () > 0)
     {
+      os << nm << " is the file " << file << "\n\n";
       display_help_text (os, h);
       os << "\n";
       retval = true;
--- a/src/parse.h
+++ b/src/parse.h
@@ -91,7 +91,10 @@
 
 extern std::string
 get_help_from_file (const std::string& nm, bool& symbol_found,
-		    bool include_file_info = false);
+		    std::string& file);
+
+extern std::string
+get_help_from_file (const std::string& nm, bool& symbol_found);
 
 extern std::string lookup_autoload (const std::string& nm);
 
--- a/src/parse.y
+++ b/src/parse.y
@@ -3141,11 +3141,11 @@
 
 std::string
 get_help_from_file (const std::string& nm, bool& symbol_found,
-		    bool include_file_info)
+		    std::string& file)
 {
   std::string retval;
 
-  std::string file = fcn_file_in_path (nm);
+  file = fcn_file_in_path (nm);
 
   if (! file.empty ())
     {
@@ -3159,9 +3159,6 @@
 
 	  retval = gobble_leading_white_space (fptr, true, true, false);
 
-	  if (! retval.empty () && include_file_info)
-	    retval = nm + " is the file: " + file + "\n\n" + retval;
-
 	  unwind_protect::run ();
 	}
     }
@@ -3169,6 +3166,13 @@
   return retval;
 }
 
+std::string
+get_help_from_file (const std::string& nm, bool& symbol_found)
+{
+  std::string file;
+  return get_help_from_file (nm, symbol_found, file);
+}
+
 static int
 is_function_file (FILE *ffile)
 {