# HG changeset patch # User mmuetzel # Date 1458842193 -3600 # Node ID 38c0c1f5cf57969bd226958c0a3eceb5f5b9209f # Parent ffb4770ba079a2de039dee0844dc36392586df21 Allow mixed structures and prop/val pairs in call to set (bug #47526) * graphics.cc (graphics_object::set): Check whether structures (octave_map) are present and handle them separately. diff -r ffb4770ba079 -r 38c0c1f5cf57 libinterp/corefcn/graphics.cc --- a/libinterp/corefcn/graphics.cc Thu Mar 24 13:35:40 2016 +1100 +++ b/libinterp/corefcn/graphics.cc Thu Mar 24 18:56:33 2016 +0100 @@ -2173,16 +2173,22 @@ if (nargin == 0) error ("graphics_object::set: Nothing to set"); - if (nargin % 2 != 0) - error ("set: invalid number of arguments"); - - for (int i = 0; i < nargin; i += 2) - { - caseless_str pname = args(i).xstring_value ("set: argument %d must be a property name", i); - - octave_value val = args(i+1); - - set_value_or_default (pname, val); + for (int i = 0; i < nargin; ) + { + if (args(i).is_map () ) + { + set (args(i).map_value ()); + i++; + } + else if (i < nargin - 1) + { + caseless_str pname = args(i).xstring_value ("set: argument %d must be a property name", i); + octave_value val = args(i+1); + set_value_or_default (pname, val); + i += 2; + } + else + error ("set: invalid number of arguments"); } }