comparison src/help.cc @ 5794:1138ced03f14

[project @ 2006-05-08 20:23:04 by jwe]
author jwe
date Mon, 08 May 2006 20:23:07 +0000
parents cbf717bf8150
children e8be7fe586f9
comparison
equal deleted inserted replaced
5793:395382df0d8a 5794:1138ced03f14
73 // (--info-file file) 73 // (--info-file file)
74 std::string Vinfo_file; 74 std::string Vinfo_file;
75 75
76 // Name of the info reader we'd like to use. 76 // Name of the info reader we'd like to use.
77 // (--info-program program) 77 // (--info-program program)
78 std::string Vinfo_prog; 78 std::string Vinfo_program;
79 79
80 // Name of the makeinfo program to run. 80 // Name of the makeinfo program to run.
81 static std::string Vmakeinfo_prog = "makeinfo"; 81 static std::string Vmakeinfo_program = "makeinfo";
82 82
83 // If TRUE, don't print additional help message in help and usage 83 // If TRUE, don't print additional help message in help and usage
84 // functions. 84 // functions.
85 static bool Vsuppress_verbose_help_message; 85 static bool Vsuppress_verbose_help_message = false;
86 86
87 // FIXME -- maybe this should use string instead of char*. 87 // FIXME -- maybe this should use string instead of char*.
88 88
89 struct help_list 89 struct help_list
90 { 90 {
450 void 450 void
451 additional_help_message (std::ostream& os) 451 additional_help_message (std::ostream& os)
452 { 452 {
453 if (! Vsuppress_verbose_help_message) 453 if (! Vsuppress_verbose_help_message)
454 os << "\ 454 os << "\
455 Additional help for built-in functions, operators, and variables\n\ 455 Additional help for built-in functions and operators is\n\
456 is available in the on-line version of the manual. Use the command\n\ 456 available in the on-line version of the manual. Use the command\n\
457 `doc <topic>' to search the manual index.\n\ 457 `doc <topic>' to search the manual index.\n\
458 \n\ 458 \n\
459 Help and information about Octave is also available on the WWW\n\ 459 Help and information about Octave is also available on the WWW\n\
460 at http://www.octave.org and via the help@octave.org\n\ 460 at http://www.octave.org and via the help@octave.org\n\
461 mailing list.\n"; 461 mailing list.\n";
516 display_names_from_help_list (octave_stdout, keyword_help (), 516 display_names_from_help_list (octave_stdout, keyword_help (),
517 "reserved words"); 517 "reserved words");
518 518
519 // FIXME -- is this distinction needed? 519 // FIXME -- is this distinction needed?
520 520
521 LIST_SYMBOLS (symbol_record::BUILTIN_VARIABLE, "built-in variables");
522
523 LIST_SYMBOLS (symbol_record::COMMAND, "commands"); 521 LIST_SYMBOLS (symbol_record::COMMAND, "commands");
524 522
525 LIST_SYMBOLS (symbol_record::MAPPER_FUNCTION, "mapper functions"); 523 LIST_SYMBOLS (symbol_record::MAPPER_FUNCTION, "mapper functions");
526 524
527 LIST_SYMBOLS (symbol_record::BUILTIN_FUNCTION, "general functions"); 525 LIST_SYMBOLS (symbol_record::BUILTIN_FUNCTION, "general functions");
644 cols = 72; 642 cols = 72;
645 643
646 std::ostringstream buf; 644 std::ostringstream buf;
647 645
648 buf << "sed -e 's/^[#%][#%]* *//' -e 's/^ *@/@/' | " 646 buf << "sed -e 's/^[#%][#%]* *//' -e 's/^ *@/@/' | "
649 << "\"" << Vmakeinfo_prog << "\"" 647 << "\"" << Vmakeinfo_program << "\""
650 << " -D \"VERSION " << OCTAVE_VERSION << "\"" 648 << " -D \"VERSION " << OCTAVE_VERSION << "\""
651 << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\"" 649 << " -D \"OCTAVEHOME " << OCTAVE_PREFIX << "\""
652 << " -D \"TARGETHOSTTYPE " << OCTAVE_CANONICAL_HOST_TYPE << "\"" 650 << " -D \"TARGETHOSTTYPE " << OCTAVE_CANONICAL_HOST_TYPE << "\""
653 << " --fill-column " << cols 651 << " --fill-column " << cols
654 << " --no-warn" 652 << " --no-warn"
876 "-*- texinfo -*-\n\ 874 "-*- texinfo -*-\n\
877 @deffn {Command} help\n\ 875 @deffn {Command} help\n\
878 Octave's @code{help} command can be used to print brief usage-style\n\ 876 Octave's @code{help} command can be used to print brief usage-style\n\
879 messages, or to display information directly from an on-line version of\n\ 877 messages, or to display information directly from an on-line version of\n\
880 the printed manual, using the GNU Info browser. If invoked without any\n\ 878 the printed manual, using the GNU Info browser. If invoked without any\n\
881 arguments, @code{help} prints a list of all the available operators,\n\ 879 arguments, @code{help} prints a list of all the available operators\n\
882 functions, and built-in variables. If the first argument is @code{-i},\n\ 880 and functions. If the first argument is @code{-i}, the @code{help}\n\
883 the @code{help} command searches the index of the on-line version of\n\ 881 command searches the index of the on-line version of this manual for\n\
884 this manual for the given topics.\n\ 882 the given topics.\n\
885 \n\ 883 \n\
886 For example, the command @kbd{help help} prints a short message\n\ 884 For example, the command @kbd{help help} prints a short message\n\
887 describing the @code{help} command, and @kbd{help -i help} starts the\n\ 885 describing the @code{help} command, and @kbd{help -i help} starts the\n\
888 GNU Info browser at this node in the on-line version of the manual.\n\ 886 GNU Info browser at this node in the on-line version of the manual.\n\
889 \n\ 887 \n\
1846 } 1844 }
1847 1845
1848 return retval; 1846 return retval;
1849 } 1847 }
1850 1848
1851 static int 1849 DEFUN (info_file, args, nargout,
1852 info_file (void) 1850 "-*- texinfo -*-\n\
1853 { 1851 @deftypefn {Built-in Function} {@var{val} =} info_file ()\n\
1854 int status = 0; 1852 @deftypefnx {Built-in Function} {@var{old_val} =} info_file (@var{new_val})\n\
1855 1853 Query or set the internal variable that specifies the name of the\n\
1856 std::string s = builtin_string_variable ("INFO_FILE"); 1854 Octave info file. The default value is\n\
1857 1855 @code{\"@var{octave-home}/info/octave.info\"}, in\n\
1858 if (s.empty ())
1859 {
1860 gripe_invalid_value_specified ("INFO_FILE");
1861 status = -1;
1862 }
1863 else
1864 Vinfo_file = s;
1865
1866 return status;
1867 }
1868
1869 static int
1870 info_prog (void)
1871 {
1872 int status = 0;
1873
1874 std::string s = builtin_string_variable ("INFO_PROGRAM");
1875
1876 if (s.empty ())
1877 {
1878 gripe_invalid_value_specified ("INFO_PROGRAM");
1879 status = -1;
1880 }
1881 else
1882 Vinfo_prog = s;
1883
1884 return status;
1885 }
1886
1887 static int
1888 makeinfo_prog (void)
1889 {
1890 int status = 0;
1891
1892 std::string s = builtin_string_variable ("MAKEINFO_PROGRAM");
1893
1894 if (s.empty ())
1895 {
1896 gripe_invalid_value_specified ("MAKEINFO_PROGRAM");
1897 status = -1;
1898 }
1899 else
1900 Vmakeinfo_prog = s;
1901
1902 return status;
1903 }
1904
1905 static int
1906 suppress_verbose_help_message (void)
1907 {
1908 Vsuppress_verbose_help_message
1909 = check_preference ("suppress_verbose_help_message");
1910
1911 return 0;
1912 }
1913
1914 void
1915 symbols_of_help (void)
1916 {
1917 DEFVAR (INFO_FILE, Vinfo_file, info_file,
1918 "-*- texinfo -*-\n\
1919 @defvr {Built-in Variable} INFO_FILE\n\
1920 The variable @code{INFO_FILE} names the location of the Octave info file.\n\
1921 The default value is @code{\"@var{octave-home}/info/octave.info\"}, in\n\
1922 which @var{octave-home} is the directory where all of Octave is installed.\n\ 1856 which @var{octave-home} is the directory where all of Octave is installed.\n\
1923 @end defvr"); 1857 @seealso{info_program, doc, help, makeinfo_program}\n\
1924 1858 @end deftypefn")
1925 DEFVAR (INFO_PROGRAM, Vinfo_prog, info_prog, 1859 {
1926 "-*- texinfo -*-\n\ 1860 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (info_file);
1927 @defvr {Built-in Variable} INFO_PROGRAM\n\ 1861 }
1928 The variable @code{INFO_PROGRAM} names the info program to run. Its\n\ 1862
1929 default initial value is\n\ 1863 DEFUN (info_program, args, nargout,
1864 "-*- texinfo -*-\n\
1865 @deftypefn {Built-in Function} {@var{val} =} info_program ()\n\
1866 @deftypefnx {Built-in Function} {@var{old_val} =} info_program (@var{new_val})\n\
1867 Query or set the internal variable that specifies the name of the\n\
1868 info program to run. The default initial value is\n\
1930 @code{\"@var{octave-home}/libexec/octave/@var{version}/exec/@var{arch}/info\"}\n\ 1869 @code{\"@var{octave-home}/libexec/octave/@var{version}/exec/@var{arch}/info\"}\n\
1931 in which @var{octave-home} is the directory where all of Octave is\n\ 1870 in which @var{octave-home} is the directory where all of Octave is\n\
1932 installed, @var{version} is the Octave version number, and @var{arch}\n\ 1871 installed, @var{version} is the Octave version number, and @var{arch}\n\
1933 is the system type (for example, @code{i686-pc-linux-gnu}). The\n\ 1872 is the system type (for example, @code{i686-pc-linux-gnu}). The\n\
1934 default initial value may be overridden by the environment variable\n\ 1873 default initial value may be overridden by the environment variable\n\
1935 @code{OCTAVE_INFO_PROGRAM}, or the command line argument\n\ 1874 @code{OCTAVE_INFO_PROGRAM}, or the command line argument\n\
1936 @code{--info-program NAME}, or by setting the value of\n\ 1875 @code{--info-program NAME}.\n\
1937 @code{INFO_PROGRAM} in a startup script\n\ 1876 @seealso{info_file, doc, help, makeinfo_program}\n\
1938 @end defvr"); 1877 @end deftypefn")
1939 1878 {
1940 DEFVAR (MAKEINFO_PROGRAM, Vmakeinfo_prog, makeinfo_prog, 1879 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (info_program);
1941 "-*- texinfo -*-\n\ 1880 }
1942 @defvr {Built-in Variable} MAKEINFO_PROGRAM\n\ 1881
1943 The variable @code{MAKEINFO_PROGRAM} names the makeinfo program that\n\ 1882 DEFUN (makeinfo_program, args, nargout,
1944 Octave runs to format help text that contains Texinfo markup commands.\n\ 1883 "-*- texinfo -*-\n\
1945 Its default initial value is @code{\"makeinfo\"}.\n\ 1884 @deftypefn {Built-in Function} {@var{val} =} makeinfo_program ()\n\
1946 @end defvr"); 1885 @deftypefnx {Built-in Function} {@var{old_val} =} makeinfo_program (@var{new_val})\n\
1947 1886 Query or set the internal variable that specifies the name of the\n\
1948 DEFVAR (suppress_verbose_help_message, false, suppress_verbose_help_message, 1887 makeinfo program that Octave runs to format help text containing\n\
1949 "-*- texinfo -*-\n\ 1888 Texinfo markup commands. The default initial value is @code{\"makeinfo\"}.\n\
1950 @defvr {Built-in Variable} suppress_verbose_help_message\n\ 1889 @seealso{info_file, info_program, doc, help}\n\
1951 If the value of @code{suppress_verbose_help_message} is nonzero, Octave\n\ 1890 @end deftypefn")
1952 will not add additional help information to the end of the output from\n\ 1891 {
1892 return SET_NONEMPTY_INTERNAL_STRING_VARIABLE (makeinfo_program);
1893 }
1894
1895 DEFUN (suppress_verbose_help_message, args, nargout,
1896 "-*- texinfo -*-\n\
1897 @deftypefn {Built-in Function} {@var{val} =} suppress_verbose_help_message ()\n\
1898 @deftypefnx {Built-in Function} {@var{old_val} =} suppress_verbose_help_message (@var{new_val})\n\
1899 Query or set the internal vaiable that controls whether Octave\n\
1900 will add additional help information to the end of the output from\n\
1953 the @code{help} command and usage messages for built-in commands.\n\ 1901 the @code{help} command and usage messages for built-in commands.\n\
1954 @end defvr"); 1902 @end deftypefn")
1903 {
1904 return SET_INTERNAL_VARIABLE (suppress_verbose_help_message);
1955 } 1905 }
1956 1906
1957 /* 1907 /*
1958 ;;; Local Variables: *** 1908 ;;; Local Variables: ***
1959 ;;; mode: C++ *** 1909 ;;; mode: C++ ***