Mercurial > hg > octave-terminal
changeset 3565:4290f11c8d3b
[project @ 2000-02-03 08:32:41 by jwe]
author | jwe |
---|---|
date | Thu, 03 Feb 2000 08:32:44 +0000 |
parents | 403039c85792 |
children | 4b1a93f83264 |
files | src/ChangeLog src/input.cc src/lex.l src/ov-dld-fcn.cc src/ov-usr-fcn.cc src/pt-plot.cc src/utils.cc src/variables.cc |
diffstat | 8 files changed, 26 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,16 @@ 2000-02-03 John W. Eaton <jwe@bevo.che.wisc.edu> + * pt-plot.cc (send_to_plot_stream): Use operator== and substr + method to do limited-length string comparison. + * input.cc (generate_completion): Likewise. + * ov-dld-fcn.cc (octave_dld_function::octave_dld_function): Likewise. + * ov-usr-fcn.cc (octave_user_function::mark_as_system_fcn_file): + Likewise. + + * utils.cc (check_preference): Expect exact string matches. + * variables.cc (ignore_function_time_stamp): Likewise. + * lex.l (whitespace_in_literal_matrix): Likewise. + * mappers.cc (xconj, ximag, xreal): New functions. Use them in DEFUN_MAPPER calls.
--- a/src/input.cc +++ b/src/input.cc @@ -425,7 +425,7 @@ matches = 0; for (int i = 0; i < name_list_len; i++) - if (! name_list[i].compare (hint, 0, hint_len)) + if (hint == name_list[i].substr (0, hint_len)) matches++; } @@ -437,7 +437,7 @@ list_index++; - if (! name.compare (hint, 0, hint_len)) + if (hint == name.substr (0, hint_len)) { if (! prefix.empty ()) retval = prefix + "." + name;
--- a/src/lex.l +++ b/src/lex.l @@ -2287,9 +2287,9 @@ if (! val.empty ()) { - if (val.compare ("ignore", 0, 6) == 0) + if (val == "ignore") pref = 2; - else if (val.compare ("traditional", 0, 11) == 0) + else if (val == "traditional") pref = 1; }
--- a/src/ov-dld-fcn.cc +++ b/src/ov-dld-fcn.cc @@ -54,7 +54,7 @@ system_fcn_file = (! file_name.empty () - && Vfcn_file_dir.compare (file_name, 0, Vfcn_file_dir.length ()) == 0); + && Vfcn_file_dir == file_name.substr (0, Vfcn_file_dir.length ())); } octave_dld_function::~octave_dld_function (void)
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -138,7 +138,7 @@ std::string ff_name = fcn_file_in_path (file_name); - if (Vfcn_file_dir.compare (ff_name, 0, Vfcn_file_dir.length ()) == 0) + if (Vfcn_file_dir == ff_name.substr (0, Vfcn_file_dir.length ())) system_fcn_file = 1; } else
--- a/src/pt-plot.cc +++ b/src/pt-plot.cc @@ -208,9 +208,11 @@ int splot_len = Vgnuplot_command_splot.length (); int plot_len = Vgnuplot_command_plot.length (); - bool is_replot = (Vgnuplot_command_replot.compare (cmd, 0, replot_len) == 0); - bool is_splot = (Vgnuplot_command_splot.compare (cmd, 0, splot_len) == 0); - bool is_plot = (Vgnuplot_command_plot.compare (cmd, 0, plot_len) == 0); + std::string s = cmd; + + bool is_replot = (Vgnuplot_command_replot == s.substr (0, replot_len)); + bool is_splot = (Vgnuplot_command_splot == s.substr (0, splot_len)); + bool is_plot = (Vgnuplot_command_plot == s.substr (0, plot_len)); if (plot_line_count == 0 && is_replot) error ("replot: no previous plot");
--- a/src/utils.cc +++ b/src/utils.cc @@ -592,15 +592,12 @@ } else { - if (val.compare ("yes", 0, 3) == 0 - || val.compare ("true", 0, 4) == 0) + if (val == "yes" || val == "true") { warn_old_style_preference (true, val); pref = 1; } - else if (val.compare ("never", 0, 5) == 0 - || val.compare ("no", 0, 2) == 0 - || val.compare ("false", 0, 5) == 0) + else if (val == "never" || val == "no" || val == "false") { warn_old_style_preference (false, val); pref = 0;