Mercurial > hg > octave-lyh
changeset 17153:73afa852a898
Merge the official development
author | LYH <lyh.kernel@gmail.com> |
---|---|
date | Fri, 02 Aug 2013 20:08:18 +0800 |
parents | c3cb55d917a9 (current diff) bbda4d952eb5 (diff) |
children | 44a301d5551a |
files | |
diffstat | 11 files changed, 98 insertions(+), 91 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/interpreter/contributors.in +++ b/doc/interpreter/contributors.in @@ -140,6 +140,7 @@ Piotr Krzyzanowski Volker Kuhlmann Tetsuro Kurita +Philipp Kutin Miroslaw Kwasniak Rafael Laboissiere Kai Labusch
--- a/doc/interpreter/intro.txi +++ b/doc/interpreter/intro.txi @@ -532,15 +532,15 @@ @subsection Format of Descriptions @cindex description format -Functions, commands, and variables are described in this manual in a +Functions and commands are described in this manual in a uniform format. The first line of a description contains the name of the item followed by its arguments, if any. @ifnottex -The category---function, variable, or whatever---appears at the +The category---function, command, or whatever---appears at the beginning of the line. @end ifnottex @iftex -The category---function, variable, or whatever---is printed next to the +The category---function, command, or whatever---is printed next to the right margin. @end iftex The description follows on succeeding lines, sometimes with examples. @@ -548,7 +548,6 @@ @menu * A Sample Function Description:: * A Sample Command Description:: -* A Sample Variable Description:: @end menu @node A Sample Function Description @@ -643,27 +642,3 @@ printed and the working directory is not changed. @end deftypefn -@node A Sample Variable Description -@subsubsection A Sample Variable Description -@cindex variable descriptions - -A @dfn{variable} is a name that can hold a value. Although any variable -can be set by the user, @dfn{built-in variables} typically exist -specifically so that users can change them to alter the way Octave -behaves (built-in variables are also sometimes called @dfn{user -options}). Ordinary variables and built-in variables are described -using a format like that for functions except that there are no -arguments. - -Here is a description of the imaginary variable -@code{do_what_i_mean_not_what_i_say}. - -@defvr {Built-in Variable} do_what_i_mean_not_what_i_say -If the value of this variable is nonzero, Octave will do what you -actually wanted, even if you have typed a completely different and -meaningless list of commands. -@end defvr - -Other variable descriptions have the same format, but `Built-in -Variable' is replaced by `Variable', for ordinary variables, or -`Constant' for symbolic constants whose values cannot be changed.
--- a/doc/interpreter/octave.texi +++ b/doc/interpreter/octave.texi @@ -222,7 +222,6 @@ * A Sample Function Description:: * A Sample Command Description:: -* A Sample Variable Description:: Getting Started
--- a/libinterp/dldfcn/__init_fltk__.cc +++ b/libinterp/dldfcn/__init_fltk__.cc @@ -1110,9 +1110,14 @@ { Matrix pos (1,2,0); pos(0) = px; - // FIXME - only works if (uimenu->is_visible ()) ? - pos(1) = h () - status_h - menu_h - py; + pos(1) = h () - menu_h - py; + if (! uimenu->is_visible ()) + pos(1) = pos(1) + menu_h; fp.set_currentpoint (pos); + graphics_object robj = gh_manager::get_object (fp.get_parent ()); + root_figure::properties& rp = + dynamic_cast<root_figure::properties&> (robj.get_properties ()); + rp.set_currentfigure (fp.get___myhandle__ ().value ()); } } @@ -1133,6 +1138,7 @@ pos(1,1) = yy; ap.set_currentpoint (pos); + fp.set_currentaxes (ap.get___myhandle__ ().value ()); } }
--- a/libinterp/dldfcn/__magick_read__.cc +++ b/libinterp/dldfcn/__magick_read__.cc @@ -55,20 +55,22 @@ const Range cols = pixel_region (1).range_value (); region["row_start"] = rows.base () -1; region["col_start"] = cols.base () -1; - region["row_end"] = rows.limit () -1; - region["col_end"] = cols.limit () -1; + region["row_end"] = rows.max () -1; + region["col_end"] = cols.max () -1; - // Length of the area to load into the Image Pixel Cache + // Length of the area to load into the Image Pixel Cache. We use max and + // min to account for cases where last element of range is the range limit. region["row_cache"] = region["row_end"] - region["row_start"] +1; region["col_cache"] = region["col_end"] - region["col_start"] +1; // How much we have to shift in the memory when doing the loops. region["row_shift"] = region["col_cache"] * rows.inc (); - region["col_shift"] = region["col_cache"] * region["row_cache"] - cols.inc (); + region["col_shift"] = region["col_cache"] * + (region["row_cache"] + rows.inc () -1) - cols.inc (); // The actual height and width of the output image - region["row_out"] = floor ((region["row_end"] - region["row_start"]) / rows.inc ()) + 1; - region["col_out"] = floor ((region["col_end"] - region["col_start"]) / cols.inc ()) + 1; + region["row_out"] = rows.nelem (); + region["col_out"] = cols.nelem (); return region; } @@ -221,10 +223,10 @@ // using quantumOperator for the cases where we will be returning floating // point and want things in the range [0 1]. This is the same reason why // the divisor is of type double. - const double divisor = (imvec[0].depth () == 32) ? - std::numeric_limits<uint32_t>::max () : - ((uint64_t (1) << QuantumDepth) - 1) / - ((uint64_t (1) << imvec[0].depth ()) - 1); + const bool float_out = imvec[0].depth () == 32; + const double type_max = float_out ? 1 : ((uint64_t (1) << QuantumDepth) - 1); + const double divisor = float_out ? std::numeric_limits<uint32_t>::max () : + type_max / ((uint64_t (1) << imvec[0].depth ()) - 1); // FIXME: this workaround should probably be fixed in GM by creating a // new ImageType BilevelMatteType @@ -320,7 +322,7 @@ for (octave_idx_type row = 0; row < nRows; row++) { img_fvec[idx] = pix->red / divisor; - a_fvec[idx] = pix->opacity / divisor; + a_fvec[idx] = abs ((pix->opacity / divisor) - type_max); pix += row_shift; idx++; } @@ -395,7 +397,7 @@ rbuf[idx] = pix->red / divisor; gbuf[idx] = pix->green / divisor; bbuf[idx] = pix->blue / divisor; - a_fvec[a_idx] = pix->opacity / divisor; + a_fvec[idx] = abs ((pix->opacity / divisor) - type_max); pix += row_shift; idx++; a_idx++; @@ -478,7 +480,7 @@ mbuf[idx] = pix->green / divisor; ybuf[idx] = pix->blue / divisor; kbuf[idx] = pix->opacity / divisor; - a_fvec[a_idx] = *apix / divisor; + a_fvec[idx] = abs ((*apix / divisor) - type_max); pix += row_shift; idx++; a_idx++; @@ -649,15 +651,18 @@ { if (depth <= 1) { - output = read_indexed_images <boolNDArray> (imvec, frameidx, nargout, options); + output = read_indexed_images <boolNDArray> (imvec, frameidx, + nargout, options); } else if (depth <= 8) { - output = read_indexed_images <uint8NDArray> (imvec, frameidx, nargout, options); + output = read_indexed_images <uint8NDArray> (imvec, frameidx, + nargout, options); } else if (depth <= 16) { - output = read_indexed_images <uint16NDArray> (imvec, frameidx, nargout, options); + output = read_indexed_images <uint16NDArray> (imvec, frameidx, + nargout, options); } else { @@ -670,19 +675,23 @@ { if (depth <= 1) { - output = read_images<boolNDArray> (imvec, frameidx, nargout, options); + output = read_images<boolNDArray> (imvec, frameidx, + nargout, options); } else if (depth <= 8) { - output = read_images<uint8NDArray> (imvec, frameidx, nargout, options); + output = read_images<uint8NDArray> (imvec, frameidx, + nargout, options); } else if (depth <= 16) { - output = read_images<uint16NDArray> (imvec, frameidx, nargout, options); + output = read_images<uint16NDArray> (imvec, frameidx, + nargout, options); } else if (depth <= 32) { - output = read_images<FloatNDArray> (imvec, frameidx, nargout, options); + output = read_images<FloatNDArray> (imvec, frameidx, + nargout, options); } else {
--- a/scripts/plot/figure.m +++ b/scripts/plot/figure.m @@ -45,59 +45,64 @@ nargs = nargin; - f = NaN; - - init_new_figure = false; - if (mod (nargs, 2) == 1) - tmp = varargin{1}; - if (ischar (tmp)) - tmp = str2double (tmp); + if (mod (nargs, 2) == 0) + f = NaN; + init_new_figure = true; + else + arg = varargin{1}; + if (ischar (arg)) + arg = str2double (arg); endif - if (isfigure (tmp)) - f = tmp; + if (isfigure (arg)) + f = arg; + init_new_figure = false; varargin(1) = []; nargs--; - elseif (isnumeric (tmp) && tmp > 0 && tmp == fix (tmp)) - f = tmp; + elseif (isnumeric (arg) && isscalar (arg) && arg > 0 && arg == fix (arg)) + f = arg; init_new_figure = true; varargin(1) = []; nargs--; else - error ("figure: expecting figure handle or figure number"); + error ("figure: N must be figure handle or figure number"); endif endif + if (rem (nargs, 2) == 1) + error ("figure: PROPERTY/VALUE arguments must be in pairs"); + endif + ## Check to see if we already have a figure on the screen. If we do, ## then update it if it is different from the figure we are creating ## or switching to. - cf = get (0, "currentfigure"); # Can't use gcf () because it calls figure () + cf = get (0, "currentfigure"); # Can't use gcf () because it calls figure() if (! isempty (cf) && cf != 0) - if (isnan (f) || cf != f) + if (init_new_figure || cf != f) drawnow (); endif endif - if (rem (nargs, 2) == 0) - if (isnan (f) || init_new_figure) - if (ismac () && strcmp (graphics_toolkit (), "fltk")) - ## FIXME - Hack for fltk-aqua to work around bug #31931 - f = __go_figure__ (f); - drawnow (); - if (! isempty (varargin)) - set (f, varargin{:}); - endif - else - f = __go_figure__ (f, varargin{:}); + if (init_new_figure) + if (ismac () && strcmp (graphics_toolkit (), "fltk")) + ## FIXME: Hack for fltk-aqua to work around bug #31931 + f = __go_figure__ (f); + drawnow (); + if (! isempty (varargin)) + set (f, varargin{:}); endif - elseif (nargs > 0) - set (f, varargin{:}); + else + f = __go_figure__ (f, varargin{:}); endif - set (0, "currentfigure", f); - else - print_usage (); + __add_default_menu__ (f); + elseif (nargs > 0) + set (f, varargin{:}); endif - __add_default_menu__ (f); + set (0, "currentfigure", f); + ## When switching to figure N, make figure visible and on top of stack. + if (! init_new_figure) + set (f, "visible", "on"); + endif if (nargout > 0) h = f; @@ -109,9 +114,14 @@ %!test %! hf = figure ("visible", "off"); %! unwind_protect -%! assert (gcf, hf); +%! assert (hf, gcf); %! assert (isfigure (hf)); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect +%!error <N must be figure handle or figure number> figure ({1}) +%!error <N must be figure handle or figure number> figure ([1 2]) +%!error <N must be figure handle or figure number> figure (-1) +%!error <N must be figure handle or figure number> figure (1.5) +
--- a/scripts/plot/print.m +++ b/scripts/plot/print.m @@ -293,7 +293,7 @@ endif orig_figure = get (0, "currentfigure"); - figure (opts.figure); + set (0, "currentfigure", opts.figure); if (opts.append_to_file) [~, ~, ext] = fileparts (opts.ghostscript.output); @@ -437,7 +437,7 @@ end_unwind_protect if (isfigure (orig_figure)) - figure (orig_figure); + set (0, "currentfigure", orig_figure); endif endfunction
--- a/scripts/plot/private/__fltk_print__.m +++ b/scripts/plot/private/__fltk_print__.m @@ -25,7 +25,7 @@ dos_shell = (ispc () && ! isunix ()); - figure (opts.figure); + set (0, "currentfigure", opts.figure); drawnow ("expose"); __fltk_redraw__ ();
--- a/scripts/plot/private/__gnuplot_print__.m +++ b/scripts/plot/private/__gnuplot_print__.m @@ -184,7 +184,7 @@ else mono = false; endif - figure (opts.figure); + set (0, "currentfigure", opts.figure); if (isempty (opts.debug_file) || ! opts.debug) drawnow (term, file, mono); else
--- a/scripts/plot/waitbar.m +++ b/scripts/plot/waitbar.m @@ -87,9 +87,13 @@ endif if (h) - p = findobj (h, "type", "patch"); + gd = get (h, "__guidata__"); + ## Get the cached handles. + ax = gd(1); + p = gd(2); + set (p, "xdata", [0; frac; frac; 0]); - ax = findobj (h, "type", "axes"); + if (ischar (msg) || iscellstr (msg)) th = get (ax, "title"); curr_msg = get (th, "string"); @@ -116,7 +120,10 @@ "xlimmode", "manual", "ylimmode", "manual", "position", [0.1, 0.3, 0.8, 0.2]); - patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]); + p = patch (ax, [0; frac; frac; 0], [0; 0; 1; 1], [0, 0.35, 0.75]); + + ## Cache the axes and patch handles. + set (h, "__guidata__", [ax p]); if (! (ischar (msg) || iscellstr (msg))) msg = "Please wait...";
--- a/scripts/signal/fftfilt.m +++ b/scripts/signal/fftfilt.m @@ -141,7 +141,7 @@ %! assert (fftfilt (b.',x ), [1 1 0 0 0 0 0 0 0 0] ); %! assert (fftfilt (b.',x.'), [1 1 0 0 0 0 0 0 0 0].'); %! assert (fftfilt (b, [x.' x.']), [1 1 0 0 0 0 0 0 0 0].'*[1 1]); -%! assert (fftfilt (b, [x.'+eps x.']) == [1 1 0 0 0 0 0 0 0 0].'*[1 1], [false(10, 1) true(10, 1)]); +%! assert (fftfilt (b, [x.'+2*eps x.']) == [1 1 0 0 0 0 0 0 0 0].'*[1 1], [false(10, 1) true(10, 1)]); %!test %! r = sqrt (1/2) * (1+i);