diff libinterp/corefcn/oct-map.cc @ 20741:a5ab31b52ae8

eliminate more uses of error_state * __qp__.cc, besselj.cc, data.cc, file-io.cc, input.cc, load-save.cc, ls-oct-text.cc, oct-map.cc, oct-stream.cc, syscalls.cc, toplev.cc, ov-base.cc, ov-cell.cc, ov-fcn-handle.cc: Eliminate more uses of error_state. * ov.h, ov.cc (octave_value::xfunction_value, octave_value::xuser_function_value, octave_value::xuser_script_value, octave_value::xuser_code_value, octave_value::xfcn_handle_value, octave_value::xfcn_inline_value, octave_value::xlist_value): New value extraction functions.
author John W. Eaton <jwe@octave.org>
date Mon, 23 Nov 2015 20:50:07 -0500
parents a6a452346c42
children 200ae1d650b7
line wrap: on
line diff
--- a/libinterp/corefcn/oct-map.cc	Thu Nov 19 16:56:39 2015 -0500
+++ b/libinterp/corefcn/oct-map.cc	Mon Nov 23 20:50:07 2015 -0500
@@ -639,20 +639,21 @@
 
   Array<octave_idx_type> perm (dim_vector (1, nf));
 
-  for (octave_idx_type i = 0; i < n; i++)
+  try
     {
-      if (i == idx)
-        continue;
+      for (octave_idx_type i = 0; i < n; i++)
+        {
+          if (i == idx)
+            continue;
 
-      permute_to_correct_order1 (map_list[idx], map_list[i], new_map_list[i],
-                                 perm);
-
-      if (error_state)
-        {
-          error ("cat: field names mismatch in concatenating structs");
-          break;
+          permute_to_correct_order1 (map_list[idx], map_list[i],
+                                     new_map_list[i], perm);
         }
     }
+  catch (const octave_execution_exception&)
+    {
+      error ("cat: field names mismatch in concatenating structs");
+    }
 }
 
 
@@ -994,14 +995,19 @@
   else
     {
       Array<octave_idx_type> perm;
-      octave_map rhs1 = rhs.orderfields (*this, perm);
-      if (! error_state)
+      octave_map rhs1;
+
+      try
         {
-          assert (rhs1.xkeys.is_same (xkeys));
-          assign (i, rhs1);
+          rhs1 = rhs.orderfields (*this, perm);
         }
-      else
-        error ("incompatible fields in struct assignment");
+      catch (const octave_execution_exception&)
+        {
+          error ("incompatible fields in struct assignment");
+        }
+
+      assert (rhs1.xkeys.is_same (xkeys));
+      assign (i, rhs1);
     }
 }
 
@@ -1037,14 +1043,19 @@
   else
     {
       Array<octave_idx_type> perm;
-      octave_map rhs1 = rhs.orderfields (*this, perm);
-      if (! error_state)
+      octave_map rhs1;
+
+      try
         {
-          assert (rhs1.xkeys.is_same (xkeys));
-          assign (i, j, rhs1);
+          rhs1 = rhs.orderfields (*this, perm);
         }
-      else
-        error ("incompatible fields in struct assignment");
+      catch (const octave_execution_exception&)
+        {
+          error ("incompatible fields in struct assignment");
+        }
+
+      assert (rhs1.xkeys.is_same (xkeys));
+      assign (i, j, rhs1);
     }
 }
 
@@ -1080,14 +1091,19 @@
   else
     {
       Array<octave_idx_type> perm;
-      octave_map rhs1 = rhs.orderfields (*this, perm);
-      if (! error_state)
+      octave_map rhs1;
+
+      try
         {
-          assert (rhs1.xkeys.is_same (xkeys));
-          assign (ia, rhs1);
+          rhs1 = rhs.orderfields (*this, perm);
         }
-      else
-        error ("incompatible fields in struct assignment");
+      catch (const octave_execution_exception&)
+        {
+          error ("incompatible fields in struct assignment");
+        }
+
+      assert (rhs1.xkeys.is_same (xkeys));
+      assign (ia, rhs1);
     }
 }