Mercurial > hg > octave-thorsten
changeset 4449:e2c91da0aa16
[project @ 2003-07-09 02:21:11 by jwe]
author | jwe |
---|---|
date | Wed, 09 Jul 2003 02:21:11 +0000 |
parents | 042cdbb7f317 |
children | c81dd5832ad8 |
files | ChangeLog Makeconf.in configure.in doc/interpreter/io.txi doc/interpreter/var.txi octMakefile.in octave-config.in src/ChangeLog src/defaults.h.in src/load-save.cc src/sighandlers.cc src/version.h |
diffstat | 12 files changed, 178 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,22 @@ 2003-07-08 John W. Eaton <jwe@bevo.che.wisc.edu> + * Makeconf.in (do-subst-default-vals): Substitute OCTAVE_API_VERSION. + * octave-config.in: Handle new variable OCTAVE_API_VERSION. + + * octMakefile.in (DIRS_TO_MAKE): Delete undefined vars + $(localfcnfilepathdirs) and $(localoctfilepathdirs) from the list. + + * octave-config.in: Handle new variables OCTAVE_LOCALAPIFCNFILEDIR + and OCTAVE_LOCALAPIOCTFILEDIR + + * configure.in (localapifcnfiledir): New variable. + (localfcnfilepath): Add it to the list. + (localapioctfiledir): New variable. + (localoctfilepath): Add it to the list. + * Makeconf.in (do-subst-default-vals): Substitute new varibles. + + * Makeconf.in (getapiversion, apiversion): New macros. + * octMakefile.in (DIRS_TO_MAKE): Include $(localverarchlibdir) in the list.
--- a/Makeconf.in +++ b/Makeconf.in @@ -13,12 +13,16 @@ export SED # A shell command to extract the version number from version.h. -getversion = $(SED) -e '/VERSION/!d' -e 's/.*"\(.*\)".*$$/\1/' -e q +getversion = $(SED) -e '/OCTAVE_VERSION/!d' -e 's/.*"\(.*\)".*$$/\1/' -e q + +# A shell command to extract the API version number from version.h. +getapiversion = $(SED) -e '/OCTAVE_API_VERSION/!d' -e 's/.*"\(.*\)".*$$/\1/' -e q # Look for version.h to get version information. xfiles := $(TOPDIR)/src/version.h $(srcdir)/$(TOPDIR)/src/version.h version_file := $(firstword $(foreach file, $(xfiles), $(wildcard $(file)))) version := $(shell $(getversion) $(version_file)) +apiversion := $(shell $(getapiversion) $(version_file)) #### Start of system configuration section. #### @@ -243,6 +247,7 @@ # ${fcnfiledir}. This should be a colon-separated list of # directories. localfcnfiledir = @localfcnfiledir@ +localapifcnfiledir = @localapifcnfiledir@ localverfcnfiledir = @localverfcnfiledir@ localfcnfilepath = @localfcnfilepath@ @@ -268,6 +273,7 @@ # (i.e. customizations), before consulting ${octfiledir}. This should # be a colon-separated list of directories. localoctfiledir = @localoctfiledir@ +localapioctfiledir = @localapioctfiledir@ localveroctfiledir = @localveroctfiledir@ localoctfilepath = @localoctfilepath@ @@ -472,6 +478,8 @@ -e "s;%OCTAVE_INFOFILE%;\"${infofile}\";" \ -e "s;%OCTAVE_LIBDIR%;\"${libdir}\";" \ -e "s;%OCTAVE_LIBEXECDIR%;\"${libexecdir}\";" \ + -e "s;%OCTAVE_LOCALAPIFCNFILEDIR%;\"${localapifcnfiledir}\";" \ + -e "s;%OCTAVE_LOCALAPIOCTFILEDIR%;\"${localapioctfiledir}\";" \ -e "s;%OCTAVE_LOCALARCHLIBDIR%;\"${localarchlibdir}\";" \ -e "s;%OCTAVE_LOCALFCNFILEDIR%;\"${localfcnfiledir}\";" \ -e "s;%OCTAVE_LOCALFCNFILEPATH%;\"${localfcnfilepath}\";" \ @@ -489,6 +497,7 @@ -e "s;%OCTAVE_OCTLIBDIR%;\"${octlibdir}\";" \ -e "s;%OCTAVE_STARTUPFILEDIR%;\"${startupfiledir}\";" \ -e "s;%OCTAVE_PREFIX%;\"${prefix}\";" \ + -e "s;%OCTAVE_API_VERSION%;\"${apiversion}\";" \ -e "s;%OCTAVE_VERSION%;\"${version}\";" $(top_srcdir)/move-if-change $@-t $@ endef
--- a/configure.in +++ b/configure.in @@ -22,7 +22,7 @@ ### 02111-1307, USA. AC_INIT -AC_REVISION($Revision: 1.429 $) +AC_REVISION($Revision: 1.430 $) AC_PREREQ(2.52) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -43,9 +43,11 @@ OCTAVE_SET_DEFAULT(octincludedir, '$(includedir)/octave-$(version)') OCTAVE_SET_DEFAULT(fcnfiledir, '$(datadir)/octave/$(version)/m') OCTAVE_SET_DEFAULT(localfcnfiledir, '$(datadir)/octave/site/m') +OCTAVE_SET_DEFAULT(localapifcnfiledir, + '$(datadir)/octave/site/$(apiversion)/m') OCTAVE_SET_DEFAULT(localverfcnfiledir, '$(datadir)/octave/$(version)/site/m') OCTAVE_SET_DEFAULT(localfcnfilepath, - '$(localverfcnfiledir)//:$(localfcnfiledir)//') + '$(localverfcnfiledir)//:$(localapifcnfiledir)//:$(localfcnfiledir)//') OCTAVE_SET_DEFAULT(octlibdir, '$(libdir)/octave-$(version)') OCTAVE_SET_DEFAULT(archlibdir, '$(libexecdir)/octave/$(version)/exec/$(canonical_host_type)') @@ -57,10 +59,12 @@ '$(libexecdir)/octave/$(version)/oct/$(canonical_host_type)') OCTAVE_SET_DEFAULT(localoctfiledir, '$(libexecdir)/octave/site/oct/$(canonical_host_type)') +OCTAVE_SET_DEFAULT(localapioctfiledir, + '$(libexecdir)/octave/site/oct/$(apiversion)/$(canonical_host_type)') OCTAVE_SET_DEFAULT(localveroctfiledir, '$(libexecdir)/octave/$(version)/site/oct/$(canonical_host_type)') OCTAVE_SET_DEFAULT(localoctfilepath, - '$(localveroctfiledir)//:$(localoctfiledir)//') + '$(localveroctfiledir)//:$(localapioctfiledir)//:$(localoctfiledir)//') OCTAVE_SET_DEFAULT(fcnfilepath, '.:$(localoctfilepath):$(localfcnfilepath):$(octfiledir)//:$(fcnfiledir)//') OCTAVE_SET_DEFAULT(imagedir, '$(datadir)/octave/$(version)/imagelib')
--- a/doc/interpreter/io.txi +++ b/doc/interpreter/io.txi @@ -129,11 +129,16 @@ @DOCSTRING(save) -There are three variables that modify the behavior of @code{save} and one -that controls whether variables are saved when Octave exits unexpectedly. +There are three variables that modify the behavior of @code{save} and +three more that control whether variables are saved when Octave exits +unexpectedly. @DOCSTRING(crash_dumps_octave_core) +@DOCSTRING(sighup_dumps_octave_core) + +@DOCSTRING(sigterm_dumps_octave_core) + @DOCSTRING(default_save_format) @DOCSTRING(save_precision)
--- a/doc/interpreter/var.txi +++ b/doc/interpreter/var.txi @@ -371,6 +371,16 @@ Default value: 1. +@item sighup_dumps_octave_core +@xref{Simple File I/O}. + +Default value: 1. + +@item sigterm_dumps_octave_core +@xref{Simple File I/O}. + +Default value: 1. + @item silent_functions @xref{Defining Functions}.
--- a/octMakefile.in +++ b/octMakefile.in @@ -66,7 +66,6 @@ DIRS_TO_MAKE = $(bindir) $(libdir) $(octincludedir)/octave $(fcnfiledir) \ $(octfiledir) $(archlibdir) $(localarchlibdir) $(localverarchlibdir) \ - $(localfcnfilepathdirs) $(localoctfilepathdirs) \ $(shell echo $(localfcnfilepath) | awk -F: '{for (i=1; i<=NF; i++) print $$i}') \ $(shell echo $(localoctfilepath) | awk -F: '{for (i=1; i<=NF; i++) print $$i}')
--- a/octave-config.in +++ b/octave-config.in @@ -5,6 +5,7 @@ # Rafael Laboissiere <rafael@laboissiere.net> # This script is in the public domain +API_VERSION="%OCTAVE_API_VERSION%" CANONICAL_HOST_TYPE="%OCTAVE_CANONICAL_HOST_TYPE%" DEFAULT_PAGER="%OCTAVE_DEFAULT_PAGER%" ARCHLIBDIR="%OCTAVE_ARCHLIBDIR%" @@ -21,6 +22,8 @@ LIBDIR="%OCTAVE_LIBDIR%" LIBEXECDIR="%OCTAVE_LIBEXECDIR%" LIBEXECDIR="%OCTAVE_LIBEXECDIR%" +LOCALAPIFCNFILEDIR="%OCTAVE_LOCALAPIFCNFILEDIR%" +LOCALAPIOCTFILEDIR="%OCTAVE_LOCALAPIOCTFILEDIR%" LOCALARCHLIBDIR="%OCTAVE_LOCALARCHLIBDIR%" LOCALFCNFILEDIR="%OCTAVE_LOCALFCNFILEDIR%" LOCALFCNFILEPATH="%OCTAVE_LOCALFCNFILEPATH%" @@ -67,23 +70,25 @@ -p VAR, --print VAR Print the value of the given configuration variable VAR. Recognized variables are: - CANONICAL_HOST_TYPE LOCALFCNFILEDIR - DEFAULT_PAGER LOCALFCNFILEPATH - ARCHLIBDIR LOCALOCTFILEDIR - BINDIR LOCALOCTFILEPATH - DATADIR LOCALSTARTUPFILEDIR - EXEC_PREFIX LOCALVERARCHLIBDIR - FCNFILEDIR LOCALVERFCNFILEDIR - FCNFILEPATH LOCALVEROCTFILEDIR - IMAGEDIR MAN1DIR - IMAGEPATH MAN1EXT - INCLUDEDIR MANDIR - INFODIR OCTFILEDIR - INFOFILE OCTINCLUDEDIR - LIBDIR OCTLIBDIR - LIBEXECDIR PREFIX - LIBEXECDIR STARTUPFILEDIR - LOCALARCHLIBDIR VERSION + API_VERSION LOCALARCHLIBDIR + CANONICAL_HOST_TYPE LOCALFCNFILEDIR + DEFAULT_PAGER LOCALFCNFILEPATH + ARCHLIBDIR LOCALOCTFILEDIR + BINDIR LOCALOCTFILEPATH + DATADIR LOCALSTARTUPFILEDIR + EXEC_PREFIX LOCALVERARCHLIBDIR + FCNFILEDIR LOCALVERFCNFILEDIR + FCNFILEPATH LOCALVEROCTFILEDIR + IMAGEDIR MAN1DIR + IMAGEPATH MAN1EXT + INCLUDEDIR MANDIR + INFODIR OCTFILEDIR + INFOFILE OCTINCLUDEDIR + LIBDIR OCTLIBDIR + LIBEXECDIR PREFIX + LIBEXECDIR STARTUPFILEDIR + LOCALAPIFCNFILEDIR VERSION + LOCALAPIOCTFILEDIR -v, --version Print the Octave version number.
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,18 @@ 2003-07-08 John W. Eaton <jwe@bevo.che.wisc.edu> + * sighandlers.cc (sig_hup_or_term_handler): New function. + (install_signal_handlers): Install sig_hup_or_term_handler for + SIGHUP and SIGTERM instead of generic_sig_handler. + (Vsighup_dumps_octave_core, Vsigterm_dumps_octave_core): + New static variables. + (sighup_dumps_octave_core, sigterm_dumps_octave_core): + New static functions. + (symbols_of_sighandlers): Add DEFVARs for sighup_dumps_octave_core + and sigterm_dumps_octave_core. + + * defaults.h.in (OCTAVE_LOCALAPIFCNFILEDIR, OCTAVE_LOCALAPIOCTFILEDIR): + Subsitute new variables. + * defun.cc (check_version): Compare version to OCTAVE_API_VERSION, not OCTAVE_VERSION. Mismatch is now fatal. * defun-int.h (DEFINE_FUN_INSTALLER_FUN3): Pass
--- a/src/defaults.h.in +++ b/src/defaults.h.in @@ -92,6 +92,14 @@ #define OCTAVE_LIBEXECDIR %OCTAVE_LIBEXECDIR% #endif +#ifndef OCTAVE_LOCALAPIFCNFILEDIR +#define OCTAVE_LOCALAPIFCNFILEDIR %OCTAVE_LOCALAPIFCNFILEDIR% +#endif + +#ifndef OCTAVE_LOCALAPIOCTFILEDIR +#define OCTAVE_LOCALAPIOCTFILEDIR %OCTAVE_LOCALAPIOCTFILEDIR% +#endif + #ifndef OCTAVE_LOCALARCHLIBDIR #define OCTAVE_LOCALARCHLIBDIR %OCTAVE_LOCALARCHLIBDIR% #endif
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -5415,10 +5415,10 @@ crash_dumps_octave_core (void) { Vcrash_dumps_octave_core = check_preference ("crash_dumps_octave_core"); + return 0; } - static int default_save_format (void) {
--- a/src/sighandlers.cc +++ b/src/sighandlers.cc @@ -60,6 +60,14 @@ // TRUE means we should try to enter the debugger on SIGINT. static bool Vdebug_on_interrupt = false; +// Allow users to avoid writing octave-core for SIGHUP (sent by +// closing gnome-terminal, for example). Note that this variable has +// no effect if Vcrash_dumps_octave_core is FALSE. +static bool Vsighup_dumps_octave_core; + +// Similar to Vsighup_dumps_octave_core, but for SIGTERM signal. +static bool Vsigterm_dumps_octave_core; + #if RETSIGTYPE == void #define SIGHANDLER_RETURN(status) return #else @@ -234,6 +242,44 @@ #endif /* defined(__alpha__) */ #endif /* defined(SIGFPE) */ +#if defined (SIGHUP) || defined (SIGTERM) +static RETSIGTYPE +sig_hup_or_term_handler (int sig) +{ + MAYBE_ACK_SIGNAL (sig); + + MAYBE_REINSTALL_SIGHANDLER (sig, sig_hup_or_term_handler); + + switch (sig) + { +#if defined (SIGHUP) + case SIGHUP: + { + if (Vsighup_dumps_octave_core) + save_user_variables (); + } + break; +#endif + +#if defined (SIGTERM) + case SIGTERM: + { + if (Vsigterm_dumps_octave_core) + save_user_variables (); + } + break; +#endif + + default: + break; + } + + clean_up_and_exit (0); + + SIGHANDLER_RETURN (0); +} +#endif + #if 0 #if defined (SIGWINCH) static RETSIGTYPE @@ -404,7 +450,7 @@ #endif #ifdef SIGHUP - octave_set_signal_handler (SIGHUP, generic_sig_handler); + octave_set_signal_handler (SIGHUP, sig_hup_or_term_handler); #endif #ifdef SIGILL @@ -451,7 +497,7 @@ #endif #ifdef SIGTERM - octave_set_signal_handler (SIGTERM, generic_sig_handler); + octave_set_signal_handler (SIGTERM, sig_hup_or_term_handler); #endif #ifdef SIGTRAP @@ -771,6 +817,22 @@ return 0; } +static int +sighup_dumps_octave_core (void) +{ + Vsighup_dumps_octave_core = check_preference ("sighup_dumps_octave_core"); + + return 0; +} + +static int +sigterm_dumps_octave_core (void) +{ + Vsigterm_dumps_octave_core = check_preference ("sigterm_dumps_octave_core"); + + return 0; +} + void symbols_of_sighandlers (void) { @@ -784,6 +846,24 @@ The default value is 0.\n\ @end defvr"); + DEFVAR (sighup_dumps_octave_core, true, sighup_dumps_octave_core, + "-*- texinfo -*-\n\ +@defvr {Built-in Variable} sighup_dumps_octave_core\n\ +If this variable is set to a nonzero value and\n\ +@code{crash_dumps_octave_core} is also nonzero, Octave tries to save all\n\ +current variables the the file \"octave-core\" if it receives a\n\ +hangup signal. The default value is 1.\n\ +@end defvr"); + + DEFVAR (sigterm_dumps_octave_core, true, sigterm_dumps_octave_core, + "-*- texinfo -*-\n\ +@defvr {Built-in Variable} sigterm_dumps_octave_core\n\ +If this variable is set to a nonzero value and\n\ +@code{crash_dumps_octave_core} is also nonzero, Octave tries to save all\n\ +current variables the the file \"octave-core\" if it receives a\n\ +terminate signal. The default value is 1.\n\ +@end defvr"); + DEFCONST (SIG, make_sig_struct (), "-*- texinfo -*-\n\ @defvr {Built-in Variable} SIG\n\