# HG changeset patch # User jwe # Date 1143004049 0 # Node ID 6286c96121c2e41d3471e9a5519c002cdf0a4f0e # Parent 5b9b492f9e98903ee66b062d82e34f391920fc68 [project @ 2006-03-22 05:07:28 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -4,6 +4,16 @@ (OCTAVE_API_VERSION): Now api-v18. (OCTAVE_RELEASE_DATE): Now 2006-03-20. + * ov-cell.h (octave_cell::convert_to_str_internal): + Ignore pad and force args. + * ov-cell.cc (octave_cell::all_strings): Delete args. Never pad. + * ov-base.cc (octave_base_value::all_strings): Delete args. + Always force string conversion, never pad. + * ov-str-mat.cc (octave_char_matrix_str::all_strings): + Delete args. Don't strip whitespace. + * ov.h, ov-base.h, ov-cell.h, ov-str-mat.h: Fix all_strings decls. + * strfns.cc (Fchar): No args for all_strings. + 2006-03-21 David bateman * DLD-FUNCTIONS/getrusage.cc (Fgetrusage): Use GetProcessTimes for diff --git a/src/ov-base.cc b/src/ov-base.cc --- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -597,11 +597,11 @@ } string_vector -octave_base_value::all_strings (bool pad, bool force) const +octave_base_value::all_strings (void) const { string_vector retval; - octave_value tmp = convert_to_str (pad, force); + octave_value tmp = convert_to_str (false, true); if (! error_state) retval = tmp.all_strings (); diff --git a/src/ov-base.h b/src/ov-base.h --- a/src/ov-base.h +++ b/src/ov-base.h @@ -265,7 +265,7 @@ uint64NDArray uint64_array_value (void) const; - string_vector all_strings (bool pad = false, bool force = false) const; + string_vector all_strings (void) const; std::string string_value (bool force = false) const; diff --git a/src/ov-cell.cc b/src/ov-cell.cc --- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -291,7 +291,7 @@ } string_vector -octave_cell::all_strings (bool pad, bool) const +octave_cell::all_strings (void) const { string_vector retval; @@ -333,15 +333,7 @@ int n = s.length (); for (octave_idx_type ii = 0; ii < n; ii++) - { - std::string t = s[ii]; - int t_len = t.length (); - - if (pad && max_len > t_len) - t += std::string (max_len - t_len, ' '); - - retval[k++] = t; - } + retval[k++] = s[ii]; } } diff --git a/src/ov-cell.h b/src/ov-cell.h --- a/src/ov-cell.h +++ b/src/ov-cell.h @@ -101,10 +101,10 @@ octave_value_list list_value (void) const; - octave_value convert_to_str_internal (bool pad, bool force, char type) const - { return octave_value (all_strings (pad, force), type); } + octave_value convert_to_str_internal (bool, bool, char type) const + { return octave_value (all_strings (), type); } - string_vector all_strings (bool pad = false, bool force = false) const; + string_vector all_strings (void) const; bool print_as_scalar (void) const; diff --git a/src/ov-str-mat.cc b/src/ov-str-mat.cc --- a/src/ov-str-mat.cc +++ b/src/ov-str-mat.cc @@ -210,7 +210,7 @@ } string_vector -octave_char_matrix_str::all_strings (bool, bool) const +octave_char_matrix_str::all_strings (void) const { string_vector retval; @@ -223,7 +223,7 @@ retval.resize (n); for (octave_idx_type i = 0; i < n; i++) - retval[i] = chm.row_as_string (i, true); + retval[i] = chm.row_as_string (i); } else error ("invalid conversion of charNDArray to string_vector"); diff --git a/src/ov-str-mat.h b/src/ov-str-mat.h --- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -125,7 +125,7 @@ ComplexNDArray complex_array_value (bool = false) const; - string_vector all_strings (bool pad = false, bool force = false) const; + string_vector all_strings (void) const; std::string string_value (bool force = false) const; diff --git a/src/ov.h b/src/ov.h --- a/src/ov.h +++ b/src/ov.h @@ -651,9 +651,8 @@ virtual uint64NDArray uint64_array_value (void) const { return rep->uint64_array_value (); } - virtual string_vector all_strings (bool pad = false, - bool force = false) const - { return rep->all_strings (pad, force); } + virtual string_vector all_strings (void) const + { return rep->all_strings (); } virtual std::string string_value (bool force = false) const { return rep->string_value (force); } diff --git a/src/strfns.cc b/src/strfns.cc --- a/src/strfns.cc +++ b/src/strfns.cc @@ -80,7 +80,7 @@ for (int i = 0; i < nargin; i++) { - string_vector s = args(i).all_strings (false, true); + string_vector s = args(i).all_strings (); if (error_state) { @@ -102,7 +102,7 @@ for (int i = 0; i < nargin; i++) { - string_vector s = args(i).all_strings (false, true); + string_vector s = args(i).all_strings (); int n = s.length (); diff --git a/test/ChangeLog b/test/ChangeLog --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2006-03-21 John W. Eaton + + * test_system.m: Use cell arrays of character strings in fnmatch + tests. + 2006-03-16 John W. Eaton * test_system.m: End all *pwent tests with a call to endpwent. diff --git a/test/test_system.m b/test/test_system.m --- a/test/test_system.m +++ b/test/test_system.m @@ -334,11 +334,11 @@ %% test/octave.test/system/fnmatch-1.m %!test %! string_fill_char = setstr (0); -%! assert((fnmatch ("a*a", ["aba"; "xxxba"; "aa"]) == [1; 0; 1] -%! && fnmatch (["a*a"; "b*b"], "bob") -%! && fnmatch ("x[0-5]*", ["x1"; "x6"]) == [1; 0] -%! && fnmatch ("x[0-5]*", ["x1"; "x6"; "x001"]) == [1; 0; 1] -%! && fnmatch ("x???y", ["xabcy"; "xy"]) == [1; 0])); +%! assert((fnmatch ("a*a", {"aba"; "xxxba"; "aa"}) == [1; 0; 1] +%! && fnmatch ({"a*a"; "b*b"}, "bob") +%! && fnmatch ("x[0-5]*", {"x1"; "x6"}) == [1; 0] +%! && fnmatch ("x[0-5]*", {"x1"; "x6"; "x001"}) == [1; 0; 1] +%! && fnmatch ("x???y", {"xabcy"; "xy"}) == [1; 0])); %% test/octave.test/system/fnmatch-2.m %!error <... fnmatch:.*> fnmatch ();