Mercurial > hg > octave-lyh
changeset 7971:dd5cc5016487
handle private functions in class directories
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 24 Jul 2008 15:42:40 -0400 |
parents | b6d4c644b4b6 |
children | 5bf4e2c13ed8 |
files | src/ChangeLog src/load-path.cc src/load-path.h |
diffstat | 3 files changed, 37 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,13 @@ 2008-07-24 John W. Eaton <jwe@octave.org> + * load-path.h (load_path::dir_info::class_info): New struct. + (load_path::dir_info::method_file_map_type): Now a map from + class name to a to a class_info object. Change all uses. + * load-path.cc (load_path::dir_info::get_method_file_map): + Also look for private functions in the class directory. + (load_path::add_to_method_map): Also add private functions from + class directories to private_fcn_map. + * dirfns.cc (Fmkdir): If directory already exists, return status = true, but also set error message.
--- a/src/load-path.cc +++ b/src/load-path.cc @@ -218,7 +218,14 @@ load_path::dir_info::get_method_file_map (const std::string& d, const std::string& class_name) { - method_file_map[class_name] = get_fcn_files (d); + method_file_map[class_name].method_file_map = get_fcn_files (d); + + std::string pd = file_ops::concat (d, "private"); + + file_stat fs (pd); + + if (fs && fs.is_dir ()) + method_file_map[class_name].private_file_map = get_fcn_files (pd); } bool @@ -1346,7 +1353,9 @@ os << "\n*** methods in " << i->dir_name << "/@" << p->first << ":\n\n"; - string_vector method_files = get_file_list (p->second); + const dir_info::class_info& ci = p->second; + + string_vector method_files = get_file_list (ci.method_file_map); method_files.list_in_columns (os); } @@ -1494,7 +1503,7 @@ { std::string dir_name = di.dir_name; - // <CLASS_NAME, <FCN_NAME, TYPES>> + // <CLASS_NAME, CLASS_INFO> dir_info::method_file_map_type method_file_map = di.method_file_map; for (dir_info::const_method_file_map_iterator q = method_file_map.begin (); @@ -1508,8 +1517,10 @@ std::string full_dir_name = file_ops::concat (dir_name, "@" + class_name); + const dir_info::class_info& ci = q->second; + // <FCN_NAME, TYPES> - const dir_info::fcn_file_map_type& m = q->second; + const dir_info::fcn_file_map_type& m = ci.method_file_map; for (dir_info::const_fcn_file_map_iterator p = m.begin (); p != m.end (); @@ -1549,6 +1560,12 @@ fi.types = types; } } + + // <FCN_NAME, TYPES> + dir_info::fcn_file_map_type private_file_map = ci.private_file_map; + + if (! private_file_map.empty ()) + private_fcn_map[full_dir_name] = private_file_map; } }
--- a/src/load-path.h +++ b/src/load-path.h @@ -233,8 +233,14 @@ typedef fcn_file_map_type::const_iterator const_fcn_file_map_iterator; typedef fcn_file_map_type::iterator fcn_file_map_iterator; - // <CLASS_NAME, <FCN_NAME, TYPE>> - typedef std::map<std::string, fcn_file_map_type> method_file_map_type; + struct class_info + { + fcn_file_map_type method_file_map; + fcn_file_map_type private_file_map; + }; + + // <CLASS_NAME, CLASS_INFO> + typedef std::map<std::string, class_info> method_file_map_type; typedef method_file_map_type::const_iterator const_method_file_map_iterator; typedef method_file_map_type::iterator method_file_map_iterator;