diff src/help.cc @ 14614:4e9dc46d4125

handle texinfo macros consistently in help system and manual * macros.texi: New file. Move macro definitions here from octave.texi. * doc/interpreter/Makefile.am (octetc_DATA): Include it in the list. (doc-cache): Pass macros.texi to mk_doc_cache.m. * octave.texi: Include macros.texi. * mk_doc_cache.m, __makeinfo__.m: Copy macros file to makeinfo input instead of handling macros specially. * configure.ac (texi_macros_file): New variable. * build-aux/common.mk (texi_macros_file, do_subst_default_vals): Substitute it. * run-octave.in (TEXIMACROSFILE): New variable. Pass --texi-macros-file to Octave. * defaults.in.h (OCTAVE_DEFAULT_TEXI_MACROS_FILE): New variable. * default.cc (set_default_texi_macros_file): New function. (install_defaults): Call it. * help.cc (Vtexi_macros_file): New variable. (Ftexi_macros_file): New function. * help.h (Vtexi_macros_file): Provide decl. * octave.cc (TEXI_MACROS_FILE_OPTION): New long option value. (long_opts): Include --texi-macros-file in the list. (octave_main): Handle TEXI_MACROS_FILE_OPTION.
author John W. Eaton <jwe@octave.org>
date Thu, 10 May 2012 12:01:42 -0400
parents 97883071e8e4
children 36f451642f79
line wrap: on
line diff
--- a/src/help.cc	Wed May 09 18:44:58 2012 -0400
+++ b/src/help.cc	Thu May 10 12:01:42 2012 -0400
@@ -71,6 +71,11 @@
 // (--doc-cache-file file)
 std::string Vdoc_cache_file;
 
+// Name of the file containing local Texinfo macros that are prepended
+// to doc strings before processing.
+// (--texi-macros-file)
+std::string Vtexi_macros_file;
+
 // Name of the info file specified on command line.
 // (--info-file file)
 std::string Vinfo_file;
@@ -1291,6 +1296,30 @@
   return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (doc_cache_file);
 }
 
+DEFUN (texi_macros_file, args, nargout,
+  "-*- texinfo -*-\n\
+@deftypefn  {Built-in Function} {@var{val} =} texi_macros_file ()\n\
+@deftypefnx {Built-in Function} {@var{old_val} =} texi_macros_file (@var{new_val})\n\
+@deftypefnx {Built-in Function} {} texi_macros_file (@var{new_val}, \"local\")\n\
+Query or set the internal variable that specifies the name of the\n\
+file containing Texinfo macros that are prepended to doc strings\n\
+before they are passed to makeinfo.  The default value is \n\
+@file{@var{octave-home}/share/octave/@var{version}/etc/macros.texi},\n\
+in which @var{octave-home} is the root directory of the Octave installation,\n\
+and @var{version} is the Octave version number.\n\
+The default value may be overridden by the environment variable\n\
+@w{@env{OCTAVE_TEXI_MACROS_FILE}}, or the command line argument\n\
+@samp{--texi-macros-file NAME}.\n\
+\n\
+When called from inside a function with the \"local\" option, the variable is\n\
+changed locally for the function and any subroutines it calls.  The original\n\
+variable value is restored when exiting the function.\n\
+@seealso{lookfor, info_program, doc, help, makeinfo_program}\n\
+@end deftypefn")
+{
+  return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (texi_macros_file);
+}
+
 DEFUN (info_file, args, nargout,
   "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {@var{val} =} info_file ()\n\