changeset 18333:1a9be98119c5

colstyle.m: Tweaks to improve code style. * colstyle.m: Use a single switch statement with otherwise clause to assign output value 'c'. Check for correct error message in %!test.
author Rik <rik@octave.org>
date Wed, 22 Jan 2014 16:00:03 -0800
parents 925bdd86a479
children 6165053c56b3
files scripts/plot/util/colstyle.m
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/colstyle.m	Wed Jan 22 15:35:47 2014 -0800
+++ b/scripts/plot/util/colstyle.m	Wed Jan 22 16:00:03 2014 -0800
@@ -36,10 +36,7 @@
   try
     opt = __pltopt__ ("colstyle", style);
     l = opt.linestyle;
-    c = opt.color;
-    m = opt.marker;
-    msg = [];
-    switch (c)
+    switch (opt.color)
       case [0 0 0]
         c = "k";
       case [1 0 0]
@@ -56,7 +53,11 @@
         c = "c";
       case [0 1 1]
         c = "w";
+      otherwise
+        c = opt.color;
     endswitch
+    m = opt.marker;
+    msg = [];
   catch
     l = c = m = [];
     msg = lasterr ();
@@ -86,5 +87,5 @@
 %% Test input validation
 %!error colstyle ()
 %!error colstyle (1, 2)
-%!error colstyle (1.5)
+%!error <STYLE must be a string> colstyle (1.5)