Mercurial > octave
comparison libinterp/corefcn/oct-stream.cc @ 31105:670a0d878af1
eliminate WHO arguments from interpreter-private functions
* interpreter-private.h, inpterpreter-private.cc (__get_interpreter__,
__get_dynamic_loader__, __get_error_system__, __get_gh_manager__,
__get_help_system__, __get_input_system__, __get_load_path__,
__get_load_save_system__, __get_event_manager__,
__get_output_system__, __get_type_info__, __get_symbol_table__,
__get_current_scope__, __require_current_scope__, __get_evaluator__,
__get_bp_table__, __get_child_list__, __get_cdef_manager__,
__get_display_info__, __get_gtk_manager__): Eliminate WHO argument.
Previously, it was never displayed by __get_interpreter__. And, as
pointed out by Petter Tomner in patch #10216, passing a std::string
object could have performance issues.
(__get_interpreter__): Eliminate useless call to error. Display
message to std::cerr then abort.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 22 Jun 2022 12:48:59 -0400 |
parents | 79edd49a5a97 |
children | c90718a28a3c |
comparison
equal
deleted
inserted
replaced
31104:90549b20fb28 | 31105:670a0d878af1 |
---|---|
98 { | 98 { |
99 dval = tc.double_value (); | 99 dval = tc.double_value (); |
100 } | 100 } |
101 catch (const execution_exception&) | 101 catch (const execution_exception&) |
102 { | 102 { |
103 interpreter& interp = __get_interpreter__ ("convert_to_valid_int"); | 103 interpreter& interp = __get_interpreter__ (); |
104 | 104 |
105 interp.recover_from_exception (); | 105 interp.recover_from_exception (); |
106 | 106 |
107 conv_err = 1; | 107 conv_err = 1; |
108 } | 108 } |
4102 | 4102 |
4103 std::string | 4103 std::string |
4104 base_stream::do_gets (octave_idx_type max_len, bool& err, | 4104 base_stream::do_gets (octave_idx_type max_len, bool& err, |
4105 bool strip_newline, const std::string& who) | 4105 bool strip_newline, const std::string& who) |
4106 { | 4106 { |
4107 interpreter& interp = __get_interpreter__ ("base_stream::do_gets"); | 4107 interpreter& interp = __get_interpreter__ (); |
4108 | 4108 |
4109 if (interp.interactive () && file_number () == 0) | 4109 if (interp.interactive () && file_number () == 0) |
4110 ::error ("%s: unable to read from stdin while running interactively", | 4110 ::error ("%s: unable to read from stdin while running interactively", |
4111 who.c_str ()); | 4111 who.c_str ()); |
4112 | 4112 |
4219 } | 4219 } |
4220 | 4220 |
4221 off_t | 4221 off_t |
4222 base_stream::skipl (off_t num, bool& err, const std::string& who) | 4222 base_stream::skipl (off_t num, bool& err, const std::string& who) |
4223 { | 4223 { |
4224 interpreter& interp = __get_interpreter__ ("base_stream::skipl"); | 4224 interpreter& interp = __get_interpreter__ (); |
4225 | 4225 |
4226 if (interp.interactive () && file_number () == 0) | 4226 if (interp.interactive () && file_number () == 0) |
4227 ::error ("%s: unable to read from stdin while running interactively", | 4227 ::error ("%s: unable to read from stdin while running interactively", |
4228 who.c_str ()); | 4228 who.c_str ()); |
4229 | 4229 |
4714 octave_idx_type nr, octave_idx_type nc, | 4714 octave_idx_type nr, octave_idx_type nc, |
4715 bool one_elt_size_spec, | 4715 bool one_elt_size_spec, |
4716 octave_idx_type& conversion_count, | 4716 octave_idx_type& conversion_count, |
4717 const std::string& who) | 4717 const std::string& who) |
4718 { | 4718 { |
4719 interpreter& interp = __get_interpreter__ ("base_stream::do_scanf"); | 4719 interpreter& interp = __get_interpreter__ (); |
4720 | 4720 |
4721 if (interp.interactive () && file_number () == 0) | 4721 if (interp.interactive () && file_number () == 0) |
4722 ::error ("%s: unable to read from stdin while running interactively", | 4722 ::error ("%s: unable to read from stdin while running interactively", |
4723 who.c_str ()); | 4723 who.c_str ()); |
4724 | 4724 |
5341 { | 5341 { |
5342 error ("%s: read error", who.c_str ()); | 5342 error ("%s: read error", who.c_str ()); |
5343 | 5343 |
5344 // FIXME: is this the right thing to do? | 5344 // FIXME: is this the right thing to do? |
5345 | 5345 |
5346 interpreter& interp = __get_interpreter__ ("base_stream::do_oscanf"); | 5346 interpreter& interp = __get_interpreter__ (); |
5347 | 5347 |
5348 if (interp.interactive () && ! application::forced_interactive () | 5348 if (interp.interactive () && ! application::forced_interactive () |
5349 && name () == "stdin") | 5349 && name () == "stdin") |
5350 { | 5350 { |
5351 // Skip to end of line. | 5351 // Skip to end of line. |
5436 octave_idx_type ntimes, | 5436 octave_idx_type ntimes, |
5437 const octave_value_list& options, | 5437 const octave_value_list& options, |
5438 const std::string& who, | 5438 const std::string& who, |
5439 octave_idx_type& read_count) | 5439 octave_idx_type& read_count) |
5440 { | 5440 { |
5441 interpreter& interp = __get_interpreter__ ("base_stream::do_textscan"); | 5441 interpreter& interp = __get_interpreter__ (); |
5442 | 5442 |
5443 if (interp.interactive () && file_number () == 0) | 5443 if (interp.interactive () && file_number () == 0) |
5444 ::error ("%s: unable to read from stdin while running interactively", | 5444 ::error ("%s: unable to read from stdin while running interactively", |
5445 who.c_str ()); | 5445 who.c_str ()); |
5446 | 5446 |