changeset 19307:dc64f1c4a33e

doc: Add documentation about finish.m and shutdown procedure to manual. * basics.txi: Add cindex terms "finish.m", "site exiting file". Add paragraph about shutdown procedure and how finish.m is invoked. * toplev.cc (Fquit): Redo docstring to list 1-argument forms. Add info about finish.m being executed. * toplev.cc (Fatexit): Make first sentence standalone. Add seealso link to quit.
author Rik <rik@octave.org>
date Tue, 21 Oct 2014 08:41:09 -0700
parents 26d1c3b73174
children 66ca15a97988
files doc/interpreter/basics.txi libinterp/corefcn/toplev.cc
diffstat 2 files changed, 26 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/basics.txi	Thu Oct 16 15:32:12 2014 -0400
+++ b/doc/interpreter/basics.txi	Tue Oct 21 08:41:09 2014 -0700
@@ -386,6 +386,15 @@
 @section Quitting Octave
 @cindex exiting octave
 @cindex quitting octave
+@cindex finish.m
+@cindex site exiting file
+
+Shutdown is initiated with the @code{exit} or @code{quit} commands (they are
+equivalent).  Similar to startup, Octave has a shutdown process that can be
+customized by user script files.  During shutdown Octave will search for the
+script file @file{finish.m} in the function load path.  Commands to save all
+workspace variables or cleanup temporary files may be placed there.  Additional
+functions to execute on shutdown may be registered with @code{atexit}.
 
 @DOCSTRING(quit)
 
--- a/libinterp/corefcn/toplev.cc	Thu Oct 16 15:32:12 2014 -0400
+++ b/libinterp/corefcn/toplev.cc	Tue Oct 21 08:41:09 2014 -0700
@@ -784,11 +784,20 @@
 
 DEFUN (quit, args, ,
        "-*- texinfo -*-\n\
-@deftypefn  {Built-in Function} {} exit (@var{status})\n\
+@deftypefn  {Built-in Function} {} exit\n\
+@deftypefnx {Built-in Function} {} exit (@var{status})\n\
+@deftypefnx {Built-in Function} {} quit\n\
 @deftypefnx {Built-in Function} {} quit (@var{status})\n\
-Exit the current Octave session.  If the optional integer value\n\
-@var{status} is supplied, pass that value to the operating system as the\n\
-Octave's exit status.  The default value is zero.\n\
+Exit the current Octave session.\n\
+\n\
+If the optional integer value @var{status} is supplied, pass that value to\n\
+the operating system as Octave's exit status.  The default value is zero.\n\
+\n\
+When exiting, Octave will attempt to run the m-file @file{finish.m} if it\n\
+exists.  User commands to save the workspace or clean up temporary files\n\
+may be placed in that file.  Alternatively, another m-file may be scheduled\n\
+to run using @code{atexit}.\n\
+@seealso{atexit}\n\
 @end deftypefn")
 {
   octave_value_list retval;
@@ -1153,7 +1162,9 @@
        "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {} atexit (@var{fcn})\n\
 @deftypefnx {Built-in Function} {} atexit (@var{fcn}, @var{flag})\n\
-Register a function to be called when Octave exits.  For example,\n\
+Register a function to be called when Octave exits.\n\
+\n\
+For example,\n\
 \n\
 @example\n\
 @group\n\
@@ -1185,6 +1196,7 @@
 from the list, so if a function was placed in the list multiple\n\
 times with @code{atexit}, it must also be removed from the list\n\
 multiple times.\n\
+@seealso{quit}\n\
 @end deftypefn")
 {
   octave_value_list retval;