Mercurial > hg > octave-nkf
comparison src/variables.cc @ 10071:e42b1bbd1052
variables.cc (get_top_level_value, set_top_level_value): new functions
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 07 Jan 2010 15:07:19 -0500 |
parents | 2cd940306a06 |
children | cd96d29c5efa |
comparison
equal
deleted
inserted
replaced
10070:897e62651c0a | 10071:e42b1bbd1052 |
---|---|
605 get_global_value (const std::string& nm, bool silent) | 605 get_global_value (const std::string& nm, bool silent) |
606 { | 606 { |
607 octave_value val = symbol_table::global_varval (nm); | 607 octave_value val = symbol_table::global_varval (nm); |
608 | 608 |
609 if (val.is_undefined () && ! silent) | 609 if (val.is_undefined () && ! silent) |
610 error ("get_global_by_name: undefined symbol `%s'", nm.c_str ()); | 610 error ("get_global_value: undefined symbol `%s'", nm.c_str ()); |
611 | 611 |
612 return val; | 612 return val; |
613 } | 613 } |
614 | 614 |
615 void | 615 void |
616 set_global_value (const std::string& nm, const octave_value& val) | 616 set_global_value (const std::string& nm, const octave_value& val) |
617 { | 617 { |
618 symbol_table::global_varref (nm) = val; | 618 symbol_table::global_varref (nm) = val; |
619 } | |
620 | |
621 octave_value | |
622 get_top_level_value (const std::string& nm, bool silent) | |
623 { | |
624 octave_value val = symbol_table::top_level_varval (nm); | |
625 | |
626 if (val.is_undefined () && ! silent) | |
627 error ("get_top_level_value: undefined symbol `%s'", nm.c_str ()); | |
628 | |
629 return val; | |
630 } | |
631 | |
632 void | |
633 set_top_level_value (const std::string& nm, const octave_value& val) | |
634 { | |
635 symbol_table::top_level_varref (nm) = val; | |
619 } | 636 } |
620 | 637 |
621 // Variable values. | 638 // Variable values. |
622 | 639 |
623 octave_value | 640 octave_value |