Mercurial > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
10612:09e244649f50 | 10613:e103fb2182ce |
---|---|
57 #include "lex.h" | 57 #include "lex.h" |
58 #include "load-path.h" | 58 #include "load-path.h" |
59 #include "oct-errno.h" | 59 #include "oct-errno.h" |
60 #include "oct-hist.h" | 60 #include "oct-hist.h" |
61 #include "oct-obj.h" | 61 #include "oct-obj.h" |
62 #include "ov-range.h" | |
62 #include "pager.h" | 63 #include "pager.h" |
63 #include "parse.h" | 64 #include "parse.h" |
64 #include "sysdep.h" | 65 #include "sysdep.h" |
65 #include "toplev.h" | 66 #include "toplev.h" |
66 #include "unwind-prot.h" | 67 #include "unwind-prot.h" |
1302 | 1303 |
1303 octave_quit (); | 1304 octave_quit (); |
1304 } | 1305 } |
1305 } | 1306 } |
1306 | 1307 |
1307 // FIXME -- is there some way to fix the declarations in unwind-prot.h | |
1308 // so that this function's argument can be declared as | |
1309 // "const octave_value_list&"? | |
1310 | |
1311 static void | |
1312 reset_warning_state (octave_value_list args) | |
1313 { | |
1314 if (! args.empty ()) | |
1315 set_warning_state (args); | |
1316 } | |
1317 | |
1318 DEFUN (isindex, args, , | 1308 DEFUN (isindex, args, , |
1319 "-*- texinfo -*-\n\ | 1309 "-*- texinfo -*-\n\ |
1320 @deftypefn {Built-in Function} {} isindex (@var{ind}, @var{n})\n\ | 1310 @deftypefn {Built-in Function} {} isindex (@var{ind}, @var{n})\n\ |
1321 Returns true if @var{ind} is a valid index. Valid indices can be\n\ | 1311 Returns true if @var{ind} is a valid index. Valid indices can be\n\ |
1322 either positive integers (though possibly real data), or logical arrays.\n\ | 1312 either positive integers (though possibly real data), or logical arrays.\n\ |
1336 | 1326 |
1337 if (! error_state) | 1327 if (! error_state) |
1338 { | 1328 { |
1339 unwind_protect frame; | 1329 unwind_protect frame; |
1340 | 1330 |
1341 octave_value_list current_warning_state | 1331 frame.protect_var (Vallow_noninteger_range_as_index); |
1342 = set_warning_state ("Octave:allow-noninteger-ranges-as-indices", | 1332 Vallow_noninteger_range_as_index = false; |
1343 "error"); | |
1344 | |
1345 frame.add_fcn (reset_warning_state, current_warning_state); | |
1346 | 1333 |
1347 frame.protect_var (error_state); | 1334 frame.protect_var (error_state); |
1348 | 1335 |
1349 frame.protect_var (discard_error_messages); | 1336 frame.protect_var (discard_error_messages); |
1350 discard_error_messages = true; | 1337 discard_error_messages = true; |