comparison liboctave/util/kpse.cc @ 20267:a9574e3c6e9e

Deprecate Array::length() and Sparse::length() in favour of ::numel(). * liboctave/array/Array.h (Array::length): deprecate for ::numel. * liboctave/array/Sparse.h (Sparse::length): deprecate for ::numel. * libgui/graphics/QtHandlesUtils.cc, libgui/src/octave-qt-link.cc, libinterp/corefcn/Cell.cc, libinterp/corefcn/__contourc__.cc, libinterp/corefcn/__pchip_deriv__.cc, libinterp/corefcn/__qp__.cc, libinterp/corefcn/cellfun.cc, libinterp/corefcn/daspk.cc, libinterp/corefcn/dasrt.cc, libinterp/corefcn/dassl.cc, libinterp/corefcn/data.cc, libinterp/corefcn/filter.cc, libinterp/corefcn/find.cc, libinterp/corefcn/gl-render.cc, libinterp/corefcn/gl-render.h, libinterp/corefcn/graphics.cc, libinterp/corefcn/graphics.in.h, libinterp/corefcn/help.cc, libinterp/corefcn/hex2num.cc, libinterp/corefcn/input.cc, libinterp/corefcn/load-path.cc, libinterp/corefcn/load-save.cc, libinterp/corefcn/ls-oct-ascii.h, libinterp/corefcn/lsode.cc, libinterp/corefcn/matrix_type.cc, libinterp/corefcn/oct-hist.cc, libinterp/corefcn/oct-map.cc, libinterp/corefcn/oct-map.h, libinterp/corefcn/oct-obj.h, libinterp/corefcn/oct-stream.cc, libinterp/corefcn/oct-stream.h, libinterp/corefcn/pr-output.cc, libinterp/corefcn/quadcc.cc, libinterp/corefcn/rand.cc, libinterp/corefcn/regexp.cc, libinterp/corefcn/strfns.cc, libinterp/corefcn/sub2ind.cc, libinterp/corefcn/symtab.h, libinterp/corefcn/syscalls.cc, libinterp/corefcn/tsearch.cc, libinterp/corefcn/urlwrite.cc, libinterp/corefcn/utils.cc, libinterp/corefcn/variables.cc, libinterp/corefcn/xdiv.cc, libinterp/corefcn/xpow.cc, libinterp/dldfcn/__glpk__.cc, libinterp/dldfcn/__init_fltk__.cc, libinterp/dldfcn/__magick_read__.cc, libinterp/dldfcn/audiodevinfo.cc, libinterp/dldfcn/ccolamd.cc, libinterp/dldfcn/colamd.cc, libinterp/octave-value/ov-cell.cc, libinterp/octave-value/ov-class.cc, libinterp/octave-value/ov-class.h, libinterp/octave-value/ov-fcn-inline.cc, libinterp/octave-value/ov-java.cc, libinterp/octave-value/ov-perm.cc, libinterp/octave-value/ov-struct.cc, libinterp/octave-value/ov-typeinfo.cc, libinterp/octave-value/ov.cc, libinterp/operators/op-int.h, libinterp/parse-tree/pt-pr-code.cc, liboctave/array/Array-util.cc, liboctave/array/Array.cc, liboctave/array/CColVector.cc, liboctave/array/CDiagMatrix.cc, liboctave/array/CMatrix.cc, liboctave/array/CRowVector.cc, liboctave/array/DiagArray2.cc, liboctave/array/DiagArray2.h, liboctave/array/MArray.cc, liboctave/array/PermMatrix.cc, liboctave/array/PermMatrix.h, liboctave/array/Sparse.cc, liboctave/array/boolMatrix.cc, liboctave/array/chMatrix.cc, liboctave/array/chNDArray.cc, liboctave/array/dColVector.cc, liboctave/array/dDiagMatrix.cc, liboctave/array/dMatrix.cc, liboctave/array/dRowVector.cc, liboctave/array/fCColVector.cc, liboctave/array/fCDiagMatrix.cc, liboctave/array/fCMatrix.cc, liboctave/array/fCRowVector.cc, liboctave/array/fColVector.cc, liboctave/array/fDiagMatrix.cc, liboctave/array/fMatrix.cc, liboctave/array/fRowVector.cc, liboctave/array/idx-vector.cc, liboctave/array/intNDArray.cc, liboctave/numeric/CmplxCHOL.cc, liboctave/numeric/CmplxLU.cc, liboctave/numeric/CmplxQR.cc, liboctave/numeric/DASPK.cc, liboctave/numeric/DASRT.cc, liboctave/numeric/DASSL.cc, liboctave/numeric/LSODE.cc, liboctave/numeric/ODES.cc, liboctave/numeric/ODES.h, liboctave/numeric/base-dae.h, liboctave/numeric/base-lu.cc, liboctave/numeric/dbleCHOL.cc, liboctave/numeric/dbleLU.cc, liboctave/numeric/dbleQR.cc, liboctave/numeric/eigs-base.cc, liboctave/numeric/fCmplxCHOL.cc, liboctave/numeric/fCmplxLU.cc, liboctave/numeric/fCmplxQR.cc, liboctave/numeric/floatCHOL.cc, liboctave/numeric/floatLU.cc, liboctave/numeric/floatQR.cc, liboctave/numeric/lo-specfun.cc, liboctave/numeric/oct-rand.cc, liboctave/numeric/oct-spparms.cc, liboctave/numeric/sparse-base-chol.cc, liboctave/operators/mx-inlines.cc, liboctave/system/file-ops.cc, liboctave/util/glob-match.h, liboctave/util/kpse.cc, liboctave/util/lo-regexp.cc, liboctave/util/oct-glob.cc, liboctave/util/pathsearch.cc, liboctave/util/str-vec.cc, liboctave/util/str-vec.h, liboctave/util/url-transfer.cc: replace all usage of Array::length() and Sparse::length() with ::numel().
author Carnë Draug <carandraug@octave.org>
date Sat, 30 May 2015 03:14:07 +0100
parents 4b7b7ac7af2c
children 610c74748518
comparison
equal deleted inserted replaced
20266:83792dd9bcc1 20267:a9574e3c6e9e
425 DEBUGF1 ("hash_lookup (%s) =>", key.c_str ()); 425 DEBUGF1 ("hash_lookup (%s) =>", key.c_str ());
426 if (ret.empty ()) 426 if (ret.empty ())
427 gnulib::fputs (" (nil)\n", stderr); 427 gnulib::fputs (" (nil)\n", stderr);
428 else 428 else
429 { 429 {
430 int len = ret.length (); 430 int len = ret.numel ();
431 for (int i = 0; i < len; i++) 431 for (int i = 0; i < len; i++)
432 { 432 {
433 gnulib::putc (' ', stderr); 433 gnulib::putc (' ', stderr);
434 gnulib::fputs (ret[i].c_str (), stderr); 434 gnulib::fputs (ret[i].c_str (), stderr);
435 } 435 }
702 } 702 }
703 703
704 if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH) || log_file) 704 if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH) || log_file)
705 { 705 {
706 /* FILENAMES should never be null, but safety doesn't hurt. */ 706 /* FILENAMES should never be null, but safety doesn't hurt. */
707 for (int e = 0; e < filenames.length () && ! filenames[e].empty (); e++) 707 for (int e = 0; e < filenames.numel () && ! filenames[e].empty (); e++)
708 { 708 {
709 std::string filename = filenames[e]; 709 std::string filename = filenames[e];
710 710
711 /* Only record absolute filenames, for privacy. */ 711 /* Only record absolute filenames, for privacy. */
712 if (log_file && kpse_absolute_p (filename.c_str (), false)) 712 if (log_file && kpse_absolute_p (filename.c_str (), false))
1008 dirs = kpse_element_dirs (elt); 1008 dirs = kpse_element_dirs (elt);
1009 for (dirs_elt = *dirs; dirs_elt; dirs_elt = STR_LLIST_NEXT (*dirs_elt)) 1009 for (dirs_elt = *dirs; dirs_elt; dirs_elt = STR_LLIST_NEXT (*dirs_elt))
1010 { 1010 {
1011 const std::string dir = STR_LLIST (*dirs_elt); 1011 const std::string dir = STR_LLIST (*dirs_elt);
1012 1012
1013 int len = names.length (); 1013 int len = names.numel ();
1014 for (int i = 0; i < len && !done; i++) 1014 for (int i = 0; i < len && !done; i++)
1015 { 1015 {
1016 std::string name = names[i]; 1016 std::string name = names[i];
1017 1017
1018 /* Try ls-R, unless we're searching for texmf.cnf. Our caller 1018 /* Try ls-R, unless we're searching for texmf.cnf. Our caller
1074 1074
1075 if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) 1075 if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
1076 { 1076 {
1077 gnulib::fputs ("start find_first_of ((", stderr); 1077 gnulib::fputs ("start find_first_of ((", stderr);
1078 1078
1079 int len = names.length (); 1079 int len = names.numel ();
1080 1080
1081 for (int i = 0; i < len; i++) 1081 for (int i = 0; i < len; i++)
1082 { 1082 {
1083 if (i == 0) 1083 if (i == 0)
1084 gnulib::fputs (names[i].c_str (), stderr); 1084 gnulib::fputs (names[i].c_str (), stderr);
1088 1088
1089 gnulib::fprintf (stderr, "), path=%s, must_exist=%d).\n", 1089 gnulib::fprintf (stderr, "), path=%s, must_exist=%d).\n",
1090 path.c_str (), must_exist); 1090 path.c_str (), must_exist);
1091 } 1091 }
1092 1092
1093 for (int i = 0; i < names.length (); i++) 1093 for (int i = 0; i < names.numel (); i++)
1094 { 1094 {
1095 std::string name = names[i]; 1095 std::string name = names[i];
1096 1096
1097 if (kpse_absolute_p (name, true)) 1097 if (kpse_absolute_p (name, true))
1098 { 1098 {
1123 1123
1124 if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH)) 1124 if (KPSE_DEBUG_P (KPSE_DEBUG_SEARCH))
1125 { 1125 {
1126 gnulib::fputs ("find_first_of (", stderr); 1126 gnulib::fputs ("find_first_of (", stderr);
1127 1127
1128 int len = names.length (); 1128 int len = names.numel ();
1129 1129
1130 for (int i = 0; i < len; i++) 1130 for (int i = 0; i < len; i++)
1131 { 1131 {
1132 if (i == 0) 1132 if (i == 0)
1133 gnulib::fputs (names[i].c_str (), stderr); 1133 gnulib::fputs (names[i].c_str (), stderr);
1335 { 1335 {
1336 std::string ret; 1336 std::string ret;
1337 1337
1338 string_vector expansions = brace_expand (elt); 1338 string_vector expansions = brace_expand (elt);
1339 1339
1340 for (int i = 0; i < expansions.length (); i++) 1340 for (int i = 0; i < expansions.numel (); i++)
1341 { 1341 {
1342 /* Do $ and ~ expansion on each element. */ 1342 /* Do $ and ~ expansion on each element. */
1343 std::string x = kpse_expand (expansions[i]); 1343 std::string x = kpse_expand (expansions[i]);
1344 1344
1345 if (x != expansions[i]) 1345 if (x != expansions[i])
1509 result = arr2; 1509 result = arr2;
1510 else if (arr2.empty ()) 1510 else if (arr2.empty ())
1511 result = arr1; 1511 result = arr1;
1512 else 1512 else
1513 { 1513 {
1514 int len1 = arr1.length (); 1514 int len1 = arr1.numel ();
1515 int len2 = arr2.length (); 1515 int len2 = arr2.numel ();
1516 1516
1517 result = string_vector (len1 * len2); 1517 result = string_vector (len1 * len2);
1518 1518
1519 int k = 0; 1519 int k = 0;
1520 for (int i = 0; i < len2; i++) 1520 for (int i = 0; i < len2; i++)
1884 /* Don't bother doing any lookups if this 'path_elt' isn't covered by 1884 /* Don't bother doing any lookups if this 'path_elt' isn't covered by
1885 any of database directories. We do this not so much because the 1885 any of database directories. We do this not so much because the
1886 extra couple of hash lookups matter -- they don't -- but rather 1886 extra couple of hash lookups matter -- they don't -- but rather
1887 because we want to return NULL in this case, so path_search can 1887 because we want to return NULL in this case, so path_search can
1888 know to do a disk search. */ 1888 know to do a disk search. */
1889 for (int e = 0; ! relevant && e < db_dir_list.length (); e++) 1889 for (int e = 0; ! relevant && e < db_dir_list.numel (); e++)
1890 relevant = elt_in_db (db_dir_list[e], path_elt); 1890 relevant = elt_in_db (db_dir_list[e], path_elt);
1891 1891
1892 if (! relevant) 1892 if (! relevant)
1893 return ret; 1893 return ret;
1894 1894
1895 /* If we have aliases for this name, use them. */ 1895 /* If we have aliases for this name, use them. */
1896 if (alias_db.buckets) 1896 if (alias_db.buckets)
1897 aliases = hash_lookup (alias_db, name); 1897 aliases = hash_lookup (alias_db, name);
1898 1898
1899 /* Push aliases up by one and insert the original name at the front. */ 1899 /* Push aliases up by one and insert the original name at the front. */
1900 int len = aliases.length (); 1900 int len = aliases.numel ();
1901 aliases.resize (len+1); 1901 aliases.resize (len+1);
1902 for (int i = len; i > 0; i--) 1902 for (int i = len; i > 0; i--)
1903 aliases[i] = aliases[i - 1]; 1903 aliases[i] = aliases[i - 1];
1904 aliases[0] = name; 1904 aliases[0] = name;
1905 1905
1906 done = false; 1906 done = false;
1907 len = aliases.length (); 1907 len = aliases.numel ();
1908 for (int i = 0; i < len && !done; i++) 1908 for (int i = 0; i < len && !done; i++)
1909 { 1909 {
1910 std::string atry = aliases[i]; 1910 std::string atry = aliases[i];
1911 1911
1912 /* We have an ls-R db. Look up 'atry'. */ 1912 /* We have an ls-R db. Look up 'atry'. */
1914 1914
1915 /* For each filename found, see if it matches the path element. For 1915 /* For each filename found, see if it matches the path element. For
1916 example, if we have .../cx/cmr10.300pk and .../ricoh/cmr10.300pk, 1916 example, if we have .../cx/cmr10.300pk and .../ricoh/cmr10.300pk,
1917 and the path looks like .../cx, we don't want the ricoh file. */ 1917 and the path looks like .../cx, we don't want the ricoh file. */
1918 1918
1919 int db_dirs_len = db_dirs.length (); 1919 int db_dirs_len = db_dirs.numel ();
1920 for (int j = 0; j < db_dirs_len && !done; j++) 1920 for (int j = 0; j < db_dirs_len && !done; j++)
1921 { 1921 {
1922 std::string db_file = db_dirs[j] + atry; 1922 std::string db_file = db_dirs[j] + atry;
1923 bool matched = match (db_file, path_elt); 1923 bool matched = match (db_file, path_elt);
1924 1924
1944 'mf.base'. Find it anyway. Could probably work 1944 'mf.base'. Find it anyway. Could probably work
1945 around this with aliases, but this is pretty easy 1945 around this with aliases, but this is pretty easy
1946 and shouldn't hurt. The upshot is that if one of 1946 and shouldn't hurt. The upshot is that if one of
1947 the aliases actually exists, we use that. */ 1947 the aliases actually exists, we use that. */
1948 1948
1949 int aliases_len = aliases.length (); 1949 int aliases_len = aliases.numel ();
1950 1950
1951 for (int k = 1; k < aliases_len && found.empty (); k++) 1951 for (int k = 1; k < aliases_len && found.empty (); k++)
1952 { 1952 {
1953 std::string aatry = db_dirs[j] + aliases[k]; 1953 std::string aatry = db_dirs[j] + aliases[k];
1954 tmp = kpse_readable_file (aatry); 1954 tmp = kpse_readable_file (aatry);