Mercurial > hg > octave-nkf
changeset 3323:511caaa5e98e
[project @ 1999-10-27 02:21:46 by jwe]
author | jwe |
---|---|
date | Wed, 27 Oct 1999 02:21:50 +0000 |
parents | 8c6b4de3bdc8 |
children | b3c323c43979 |
files | ChangeLog emacs/Makefile.in emacs/octave-hlp.el emacs/octave-inf.el emacs/octave-mod.el src/ChangeLog src/DLD-FUNCTIONS/besselj.cc src/DLD-FUNCTIONS/dassl.cc src/DLD-FUNCTIONS/fsolve.cc src/DLD-FUNCTIONS/getgrent.cc src/DLD-FUNCTIONS/getpwent.cc src/DLD-FUNCTIONS/inv.cc src/DLD-FUNCTIONS/log.cc src/DLD-FUNCTIONS/lsode.cc src/DLD-FUNCTIONS/minmax.cc src/DLD-FUNCTIONS/quad.cc src/DLD-FUNCTIONS/rand.cc src/DLD-FUNCTIONS/time.cc src/defun-dld.h src/load-save.cc |
diffstat | 20 files changed, 234 insertions(+), 159 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-10-26 John W. Eaton <jwe@bevo.che.wisc.edu> + + * emacs/README: New file. + * emacs/Makefile.in (DISTFILES, BINDISTFILES): Add it to the lists. + + * emacs/Makefile.in: Don't distribute .elc files. + 1999-10-21 John W. Eaton <jwe@bevo.che.wisc.edu> * configure.in: Check for select and poll. Also check for poll.h
--- a/emacs/Makefile.in +++ b/emacs/Makefile.in @@ -21,14 +21,11 @@ EL_FILES = octave-hlp.el octave-inf.el octave-mod.el -ELC_FILES = octave-hlp.elc octave-inf.elc octave-mod.elc - SOURCES = $(EL_FILES) otags -DISTFILES = Makefile.in $(EL_FILES) $(ELC_FILES) otags NEWS TODO +DISTFILES = Makefile.in $(EL_FILES) otags NEWS TODO README -BINDISTFILES = \ - $(addprefix $(srcdir)/, $(EL_FILES) $(ELC_FILES) otags NEWS TODO) +BINDISTFILES = $(addprefix $(srcdir)/, $(EL_FILES) otags NEWS TODO README) all: .PHONY: all
--- a/emacs/octave-hlp.el +++ b/emacs/octave-hlp.el @@ -1,6 +1,6 @@ -;; octave-hlp.el --- getting help on Octave symbols using info +;;; octave-hlp.el --- getting help on Octave symbols using info -;;; Copyright (C) 1997 Free Software Foundation, Inc. +;; Copyright (C) 1997 Free Software Foundation, Inc. ;; Author: Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> ;; Author: John Eaton <jwe@bevo.che.wisc.edu>
--- a/emacs/octave-inf.el +++ b/emacs/octave-inf.el @@ -371,4 +371,3 @@ (provide 'octave-inf) ;;; octave-inf.el ends here -
--- a/emacs/octave-mod.el +++ b/emacs/octave-mod.el @@ -40,6 +40,7 @@ ;; `run-octave' for further information on usage and customization. ;;; Code: +(require 'custom) (defgroup octave nil "Major mode for editing Octave source files."
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,28 @@ 1999-10-26 John W. Eaton <jwe@bevo.che.wisc.edu> + * DLD-FUNCTIONS/lsode.cc (Flsode): Be sure to call + unwind_protect::run_frame before returning. + * DLD-FUNCTIONS/quad.cc (Fquad): Likewise. + * DLD-FUNCTIONS/fsolve.cc (Ffsolve): Likewise. + * DLD-FUNCTIONS/dassl.cc (Fdassl): Likewise. + + * load-save.cc (read_mat_ascii_data): When reading from + tmp_stream, check its state, not the state of is. + + * defun-dld.h (INSTALL_DLD_FCN, INSTALL_DLD_FCNS): New macros. + * DLD-FUNCTIONS/dassl.cc: Use them. + * DLD-FUNCTIONS/lsode.cc: Ditto. + * DLD-FUNCTIONS/fsolve.cc: Ditto. + * DLD-FUNCTIONS/quad.cc: Ditto. + * DLD-FUNCTIONS/time.cc: Ditto. + * DLD-FUNCTIONS/besselj.cc: Ditto. + * DLD-FUNCTIONS/getgrent.cc: Ditto. + * DLD-FUNCTIONS/getpwent.cc: Ditto. + * DLD-FUNCTIONS/inv.cc: Ditto. + * DLD-FUNCTIONS/log.cc: Ditto. + * DLD-FUNCTIONS/minmax.cc: Ditto. + * DLD-FUNCTIONS/rand.cc: Ditto. + * data.cc (Flinspace): Let linspace functions handle errors. * mkgendoc (print_doc_string): Handle quoted names. @@ -42,8 +65,9 @@ 1999-10-22 John W. Eaton <jwe@bevo.che.wisc.edu> - * ov-usr-fcn.cc (octave_user_function::do_index_op): If call_depth - is exceeded, call unwind_protect::run_frame before returning. + * ov-usr-fcn.cc (octave_user_function::do_index_op): If + Vmax_recursion_depth is exceeded, call unwind_protect::run_frame + before returning. 1999-10-21 John W. Eaton <jwe@bevo.che.wisc.edu>
--- a/src/DLD-FUNCTIONS/besselj.cc +++ b/src/DLD-FUNCTIONS/besselj.cc @@ -511,9 +511,15 @@ return retval; } +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (besselj); + INSTALL_DLD_FCN (bessely); + INSTALL_DLD_FCN (besseli); + INSTALL_DLD_FCN (besselk); + INSTALL_DLD_FCN (besselh); + INSTALL_DLD_FCN (airy);) + /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */ -
--- a/src/DLD-FUNCTIONS/dassl.cc +++ b/src/DLD-FUNCTIONS/dassl.cc @@ -108,6 +108,30 @@ return retval; } +#define DASSL_ABORT() \ + do \ + { \ + unwind_protect::run_frame ("Fdassl"); \ + return retval; \ + } \ + while (0) + +#define DASSL_ABORT1(msg) \ + do \ + { \ + ::error ("dassl: " ## msg); \ + DASSL_ABORT (); \ + } \ + while (0) + +#define DASSL_ABORT2(fmt, arg) \ + do \ + { \ + ::error ("dassl: " ## fmt, arg); \ + DASSL_ABORT (); \ + } \ + while (0) + DEFUN_DLD (dassl, args, , "dassl (\"function_name\", x_0, xdot_0, t_out)\n\ dassl (F, X_0, XDOT_0, T_OUT, T_CRIT)\n\ @@ -127,10 +151,7 @@ call_depth++; if (call_depth > 1) - { - error ("dassl: invalid recursive call"); - return retval; - } + DASSL_ABORT1 ("invalid recursive call"); int nargin = args.length (); @@ -142,31 +163,22 @@ "; endfunction"); if (! dassl_fcn) - return retval; + DASSL_ABORT (); ColumnVector state = args(1).vector_value (); if (error_state) - { - error ("dassl: expecting state vector as second argument"); - return retval; - } + DASSL_ABORT1 ("expecting state vector as second argument"); ColumnVector deriv = args(2).vector_value (); if (error_state) - { - error ("dassl: expecting derivative vector as third argument"); - return retval; - } + DASSL_ABORT1 ("expecting derivative vector as third argument"); ColumnVector out_times = args(3).vector_value (); if (error_state) - { - error ("dassl: expecting output time vector as fourth argument"); - return retval; - } + DASSL_ABORT1 ("expecting output time vector as fourth argument"); ColumnVector crit_times; int crit_times_set = 0; @@ -175,19 +187,13 @@ crit_times = args(4).vector_value (); if (error_state) - { - error ("dassl: expecting critical time vector as fifth argument"); - return retval; - } + DASSL_ABORT1 ("expecting critical time vector as fifth argument"); crit_times_set = 1; } if (state.capacity () != deriv.capacity ()) - { - error ("dassl: x and xdot must have the same size"); - return retval; - } + DASSL_ABORT1 ("x and xdot must have the same size"); double tzero = out_times (0); @@ -385,21 +391,8 @@ return retval; } -#define DLD_INSTALLER_FCN() \ - bool \ - FSoctave_install_dld_functions (void) - -#define INSTALL_DLD_FCN(name) \ - if (! FS ## name ()) \ - return false - -DLD_INSTALLER_FCN () -{ - INSTALL_DLD_FCN (dassl); - INSTALL_DLD_FCN (dassl_options); - - return true; -} +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (dassl); + INSTALL_DLD_FCN (dassl_options);) /* ;;; Local Variables: ***
--- a/src/DLD-FUNCTIONS/fsolve.cc +++ b/src/DLD-FUNCTIONS/fsolve.cc @@ -124,6 +124,30 @@ return retval; } +#define FSOLVE_ABORT() \ + do \ + { \ + unwind_protect::run_frame ("Ffsolve"); \ + return retval; \ + } \ + while (0) + +#define FSOLVE_ABORT1(msg) \ + do \ + { \ + ::error ("fsolve: " ## msg); \ + FSOLVE_ABORT (); \ + } \ + while (0) + +#define FSOLVE_ABORT2(fmt, arg) \ + do \ + { \ + ::error ("fsolve: " ## fmt, arg); \ + FSOLVE_ABORT (); \ + } \ + while (0) + DEFUN_DLD (fsolve, args, nargout, "Solve nonlinear equations using Minpack. Usage:\n\ \n\ @@ -144,10 +168,7 @@ call_depth++; if (call_depth > 1) - { - error ("fsolve: invalid recursive call"); - return retval; - } + FSOLVE_ABORT1 ("invalid recursive call"); int nargin = args.length (); @@ -157,15 +178,12 @@ "function y = __fsolve_fcn__ (x) y = ", "; endfunction"); if (! fsolve_fcn) - return retval; + FSOLVE_ABORT (); ColumnVector x = args(1).vector_value (); if (error_state) - { - error ("fsolve: expecting vector as second argument"); - return retval; - } + FSOLVE_ABORT1 ("expecting vector as second argument"); if (nargin > 2) warning ("fsolve: ignoring extra arguments"); @@ -344,21 +362,8 @@ return retval; } -#define DLD_INSTALLER_FCN() \ - bool \ - FSoctave_install_dld_functions (void) - -#define INSTALL_DLD_FCN(name) \ - if (! FS ## name ()) \ - return false - -DLD_INSTALLER_FCN () -{ - INSTALL_DLD_FCN (fsolve); - INSTALL_DLD_FCN (fsolve_options); - - return true; -} +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (fsolve); + INSTALL_DLD_FCN (fsolve_options);) /* ;;; Local Variables: ***
--- a/src/DLD-FUNCTIONS/getgrent.cc +++ b/src/DLD-FUNCTIONS/getgrent.cc @@ -216,6 +216,12 @@ return retval; } +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (getgrent); + INSTALL_DLD_FCN (getgrgid); + INSTALL_DLD_FCN (getgrnam); + INSTALL_DLD_FCN (setgrent); + INSTALL_DLD_FCN (endgrent);) + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/DLD-FUNCTIONS/getpwent.cc +++ b/src/DLD-FUNCTIONS/getpwent.cc @@ -220,6 +220,12 @@ return retval; } +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (getpwent); + INSTALL_DLD_FCN (getpwuid); + INSTALL_DLD_FCN (getpwnam); + INSTALL_DLD_FCN (setpwent); + INSTALL_DLD_FCN (endpwent);) + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/DLD-FUNCTIONS/inv.cc +++ b/src/DLD-FUNCTIONS/inv.cc @@ -111,6 +111,9 @@ return Finv (args, nargout); } +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (inv); + INSTALL_DLD_FCN (inverse);) + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/DLD-FUNCTIONS/log.cc +++ b/src/DLD-FUNCTIONS/log.cc @@ -259,6 +259,9 @@ return retval; } +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (logm); + INSTALL_DLD_FCN (sqrtm);) + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/DLD-FUNCTIONS/lsode.cc +++ b/src/DLD-FUNCTIONS/lsode.cc @@ -132,6 +132,30 @@ return retval; } +#define LSODE_ABORT() \ + do \ + { \ + unwind_protect::run_frame ("Flsode"); \ + return retval; \ + } \ + while (0) + +#define LSODE_ABORT1(msg) \ + do \ + { \ + ::error ("lsode: " ## msg); \ + LSODE_ABORT (); \ + } \ + while (0) + +#define LSODE_ABORT2(fmt, arg) \ + do \ + { \ + ::error ("lsode: " ## fmt, arg); \ + LSODE_ABORT (); \ + } \ + while (0) + DEFUN_DLD (lsode, args, nargout, "lsode (F, X0, T_OUT, T_CRIT)\n\ \n\ @@ -150,10 +174,7 @@ call_depth++; if (call_depth > 1) - { - error ("lsode: invalid recursive call"); - return retval; - } + LSODE_ABORT1 ("invalid recursive call"); int nargin = args.length (); @@ -196,28 +217,22 @@ break; default: - error ("lsode: first arg should be a string or 2-element string array"); - break; + LSODE_ABORT1 + ("first arg should be a string or 2-element string array"); } if (error_state || ! lsode_fcn) - return retval; + LSODE_ABORT (); ColumnVector state = args(1).vector_value (); if (error_state) - { - error ("lsode: expecting state vector as second argument"); - return retval; - } + LSODE_ABORT1 ("expecting state vector as second argument"); ColumnVector out_times = args(2).vector_value (); if (error_state) - { - error ("lsode: expecting output time vector as third argument"); - return retval; - } + LSODE_ABORT1 ("expecting output time vector as third argument"); ColumnVector crit_times; @@ -227,10 +242,7 @@ crit_times = args(3).vector_value (); if (error_state) - { - error ("lsode: expecting critical time vector as fourth argument"); - return retval; - } + LSODE_ABORT1 ("expecting critical time vector as fourth argument"); crit_times_set = 1; } @@ -480,21 +492,8 @@ return retval; } -#define DLD_INSTALLER_FCN() \ - bool \ - FSoctave_install_dld_functions (void) - -#define INSTALL_DLD_FCN(name) \ - if (! FS ## name ()) \ - return false - -DLD_INSTALLER_FCN () -{ - INSTALL_DLD_FCN (lsode); - INSTALL_DLD_FCN (lsode_options); - - return true; -} +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (lsode); + INSTALL_DLD_FCN (lsode_options);) /* ;;; Local Variables: ***
--- a/src/DLD-FUNCTIONS/minmax.cc +++ b/src/DLD-FUNCTIONS/minmax.cc @@ -701,6 +701,9 @@ return retval; } +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (min); + INSTALL_DLD_FCN (max);) + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/DLD-FUNCTIONS/quad.cc +++ b/src/DLD-FUNCTIONS/quad.cc @@ -92,6 +92,30 @@ return retval; } +#define QUAD_ABORT() \ + do \ + { \ + unwind_protect::run_frame ("Fquad"); \ + return retval; \ + } \ + while (0) + +#define QUAD_ABORT1(msg) \ + do \ + { \ + ::error ("quad: " ## msg); \ + QUAD_ABORT (); \ + } \ + while (0) + +#define QUAD_ABORT2(fmt, arg) \ + do \ + { \ + ::error ("quad: " ## fmt, arg); \ + QUAD_ABORT (); \ + } \ + while (0) + DEFUN_DLD (quad, args, nargout, "[V, IER, NFUN] = quad (F, A, B [, TOL] [, SING])\n\ \n\ @@ -121,10 +145,7 @@ call_depth++; if (call_depth > 1) - { - error ("quad: invalid recursive call"); - return retval; - } + QUAD_ABORT1 ("invalid recursive call"); int nargin = args.length (); @@ -134,23 +155,17 @@ "function y = __quad_fcn__ (x) y = ", "; endfunction"); if (! quad_fcn) - return retval; + QUAD_ABORT (); double a = args(1).double_value (); if (error_state) - { - error ("quad: expecting second argument to be a scalar"); - return retval; - } + QUAD_ABORT1 ("expecting second argument to be a scalar"); double b = args(2).double_value (); if (error_state) - { - error ("quad: expecting third argument to be a scalar"); - return retval; - } + QUAD_ABORT1 ("expecting third argument to be a scalar"); int indefinite = 0; IndefQuad::IntegralType indef_type = IndefQuad::doubly_infinite; @@ -186,29 +201,20 @@ { case 5: if (indefinite) - { - error("quad: singularities not allowed on infinite intervals"); - return retval; - } + QUAD_ABORT1 ("singularities not allowed on infinite intervals"); have_sing = 1; sing = args(4).vector_value (); if (error_state) - { - error ("quad: expecting vector of singularities as fourth argument"); - return retval; - } + QUAD_ABORT1 ("expecting vector of singularities as fourth argument"); case 4: tol = args(3).vector_value (); if (error_state) - { - error ("quad: expecting vector of tolerances as fifth argument"); - return retval; - } + QUAD_ABORT1 ("expecting vector of tolerances as fifth argument"); switch (tol.capacity ()) { @@ -220,8 +226,7 @@ break; default: - error ("quad: expecting tol to contain no more than two values"); - return retval; + QUAD_ABORT1 ("expecting tol to contain no more than two values"); } case 3: @@ -259,10 +264,7 @@ retval(0) = val; } else - { - print_usage ("quad"); - return retval; - } + print_usage ("quad"); unwind_protect::run_frame ("Fquad"); @@ -417,21 +419,8 @@ return retval; } -#define DLD_INSTALLER_FCN() \ - bool \ - FSoctave_install_dld_functions (void) - -#define INSTALL_DLD_FCN(name) \ - if (! FS ## name ()) \ - return false - -DLD_INSTALLER_FCN () -{ - INSTALL_DLD_FCN (quad); - INSTALL_DLD_FCN (quad_options); - - return true; -} +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (quad); + INSTALL_DLD_FCN (quad_options);) /* ;;; Local Variables: ***
--- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -408,6 +408,9 @@ return retval; } +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (rand); + INSTALL_DLD_FCN (randn);) + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/DLD-FUNCTIONS/time.cc +++ b/src/DLD-FUNCTIONS/time.cc @@ -396,6 +396,12 @@ return retval; } +INSTALL_DLD_FCNS (INSTALL_DLD_FCN (time); + INSTALL_DLD_FCN (gmtime); + INSTALL_DLD_FCN (localtime); + INSTALL_DLD_FCN (mktime); + INSTALL_DLD_FCN (strftime);) + /* ;;; Local Variables: *** ;;; mode: C++ ***
--- a/src/defun-dld.h +++ b/src/defun-dld.h @@ -55,6 +55,26 @@ DEFINE_FUN_INSTALLER_FUN (name, doc) \ DECLARE_FUN (name, args_name, nargout_name) +#if (defined (OCTAVE_LITE) && defined (WITH_DYNAMIC_LINKING)) + +#define INSTALL_DLD_FCNS(body) \ + bool \ + FSoctave_install_dld_functions (void) \ + { \ + body \ + return true; \ + } + +#else + +#define INSTALL_DLD_FCNS(body) + +#endif + +#define INSTALL_DLD_FCN(name) \ + if (! FS ## name ()) \ + return false + #endif #endif
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1096,16 +1096,21 @@ for (int j = 0; j < nc; j++) { tmp_stream >> d; - if (is) + + if (tmp_stream) tmp.elem (i, j) = d; else - goto done; + { + error ("load: failed to read matrix from file `%s'", + filename.c_str ()); + + return name; + } + } } } - done: - if (is) { tc = tmp;