Mercurial > hg > octave-terminal
changeset 14907:6985da10c5a9
maint: Periodic merge of default to jit
author | Jordi Gutiérrez Hermoso <jordigh@octave.org> |
---|---|
date | Thu, 17 May 2012 19:50:01 -0400 |
parents | 3f81e8b42955 (current diff) f40c355491cc (diff) |
children | f5fe1e3bda34 |
files | |
diffstat | 27 files changed, 206 insertions(+), 83 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS +++ b/NEWS @@ -89,6 +89,11 @@ static + ** The colormap function now provides new options "list", "register", + and "unregister" to list all available colormap functions, and to + add or remove a function name from teh list of known colormap + functions. Packages that implement extra colormaps should use these + commands with PKG_ADD and PKG_DEL statements. Summary of important user-visible changes for version 3.6: ---------------------------------------------------------
--- a/etc/HACKING +++ b/etc/HACKING @@ -5,7 +5,7 @@ * Working from the repository -These notes are intended to help people working on sources checked-out from +These notes are intended to help people working on sources cloned from the savannah source code repository. These requirements do not apply when building from a distribution tarball. @@ -13,7 +13,7 @@ We've opted to keep only the highest-level sources in the repository. This eases our maintenance burden, (fewer merges, etc.), but imposes -more requirements on anyone wishing to build from the just-checked-out +more requirements on anyone wishing to build from the just-cloned sources. For example, you have to use the latest stable versions of the maintainer tools we depend upon, including: @@ -35,15 +35,15 @@ Later, after synchronizing from the repository, a plain `make' should be sufficient. -** First checkout +** First clone -Obviously, if you are reading these notes, you did manage to check out +If you are reading these notes, you may have already managed to clone this package from the repository. For the record, you will find all the relevant information on downloading sources at: http://www.gnu.org/software/octave/download.html -After checking out Octave, you will need to run the autogen.sh script: +After cloning Octave, you will need to run the autogen.sh script: $ ./autogen.sh @@ -51,8 +51,7 @@ fragments and then runs the bootstrap script. The bootstrap script comes from gnulib, but is kept in the Octave source archive. It should be updated from the gnulib sources as necssary. The bootstrap script takes -care of checking out a copy of gnulib, running the autotools, and -generating the configure script. +care of running the autotools and generating the configure script. If you have a copy of gnulib in some directory apart from the Octave source tree, then pass the name of the directory containing gnulib-tool @@ -66,12 +65,10 @@ gnulib-tool script resides). By using an external gnulib directory, you can share a single gnulib source -tree among several projects. Regardless of the location of the gnulib -sources, the bootstrap script will try to update them if it appears -that they are checked out using git. Otherwise, it is your -responsibility to keep the gnulib sources up to date. They change -frequently, so the best way to stay current is probably to use git to -do the job. +tree among several projects. Since 2011, the gnulib sources are a Mercurial +subrepository, so they will be automatically updated to the +corresponding Mercurial revision if you update the working directory to +a past revision not too far in the past. Additional options besides --gnulib-srcdir can be passed to autogen.sh and they will be forwarded without modification to the bootstrap script. @@ -83,8 +80,8 @@ $ make $ make check -At this point, there should be no difference between your local copy, -and the master copy: +At this point, there should be no difference between your working tree +and the currently visited hg revision: $ hg diff
--- a/scripts/general/bitset.m +++ b/scripts/general/bitset.m @@ -22,7 +22,7 @@ ## @deftypefnx {Function File} {@var{C} =} bitset (@var{A}, @var{n}, @var{val}) ## Set or reset bit(s) @var{n} of unsigned integers in @var{A}. ## @var{val} = 0 resets and @var{val} = 1 sets the bits. -## The lowest significant bit is: @var{n} = 1. All variables must be the +## The lowest significant bit is: @var{n} = 1. All variables must be the ## same size or scalars. ## ## @example @@ -34,12 +34,16 @@ ## @seealso{bitand, bitor, bitxor, bitget, bitcmp, bitshift, bitmax} ## @end deftypefn -function A = bitset (A, n, val) +function C = bitset (A, n, val) if (nargin < 2 || nargin > 3) print_usage (); endif + if (any (A(:) < 0)) + error ("bitset: A must be >= 0"); + endif + sz = size (A); if (nargin == 2) @@ -53,8 +57,7 @@ Amax = log2 (Bmax); elseif (isinteger (A)) Bmax = intmax (cl); - ## FIXME: Better way to get number of bits than regexping? - Amax = str2num (nthargout (4, @regexp, cl, '\d{1,2}'){1}); + Amax = round (log2 (Bmax)); else error ("bitset: invalid class %s", cl); endif @@ -79,8 +82,9 @@ offmask = mask(off); endif - A(on) = bitor (A(on), onmask); - A(off) = bitand (A(off), bitcmp (offmask)); + C = zeros (sz, cl); + C(on) = bitor (A(on), onmask); + C(off) = bitand (A(off), bitcmp (offmask)); endfunction @@ -96,19 +100,23 @@ %! endfor ## Bug #36458 -%!assert (bitset(uint8 ([1, 2;3 4]), 1, [0 1; 0 1]), uint8 ([0, 3; 2 5])) - -%!error bitset (0, 0) -%!error bitset (0, 55) -%!error bitset (int8 (0), 9) -%!error bitset (uint8 (0), 9) -%!error bitset (int16 (0), 17) -%!error bitset (uint16 (0), 17) -%!error bitset (int32 (0), 33) -%!error bitset (uint32 (0), 33) -%!error bitset (int64 (0), 65) -%!error bitset (uint64 (0), 65) +%!assert (bitset (uint8 ([1, 2;3 4]), 1, [0 1; 0 1]), uint8 ([0, 3; 2 5])) %!error bitset (1) %!error bitset (1, 2, 3, 4) +%!error <A must be .= 0> bitset (-1, 2) +%!error <invalid class char> bitset ("1", 2) +%!error <N must be in the range \[1,53\]> bitset (0, 0) +%!error <N must be in the range \[1,53\]> bitset (0, 55) +%!error <N must be in the range \[1,8\]> bitset (uint8 (0), 0) +%!error <N must be in the range \[1,8\]> bitset (uint8 (0), 9) +%!error <N must be in the range \[1,7\]> bitset (int8 (0), 9) +%!error <N must be in the range \[1,15\]> bitset (int16 (0), 17) +%!error <N must be in the range \[1,16\]> bitset (uint16 (0), 17) +%!error <N must be in the range \[1,31\]> bitset (int32 (0), 33) +%!error <N must be in the range \[1,32\]> bitset (uint32 (0), 33) +%!error <N must be in the range \[1,63\]> bitset (int64 (0), 65) +%!error <N must be in the range \[1,64\]> bitset (uint64 (0), 65) +%!error <N must be scalar or the same size as A> bitset (uint8 (1), [1 3]) +%!error <N must be scalar or the same size as A> bitset (uint8 (1:3), [1 3])
--- a/scripts/image/autumn.m +++ b/scripts/image/autumn.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "autumn"); +## PKG_DEL: colormap ("unregister", "autumn"); + function map = autumn (n) if (nargin == 0) @@ -48,7 +51,7 @@ b = zeros (n, 1); map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/bone.m +++ b/scripts/image/bone.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "bone"); +## PKG_DEL: colormap ("unregister", "bone"); + function map = bone (n) if (nargin == 0) @@ -41,7 +44,7 @@ endif if (n == 1) - map = [0, 0, 0]; + map = [0.125, 0.125, 0.125]; elseif (n > 1) x = linspace (0, 1, n)'; r = (x < 3/4) .* (7/8 * x) ... @@ -53,7 +56,7 @@ + (x >= 3/8) .* (7/8 * x + 1/8); map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/colormap.m +++ b/scripts/image/colormap.m @@ -1,4 +1,5 @@ ## Copyright (C) 1994-2012 John W. Eaton +## Copyright (C) 2012 Carnë Draug ## ## This file is part of Octave. ## @@ -20,6 +21,9 @@ ## @deftypefn {Function File} {@var{cmap} =} colormap () ## @deftypefnx {Function File} {@var{cmap} =} colormap (@var{map}) ## @deftypefnx {Function File} {@var{cmap} =} colormap ("default") +## @deftypefnx {Function File} {@var{cmap} =} colormap ("list") +## @deftypefnx {Function File} {@var{cmap} =} colormap ("register", "name") +## @deftypefnx {Function File} {@var{cmap} =} colormap ("unregister", "name") ## Query or set the current colormap. ## ## @code{colormap (@var{map})} sets the current colormap to @var{map}. The @@ -30,6 +34,10 @@ ## @code{colormap ("default")} restores the default colormap (the ## @code{jet} map with 64 entries). The default colormap is returned. ## +## @code{colormap ("list")} returns a cell array with all the available +## colormaps. The options `register' and `unregister' will add or remove the +## colormap @var{name} to it. +## ## With no arguments, @code{colormap} returns the current color map. ## @seealso{jet} ## @end deftypefn @@ -38,17 +46,22 @@ ## Created: July 1994 ## Adapted-By: jwe -function cmap = colormap (map) +function cmap = colormap (map, name) - if (nargin > 1) + if (nargin > 2) print_usage (); endif + persistent map_list = cell (); + if (nargin == 1) if (ischar (map)) if (strcmp (map, "default")) map = jet (64); + elseif (strcmp (map, "list")) + cmap = map_list; + return; else map = feval (map); endif @@ -65,6 +78,16 @@ set (gcf (), "colormap", map); endif + elseif (nargin == 2) + if (! ischar (map) || all (! strcmp (map, {"register", "unregister"}))) + print_usage (); + elseif (! ischar (name)) + error ("colormap: to register/unregister a colormap, NAME must be a string"); + elseif (strcmp (map, "register")) + map_list{end+1} = name; + elseif (strcmp (map, "unregister")) + map_list(strcmp (name, map_list)) = []; + endif endif ## Return current color map.
--- a/scripts/image/cool.m +++ b/scripts/image/cool.m @@ -27,6 +27,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "cool"); +## PKG_DEL: colormap ("unregister", "cool"); + function map = cool (n) if (nargin == 0) @@ -47,7 +50,7 @@ b = ones (n, 1); map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/copper.m +++ b/scripts/image/copper.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "copper"); +## PKG_DEL: colormap ("unregister", "copper"); + function map = copper (n) if (nargin == 0) @@ -50,7 +53,7 @@ b = 1/2 * x; map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/flag.m +++ b/scripts/image/flag.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "flag"); +## PKG_DEL: colormap ("unregister", "flag"); + function map = flag (n) if (nargin == 0) @@ -40,8 +43,14 @@ print_usage (); endif - C = [1, 0, 0; 1, 1, 1; 0, 0, 1; 0, 0, 0]; - map = C(rem (0:(n-1), 4) + 1, :); + if (n == 1) + map = [1, 0, 0]; + elseif (n > 1) + C = [1, 0, 0; 1, 1, 1; 0, 0, 1; 0, 0, 0]; + map = C(rem (0:(n-1), 4) + 1, :); + else + map = zeros (0, 3); + endif endfunction
--- a/scripts/image/gmap40.m +++ b/scripts/image/gmap40.m @@ -28,6 +28,9 @@ ## @seealso{colormap} ## @end deftypefn +## PKG_ADD: colormap ("register", "gmap40"); +## PKG_DEL: colormap ("unregister", "gmap40"); + function map = gmap40 (n) if (nargin == 0) @@ -40,8 +43,12 @@ print_usage (); endif - C = [1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1]; - map = C(rem (0:(n-1), 6) + 1, :); + if (n > 1) + C = [1, 0, 0; 0, 1, 0; 0, 0, 1; 1, 1, 0; 1, 0, 1; 0, 1, 1]; + map = C(rem (0:(n-1), 6) + 1, :); + else + map = zeros (0, 3); + endif endfunction
--- a/scripts/image/gray.m +++ b/scripts/image/gray.m @@ -30,6 +30,9 @@ ## Created: July 1994 ## Adapted-By: jwe +## PKG_ADD: colormap ("register", "gray"); +## PKG_DEL: colormap ("unregister", "gray"); + function map = gray (n) if (nargin == 0) @@ -42,9 +45,14 @@ print_usage (); endif - gr = [0:(n-1)]' / (n - 1); - - map = [gr, gr, gr]; + if (n == 1) + map = [0, 0, 0]; + elseif (n > 1) + gr = [0:(n-1)]' / (n - 1); + map = [gr, gr, gr]; + else + map = zeros (0, 3); + endif endfunction
--- a/scripts/image/hot.m +++ b/scripts/image/hot.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "hot"); +## PKG_DEL: colormap ("unregister", "hot"); + function map = hot (n) if (nargin == 0) @@ -41,7 +44,7 @@ endif if (n == 1) - map = [0, 0, 0]; + map = [1, 1, 1]; elseif (n > 1) x = linspace (0, 1, n)'; r = (x < 2/5) .* (5/2 * x) ... @@ -51,7 +54,7 @@ b = (x >= 4/5) .* (5 * x - 4); map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/hsv.m +++ b/scripts/image/hsv.m @@ -32,6 +32,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "hsv"); +## PKG_DEL: colormap ("unregister", "hsv"); + function map = hsv (n) if (nargin == 0) @@ -50,7 +53,7 @@ hue = linspace (0, 1, n)'; map = hsv2rgb ([hue, ones(n,1), ones(n,1)]); else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/jet.m +++ b/scripts/image/jet.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "jet"); +## PKG_DEL: colormap ("unregister", "jet"); + function map = jet (n) if (nargin == 0) @@ -41,7 +44,7 @@ endif if (n == 1) - map = [0, 0, 0.5]; + map = [0, 1, 1]; elseif (n > 1) x = linspace (0, 1, n)'; r = (x >= 3/8 & x < 5/8) .* (4 * x - 3/2) ... @@ -55,7 +58,7 @@ + (x >= 3/8 & x < 5/8) .* (-4 * x + 5/2); map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/lines.m +++ b/scripts/image/lines.m @@ -27,6 +27,9 @@ ## @seealso{colormap} ## @end deftypefn +## PKG_ADD: colormap ("register", "lines"); +## PKG_DEL: colormap ("unregister", "lines"); + function map = lines (n) if (nargin == 0) @@ -39,9 +42,15 @@ print_usage (); endif - C = get (gca, "colororder"); - nr = rows (C); - map = C(rem (0:(n-1), nr) + 1, :); + if (n == 1) + map = [0, 0, 1]; + elseif (n > 1) + C = get (gca, "colororder"); + nr = rows (C); + map = C(rem (0:(n-1), nr) + 1, :); + else + map = zeros (0, 3); + endif endfunction
--- a/scripts/image/ocean.m +++ b/scripts/image/ocean.m @@ -30,6 +30,9 @@ ## Created: July 1994 ## Adapted-By: jwe +## PKG_ADD: colormap ("register", "ocean"); +## PKG_DEL: colormap ("unregister", "ocean"); + function map = ocean (n) if (nargin == 0) @@ -42,17 +45,23 @@ print_usage (); endif - cutin = fix (n/3); + if (n == 1) + map = [0, 0, 0]; + elseif (n > 1) + cutin = fix (n/3); - dr = (n - 1) / cutin; - r = prepad ([0:dr:(n-1)], n)'; + dr = (n - 1) / cutin; + r = prepad ([0:dr:(n-1)], n)'; - dg = (n - 1) / (2 * cutin); - g = prepad ([0:dg:(n-1)], n)'; + dg = (n - 1) / (2 * cutin); + g = prepad ([0:dg:(n-1)], n)'; + + b = [0:(n-1)]'; - b = [0:(n-1)]'; - - map = [r, g, b] / (n - 1); + map = [r, g, b] / (n - 1); + else + map = zeros (0, 3); + endif endfunction
--- a/scripts/image/pink.m +++ b/scripts/image/pink.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "pink"); +## PKG_DEL: colormap ("unregister", "pink"); + function map = pink (n) if (nargin == 0) @@ -41,7 +44,7 @@ endif if (n == 1) - map = [0, 0, 0]; + map = sqrt([1/3, 1/3, 1/3]); elseif (n > 1) x = linspace (0, 1, n)'; r = (x < 3/8) .* (14/9 * x) ... @@ -53,7 +56,7 @@ + (x >= 3/4) .* (2 * x - 1); map = sqrt ([r, g, b]); else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/prism.m +++ b/scripts/image/prism.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "prism"); +## PKG_DEL: colormap ("unregister", "prism"); + function map = prism (n) if (nargin == 0) @@ -40,8 +43,14 @@ print_usage (); endif - C = [1, 0, 0; 1, 1/2, 0; 1, 1, 0; 0, 1, 0; 0, 0, 1; 2/3, 0, 1]; - map = C(rem (0:(n-1), 6) + 1, :); + if (n == 1) + map = [1 0 0]; + elseif (n > 1) + C = [1, 0, 0; 1, 1/2, 0; 1, 1, 0; 0, 1, 0; 0, 0, 1; 2/3, 0, 1]; + map = C(rem (0:(n-1), 6) + 1, :); + else + map = zeros (0, 3); + endif endfunction
--- a/scripts/image/rainbow.m +++ b/scripts/image/rainbow.m @@ -31,6 +31,9 @@ ## this colormap is not part of matlab, it is like the prism ## colormap map but with a continuous map +## PKG_ADD: colormap ("register", "rainbow"); +## PKG_DEL: colormap ("unregister", "rainbow"); + function map = rainbow (n) if (nargin == 0) @@ -60,7 +63,7 @@ map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/spring.m +++ b/scripts/image/spring.m @@ -27,6 +27,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "spring"); +## PKG_DEL: colormap ("unregister", "spring"); + function map = spring (n) if (nargin == 0) @@ -47,7 +50,7 @@ b = 1 - g; map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/summer.m +++ b/scripts/image/summer.m @@ -28,6 +28,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> ## Date: 06/03/2000 +## PKG_ADD: colormap ("register", "summer"); +## PKG_DEL: colormap ("unregister", "summer"); + function map = summer (n) if (nargin == 0) @@ -48,7 +51,7 @@ b = 0.4 * ones (n, 1); map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/image/white.m +++ b/scripts/image/white.m @@ -27,6 +27,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "white"); +## PKG_DEL: colormap ("unregister", "white"); + function map = white (n) if (nargin == 0)
--- a/scripts/image/winter.m +++ b/scripts/image/winter.m @@ -27,6 +27,9 @@ ## Author: Kai Habel <kai.habel@gmx.de> +## PKG_ADD: colormap ("register", "winter"); +## PKG_DEL: colormap ("unregister", "winter"); + function map = winter (n) if (nargin == 0) @@ -47,7 +50,7 @@ b = 1 - g / 2; map = [r, g, b]; else - map = []; + map = zeros (0, 3); endif endfunction
--- a/scripts/mkdoc.pl +++ b/scripts/mkdoc.pl @@ -50,7 +50,7 @@ $fcn = $4; } - @help_txt = mygethelp ($fcn, $full_fname); + @help_txt = gethelp ($fcn, $full_fname); next MFILE if ($help_txt[0] eq ""); print "$fcn\n"; @@ -69,7 +69,7 @@ ################################################################################ # Subroutines ################################################################################ -sub mygethelp +sub gethelp { ($fcn, $fname) = @_[0..1]; open (FH, $fname) or return "";
--- a/scripts/pkg/private/installed_packages.m +++ b/scripts/pkg/private/installed_packages.m @@ -40,11 +40,11 @@ ## Locally installed packages take precedence. dup = []; for i = 1:length (installed_pkgs_lst) - if (find (dup, i)) + if (any (dup == i)) continue; endif for j = (i+1):length (installed_pkgs_lst) - if (find (dup, j)) + if (any (dup == j)) continue; endif if (strcmp (installed_pkgs_lst{i}.name, installed_pkgs_lst{j}.name))
--- a/scripts/pkg/private/rebuild.m +++ b/scripts/pkg/private/rebuild.m @@ -81,11 +81,11 @@ dup = []; for i = 1:length (descriptions) - if (find (dup, i)) + if (any (dup == i)) continue; endif for j = (i+1):length (descriptions) - if (find (dup, j)) + if (any (dup == j)) continue; endif if (strcmp (descriptions{i}.name, descriptions{j}.name))
--- a/src/lex.ll +++ b/src/lex.ll @@ -765,8 +765,8 @@ %} \?{IDENT}{S}* | -\?{IDENT}.{IDENT}{S}* { - LEXER_DEBUG ("\?{IDENT}{S}* | \?{IDENT}.{IDENT}{S}*"); +\?{IDENT}\.{IDENT}{S}* { + LEXER_DEBUG ("\\?{IDENT}{S}*|\\?{IDENT}\\.{IDENT}{S}*"); int id_tok = handle_meta_identifier (); @@ -1525,11 +1525,11 @@ break; case end_kw: - if (! reading_classdef_file - && (inside_any_object_index () - || (lexer_flags.defining_func + if (inside_any_object_index () + || (! reading_classdef_file + && (lexer_flags.defining_func && ! (lexer_flags.looking_at_return_list - || lexer_flags.parsed_function_name.top ())))) + || lexer_flags.parsed_function_name.top ()))) return 0; yylval.tok_val = new token (token::simple_end, l, c);