# HG changeset patch # User John W. Eaton # Date 1328201990 18000 # Node ID 7a7ce92cff5626b56e9d85aa0b0d235e2dee4c03 # Parent 6cb3b158e9732e3269f9db3d1389929c3cf560c9# Parent 1734c3a48f312977331db45cf72f9a95e3c451e9 maint: periodic merge of stable to default diff -r 6cb3b158e973 -r 7a7ce92cff56 scripts/plot/waitbar.m diff -r 6cb3b158e973 -r 7a7ce92cff56 src/DLD-FUNCTIONS/__delaunayn__.cc --- a/src/DLD-FUNCTIONS/__delaunayn__.cc Tue Jan 31 10:40:13 2012 -0800 +++ b/src/DLD-FUNCTIONS/__delaunayn__.cc Thu Feb 02 11:59:50 2012 -0500 @@ -121,10 +121,20 @@ sprintf (flags, "qhull d %s", options.c_str ()); - // Replace the 0 pointer with stdout for debugging information - FILE *outfile = 0; + // Replace the outfile pointer with stdout for debugging information. +#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) + FILE *outfile = gnulib::fopen ("NUL", "w"); +#else + FILE *outfile = gnulib::fopen ("/dev/null", "w"); +#endif FILE *errfile = stderr; - + + if (! outfile) + { + error ("__delaunayn__: Unable to create temporary file for output."); + return retval; + } + int exitcode = qh_new_qhull (dim, n, pt_array, ismalloc, flags, outfile, errfile); if (! exitcode) diff -r 6cb3b158e973 -r 7a7ce92cff56 src/DLD-FUNCTIONS/__voronoi__.cc --- a/src/DLD-FUNCTIONS/__voronoi__.cc Tue Jan 31 10:40:13 2012 -0800 +++ b/src/DLD-FUNCTIONS/__voronoi__.cc Thu Feb 02 11:59:50 2012 -0500 @@ -115,9 +115,19 @@ boolT ismalloc = false; - // Replace the 0 pointer with stdout for debugging information - FILE *outfile = 0; + // Replace the outfile pointer with stdout for debugging information. +#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) + FILE *outfile = gnulib::fopen ("NUL", "w"); +#else + FILE *outfile = gnulib::fopen ("/dev/null", "w"); +#endif FILE *errfile = stderr; + + if (! outfile) + { + error ("__voronoi__: Unable to create temporary file for output."); + return retval; + } // qh_new_qhull command and points arguments are not const... diff -r 6cb3b158e973 -r 7a7ce92cff56 src/DLD-FUNCTIONS/convhulln.cc --- a/src/DLD-FUNCTIONS/convhulln.cc Tue Jan 31 10:40:13 2012 -0800 +++ b/src/DLD-FUNCTIONS/convhulln.cc Thu Feb 02 11:59:50 2012 -0500 @@ -128,10 +128,20 @@ boolT ismalloc = false; - // Replace the 0 pointer with stdout for debugging information. - FILE *outfile = 0; + // Replace the outfile pointer with stdout for debugging information. +#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) + FILE *outfile = gnulib::fopen ("NUL", "w"); +#else + FILE *outfile = gnulib::fopen ("/dev/null", "w"); +#endif FILE *errfile = stderr; + if (! outfile) + { + error ("convhulln: Unable to create temporary file for output."); + return retval; + } + // qh_new_qhull command and points arguments are not const... std::string cmd = "qhull" + options; diff -r 6cb3b158e973 -r 7a7ce92cff56 src/graphics.cc --- a/src/graphics.cc Tue Jan 31 10:40:13 2012 -0800 +++ b/src/graphics.cc Thu Feb 02 11:59:50 2012 -0500 @@ -5977,12 +5977,6 @@ } lims = tmp_lims; } - else - { - // adjust min and max tics if they are out of limits - i1 = static_cast (std::ceil (lo / tick_sep)); - i2 = static_cast (gnulib::floor (hi / tick_sep)); - } Matrix tmp_ticks (1, i2-i1+1); for (int i = 0; i <= i2-i1; i++) @@ -6564,6 +6558,58 @@ { return x; } } +static Matrix +do_zoom (double val, double factor, const Matrix& lims, bool is_logscale) +{ + Matrix new_lims = lims; + + double lo = lims(0); + double hi = lims(1); + + bool is_negative = lo < 0 && hi < 0; + + if (is_logscale) + { + if (is_negative) + { + double tmp = hi; + hi = std::log10 (-lo); + lo = std::log10 (-tmp); + val = std::log10 (-val); + } + else + { + hi = std::log10 (hi); + lo = std::log10 (lo); + val = std::log10 (val); + } + } + + // Perform the zooming + lo = val + factor * (lo - val); + hi = val + factor * (hi - val); + + if (is_logscale) + { + if (is_negative) + { + double tmp = -std::pow (10.0, hi); + hi = -std::pow (10.0, lo); + lo = tmp; + } + else + { + lo = std::pow (10.0, lo); + hi = std::pow (10.0, hi); + } + } + + new_lims(0) = lo; + new_lims(1) = hi; + + return new_lims; +} + void axes::properties::zoom_about_point (double x, double y, double factor, bool push_to_zoom_stack) @@ -6586,11 +6632,8 @@ double max_neg_y = -octave_Inf; get_children_limits (miny, maxy, min_pos_y, max_neg_y, kids, 'y'); - // Perform the zooming - xlims (0) = x + factor * (xlims (0) - x); - xlims (1) = x + factor * (xlims (1) - x); - ylims (0) = y + factor * (ylims (0) - y); - ylims (1) = y + factor * (ylims (1) - y); + xlims = do_zoom (x, factor, xlims, xscale_is ("log")); + ylims = do_zoom (y, factor, ylims, yscale_is ("log")); zoom (xlims, ylims, push_to_zoom_stack); } @@ -6637,10 +6680,17 @@ double max_neg_y = -octave_Inf; get_children_limits (miny, maxy, min_pos_y, max_neg_y, kids, 'y'); - xlims (0) += delta_x; - xlims (1) += delta_x; - ylims (0) += delta_y; - ylims (1) += delta_y; + if (! xscale_is ("log")) + { + xlims (0) += delta_x; + xlims (1) += delta_x; + } + + if (! yscale_is ("log")) + { + ylims (0) += delta_y; + ylims (1) += delta_y; + } zoom (xlims, ylims, false); } diff -r 6cb3b158e973 -r 7a7ce92cff56 src/load-save.cc --- a/src/load-save.cc Tue Jan 31 10:40:13 2012 -0800 +++ b/src/load-save.cc Thu Feb 02 11:59:50 2012 -0500 @@ -649,7 +649,7 @@ std::string orig_fname = ""; // Function called with Matlab-style ["filename", options] syntax - if (argc > 1 && argv[1].at(0) != '-') + if (argc > 1 && ! argv[1].empty () && argv[1].at(0) != '-') { orig_fname = argv[1]; i++; diff -r 6cb3b158e973 -r 7a7ce92cff56 test/test_io.m --- a/test/test_io.m Tue Jan 31 10:40:13 2012 -0800 +++ b/test/test_io.m Thu Feb 02 11:59:50 2012 -0500 @@ -227,6 +227,8 @@ %! %! delete matrix.ascii; +%!error load ("") + %% FIXME: This test is disabled as it writes to stdout and there is no easy %% way to recover output. Need to spawn new octave process and pipe stdout %% somewhere to treat this case.