Mercurial > hg > octave-lyh
comparison src/help.cc @ 8863:34a821854961
pkg.m (generate_lookfor_cache): generate a DOC file for each directory
author | Jason Riedy <jason@acm.org> |
---|---|
date | Wed, 25 Feb 2009 00:41:40 -0500 |
parents | 31f864877246 |
children | eb63fbe60fab |
comparison
equal
deleted
inserted
replaced
8862:f71b749be1c1 | 8863:34a821854961 |
---|---|
933 @deftypefn {Function File} {@var{retval} =} __list_functions__ ()\n\ | 933 @deftypefn {Function File} {@var{retval} =} __list_functions__ ()\n\ |
934 @deftypefnx{Function File} {@var{retval} =} __list_functions__ (@var{directory})\n\ | 934 @deftypefnx{Function File} {@var{retval} =} __list_functions__ (@var{directory})\n\ |
935 Undocumented internal function.\n\ | 935 Undocumented internal function.\n\ |
936 @end deftypefn") | 936 @end deftypefn") |
937 { | 937 { |
938 octave_value_list retval; | 938 octave_value retval; |
939 | 939 |
940 // Get list of functions | 940 // Get list of functions |
941 const string_vector ffl = load_path::fcn_names (); | 941 string_vector ffl = load_path::fcn_names (); |
942 const int ffl_len = ffl.length (); | 942 string_vector afl = autoloaded_functions (); |
943 const string_vector afl = autoloaded_functions (); | |
944 const int afl_len = afl.length (); | |
945 | 943 |
946 if (args.length () == 0) | 944 if (args.length () == 0) |
947 { | 945 retval = Cell (ffl.append (afl)); |
948 Cell C (ffl_len + afl_len, 1); | |
949 int j = 0; | |
950 for (int i = 0; i < ffl_len; i++) | |
951 C (j++, 0) = octave_value (ffl [i]); | |
952 for (int i = 0; i < afl_len; i++) | |
953 C (j++, 0) = octave_value (afl [i]); | |
954 | |
955 retval.append (octave_value (C)); | |
956 } | |
957 else | 946 else |
958 { | 947 { |
959 // Get input | |
960 std::string dir = args (0).string_value (); | 948 std::string dir = args (0).string_value (); |
961 if (error_state) | 949 |
950 if (! error_state) | |
951 { | |
952 string_vector fl = load_path::files (dir); | |
953 | |
954 if (! error_state) | |
955 retval = Cell (fl); | |
956 } | |
957 else | |
962 error ("__list_functions__: input must be a string"); | 958 error ("__list_functions__: input must be a string"); |
963 else | |
964 { | |
965 dir = file_ops::canonicalize_file_name (dir); | |
966 | |
967 // FIXME -- This seems very inefficient. Is there a better way? | |
968 std::list<std::string> list; | |
969 for (int i = 0; i < ffl_len; i++) | |
970 { | |
971 const std::string filename = do_which (ffl [i]); | |
972 if (file_is_in_dir (filename, dir)) | |
973 list.push_back (ffl [i]); | |
974 } | |
975 for (int i = 0; i < afl_len; i++) | |
976 { | |
977 const std::string filename = do_which (afl [i]); | |
978 if (file_is_in_dir (filename, dir)) | |
979 list.push_back (afl [i]); | |
980 } | |
981 | |
982 Cell C (list.size (), 1); | |
983 int j = 0; | |
984 for (std::list<std::string>::const_iterator iter = list.begin (); | |
985 iter != list.end (); iter++) | |
986 { | |
987 C (j++, 0) = octave_value (*iter); | |
988 } | |
989 | |
990 retval.append (octave_value (C)); | |
991 } | |
992 } | 959 } |
993 | 960 |
994 return retval; | 961 return retval; |
995 } | 962 } |
996 | 963 |