diff liboctave/Array.cc @ 5781:faafc2d98b8d

[project @ 2006-05-02 19:40:19 by jwe]
author jwe
date Tue, 02 May 2006 19:40:21 +0000
parents ace8d8d26933
children 55404f3b0da1
line wrap: on
line diff
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -34,7 +34,6 @@
 #include <vector>
 
 #include "Array.h"
-#include "Array-flags.h"
 #include "Array-util.h"
 #include "Range.h"
 #include "idx-vector.h"
@@ -1792,9 +1791,10 @@
 	    {
 	      // Collapse dimensions beyond last index.
 
-	      if (liboctave_wfi_flag && ! (ra_idx(n_idx-1).is_colon ()))
-		(*current_liboctave_warning_handler)
-		  ("fewer indices than dimensions for N-d array");
+	      if (! (ra_idx(n_idx-1).is_colon ()))
+		(*current_liboctave_warning_with_id_handler)
+		  ("Octave:fortran-indexing",
+		   "fewer indices than dimensions for N-d array");
 
 	      for (octave_idx_type i = n_idx; i < n_lhs_dims; i++)
 		lhs_dims(n_idx-1) *= lhs_dims(i);
@@ -1945,7 +1945,7 @@
 
 	  idx_vector idx_vec = ra_idx(0);
 
-	  idx_vec.freeze (lhs_numel, 0, true, liboctave_wrore_flag);
+	  idx_vec.freeze (lhs_numel, 0, true);
       
 	  idx_vec.sort (true);
 
@@ -2172,11 +2172,11 @@
     }
   else
     {
-      if (liboctave_wfi_flag
-	  && ! (idx_arg.one_zero_only ()
-		&& idx_orig_rows == nr
-		&& idx_orig_columns == nc))
-	(*current_liboctave_warning_handler) ("single index used for matrix");
+      if (! (idx_arg.one_zero_only ()
+	     && idx_orig_rows == nr
+	     && idx_orig_columns == nc))
+	(*current_liboctave_warning_with_id_handler)
+	  ("Octave:fortran-indexing", "single index used for matrix");
 
       // This code is only for indexing matrices.  The vector
       // cases are handled above.
@@ -2244,11 +2244,10 @@
       bool vec_equiv = vector_equivalent (dv);
 
       if (! vec_equiv
-	  && liboctave_wfi_flag
 	  && ! (ra_idx.is_colon ()
 		|| (ra_idx.one_zero_only () && idx_orig_dims == dv)))
-	(*current_liboctave_warning_handler)
-	  ("single index used for N-d array");
+	(*current_liboctave_warning_with_id_handler)
+	  ("Octave:fortran-indexing", "single index used for N-d array");
 
       octave_idx_type frozen_len
 	= ra_idx.freeze (orig_len, "nd-array", resize_ok);
@@ -2512,7 +2511,7 @@
   octave_idx_type lhs_len = lhs.length ();
   octave_idx_type rhs_len = rhs.length ();
 
-  octave_idx_type n = lhs_idx.freeze (lhs_len, "vector", true, liboctave_wrore_flag);
+  octave_idx_type n = lhs_idx.freeze (lhs_len, "vector", true);
 
   if (n != 0)
     {
@@ -2644,9 +2643,9 @@
 
   if (n_idx == 2)
     {
-      octave_idx_type n = idx_i.freeze (lhs_nr, "row", true, liboctave_wrore_flag);
-
-      octave_idx_type m = idx_j.freeze (lhs_nc, "column", true, liboctave_wrore_flag);
+      octave_idx_type n = idx_i.freeze (lhs_nr, "row", true);
+
+      octave_idx_type m = idx_j.freeze (lhs_nc, "column", true);
 
       int idx_i_is_colon = idx_i.is_colon ();
       int idx_j_is_colon = idx_j.is_colon ();
@@ -2738,7 +2737,7 @@
 	{
 	  octave_idx_type lhs_len = lhs.length ();
 
-	  octave_idx_type n = idx_i.freeze (lhs_len, 0, true, liboctave_wrore_flag);
+	  octave_idx_type n = idx_i.freeze (lhs_len, 0, true);
 
 	  if (idx_i)
 	    {
@@ -2749,24 +2748,23 @@
 		}
 	      else
 		{
-		  if (liboctave_wfi_flag)
+		  if (lhs_is_empty
+		      && idx_i.is_colon ()
+		      && ! (rhs_nr == 1 || rhs_nc == 1))
 		    {
-		      if (lhs_is_empty
-			  && idx_i.is_colon ()
-			  && ! (rhs_nr == 1 || rhs_nc == 1))
-			{
-			  (*current_liboctave_warning_handler)
-			    ("A(:) = X: X is not a vector or scalar");
-			}
-		      else
-			{
-			  octave_idx_type idx_nr = idx_i.orig_rows ();
-			  octave_idx_type idx_nc = idx_i.orig_columns ();
-
-			  if (! (rhs_nr == idx_nr && rhs_nc == idx_nc))
-			    (*current_liboctave_warning_handler)
-			      ("A(I) = X: X does not have same shape as I");
-			}
+		      (*current_liboctave_warning_with_id_handler)
+			("Octave:fortran-indexing",
+			 "A(:) = X: X is not a vector or scalar");
+		    }
+		  else
+		    {
+		      octave_idx_type idx_nr = idx_i.orig_rows ();
+		      octave_idx_type idx_nc = idx_i.orig_columns ();
+
+		      if (! (rhs_nr == idx_nr && rhs_nc == idx_nc))
+			(*current_liboctave_warning_with_id_handler)
+			  ("Octave:fortran-indexing",
+			   "A(I) = X: X does not have same shape as I");
 		    }
 
 		  if (assign1 (lhs, xrhs, rfv))
@@ -2792,7 +2790,7 @@
 	}
       else if (lhs_nr == 1)
 	{
-	  idx_i.freeze (lhs_nc, "vector", true, liboctave_wrore_flag);
+	  idx_i.freeze (lhs_nc, "vector", true);
 
 	  if (idx_i)
 	    {
@@ -2810,7 +2808,7 @@
 	}
       else if (lhs_nc == 1)
 	{
-	  idx_i.freeze (lhs_nr, "vector", true, liboctave_wrore_flag);
+	  idx_i.freeze (lhs_nr, "vector", true);
 
 	  if (idx_i)
 	    {
@@ -2828,13 +2826,12 @@
 	}
       else
 	{
-	  if (liboctave_wfi_flag
-	      && ! (idx_i.is_colon ()
-		    || (idx_i.one_zero_only ()
-			&& idx_i.orig_rows () == lhs_nr
-			&& idx_i.orig_columns () == lhs_nc)))
-	    (*current_liboctave_warning_handler)
-	      ("single index used for matrix");
+	  if (! (idx_i.is_colon ()
+		 || (idx_i.one_zero_only ()
+		     && idx_i.orig_rows () == lhs_nr
+		     && idx_i.orig_columns () == lhs_nc)))
+	    (*current_liboctave_warning_with_id_handler)
+	      ("Octave:fortran-indexing", "single index used for matrix");
 
 	  octave_idx_type len = idx_i.freeze (lhs_nr * lhs_nc, "matrix");
 
@@ -2930,12 +2927,11 @@
     {
       idx_vector iidx = idx(0);
 
-      if (liboctave_wfi_flag
-	  && ! (iidx.is_colon ()
-		|| (iidx.one_zero_only ()
-		    && iidx.orig_dimensions () == lhs.dims ())))
-	(*current_liboctave_warning_handler)
-	  ("single index used for N-d array");
+      if (! (iidx.is_colon ()
+	     || (iidx.one_zero_only ()
+		 && iidx.orig_dimensions () == lhs.dims ())))
+	(*current_liboctave_warning_with_id_handler)
+	  ("Octave:fortran-indexing", "single index used for N-d array");
 
       octave_idx_type lhs_len = lhs.length ();
 
@@ -3006,9 +3002,10 @@
 	  // delay resizing LHS until we know that the assignment will
 	  // succeed.
 
-	  if (liboctave_wfi_flag && ! (idx(n_idx-1).is_colon ()))
-	    (*current_liboctave_warning_handler)
-	      ("fewer indices than dimensions for N-d array");
+	  if (! (idx(n_idx-1).is_colon ()))
+	    (*current_liboctave_warning_with_id_handler)
+	      ("Octave:fortran-indexing",
+	       "fewer indices than dimensions for N-d array");
 
 	  for (int i = n_idx; i < lhs_dims_len; i++)
 	    lhs_dims(n_idx-1) *= lhs_dims(i);