changeset 8861:31f864877246

doc and lookfor fixes
author John W. Eaton <jwe@octave.org>
date Tue, 24 Feb 2009 15:08:39 -0500
parents 257ed585b471
children f71b749be1c1
files ChangeLog run-octave.in scripts/ChangeLog scripts/help/gen_doc_cache.m scripts/help/lookfor.m src/ChangeLog src/help.cc src/help.h src/octave.cc
diffstat 9 files changed, 61 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Feb 24 14:13:32 2009 -0500
+++ b/ChangeLog	Tue Feb 24 15:08:39 2009 -0500
@@ -1,5 +1,8 @@
 2009-02-24  John W. Eaton  <jwe@octave.org>
 
+	* run-octave.in (DOCFILE): New variable.  Pass --doc-cache-file
+	option to Octave.
+
 	* configure.in: Copy Makefile to build directory if not building
 	in srcdir.
 
--- a/run-octave.in	Tue Feb 24 14:13:32 2009 -0500
+++ b/run-octave.in	Tue Feb 24 15:08:39 2009 -0500
@@ -51,6 +51,7 @@
 
 LOADPATH="$d1_path:$d2_path:$d3_path:$d4_path"
 IMAGEPATH="$top_srcdir/scripts/image"
+DOCFILE="$builddir/doc/interpreter/DOC"
 INFOFILE="$builddir/doc/interpreter/octave.info"
 
 if [ $# -gt 0 ]; then
@@ -69,5 +70,5 @@
 OCTAVE_SITE_INITFILE="$top_srcdir/scripts/startup/main-rcfile" \
 LD_PRELOAD="$liboctinterp $liboctave $libcruft" \
 %library_path_var%="$builddir/src:$builddir/liboctave:$builddir/libcruft:$%library_path_var%" \
-  exec $driver "$builddir/src/octave" --no-initial-path --path="$LOADPATH" --image-path="$IMAGEPATH" --info-file="$INFOFILE" "$@"
+  exec $driver "$builddir/src/octave" --no-initial-path --path="$LOADPATH" --image-path="$IMAGEPATH" --doc-cache-file="$DOCFILE" --info-file="$INFOFILE" "$@"
 
--- a/scripts/ChangeLog	Tue Feb 24 14:13:32 2009 -0500
+++ b/scripts/ChangeLog	Tue Feb 24 15:08:39 2009 -0500
@@ -1,3 +1,9 @@
+2009-02-24  John W. Eaton  <jwe@octave.org>
+
+	* help/gen_doc_cache.m: Don't compress output file.  By default,
+	write to DOC, not DOC.gz.
+	* help/lookfor.m: Use doc_cache_file to get location of DOC file.
+
 2009-02-24  Jason Riedy  <jason@acm.org>
 
 	* help/gen_doc_cache.m: Call __makeinfo__, not makeinfo.
--- a/scripts/help/gen_doc_cache.m	Tue Feb 24 14:13:32 2009 -0500
+++ b/scripts/help/gen_doc_cache.m	Tue Feb 24 15:08:39 2009 -0500
@@ -28,7 +28,7 @@
 ## @seealso{lookfor, path}
 ## @end deftypefn
 
-function gen_doc_cache (out_file = "DOC.gz", directory = [])
+function gen_doc_cache (out_file = "DOC", directory = [])
   ## Check input
   if (!ischar (out_file))
     print_usage ();
@@ -44,7 +44,7 @@
   endif
   
   ## Save cache
-  save ("-text", "-z", out_file, "cache");
+  save ("-text", out_file, "cache");
 endfunction
 
 function [text, first_sentence, status] = handle_function (f, text, format)
--- a/scripts/help/lookfor.m	Tue Feb 24 14:13:32 2009 -0500
+++ b/scripts/help/lookfor.m	Tue Feb 24 15:08:39 2009 -0500
@@ -53,7 +53,7 @@
   str = lower (str);
 
   ## Search functions, operators, and keywords that come with Octave
-  cache_file = fullfile (octave_config_info.datadir, "etc", "DOC");
+  cache_file = doc_cache_file ();
   if (exist (cache_file, "file"))
     [fun, help_text] = search_cache (str, cache_file, search_type);
     had_core_cache = true;
--- a/src/ChangeLog	Tue Feb 24 14:13:32 2009 -0500
+++ b/src/ChangeLog	Tue Feb 24 15:08:39 2009 -0500
@@ -1,3 +1,11 @@
+2009-02-24  John W. Eaton  <jwe@octave.org>
+
+	* help.cc, help.h (Vdoc_cache_file): New global variable.
+	(Fdoc_cache_file): New function.
+	* octave.cc (DOC_CACHE_FILE_OPTION): New option tag.
+	(long_opts): Include doc-cache-file in the list.
+	(octave_main): Handle DOC_CACHE_FILE_OPTION.
+
 2009-02-24  Jaroslav Hajek  <highegg@gmail.com>
 
 	* ov-scalar.h 
--- a/src/help.cc	Tue Feb 24 14:13:32 2009 -0500
+++ b/src/help.cc	Tue Feb 24 15:08:39 2009 -0500
@@ -72,6 +72,10 @@
 #include "version.h"
 #include "quit.h"
 
+// Name of the doc cache file specified on the command line.
+// (--doc-cache-file file)
+std::string Vdoc_cache_file;
+
 // Name of the info file specified on command line.
 // (--info-file file)
 std::string Vinfo_file;
@@ -990,6 +994,18 @@
   return retval;
 }
 
+DEFUN (doc_cache_file, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn {Built-in Function} {@var{val} =} doc_cache_file ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} doc_cache_file (@var{new_val})\n\
+Query or set the internal variable that specifies the name of the\n\
+Octave DOC file.  The default value is @code{\"@var{octetcdir}/DOC\"}.\n\
+@seealso{info_program, doc, help, makeinfo_program}\n\
+@end deftypefn")
+{
+  return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (doc_cache_file);
+}
+
 DEFUN (info_file, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {@var{val} =} info_file ()\n\
--- a/src/help.h	Tue Feb 24 14:13:32 2009 -0500
+++ b/src/help.h	Tue Feb 24 15:08:39 2009 -0500
@@ -33,6 +33,10 @@
 
 extern OCTINTERP_API std::string raw_help (const std::string&, bool&);
 
+// Name of the doc cache file specified on the command line.
+// (--doc-cache-file file)
+extern std::string Vdoc_cache_file;
+
 // Name of the info file specified on command line.
 // (--info-file file)
 extern std::string Vinfo_file;
--- a/src/octave.cc	Tue Feb 24 14:13:32 2009 -0500
+++ b/src/octave.cc	Tue Feb 24 15:08:39 2009 -0500
@@ -143,22 +143,24 @@
 
 // Long options.  See the comments in getopt.h for the meanings of the
 // fields in this structure.
-#define EVAL_OPTION 1
-#define EXEC_PATH_OPTION 2
-#define IMAGE_PATH_OPTION 3
-#define INFO_FILE_OPTION 4
-#define INFO_PROG_OPTION 5
-#define NO_INIT_FILE_OPTION 6
-#define NO_LINE_EDITING_OPTION 7
-#define NO_SITE_FILE_OPTION 8
-#define NO_INITIAL_PATH_OPTION 9
-#define PERSIST_OPTION 10
-#define TRADITIONAL_OPTION 11
-#define LINE_EDITING_OPTION 12
+#define DOC_CACHE_FILE_OPTION 1
+#define EVAL_OPTION 2
+#define EXEC_PATH_OPTION 3
+#define IMAGE_PATH_OPTION 4
+#define INFO_FILE_OPTION 5
+#define INFO_PROG_OPTION 6
+#define NO_INIT_FILE_OPTION 7
+#define NO_LINE_EDITING_OPTION 8
+#define NO_SITE_FILE_OPTION 9
+#define NO_INITIAL_PATH_OPTION 10
+#define PERSIST_OPTION 11
+#define TRADITIONAL_OPTION 12
+#define LINE_EDITING_OPTION 13
 long_options long_opts[] =
   {
     { "debug",            prog_args::no_arg,       0, 'd' },
     { "braindead",        prog_args::no_arg,       0, TRADITIONAL_OPTION },
+    { "doc-cache-file",   prog_args::required_arg, 0, DOC_CACHE_FILE_OPTION },
     { "echo-commands",    prog_args::no_arg,       0, 'x' },
     { "eval",             prog_args::required_arg, 0, EVAL_OPTION },
     { "exec-path",        prog_args::required_arg, 0, EXEC_PATH_OPTION },
@@ -684,6 +686,11 @@
 	  print_version_and_exit ();
 	  break;
 
+	case DOC_CACHE_FILE_OPTION:
+	  if (args.optarg ())
+	    bind_internal_variable ("doc_cache_file", args.optarg ());
+	  break;
+
 	case EVAL_OPTION:
 	  if (args.optarg ())
 	    {