comparison src/ov-range.h @ 10613:e103fb2182ce

use internal variable instead of warning state to control whether to allow non-integer ranges as indices
author John W. Eaton <jwe@octave.org>
date Fri, 07 May 2010 15:58:51 -0400
parents 1834132fb50b
children d9e57045b9e1
comparison
equal deleted inserted replaced
10612:09e244649f50 10613:e103fb2182ce
229 229
230 Complex complex_value (bool = false) const; 230 Complex complex_value (bool = false) const;
231 231
232 FloatComplex float_complex_value (bool = false) const; 232 FloatComplex float_complex_value (bool = false) const;
233 233
234 boolNDArray bool_array_value (bool warn = false) const 234 boolNDArray bool_array_value (bool warn = false) const;
235 {
236 Matrix m = range.matrix_value ();
237
238 if (m.any_element_is_nan ())
239 error ("invalid conversion from NaN to logical");
240 else if (warn && m.any_element_not_one_or_zero ())
241 gripe_logical_conversion ();
242
243 return boolNDArray (m);
244 }
245 235
246 ComplexMatrix complex_matrix_value (bool = false) const 236 ComplexMatrix complex_matrix_value (bool = false) const
247 { return ComplexMatrix (range.matrix_value ()); } 237 { return ComplexMatrix (range.matrix_value ()); }
248 238
249 FloatComplexMatrix float_complex_matrix_value (bool = false) const 239 FloatComplexMatrix float_complex_matrix_value (bool = false) const
320 DECLARE_OCTAVE_ALLOCATOR 310 DECLARE_OCTAVE_ALLOCATOR
321 311
322 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA 312 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
323 }; 313 };
324 314
315 // If TRUE, allow ranges with non-integer elements as array indices.
316 extern bool Vallow_noninteger_range_as_index;
317
325 #endif 318 #endif