comparison src/error.cc @ 10605:1834132fb50b

allow non-integer ranges as indices conditionally
author John W. Eaton <jwe@octave.org>
date Wed, 05 May 2010 14:20:58 -0400
parents cc69a17ec801
children 2b041d3995a3
comparison
equal deleted inserted replaced
10604:d7ff75c977e2 10605:1834132fb50b
1438 } 1438 }
1439 1439
1440 return retval; 1440 return retval;
1441 } 1441 }
1442 1442
1443 octave_value_list
1444 set_warning_state (const std::string& id, const std::string& state)
1445 {
1446 octave_value_list args;
1447
1448 args(1) = id;
1449 args(0) = state;
1450
1451 return Fwarning (args, 1);
1452 }
1453
1454 octave_value_list
1455 set_warning_state (const octave_value_list& args)
1456 {
1457 return Fwarning (args, 1);
1458 }
1459
1443 void 1460 void
1444 disable_warning (const std::string& id) 1461 disable_warning (const std::string& id)
1445 { 1462 {
1446 octave_value_list args; 1463 set_warning_state (id, "off");
1447
1448 args(1) = id;
1449 args(0) = "off";
1450
1451 Fwarning (args, 0);
1452 } 1464 }
1453 1465
1454 void 1466 void
1455 initialize_default_warning_state (void) 1467 initialize_default_warning_state (void)
1456 { 1468 {
1471 disable_warning ("Octave:single-quote-string"); 1483 disable_warning ("Octave:single-quote-string");
1472 disable_warning ("Octave:str-to-num"); 1484 disable_warning ("Octave:str-to-num");
1473 disable_warning ("Octave:string-concat"); 1485 disable_warning ("Octave:string-concat");
1474 disable_warning ("Octave:variable-switch-label"); 1486 disable_warning ("Octave:variable-switch-label");
1475 disable_warning ("Octave:complex-cmp-ops"); 1487 disable_warning ("Octave:complex-cmp-ops");
1488
1489 // This should be an error unless we are in maximum braindamage mode.
1490
1491 set_warning_state ("Octave:allow-noninteger-ranges-as-indices", "error");
1476 } 1492 }
1477 1493
1478 DEFUN (lasterror, args, , 1494 DEFUN (lasterror, args, ,
1479 "-*- texinfo -*-\n\ 1495 "-*- texinfo -*-\n\
1480 @deftypefn {Built-in Function} {@var{err} =} lasterror (@var{err})\n\ 1496 @deftypefn {Built-in Function} {@var{err} =} lasterror (@var{err})\n\