diff libinterp/octave.cc @ 31535:4b80982e0af8 stable

doc: Add undocumented functions to Octave manual for 8.1 release. * basics.txi: Add DOCSTRING entry for "cmdline_options". Correct missing word in description of "--built-in-docstrings-file" commmand line option. Wrap some lines to 80 characters. * mk_undocumented_list: Add exceptions to undocumented list for ytickangle, ztickangle. * octave.cc (Fcmdline_options): Improve documentation string. Add BIST tests. * octave.cc (Fprogram_invocation_name, Fprogram_name): Improve documentation string. Check for pattern "Invalid call" in BIST error tests for input validation.
author Rik <rik@octave.org>
date Thu, 24 Nov 2022 06:30:04 -0800
parents 1a0756f7c90a
children e88a07dec498
line wrap: on
line diff
--- a/libinterp/octave.cc	Thu Nov 24 06:12:23 2022 -0800
+++ b/libinterp/octave.cc	Thu Nov 24 06:30:04 2022 -0800
@@ -447,7 +447,7 @@
 
 /*
 %!assert (islogical (isguirunning ()))
-%!error isguirunning (1)
+%!error <Invalid call> isguirunning (1)
 */
 
 DEFUN (argv, args, ,
@@ -468,6 +468,7 @@
 If you write an executable Octave script, @code{argv} will return the list
 of arguments passed to the script.  @xref{Executable Octave Programs}, for
 an example of how to create an executable Octave script.
+@seealso{program_name, cmdline_options}
 @end deftypefn */)
 {
   if (args.length () != 0)
@@ -478,14 +479,19 @@
 
 /*
 %!assert (iscellstr (argv ()))
-%!error argv (1)
+%!error <Invalid call> argv (1)
 */
 
 DEFUN (cmdline_options, args, ,
        doc: /* -*- texinfo -*-
 @deftypefn {} {@var{opt_struct} =} cmdline_options ()
-Return a structure containing info about the command line arguments passed to
-Octave.
+Return a structure containing detailed information about the command line
+arguments passed to Octave.
+
+Programming Note: This function provides copious amounts of information about
+Octave's parsing of command line options and may be more useful for debugging
+Octave rather than for general use.
+@seealso{argv, program_name}
 @end deftypefn */)
 {
   if (args.length () != 0)
@@ -501,16 +507,23 @@
   return ovl (opts.as_octave_value ());
 }
 
+/*
+%!assert (isstruct (cmdline_options ()))
+%!error <Invalid call> cmdline_options (1)
+*/
+
 DEFUN (program_invocation_name, args, ,
        doc: /* -*- texinfo -*-
 @deftypefn {} {@var{name} =} program_invocation_name ()
-Return the name that was typed at the shell prompt to run Octave.
+Return the string that was typed at the shell prompt to run Octave.
+
+The string may include path components as well as the program filename.
 
 If executing a script from the command line (e.g., @code{octave foo.m}) or
 using an executable Octave script, the program name is set to the name of the
 script.  @xref{Executable Octave Programs}, for an example of how to create an
 executable Octave script.
-@seealso{program_name}
+@seealso{program_name, argv}
 @end deftypefn */)
 {
   if (args.length () != 0)
@@ -521,15 +534,16 @@
 
 /*
 %!assert (ischar (program_invocation_name ()))
-%!error program_invocation_name (1)
+%!error <Invalid call> program_invocation_name (1)
 */
 
 DEFUN (program_name, args, ,
        doc: /* -*- texinfo -*-
 @deftypefn {} {@var{name} =} program_name ()
-Return the last component of the value returned by
+Return the filename component of the value returned by
 @code{program_invocation_name}.
-@seealso{program_invocation_name}
+
+@seealso{program_invocation_name, argv}
 @end deftypefn */)
 {
   if (args.length () != 0)
@@ -540,7 +554,7 @@
 
 /*
 %!assert (ischar (program_name ()))
-%!error program_name (1)
+%!error <Invalid call> program_name (1)
 */
 
 OCTAVE_NAMESPACE_END