# HG changeset patch # User jwe # Date 1155711139 0 # Node ID 25da9a7d5f6d72aa9f068e5647606d93719e6be1 # Parent a703198cb8b8e285e98bfd12d18364a398e990f0 [project @ 2006-08-16 06:52:19 by jwe] diff -r a703198cb8b8 -r 25da9a7d5f6d scripts/miscellaneous/ans.m --- a/scripts/miscellaneous/ans.m Tue Aug 15 06:06:16 2006 +0000 +++ b/scripts/miscellaneous/ans.m Wed Aug 16 06:52:19 2006 +0000 @@ -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 diff -r a703198cb8b8 -r 25da9a7d5f6d src/ChangeLog --- a/src/ChangeLog Tue Aug 15 06:06:16 2006 +0000 +++ b/src/ChangeLog Wed Aug 16 06:52:19 2006 +0000 @@ -1,5 +1,12 @@ 2006-08-15 John W. Eaton + * 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. diff -r a703198cb8b8 -r 25da9a7d5f6d src/help.cc --- a/src/help.cc Tue Aug 15 06:06:16 2006 +0000 +++ b/src/help.cc Wed Aug 16 06:52:19 2006 +0000 @@ -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; diff -r a703198cb8b8 -r 25da9a7d5f6d src/parse.h --- a/src/parse.h Tue Aug 15 06:06:16 2006 +0000 +++ b/src/parse.h Wed Aug 16 06:52:19 2006 +0000 @@ -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); diff -r a703198cb8b8 -r 25da9a7d5f6d src/parse.y --- a/src/parse.y Tue Aug 15 06:06:16 2006 +0000 +++ b/src/parse.y Wed Aug 16 06:52:19 2006 +0000 @@ -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) {