Mercurial > octave
changeset 26521:8b0c9dc0799a
maint: Merge stable to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 11 Jan 2019 15:22:59 -0500 |
parents | 32890ede698c (current diff) 278ae90567a7 (diff) |
children | cd73f8e9235f |
files | libgui/src/m-editor/file-editor-tab.cc libinterp/corefcn/graphics.cc libinterp/corefcn/graphics.in.h |
diffstat | 13 files changed, 132 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/Figure.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/libgui/graphics/Figure.cc Fri Jan 11 15:22:59 2019 -0500 @@ -650,15 +650,6 @@ prop == "position"); } - void - Figure::close_figure_callback (void) - { - figure::properties& fp = properties<figure> (); - octave_value fnum = fp.get___myhandle__ ().as_octave_value (); - - Ffeval (ovl ("close", fnum)); - } - bool Figure::eventNotifyBefore (QObject *obj, QEvent *xevent) { @@ -697,7 +688,7 @@ { case QEvent::Close: xevent->ignore (); - octave_link::post_event (this, &Figure::close_figure_callback); + gh_manager::post_callback (m_handle, "closerequestfcn"); return true; default:
--- a/libgui/graphics/Figure.h Wed Jan 09 14:50:12 2019 -0500 +++ b/libgui/graphics/Figure.h Fri Jan 11 15:22:59 2019 -0500 @@ -108,8 +108,6 @@ void updateFigureToolBarAndMenuBar (void); void set_geometry (QRect r); - void close_figure_callback (void); - void enableMouseTracking (void); private slots:
--- a/libgui/src/m-editor/file-editor-tab.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/libgui/src/m-editor/file-editor-tab.cc Fri Jan 11 15:22:59 2019 -0500 @@ -1900,8 +1900,6 @@ // get default from OS or from settings #if defined (Q_OS_WIN32) int os_eol_mode = QsciScintilla::EolWindows; -#elif defined (Q_OS_MAC) - int os_eol_mode = QsciScintilla::EolMac; #else int os_eol_mode = QsciScintilla::EolUnix; #endif @@ -1987,8 +1985,6 @@ // missing in the settings #if defined (Q_OS_WIN32) int eol_mode = QsciScintilla::EolWindows; -#elif defined (Q_OS_MAC) - int eol_mode = QsciScintilla::EolMac; #else int eol_mode = QsciScintilla::EolUnix; #endif
--- a/libgui/src/settings-dialog.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/libgui/src/settings-dialog.cc Fri Jan 11 15:22:59 2019 -0500 @@ -329,11 +329,9 @@ #if defined (HAVE_QSCINTILLA) # if defined (Q_OS_WIN32) int eol_mode = QsciScintilla::EolWindows; -#elif defined (Q_OS_MAC) - int eol_mode = QsciScintilla::EolMac; -#else +# else int eol_mode = QsciScintilla::EolUnix; -#endif +# endif #else int eol_mode = 2; #endif
--- a/libinterp/corefcn/graphics.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/libinterp/corefcn/graphics.cc Fri Jan 11 15:22:59 2019 -0500 @@ -3388,17 +3388,6 @@ if (is_handle_visible ()) return; - // This object should not be the root "callbackobject" - graphics_object rt = gh_manager::get_object (0); - octave_value cbo = rt.get ("callbackobject"); - if (! cbo.isempty () && cbo.double_value () == __myhandle__) - { - gh_manager::auto_lock guard; - auto& root_props = - dynamic_cast<root_figure::properties&> (rt.get_properties ()); - root_props.set_callbackobject (Matrix ()); - } - // This object should not be the figure "currentobject" graphics_object go (gh_manager::get_object (get___myhandle__ ())); graphics_object fig (go.get_ancestor ("figure")); @@ -3438,17 +3427,16 @@ /* ## test current callback object have visible handle %!test -%! hf = figure ("visible", "off"); -%! hax = axes (); +%! hf = figure ("handlevisibility", "off", "visible", "off"); +%! hax = axes ("parent", hf, "handlevisibility", "off"); %! unwind_protect -%! fcn = @(h) assert (gcbo (), h); +%! fcn = @(h) setappdata (h, "testdata", gcbo ()); +%! addlistener (hf, "color", fcn); %! addlistener (hax, "color", fcn); -%! set (hax, "color", "r"); -%! dellistener (hax, "color", fcn); -%! set (hax, "handlevisibility", "off"); -%! fcn = @() assert (gcbo (), []); -%! addlistener (hax, "color", fcn); +%! set (hf, "color", "b"); %! set (hax, "color", "b"); +%! assert (getappdata (hf, "testdata"), hf) +%! assert (getappdata (hax, "testdata"), hax) %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect; @@ -11366,6 +11354,38 @@ }; class +mcode_event : public base_graphics_event +{ +public: + mcode_event (const graphics_handle& h, const std::string& cmd, + int busyaction = base_graphics_event::QUEUE) + : base_graphics_event (busyaction), handle (h), mcode (cmd) + { } + + void execute (void) + { + if (! mcode.empty ()) + { + graphics_object go = gh_manager::get_object (handle); + if (go.valid_object ()) + { + octave_value cb (mcode); + gh_manager::execute_callback (handle, cb); + } + } + } + +private: + mcode_event (void) + : base_graphics_event (), handle (), mcode () + { } + +private: + graphics_handle handle; + std::string mcode; +}; + +class function_event : public base_graphics_event { public: @@ -11489,6 +11509,14 @@ } graphics_event +graphics_event::create_mcode_event (const graphics_handle& h, + const std::string& cmd, + int busyaction) +{ + return graphics_event (new mcode_event (h, cmd, busyaction)); +} + +graphics_event graphics_event::create_function_event (graphics_event::event_fcn fcn, void *data) { @@ -11566,12 +11594,10 @@ // const "get" method? gh_manager::auto_lock guard; callback_objects.push_front (go); - if (go.get ("handlevisibility").string_value () != "off") - xset_gcbo (h); + xset_gcbo (h); } // Copy CB because "function_value" method is non-const. - octave_value cb = cb_arg; if (cb.is_function () || cb.is_function_handle ()) @@ -11668,22 +11694,26 @@ caseless_str cname (name); int busyaction = base_graphics_event::QUEUE; - if (cname.compare ("deletefcn") - || cname.compare ("createfcn") - || (go.isa ("figure") - && cname.compare ("closerequestfcn")) - || ((go.isa ("figure") - || go.isa ("uipanel") + if (cname == "deletefcn" || cname == "createfcn" + || cname == "closerequestfcn" + || ((go.isa ("figure") || go.isa ("uipanel") || go.isa ("uibuttongroup")) - && (cname.compare ("resizefcn") - || cname.compare ("sizechangedfcn")))) + && (cname == "resizefcn" || cname == "sizechangedfcn"))) busyaction = base_graphics_event::INTERRUPT; else if (go.get_properties ().get_busyaction () == "cancel") busyaction = base_graphics_event::CANCEL; - - do_post_event (graphics_event::create_callback_event (h, name, data, - busyaction)); + // The "closerequestfcn" callback must be executed once the figure has + // been made current. Let "close" do the job. + if (cname == "closerequestfcn") + { + std::string cmd ("close (gcbf ());"); + do_post_event (graphics_event::create_mcode_event (h, cmd, + busyaction)); + } + else + do_post_event (graphics_event::create_callback_event (h, name, data, + busyaction)); } }
--- a/libinterp/corefcn/graphics.in.h Wed Jan 09 14:50:12 2019 -0500 +++ b/libinterp/corefcn/graphics.in.h Fri Jan 11 15:22:59 2019 -0500 @@ -6130,6 +6130,10 @@ int busyaction = base_graphics_event::QUEUE); static graphics_event + create_mcode_event (const graphics_handle& h, const std::string& cmd, + int busyaction); + + static graphics_event create_function_event (event_fcn fcn, void *data = nullptr); static graphics_event
--- a/libinterp/dldfcn/qr.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/libinterp/dldfcn/qr.cc Fri Jan 11 15:22:59 2019 -0500 @@ -40,6 +40,21 @@ #include "ov.h" #include "ovl.h" +/* +## Restore all rand* "state" values +%!function restore_rand_states (state) +%! rand ("state", state.rand); +%! randn ("state", state.randn); +%!endfunction + +%!shared old_state, restore_state +%! ## Save and restore the states of both random number generators that are +%! ## tested by the unit tests in this file. +%! old_state.rand = rand ("state"); +%! old_state.randn = randn ("state"); +%! restore_state = onCleanup (@() restore_rand_states (old_state)); +*/ + template <typename MT> static octave_value get_qr_r (const octave::math::qr<MT>& fact) @@ -842,12 +857,18 @@ %!testif HAVE_CXSPARSE %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = sprandn (n,n,d) + speye (n,n); %! r = qr (a); %! assert (r'*r, a'*a, 1e-10); %!testif HAVE_COLAMD %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = sprandn (n,n,d) + speye (n,n); %! q = symamd (a); %! a = a(q,q); @@ -856,12 +877,18 @@ %!testif HAVE_CXSPARSE %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = sprandn (n,n,d) + speye (n,n); %! [c,r] = qr (a, ones (n,1)); %! assert (r\c, full (a)\ones (n,1), 10e-10); %!testif HAVE_CXSPARSE %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = sprandn (n,n,d) + speye (n,n); %! b = randn (n,2); %! [c,r] = qr (a, b); @@ -870,6 +897,9 @@ ## Test under-determined systems!! %!#testif HAVE_CXSPARSE %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = sprandn (n,n+1,d) + speye (n,n+1); %! b = randn (n,2); %! [c,r] = qr (a, b); @@ -877,12 +907,18 @@ %!testif HAVE_CXSPARSE %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = 1i*sprandn (n,n,d) + speye (n,n); %! r = qr (a); %! assert (r'*r,a'*a,1e-10); %!testif HAVE_COLAMD %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = 1i*sprandn (n,n,d) + speye (n,n); %! q = symamd (a); %! a = a(q,q); @@ -891,12 +927,18 @@ %!testif HAVE_CXSPARSE %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = 1i*sprandn (n,n,d) + speye (n,n); %! [c,r] = qr (a, ones (n,1)); %! assert (r\c, full (a)\ones (n,1), 10e-10); %!testif HAVE_CXSPARSE %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = 1i*sprandn (n,n,d) + speye (n,n); %! b = randn (n,2); %! [c,r] = qr (a, b); @@ -905,6 +947,9 @@ ## Test under-determined systems!! %!#testif HAVE_CXSPARSE %! n = 20; d = 0.2; +%! ## initialize generators to make behavior reproducible +%! rand ("state", 42); +%! randn ("state", 42); %! a = 1i*sprandn (n,n+1,d) + speye (n,n+1); %! b = randn (n,2); %! [c,r] = qr (a, b);
--- a/libinterp/op-kw-docs Wed Jan 09 14:50:12 2019 -0500 +++ b/libinterp/op-kw-docs Fri Jan 11 15:22:59 2019 -0500 @@ -708,13 +708,6 @@ Return from a function. @seealso{function} @end deftypefn -static -@c libinterp/parse-tree/oct-parse.yy --*- texinfo -*- -@deftypefn {} {} static -This statement has been deprecated in favor of @code{persistent}. -@seealso{persistent} -@end deftypefn switch @c libinterp/parse-tree/oct-parse.yy -*- texinfo -*-
--- a/liboctave/array/CNDArray.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/liboctave/array/CNDArray.cc Fri Jan 11 15:22:59 2019 -0500 @@ -190,6 +190,8 @@ ComplexNDArray ComplexNDArray::fourier (int dim) const { + octave_unused_parameter (dim); + (*current_liboctave_error_handler) ("support for FFTW was unavailable or disabled when liboctave was built"); @@ -199,6 +201,8 @@ ComplexNDArray ComplexNDArray::ifourier (int dim) const { + octave_unused_parameter (dim); + (*current_liboctave_error_handler) ("support for FFTW was unavailable or disabled when liboctave was built");
--- a/liboctave/array/dNDArray.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/liboctave/array/dNDArray.cc Fri Jan 11 15:22:59 2019 -0500 @@ -231,6 +231,8 @@ ComplexNDArray NDArray::fourier (int dim) const { + octave_unused_parameter (dim); + (*current_liboctave_error_handler) ("support for FFTW was unavailable or disabled when liboctave was built"); @@ -240,6 +242,8 @@ ComplexNDArray NDArray::ifourier (int dim) const { + octave_unused_parameter (dim); + (*current_liboctave_error_handler) ("support for FFTW was unavailable or disabled when liboctave was built");
--- a/liboctave/array/fCNDArray.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/liboctave/array/fCNDArray.cc Fri Jan 11 15:22:59 2019 -0500 @@ -190,6 +190,8 @@ FloatComplexNDArray FloatComplexNDArray::fourier (int dim) const { + octave_unused_parameter (dim); + (*current_liboctave_error_handler) ("support for FFTW was unavailable or disabled when liboctave was built"); @@ -199,6 +201,8 @@ FloatComplexNDArray FloatComplexNDArray::ifourier (int dim) const { + octave_unused_parameter (dim); + (*current_liboctave_error_handler) ("support for FFTW was unavailable or disabled when liboctave was built");
--- a/liboctave/array/fNDArray.cc Wed Jan 09 14:50:12 2019 -0500 +++ b/liboctave/array/fNDArray.cc Fri Jan 11 15:22:59 2019 -0500 @@ -189,6 +189,8 @@ FloatComplexNDArray FloatNDArray::fourier (int dim) const { + octave_unused_parameter (dim); + (*current_liboctave_error_handler) ("support for FFTW was unavailable or disabled when liboctave was built"); @@ -198,6 +200,8 @@ FloatComplexNDArray FloatNDArray::ifourier (int dim) const { + octave_unused_parameter (dim); + (*current_liboctave_error_handler) ("support for FFTW was unavailable or disabled when liboctave was built"); return FloatComplexNDArray ();
--- a/scripts/specfun/betainc.m Wed Jan 09 14:50:12 2019 -0500 +++ b/scripts/specfun/betainc.m Fri Jan 11 15:22:59 2019 -0500 @@ -201,7 +201,7 @@ %!assert (betainc (0.001, 20, 30), 2.750687665855991e-47, -3e-14); %!assert (betainc (0.0001, 20, 30), 2.819953178893307e-67, -7e-14); -%!assert <54383> (betainc (0.99, 20, 30, "upper"), 1.5671643161872703e-47, -5e-14); +%!assert <54383> (betainc (0.99, 20, 30, "upper"), 1.5671643161872703e-47, -7e-14); %!assert (betainc (0.999, 20, 30, "upper"), 1.850806276141535e-77, -7e-14); %!assert (betainc (0.5, 200, 300), 0.9999964565197356, -1e-15); %!assert (betainc (0.5, 200, 300, "upper"), 3.54348026439253e-06, -3e-13);