diff src/utils.cc @ 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 6c50b56824aa
line wrap: on
line diff
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -59,6 +59,7 @@
 #include "oct-errno.h"
 #include "oct-hist.h"
 #include "oct-obj.h"
+#include "ov-range.h"
 #include "pager.h"
 #include "parse.h"
 #include "sysdep.h"
@@ -1304,17 +1305,6 @@
     }
 }
 
-// FIXME -- is there some way to fix the declarations in unwind-prot.h
-// so that this function's argument can be declared as
-// "const octave_value_list&"?
-
-static void
-reset_warning_state (octave_value_list args)
-{
-  if (! args.empty ())
-    set_warning_state (args);
-}
-
 DEFUN (isindex, args, ,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} isindex (@var{ind}, @var{n})\n\
@@ -1338,11 +1328,8 @@
     {
       unwind_protect frame;
 
-      octave_value_list current_warning_state
-        = set_warning_state ("Octave:allow-noninteger-ranges-as-indices",
-                             "error");
-
-      frame.add_fcn (reset_warning_state, current_warning_state);
+      frame.protect_var (Vallow_noninteger_range_as_index);
+      Vallow_noninteger_range_as_index = false;
 
       frame.protect_var (error_state);