Mercurial > octave
comparison src/ov.cc @ 2948:56be458e237f
[project @ 1997-05-09 13:37:35 by jwe]
author | jwe |
---|---|
date | Fri, 09 May 1997 13:51:06 +0000 |
parents | 026f342c2019 |
children | ac3368dba5d3 |
comparison
equal
deleted
inserted
replaced
2947:cf676ff8b702 | 2948:56be458e237f |
---|---|
100 // error? A positive value means yes. A negative value means yes, | 100 // error? A positive value means yes. A negative value means yes, |
101 // but print a warning message. Zero means it should be considered an | 101 // but print a warning message. Zero means it should be considered an |
102 // error. | 102 // error. |
103 int Vpropagate_empty_matrices; | 103 int Vpropagate_empty_matrices; |
104 | 104 |
105 // How many levels of structure elements should we print? | |
106 int Vstruct_levels_to_print; | |
107 | |
108 // Allow divide by zero errors to be suppressed. | |
109 bool Vwarn_divide_by_zero; | |
110 | |
105 // If TRUE, resize matrices when performing and indexed assignment and | 111 // If TRUE, resize matrices when performing and indexed assignment and |
106 // the indices are outside the current bounds. | 112 // the indices are outside the current bounds. |
107 bool Vresize_on_range_error; | 113 static bool Vresize_on_range_error; |
108 | |
109 // How many levels of structure elements should we print? | |
110 int Vstruct_levels_to_print; | |
111 | |
112 // Allow divide by zero errors to be suppressed. | |
113 bool Vwarn_divide_by_zero; | |
114 | 114 |
115 // XXX FIXME XXX | 115 // XXX FIXME XXX |
116 | 116 |
117 // Octave's value type. | 117 // Octave's value type. |
118 | 118 |
496 octave_value& | 496 octave_value& |
497 octave_value::assign (octave_value::assign_op op, | 497 octave_value::assign (octave_value::assign_op op, |
498 const octave_value_list& idx, | 498 const octave_value_list& idx, |
499 const octave_value& rhs) | 499 const octave_value& rhs) |
500 { | 500 { |
501 if (Vresize_on_range_error || is_defined ()) | |
502 { | |
503 make_unique (); | |
504 | |
505 bool assignment_ok = try_assignment (op, idx, rhs); | |
506 | |
507 if (! (error_state || assignment_ok)) | |
508 { | |
509 assignment_ok = try_assignment_with_conversion (op,idx, rhs); | |
510 | |
511 if (! (error_state || assignment_ok)) | |
512 gripe_no_conversion (type_name (), rhs.type_name ()); | |
513 } | |
514 | |
515 if (! error_state) | |
516 maybe_mutate (); | |
517 } | |
518 else | |
519 { | |
520 error ("indexed assignment to previously undefined variables"); | |
521 error ("is only possible when resize_on_range_error is true"); | |
522 } | |
523 | |
524 return *this; | |
525 } | |
526 | |
527 void | |
528 octave_value::assign_struct_elt (assign_op op, const string& elt_nm, | |
529 const octave_value& rhs) | |
530 { | |
501 make_unique (); | 531 make_unique (); |
502 | 532 |
503 bool assignment_ok = try_assignment (op, idx, rhs); | 533 rep->assign_struct_elt (op, elt_nm, rhs); |
504 | 534 } |
505 if (! (error_state || assignment_ok)) | 535 |
506 { | 536 |
507 assignment_ok = try_assignment_with_conversion (op,idx, rhs); | 537 void |
508 | 538 octave_value::assign_struct_elt (assign_op op, const string& elt_nm, |
509 if (! (error_state || assignment_ok)) | 539 const octave_value_list& idx, |
510 gripe_no_conversion (type_name (), rhs.type_name ()); | 540 const octave_value& rhs) |
511 } | 541 { |
512 | 542 make_unique (); |
513 if (! error_state) | 543 |
514 maybe_mutate (); | 544 rep->assign_struct_elt (op, elt_nm, idx, rhs); |
515 | 545 } |
516 return *this; | 546 |
547 octave_variable_reference | |
548 octave_value::struct_elt_ref (const string& nm) | |
549 { | |
550 return rep->struct_elt_ref (this, nm); | |
551 } | |
552 | |
553 octave_variable_reference | |
554 octave_value::struct_elt_ref (octave_value *, const string&) | |
555 { | |
556 panic_impossible (); | |
557 | |
558 return octave_variable_reference (); | |
517 } | 559 } |
518 | 560 |
519 octave_value_list | 561 octave_value_list |
520 octave_value::eval (int, const octave_value_list& idx) | 562 octave_value::eval (int, const octave_value_list& idx) |
521 { | 563 { |