# HG changeset patch # User dbateman # Date 1191254513 0 # Node ID 688ef944002215d41f6e6a511d9b5d97ce6b98dd # Parent ee12d56c42000cf85234d0f9207c8dca3b4c3307 [project @ 2007-10-01 15:59:33 by dbateman] diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,5 +1,7 @@ 2007-10-01 David Bateman + * linear-algebra/norm.m: Inline the isvector(x) calculation for + speed with small vectors. * pkg/pkg.m (archprefix): Set using octave_config_info("libexecdir") rather than OCTAVE_HOME(). diff --git a/scripts/linear-algebra/norm.m b/scripts/linear-algebra/norm.m --- a/scripts/linear-algebra/norm.m +++ b/scripts/linear-algebra/norm.m @@ -78,7 +78,7 @@ ## Do we have a vector or matrix as the first argument? - if (is_vector (x)) + if (ndims(x) == 2 && (rows (x) == 1 || columns (x) == 1)) if (isinteger (x) || issparse (x)) if (ischar (p)) if (strcmp (p, "fro")) diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,18 @@ +2007-10-01 Shai Ayal + + * graphics.cc ((color_property::color_property (const + octave_value& val)): Undo change from 2007-09-26 + (patch::properties::properties): use the "a" modifier to + face_color & edge_color properties + (patch::properties::set): Undo change from 2007-09-26 + * graphics.h.in (color_property::color_property + (const octave_value& val)): Undo change from 2007-09-26 + +2007-10-01 Michael Goffioul + + * octave.cc (octave_main): Add "--line-editing" option to force + readline line editing. + 2007-09-28 David Bateman * ov-range.h (int8_array_value, int16_array_value, int32_array_value, diff --git a/src/graphics.cc b/src/graphics.cc --- a/src/graphics.cc +++ b/src/graphics.cc @@ -122,8 +122,8 @@ return retval; } -color_property::color_property (const octave_value& val, const radio_values &v) - : radio_val (v), current_val () +color_property::color_property (const octave_value& val) + : radio_val (), current_val () { // FIXME -- need some error checking here. @@ -133,19 +133,11 @@ if (! s.empty ()) { - if (radio_val.contains (s)) - { - current_val = s; - current_type = radio_t; - } - else + color_values col (s); + if (! error_state) { - color_values col (s); - if (! error_state) - { - color_val = col; - current_type = color_t; - } + color_val = col; + current_type = color_t; } } else @@ -2131,7 +2123,7 @@ else if (name.compare ("zdata")) set_zdata (val); else if (name.compare ("facecolor")) - set_facecolor (color_property (val, radio_values ("flat|none|interp"))); + set_facecolor (val); else if (name.compare ("facealpha")) set_facealpha (val); else if (name.compare ("edgecolor")) diff --git a/src/graphics.h.in b/src/graphics.h.in --- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -206,8 +206,7 @@ current_val (initial_value) { } - color_property (const octave_value& val, - const radio_values &v = radio_values()); + color_property (const octave_value& val); operator octave_value (void) const { @@ -1600,9 +1599,9 @@ octave_value xdata octave_value ydata octave_value zdata - color_property facecolor + color_property facecolor a octave_value facealpha - color_property edgecolor + color_property edgecolor a octave_value linestyle octave_value linewidth octave_value marker diff --git a/src/octave.cc b/src/octave.cc --- a/src/octave.cc +++ b/src/octave.cc @@ -126,7 +126,7 @@ static const char *usage_string = "octave [-?HVdfhiqvx] [--debug] [--echo-commands] [--eval CODE]\n\ [--exec-path path] [--help] [--image-path path] [--info-file file]\n\ - [--info-program prog] [--interactive] [--no-history] [--no-init-file]\n\ + [--info-program prog] [--interactive] [--line-editing] [--no-history] [--no-init-file]\n\ [--no-line-editing] [--no-site-file] [--no-init-path] [-p path]\n\ [--path path] [--silent] [--traditional] [--verbose] [--version] [file]"; @@ -154,6 +154,7 @@ #define NO_INITIAL_PATH_OPTION 9 #define PERSIST_OPTION 10 #define TRADITIONAL_OPTION 11 +#define LINE_EDITING_OPTION 12 long_options long_opts[] = { { "debug", prog_args::no_arg, 0, 'd' }, @@ -166,6 +167,7 @@ { "info-file", prog_args::required_arg, 0, INFO_FILE_OPTION }, { "info-program", prog_args::required_arg, 0, INFO_PROG_OPTION }, { "interactive", prog_args::no_arg, 0, 'i' }, + { "line-editing", prog_args::no_arg, 0, LINE_EDITING_OPTION }, { "no-history", prog_args::no_arg, 0, 'H' }, { "no-init-file", prog_args::no_arg, 0, NO_INIT_FILE_OPTION }, { "no-line-editing", prog_args::no_arg, 0, NO_LINE_EDITING_OPTION }, @@ -448,6 +450,7 @@ --info-file FILE Use top-level info file FILE.\n\ --info-program PROGRAM Use PROGRAM for reading info files.\n\ --interactive, -i Force interactive behavior.\n\ + --line-editing Force readline use for command-line editing.\n\ --no-history, -H Don't save commands to the history list\n\ --no-init-file Don't read the ~/.octaverc or .octaverc files.\n\ --no-line-editing Don't use readline for command-line editing.\n\ @@ -571,6 +574,8 @@ prog_args args (argc, argv, short_opts, long_opts); + bool forced_line_editing = false; + int optc; while ((optc = args.getopt ()) != EOF) { @@ -653,6 +658,10 @@ bind_internal_variable ("info_program", args.optarg ()); break; + case LINE_EDITING_OPTION: + forced_line_editing = true; + break; + case NO_INIT_FILE_OPTION: read_init_files = false; break; @@ -721,7 +730,7 @@ interactive = (! embedded && isatty (fileno (stdin)) && isatty (fileno (stdout))); - if (! interactive) + if (! interactive && ! forced_line_editing) line_editing = false; // If there is an extra argument, see if it names a file to read. diff --git a/test/ChangeLog b/test/ChangeLog --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2007-09-29 Kim Hansen + + * test_range.m: Test range data + 2007-09-21 John W. Eaton * test_slice.m: Fix test for x = ones ([0, 2]); x(idx) = N case. diff --git a/test/test_range.m b/test/test_range.m new file mode 100644 --- /dev/null +++ b/test/test_range.m @@ -0,0 +1,54 @@ +## Test values of range + +%!assert(full(1:9), [ 1 2 3 4 5 6 7 8 9 ]) +%!assert(full(1:0.4:3), [ 1.0 1.4 1.8 2.2 2.6 3.0 ]) +%!assert(full(9:1), zeros(1,0)) +%!assert(full(9:-1:1), [ 9 8 7 6 5 4 3 2 1 ]) +%!assert(full(1:-1:9), zeros(1,0)) + + +## Test mixing integer range with other types + +%!shared expect, r, z +%! expect = [ 1 2 3 4 5 6 7 8 9 +%! 0 0 0 0 0 0 0 0 0 ]; +%! z = zeros(1,9); +%! r = 1:9; + +%!assert([ r ; z ], expect) +%!assert([ r ; logical(z) ], expect) +%!assert([ r ; sparse(z) ], expect) +%!assert([ r ; sparse(logical(z)) ], expect) + +%!assert([ r ; int8(z) ], int8(expect)) +%!assert([ r ; int16(z) ], int16(expect)) +%!assert([ r ; int32(z) ], int32(expect)) +%!assert([ r ; int64(z) ], int64(expect)) +%!assert([ r ; uint8(z) ], uint8(expect)) +%!assert([ r ; uint16(z) ], uint16(expect)) +%!assert([ r ; uint32(z) ], uint32(expect)) +%!assert([ r ; uint64(z) ], uint64(expect)) + + +## Test mixing non integer range with other types + +%!shared expect, r, z +%! expect = [ 1.0 1.4 1.8 2.2 2.6 3.0 +%! 0 0 0 0 0 0 ]; +%! z = zeros(1,6); +%! r = 1:0.4:3; + +%!assert([ r ; z ], expect) +%!assert([ r ; logical(z) ], expect) +%!assert([ r ; sparse(z) ], expect) +%!assert([ r ; sparse(logical(z)) ], expect) + +%!assert([ r ; int8(z) ], int8(expect)) +%!assert([ r ; int16(z) ], int16(expect)) +%!assert([ r ; int32(z) ], int32(expect)) +%!assert([ r ; int64(z) ], int64(expect)) +%!assert([ r ; uint8(z) ], uint8(expect)) +%!assert([ r ; uint16(z) ], uint16(expect)) +%!assert([ r ; uint32(z) ], uint32(expect)) +%!assert([ r ; uint64(z) ], uint64(expect)) +