changeset 3686:9507d6de9bbd

[project @ 2000-06-29 16:30:44 by jwe]
author jwe
date Thu, 29 Jun 2000 16:30:45 +0000
parents 9d8306640373
children b5a285d1c1f4
files doc/interpreter/basics.txi doc/interpreter/func.txi src/ChangeLog src/help.cc src/pr-output.cc src/toplev.cc
diffstat 6 files changed, 79 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/basics.txi
+++ b/doc/interpreter/basics.txi
@@ -297,6 +297,8 @@
 
 @DOCSTRING(INFO_PROGRAM)
 
+@DOCSTRING(MAKEINFO_PROGRAM)
+
 @DOCSTRING(suppress_verbose_help_message)
 
 @node Command Line Editing, Errors, Getting Help, Getting Started
--- a/doc/interpreter/func.txi
+++ b/doc/interpreter/func.txi
@@ -749,14 +749,18 @@
 header file @file{octave/oct.h}).
 
 Note that the third parameter to @code{DEFUN_DLD} (@code{nargout}) is
-not used, so it is omitted from the list of arguments to in order to
-avoid  the warning from gcc about an unused function parameter.
+not used, so it is omitted from the list of arguments in order to
+avoid the warning from gcc about an unused function parameter.
+
+The next line,
+
+@example
+ColumnVector dx (3);
+@end example
 
 @noindent
 simply declares an object to store the right hand sides of the
-differential equation, and
-
-The statement
+differential equation, and the statement
 
 @example
 ColumnVector x = args(0).vector_value ();
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-28  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* help.cc (display_help_text): If writing to filter fails, send
+	unformatted text to output stream.
+
 2000-06-27  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* OPERATORS/op-bm-bm.cc (eq): Define using mx_el_eq, not operator ==.
--- a/src/help.cc
+++ b/src/help.cc
@@ -74,6 +74,9 @@
 // (--info-program program)
 std::string Vinfo_prog;
 
+// Name of the makeinfo program to run.
+static std::string Vmakeinfo_prog = "makeinfo";
+
 // If TRUE, don't print additional help message in help and usage
 // functions.
 static bool Vsuppress_verbose_help_message;
@@ -608,7 +611,8 @@
 	cols = 72;
 
       std::ostrstream buf;
-      buf << "sed -e 's/^[#%]+ *//' -e 's/^ *@/@/' | makeinfo"
+      buf << "sed -e 's/^[#%]+ *//' -e 's/^ *@/@/' | "
+	  << Vmakeinfo_prog
 	  << " -D \"VERSION " << OCTAVE_VERSION << "\""
 	  << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\""
 	  << " -D \"TARGETHOSTTYPE " << OCTAVE_CANONICAL_HOST_TYPE << "\""
@@ -627,7 +631,7 @@
 
       delete [] cmd;
 
-      if (filter)
+      if (filter && filter.is_open ())
 	{
 	  filter << "@macro seealso {args}\n"
 		 << "\n"
@@ -637,15 +641,25 @@
 
 	  filter << msg.substr (pos+1);
 
-	  filter.close ();
+	  int status = filter.close ();
 
 	  std::ifstream tmp_file (tmp_file_name.c_str ());
 
-	  int c;
-	  while ((c = tmp_file.get ()) != EOF)
-	    os << (char) c;
+	  if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
+	    {
+	      int c;
+	      while ((c = tmp_file.get ()) != EOF)
+		os << (char) c;
 
-	  tmp_file.close ();
+	      tmp_file.close ();
+	    }
+	  else
+	    {
+	      warning ("help: Texinfo formatting filter exited abnormally");
+	      warning ("help: raw Texinfo source of help text follows...");
+
+	      os << "\n" << msg;
+	    }
 
 	  file_ops::unlink (tmp_file_name);
 	}
@@ -1031,6 +1045,24 @@
 }
 
 static int
+makeinfo_prog (void)
+{
+  int status = 0;
+
+  std::string s = builtin_string_variable ("MAKEINFO_PROGRAM");
+
+  if (s.empty ())
+    {
+      gripe_invalid_value_specified ("MAKEINFO_PROGRAM");
+      status = -1;
+    }
+  else
+    Vmakeinfo_prog = s;
+
+  return status;
+}
+
+static int
 suppress_verbose_help_message (void)
 {
   Vsuppress_verbose_help_message
@@ -1046,16 +1078,31 @@
     "-*- texinfo -*-\n\
 @defvr {Built-in Variable} INFO_FILE\n\
 The variable @code{INFO_FILE} names the location of the Octave info file.\n\
-The default value is @code{\"@var{octave-home}/info/octave.info\"}, where\n\
-@var{octave-home} is the directory where all of Octave is installed.\n\
+The default value is @code{\"@var{octave-home}/info/octave.info\"}, in\n\
+which @var{octave-home} is the directory where all of Octave is installed.\n\
 @end defvr");
 
   DEFVAR (INFO_PROGRAM, Vinfo_prog, info_prog,
     "-*- texinfo -*-\n\
-@defvr {Built-in Variable} INFO_FILE\n\
-The variable @code{INFO_FILE} names the location of the Octave info file.\n\
-The default value is @code{\"@var{octave-home}/info/octave.info\"}, where\n\
-@var{octave-home} is the directory where all of Octave is installed.\n\
+@defvr {Built-in Variable} INFO_PROGRAM\n\
+The variable @code{INFO_PROGRAM} names the info program to run.  Its\n\
+default initial value is\n\
+@code{\"@var{octave-home}/libexec/octave/@var{version}/exec/@var{arch}/info\"}\n\
+in which @var{octave-home} is the directory where all of Octave is\n\
+installed, @var{version} is the Octave version number, and @var{arch}\n\
+is the system type (for example, @code{i686-pc-linux-gnu}).  The\n\
+default initial value may be overridden by the environment variable\n\
+@code{OCTAVE_INFO_PROGRAM}, or the command line argument\n\
+@code{--info-program NAME}, or by setting the value of\n\
+@code{INFO_PROGRAM} in a startup script\n\
+@end defvr");
+
+  DEFVAR (MAKEINFO_PROGRAM, Vmakeinfo_prog, makeinfo_prog,
+    "-*- texinfo -*-\n\
+@defvr {Built-in Variable} MAKEINFO_PROGRAM\n\
+The variable @code{MAKEINFO_PROGRAM} names the makeinfo program that\n\
+Octave runs to format help text that contains Texinfo markup commands.\n\
+Its default initial value is @code{\"makeinfo\"}.\n\
 @end defvr");
 
   DEFVAR (suppress_verbose_help_message, 0.0, suppress_verbose_help_message,
--- a/src/pr-output.cc
+++ b/src/pr-output.cc
@@ -1784,7 +1784,7 @@
 	{
 	  std::ostrstream buf;
 	  args(0).print (buf);
-	  buf << ends;
+	  buf << std::ends;
 	  char *tmp = buf.str ();
 	  retval = tmp;
 	  delete [] tmp;
--- a/src/toplev.cc
+++ b/src/toplev.cc
@@ -550,11 +550,11 @@
 \n\
 @example\n\
 @group\n\
-function print_flops_at_exit ()\n\
+function print_fortune ()\n\
   printf (\"\\n%s\\n\", system (\"fortune\"));\n\
   fflush (stdout);\n\
 endfunction\n\
-atexit (\"print_flops_at_exit\");\n\
+atexit (\"print_fortune\");\n\
 @end group\n\
 @end example\n\
 \n\