Mercurial > octave
annotate libinterp/interpfcn/load-path.h @ 16676:7368654f302f classdef
Initial support for (classdef) packages.
* libinterp/interpfcn/load-path.h (class load_path::loader): New class.
(load_path::default_loader, load_path::loader_map): New members.
(load_path::load_path): Initialize them.
(load_path::fcn_map, load_path::private_fcn_map,
load_path::method_map): Move to class load_path::loader.
(load_path::add_to_fcn_map, load_path::add_to_private_fcn_map,
load_path::add_to_method_map, load_path::move_fcn_map,
load_path::move_method_map, load_path::remove_fcn_map,
load_path::remove_private_fcn_map, load_path::remove_method_map):
Move to class load_path::loader.
(load_path::move): Change signature.
(load_path::do_move, load_path::remove, load_path::add,
load_path::get_loader): New methods.
(load_path::find_package, load_path::do_find_package): Likewise.
(load_path::dir_info::package_dir_map): New member.
(load_path::dir_info::dir_info, load_path::dir_info::operator=):
Initialize/assign it.
(load_path::dir_info::get_package_dir): New method.
(load_path::do_find_fcn, load_path::do_find_private_fcn): Remove
methods.
(load_path::find_fcn, load_path::find_private_fcn,
load_path::find_fcn_file, load_path::find_oct_file,
load_path::find_mex_file): Rewrite using class load_path::loader.
New argument for package name.
*libinterp/interpfcn/load-path.cc (load_path::dir_info::initialize):
Clear package_map_dir.
(load_path::dir_info::get_package_dir): New method.
(load_path::dir_info::get_files_list): Use it.
(load_path::add_to_fcn_map, load_path::add_to_private_fcn_map,
load_path::add_to_method_map, load_path::move_fcn_map,
load_path::move_method_map, load_path::remove_fcn_map,
load_path::remove_private_fcn_map, load_path::remove_method_map):
Move to class load_path::loader.
(load_path::move): Move implementation to do_move, rewrite using
class load_path::loader. Signature change.
(load_path::do_move, load_path::add, load_path::remove): New methods.
(load_path::do_clear): Rewrite using class load_path::loader.
(load_path::do_add): Use "do_move" and "add" methods.
(load_path::do_remove): Rewrite using "remove" method.
(load_path::do_update): Rewitre using class load_path::loader and
"add" method.
(load_path::do_find_method, load_path::do_methods,
load_path::do_overloads, load_path::do_fcn_names, load_path::do_display):
Move Implementation to class load_path::loader, without "do_" prefix.
Rewrite original to redirect to appropriate loaders.
(F__dump_load_path__): New debug function.
* libinterp/interpfcn/symtab.h (symbol_table::package_name): New member.
(symbol_table::symbol_table): Initialize it.
(symbol_table::find): New scope argument.
(symbol_table::alloc_package_scope): New method.
(symbol_table::fcn_info::find, symbol_table::fcn_info::find_function,
symbol_table::fcn_info::find_user_function,
symbol_table::fcn_info::fcn_info_rep::xfind,
symbol_table::fcn_info::fcn_info_rep::load_class_constructor,
symbol_table::fcn_info::fcn_info_rep::find,
symbol_table::fcn_info::fcn_info_rep::find_user_function): New
argument for package name.
(symbol_table::fcn_info::fcn_info_rep::package): New member.
(symbol_table::fcn_info::fcn_info_rep::find_package,
symbol_table::fcn_info::fcn_info_rep::clear_package): New methods.
(symbol_table::fcn_info::fcn_info_rep::clear): Clear package.
* libinterp/interpfcn/symtab.cc
(symbol_table::fcn_info::fcn_info_rep::load_class_constructor,
symbol_table::fcn_info::fcn_info_rep::find,
symbol_table::fcn_info::fcn_info_rep::xfind,
symbol_table::fcn_info::fcn_info_rep::find_user_function):
New argument for package name.
(symbol_table::fcn_info::fcn_info_rep::find_package): New method.
(symbol_table::find): New scope argument.
(symbol_table::do_find): Use package_name member.
* libinterp/octave-value/ov-classdef.h
(cdef_package::cdef_package_rep::scope): New member.
(cdef_package::cdef_package_rep::~cdef_package_rep): New destructor.
(cdef_package::cdef_package_rep::meta_subsref,
cdef_package::cdef_package_rep::meta_release,
cdef_package::cdef_package_rep::meta_is_postfix_index_handled,
cdef_package::cdef_package_rep::find,
cdef_package::cdef_package_rep::wrap): New methods.
(cdef_package::find): New method.
(cdef_manager::find_package, cdef_manager::do_find_package): New
argument "load_if_not_found".
(cdef_manager::find_package_symbol,
cdef_manager::do_find_package_symbol): New methods.
* libinterp/octave-value/ov-classdef.cc
(cdef_manager::do_find_package_symbol): New method.
(cdef_manager::do_find_package): New argument. Create package object if
it is not loaded yet and the package exists in load_path.
(cdef_manager::do_find_class): Handle class names with package.
(cdef_package::cdef_package_rep::meta_subsref,
cdef_package::cdef_package_rep::meta_release,
cdef_package::cdef_package_rep::find): New methods.
(cdef_class::make_meta_class): Handle package-scoped classes.
(make_package): Assign correct name to the package object.
* libinterp/parse-tree/pt-classdef.h (tree_classdef::pack_name): New
member.
(tree_classdef::tree_classdef): New argument. Initialize it.
(tree_classdef::package_name): New accessor.
* libinterp/parse-tree/parse.h (octave_base_parser::curr_package_name):
New member.
(octave_base_parser::octave_base_parser): Initialize it.
(load_fcn_from_file): New argument for package name.
* libinterp/parse-tree/oct-parse.in.yy (load_fcn_from_file): New
argument for package name. Change callers.
(parse_fcn_from_file): New argument for package name. Change callers.
(octave_base_parser::make_classdef): Use curr_package_name to create
the tree_classdef object.
* libinterp/octave-value/ov-fcn-handle.cc (octave_fcn_handle::set_fcn):
Adapt to new load_fcn_from_file signature.
* libinterp/interp-core/ls-mat5.cc (read_mat5_binary_element): Adapt
to new load_fcn_from_file signature.
author | Michael Goffioul <michael.goffioul@gmail.com> |
---|---|
date | Fri, 17 May 2013 23:17:25 -0400 |
parents | 3cd80afc3509 |
children | edbb123cbe3a |
rev | line source |
---|---|
5832 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13983
diff
changeset
|
3 Copyright (C) 2006-2012 John W. Eaton |
10521
4d1fc073fbb7
add some missing copyright stmts
Jaroslav Hajek <highegg@gmail.com>
parents:
10321
diff
changeset
|
4 Copyright (C) 2010 VZLU Prague |
5832 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5832 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5832 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_load_path_h) | |
25 #define octave_load_path_h 1 | |
26 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
27 #include <iosfwd> |
5832 | 28 #include <list> |
29 #include <map> | |
30 #include <string> | |
31 | |
5835 | 32 #include "pathsearch.h" |
5832 | 33 #include "str-vec.h" |
34 | |
35 class | |
6241 | 36 OCTINTERP_API |
5832 | 37 load_path |
38 { | |
39 protected: | |
40 | |
9010
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8950
diff
changeset
|
41 load_path (void) |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
42 : loader_map (), default_loader (), dir_info_list (), init_dirs () { } |
5832 | 43 |
44 public: | |
45 | |
7336 | 46 typedef void (*hook_fcn_ptr) (const std::string& dir); |
5832 | 47 |
48 ~load_path (void) { } | |
49 | |
6365 | 50 static void initialize (bool set_initial_path = false) |
5832 | 51 { |
52 if (instance_ok ()) | |
6365 | 53 instance->do_initialize (set_initial_path); |
5832 | 54 } |
55 | |
56 static void clear (void) | |
57 { | |
58 if (instance_ok ()) | |
15008
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
59 instance->do_clear (); |
5832 | 60 } |
61 | |
5867 | 62 static void set (const std::string& p, bool warn = false) |
5832 | 63 { |
64 if (instance_ok ()) | |
5867 | 65 instance->do_set (p, warn); |
5832 | 66 } |
67 | |
5867 | 68 static void append (const std::string& dir, bool warn = false) |
5832 | 69 { |
70 if (instance_ok ()) | |
5867 | 71 instance->do_append (dir, warn); |
5832 | 72 } |
73 | |
5867 | 74 static void prepend (const std::string& dir, bool warn = false) |
5832 | 75 { |
76 if (instance_ok ()) | |
5867 | 77 instance->do_prepend (dir, warn); |
5832 | 78 } |
79 | |
80 static bool remove (const std::string& dir) | |
81 { | |
82 return instance_ok () ? instance->do_remove (dir) : false; | |
83 } | |
84 | |
85 static void update (void) | |
86 { | |
87 if (instance_ok ()) | |
88 instance->do_update (); | |
89 } | |
90 | |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
91 static bool contains_canonical (const std::string& dir_name) |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
92 { |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
93 return instance_ok () ? instance->do_contains_canonical (dir_name) : false; |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
94 } |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
95 |
7336 | 96 static std::string find_method (const std::string& class_name, |
10313 | 97 const std::string& meth, |
98 std::string& dir_name) | |
7336 | 99 { |
100 return instance_ok () | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
101 ? instance->do_find_method (class_name, meth, dir_name) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
102 : std::string (); |
7336 | 103 } |
104 | |
105 static std::string find_method (const std::string& class_name, | |
10313 | 106 const std::string& meth) |
7336 | 107 { |
108 std::string dir_name; | |
109 return find_method (class_name, meth, dir_name); | |
110 } | |
111 | |
112 static std::list<std::string> methods (const std::string& class_name) | |
113 { | |
114 return instance_ok () | |
115 ? instance->do_methods (class_name) : std::list<std::string> (); | |
116 } | |
117 | |
10321
97b4bd6f0925
partially rewrite function handles
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
118 static std::list<std::string> overloads (const std::string& meth) |
9458
0c7d84a65386
allow taking handles of methods with no base overload
Jaroslav Hajek <highegg@gmail.com>
parents:
9261
diff
changeset
|
119 { |
0c7d84a65386
allow taking handles of methods with no base overload
Jaroslav Hajek <highegg@gmail.com>
parents:
9261
diff
changeset
|
120 return instance_ok () |
10321
97b4bd6f0925
partially rewrite function handles
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
121 ? instance->do_overloads (meth) : std::list<std::string> (); |
9458
0c7d84a65386
allow taking handles of methods with no base overload
Jaroslav Hajek <highegg@gmail.com>
parents:
9261
diff
changeset
|
122 } |
0c7d84a65386
allow taking handles of methods with no base overload
Jaroslav Hajek <highegg@gmail.com>
parents:
9261
diff
changeset
|
123 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
124 static bool find_package (const std::string& package_name) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
125 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
126 return instance_ok () |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
127 ? instance->do_find_package (package_name) : false; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
128 } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
129 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
130 static std::string find_fcn (const std::string& fcn, std::string& dir_name, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
131 const std::string& pack_name = std::string ()) |
7336 | 132 { |
133 return instance_ok () | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
134 ? instance->get_loader (pack_name).find_fcn (fcn, dir_name) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
135 : std::string (); |
7336 | 136 } |
137 | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
138 static std::string find_fcn (const std::string& fcn, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
139 const std::string& pack_name = std::string ()) |
5832 | 140 { |
7336 | 141 std::string dir_name; |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
142 return find_fcn (fcn, dir_name, pack_name); |
7336 | 143 } |
144 | |
145 static std::string find_private_fcn (const std::string& dir, | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
146 const std::string& fcn, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
147 const std::string& pack_name = std::string ()) |
7336 | 148 { |
5832 | 149 return instance_ok () |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
150 ? instance->get_loader (pack_name).find_private_fcn (dir, fcn) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
151 : std::string (); |
5832 | 152 } |
153 | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
154 static std::string find_fcn_file (const std::string& fcn, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
155 const std::string& pack_name = std::string ()) |
5832 | 156 { |
7336 | 157 std::string dir_name; |
158 | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
159 return instance_ok () |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
160 ? instance->get_loader (pack_name).find_fcn (fcn, dir_name, M_FILE) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
161 : std::string (); |
5832 | 162 } |
163 | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
164 static std::string find_oct_file (const std::string& fcn, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
165 const std::string& pack_name = std::string ()) |
5832 | 166 { |
7336 | 167 std::string dir_name; |
168 | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
169 return instance_ok () |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
170 ? instance->get_loader (pack_name).find_fcn (fcn, dir_name, M_FILE) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
171 : std::string (); |
5832 | 172 } |
173 | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
174 static std::string find_mex_file (const std::string& fcn, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
175 const std::string& pack_name = std::string ()) |
5864 | 176 { |
7336 | 177 std::string dir_name; |
178 | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
179 return instance_ok () |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
180 ? instance->get_loader (pack_name).find_fcn (fcn, dir_name, M_FILE) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
181 : std::string (); |
5864 | 182 } |
183 | |
5832 | 184 static std::string find_file (const std::string& file) |
185 { | |
186 return instance_ok () | |
187 ? instance->do_find_file (file) : std::string (); | |
188 } | |
189 | |
8041
a14bdf90be55
Add a search for Contents.m files to the help function
David Bateman <dbateman@free.fr>
parents:
8008
diff
changeset
|
190 static std::string find_dir (const std::string& dir) |
a14bdf90be55
Add a search for Contents.m files to the help function
David Bateman <dbateman@free.fr>
parents:
8008
diff
changeset
|
191 { |
a14bdf90be55
Add a search for Contents.m files to the help function
David Bateman <dbateman@free.fr>
parents:
8008
diff
changeset
|
192 return instance_ok () |
a14bdf90be55
Add a search for Contents.m files to the help function
David Bateman <dbateman@free.fr>
parents:
8008
diff
changeset
|
193 ? instance->do_find_dir (dir) : std::string (); |
a14bdf90be55
Add a search for Contents.m files to the help function
David Bateman <dbateman@free.fr>
parents:
8008
diff
changeset
|
194 } |
a14bdf90be55
Add a search for Contents.m files to the help function
David Bateman <dbateman@free.fr>
parents:
8008
diff
changeset
|
195 |
9806
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9748
diff
changeset
|
196 static string_vector find_matching_dirs (const std::string& dir) |
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9748
diff
changeset
|
197 { |
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9748
diff
changeset
|
198 return instance_ok () |
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9748
diff
changeset
|
199 ? instance->do_find_matching_dirs (dir) : string_vector (); |
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9748
diff
changeset
|
200 } |
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9748
diff
changeset
|
201 |
5832 | 202 static std::string find_first_of (const string_vector& files) |
203 { | |
204 return instance_ok () ? | |
205 instance->do_find_first_of (files) : std::string (); | |
206 } | |
207 | |
208 static string_vector find_all_first_of (const string_vector& files) | |
209 { | |
210 return instance_ok () ? | |
211 instance->do_find_all_first_of (files) : string_vector (); | |
212 } | |
213 | |
214 static string_vector dirs (void) | |
215 { | |
216 return instance_ok () ? instance->do_dirs () : string_vector (); | |
217 } | |
218 | |
219 static std::list<std::string> dir_list (void) | |
220 { | |
221 return instance_ok () | |
222 ? instance->do_dir_list () : std::list<std::string> (); | |
223 } | |
224 | |
9261
95445f9f5976
omit file extensions from __list_functions__ output
John W. Eaton <jwe@octave.org>
parents:
9010
diff
changeset
|
225 static string_vector files (const std::string& dir, bool omit_exts = false) |
5832 | 226 { |
9261
95445f9f5976
omit file extensions from __list_functions__ output
John W. Eaton <jwe@octave.org>
parents:
9010
diff
changeset
|
227 return instance_ok () |
95445f9f5976
omit file extensions from __list_functions__ output
John W. Eaton <jwe@octave.org>
parents:
9010
diff
changeset
|
228 ? instance->do_files (dir, omit_exts) : string_vector (); |
5832 | 229 } |
230 | |
231 static string_vector fcn_names (void) | |
232 { | |
233 return instance_ok () ? instance->do_fcn_names () : string_vector (); | |
234 } | |
235 | |
236 static std::string path (void) | |
237 { | |
238 return instance_ok () ? instance->do_path () : std::string (); | |
239 } | |
240 | |
241 static void display (std::ostream& os) | |
242 { | |
243 if (instance_ok ()) | |
244 instance->do_display (os); | |
245 } | |
246 | |
7336 | 247 static void set_add_hook (hook_fcn_ptr f) { add_hook = f; } |
5832 | 248 |
7336 | 249 static void set_remove_hook (hook_fcn_ptr f) { remove_hook = f; } |
5832 | 250 |
251 static void set_command_line_path (const std::string& p) | |
252 { | |
5835 | 253 if (command_line_path.empty ()) |
254 command_line_path = p; | |
255 else | |
8008
4d13a7a2f6ab
dir_path: use singleton class for static data members
John W. Eaton <jwe@octave.org>
parents:
7971
diff
changeset
|
256 command_line_path += dir_path::path_sep_str () + p; |
5832 | 257 } |
258 | |
8586
31ab3b83bc8a
savepath: Respect cmd-line and env paths.
Ben Abbott <bpabbott@mac.com>
parents:
8329
diff
changeset
|
259 static std::string get_command_line_path (void) |
31ab3b83bc8a
savepath: Respect cmd-line and env paths.
Ben Abbott <bpabbott@mac.com>
parents:
8329
diff
changeset
|
260 { |
31ab3b83bc8a
savepath: Respect cmd-line and env paths.
Ben Abbott <bpabbott@mac.com>
parents:
8329
diff
changeset
|
261 return instance_ok () ? instance->do_get_command_line_path () : std::string (); |
31ab3b83bc8a
savepath: Respect cmd-line and env paths.
Ben Abbott <bpabbott@mac.com>
parents:
8329
diff
changeset
|
262 } |
31ab3b83bc8a
savepath: Respect cmd-line and env paths.
Ben Abbott <bpabbott@mac.com>
parents:
8329
diff
changeset
|
263 |
6626 | 264 static std::string system_path (void) |
265 { | |
6630 | 266 return instance_ok () ? instance->do_system_path () : std::string (); |
6626 | 267 } |
268 | |
5832 | 269 private: |
270 | |
271 static const int M_FILE = 1; | |
272 static const int OCT_FILE = 2; | |
5864 | 273 static const int MEX_FILE = 4; |
5832 | 274 |
275 class dir_info | |
276 { | |
277 public: | |
278 | |
7336 | 279 // <FCN_NAME, TYPE> |
280 typedef std::map<std::string, int> fcn_file_map_type; | |
281 | |
282 typedef fcn_file_map_type::const_iterator const_fcn_file_map_iterator; | |
283 typedef fcn_file_map_type::iterator fcn_file_map_iterator; | |
284 | |
7971
dd5cc5016487
handle private functions in class directories
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
285 struct class_info |
dd5cc5016487
handle private functions in class directories
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
286 { |
11515
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
287 class_info (void) : method_file_map (), private_file_map () { } |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
288 |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
289 class_info (const class_info& ci) |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
290 : method_file_map (ci.method_file_map), |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
291 private_file_map (ci.private_file_map) { } |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
292 |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
293 class_info& operator = (const class_info& ci) |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
294 { |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
295 if (this != &ci) |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
296 { |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
297 method_file_map = ci.method_file_map; |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
298 private_file_map = ci.private_file_map; |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
299 } |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
300 return *this; |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
301 } |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
302 |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
303 ~class_info (void) { } |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
304 |
7971
dd5cc5016487
handle private functions in class directories
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
305 fcn_file_map_type method_file_map; |
dd5cc5016487
handle private functions in class directories
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
306 fcn_file_map_type private_file_map; |
dd5cc5016487
handle private functions in class directories
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
307 }; |
dd5cc5016487
handle private functions in class directories
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
308 |
dd5cc5016487
handle private functions in class directories
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
309 // <CLASS_NAME, CLASS_INFO> |
dd5cc5016487
handle private functions in class directories
John W. Eaton <jwe@octave.org>
parents:
7336
diff
changeset
|
310 typedef std::map<std::string, class_info> method_file_map_type; |
7336 | 311 |
312 typedef method_file_map_type::const_iterator const_method_file_map_iterator; | |
313 typedef method_file_map_type::iterator method_file_map_iterator; | |
314 | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
315 // <PACKAGE_NAME, DIR_INFO> |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
316 typedef std::map<std::string, dir_info> package_dir_map_type; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
317 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
318 typedef package_dir_map_type::const_iterator const_package_dir_map_iterator; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
319 typedef package_dir_map_type::iterator package_dir_map_iterator; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
320 |
8329
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
321 // This default constructor is only provided so we can create a |
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
322 // std::map of dir_info objects. You should not use this |
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
323 // constructor for any other purpose. |
11515
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
324 dir_info (void) |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
325 : dir_name (), abs_dir_name (), is_relative (false), |
15008
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
326 dir_mtime (), dir_time_last_checked (), |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
327 all_files (), fcn_files (), private_file_map (), method_file_map (), |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
328 package_dir_map () |
11515
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
329 { } |
8329
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
330 |
11515
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
331 dir_info (const std::string& d) |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
332 : dir_name (d), abs_dir_name (), is_relative (false), |
15008
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
333 dir_mtime (), dir_time_last_checked (), |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
334 all_files (), fcn_files (), private_file_map (), method_file_map (), |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
335 package_dir_map () |
11515
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
336 { |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
337 initialize (); |
6dbf9bcce90e
more data member initialization fixes
John W. Eaton <jwe@octave.org>
parents:
10907
diff
changeset
|
338 } |
5832 | 339 |
340 dir_info (const dir_info& di) | |
8329
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
341 : dir_name (di.dir_name), abs_dir_name (di.abs_dir_name), |
10313 | 342 is_relative (di.is_relative), |
343 dir_mtime (di.dir_mtime), | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
344 dir_time_last_checked (di.dir_time_last_checked), |
10313 | 345 all_files (di.all_files), fcn_files (di.fcn_files), |
346 private_file_map (di.private_file_map), | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
347 method_file_map (di.method_file_map), |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
348 package_dir_map (di.package_dir_map) { } |
5832 | 349 |
350 ~dir_info (void) { } | |
351 | |
352 dir_info& operator = (const dir_info& di) | |
353 { | |
354 if (&di != this) | |
10313 | 355 { |
356 dir_name = di.dir_name; | |
357 abs_dir_name = di.abs_dir_name; | |
358 is_relative = di.is_relative; | |
359 dir_mtime = di.dir_mtime; | |
360 dir_time_last_checked = di.dir_time_last_checked; | |
361 all_files = di.all_files; | |
362 fcn_files = di.fcn_files; | |
363 private_file_map = di.private_file_map; | |
364 method_file_map = di.method_file_map; | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
365 package_dir_map = di.package_dir_map; |
10313 | 366 } |
5832 | 367 |
368 return *this; | |
369 } | |
370 | |
371 void update (void); | |
372 | |
373 std::string dir_name; | |
8329
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
374 std::string abs_dir_name; |
5832 | 375 bool is_relative; |
376 octave_time dir_mtime; | |
9748
d6b2b708b6b0
load-path: compare directory timestamps with tolerance
John W. Eaton <jwe@octave.org>
parents:
9581
diff
changeset
|
377 octave_time dir_time_last_checked; |
5832 | 378 string_vector all_files; |
379 string_vector fcn_files; | |
7336 | 380 fcn_file_map_type private_file_map; |
381 method_file_map_type method_file_map; | |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
382 package_dir_map_type package_dir_map; |
5832 | 383 |
384 private: | |
385 | |
386 void initialize (void); | |
387 | |
7336 | 388 void get_file_list (const std::string& d); |
389 | |
390 void get_private_file_map (const std::string& d); | |
5832 | 391 |
7336 | 392 void get_method_file_map (const std::string& d, |
10313 | 393 const std::string& class_name); |
7336 | 394 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
395 void get_package_dir (const std::string& d, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
396 const std::string& package_name); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
397 |
7336 | 398 friend fcn_file_map_type get_fcn_files (const std::string& d); |
5832 | 399 }; |
400 | |
401 class file_info | |
402 { | |
403 public: | |
404 | |
405 file_info (const std::string& d, int t) : dir_name (d), types (t) { } | |
406 | |
407 file_info (const file_info& fi) | |
408 : dir_name (fi.dir_name), types (fi.types) { } | |
409 | |
410 ~file_info (void) { } | |
411 | |
412 file_info& operator = (const file_info& fi) | |
413 { | |
414 if (&fi != this) | |
10313 | 415 { |
416 dir_name = fi.dir_name; | |
417 types = fi.types; | |
418 } | |
5832 | 419 |
420 return *this; | |
421 } | |
422 | |
423 std::string dir_name; | |
424 int types; | |
425 }; | |
426 | |
427 // We maintain two ways of looking at the same information. | |
428 // | |
429 // First, a list of directories and the set of "public" files and | |
430 // private files (those found in the special "private" subdirectory) | |
431 // in each directory. | |
432 // | |
433 // Second, a map from file names (the union of all "public" files for all | |
7336 | 434 // directories, but without filename extensions) to a list of |
5832 | 435 // corresponding information (directory name and file types). This |
436 // way, we can quickly find shadowed file names and look up all | |
437 // overloaded functions (in the "@" directories used to implement | |
438 // classes). | |
439 | |
7336 | 440 typedef std::list<dir_info> dir_info_list_type; |
441 | |
442 typedef dir_info_list_type::const_iterator const_dir_info_list_iterator; | |
443 typedef dir_info_list_type::iterator dir_info_list_iterator; | |
444 | |
8329
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
445 typedef std::map<std::string, dir_info> abs_dir_cache_type; |
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
446 |
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
447 typedef abs_dir_cache_type::const_iterator const_abs_dir_cache_iterator; |
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
448 typedef abs_dir_cache_type::iterator abs_dir_cache_iterator; |
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
449 |
7336 | 450 typedef std::list<file_info> file_info_list_type; |
451 | |
452 typedef file_info_list_type::const_iterator const_file_info_list_iterator; | |
453 typedef file_info_list_type::iterator file_info_list_iterator; | |
454 | |
455 // <FCN_NAME, FILE_INFO_LIST> | |
456 typedef std::map<std::string, file_info_list_type> fcn_map_type; | |
457 | |
458 typedef fcn_map_type::const_iterator const_fcn_map_iterator; | |
459 typedef fcn_map_type::iterator fcn_map_iterator; | |
5832 | 460 |
7336 | 461 // <DIR_NAME, <FCN_NAME, TYPE>> |
462 typedef std::map<std::string, dir_info::fcn_file_map_type> private_fcn_map_type; | |
463 | |
464 typedef private_fcn_map_type::const_iterator const_private_fcn_map_iterator; | |
465 typedef private_fcn_map_type::iterator private_fcn_map_iterator; | |
466 | |
467 // <CLASS_NAME, <FCN_NAME, FILE_INFO_LIST>> | |
468 typedef std::map<std::string, fcn_map_type> method_map_type; | |
469 | |
470 typedef method_map_type::const_iterator const_method_map_iterator; | |
471 typedef method_map_type::iterator method_map_iterator; | |
10907
6105ed2db9d7
load_path::dir_info::initialize: clear method_file_map before updating file list
John W. Eaton <jwe@octave.org>
parents:
10521
diff
changeset
|
472 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
473 class loader |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
474 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
475 public: |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
476 loader (const std::string& pfx = std::string ()) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
477 : prefix (pfx), dir_list (), fcn_map (), private_fcn_map (), |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
478 method_map () { } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
479 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
480 loader (const loader& l) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
481 : prefix (l.prefix), dir_list (l.dir_list), |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
482 private_fcn_map (l.private_fcn_map), method_map (l.method_map) { } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
483 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
484 ~loader (void) { } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
485 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
486 loader& operator = (const loader& l) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
487 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
488 if (&l != this) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
489 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
490 prefix = l.prefix; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
491 dir_list = l.dir_list; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
492 fcn_map = l.fcn_map; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
493 private_fcn_map = l.private_fcn_map; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
494 method_map = l.method_map; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
495 } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
496 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
497 return *this; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
498 } |
7336 | 499 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
500 void add (const dir_info& di, bool at_end) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
501 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
502 if (at_end) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
503 dir_list.push_back (di.dir_name); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
504 else |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
505 dir_list.push_front (di.dir_name); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
506 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
507 add_to_fcn_map (di, at_end); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
508 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
509 add_to_private_fcn_map (di); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
510 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
511 add_to_method_map (di, at_end); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
512 } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
513 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
514 void move (const dir_info& di, bool at_end); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
515 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
516 void remove (const dir_info& di); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
517 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
518 void clear (void) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
519 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
520 dir_list.clear (); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
521 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
522 fcn_map.clear (); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
523 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
524 private_fcn_map.clear (); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
525 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
526 method_map.clear (); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
527 } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
528 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
529 void display (std::ostream& out) const; |
7336 | 530 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
531 std::string find_fcn (const std::string& fcn, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
532 std::string& dir_name, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
533 int type = M_FILE | OCT_FILE | MEX_FILE) const; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
534 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
535 std::string find_private_fcn (const std::string& dir, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
536 const std::string& fcn, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
537 int type = M_FILE | OCT_FILE | MEX_FILE) const; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
538 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
539 std::string find_method (const std::string& class_name, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
540 const std::string& meth, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
541 std::string& dir_name, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
542 int type = M_FILE | OCT_FILE | MEX_FILE) const; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
543 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
544 std::list<std::string> methods (const std::string& class_name) const; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
545 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
546 void overloads (const std::string& meth, std::list<std::string>& l) const; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
547 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
548 string_vector fcn_names (void) const; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
549 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
550 private: |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
551 void add_to_fcn_map (const dir_info& di, bool at_end); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
552 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
553 void add_to_private_fcn_map (const dir_info& di); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
554 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
555 void add_to_method_map (const dir_info& di, bool at_end); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
556 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
557 void move_fcn_map (const std::string& dir, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
558 const string_vector& fcn_files, bool at_end); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
559 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
560 void move_method_map (const std::string& dir, bool at_end); |
7336 | 561 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
562 void remove_fcn_map (const std::string& dir, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
563 const string_vector& fcn_files); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
564 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
565 void remove_private_fcn_map (const std::string& dir); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
566 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
567 void remove_method_map (const std::string& dir); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
568 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
569 private: |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
570 std::string prefix; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
571 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
572 std::list<std::string> dir_list; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
573 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
574 fcn_map_type fcn_map; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
575 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
576 private_fcn_map_type private_fcn_map; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
577 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
578 method_map_type method_map; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
579 }; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
580 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
581 // <PACKAGE_NAME, LOADER> |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
582 typedef std::map<std::string, loader> loader_map_type; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
583 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
584 typedef loader_map_type::const_iterator const_loader_map_iterator; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
585 typedef loader_map_type::iterator loader_map_iterator; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
586 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
587 mutable loader_map_type loader_map; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
588 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
589 mutable loader default_loader; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
590 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
591 mutable dir_info_list_type dir_info_list; |
5832 | 592 |
15008
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
593 mutable std::set<std::string> init_dirs; |
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
594 |
5832 | 595 static load_path *instance; |
596 | |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
597 static void cleanup_instance (void) { delete instance; instance = 0; } |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
598 |
7336 | 599 static hook_fcn_ptr add_hook; |
5832 | 600 |
7336 | 601 static hook_fcn_ptr remove_hook; |
5832 | 602 |
603 static std::string command_line_path; | |
604 | |
6626 | 605 static std::string sys_path; |
606 | |
8329
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
607 static abs_dir_cache_type abs_dir_cache; |
c91b59532f32
load-path.cc (load_path::dir_info::update): smarter handling of relative names
John W. Eaton <jwe@octave.org>
parents:
8041
diff
changeset
|
608 |
5832 | 609 static bool instance_ok (void); |
610 | |
611 const_dir_info_list_iterator find_dir_info (const std::string& dir) const; | |
612 dir_info_list_iterator find_dir_info (const std::string& dir); | |
613 | |
614 bool contains (const std::string& dir) const; | |
615 | |
16547
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
616 bool do_contains_canonical (const std::string& dir) const; |
3cd80afc3509
improve debugging with the GUI
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
617 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
618 void do_move (dir_info_list_iterator i, bool at_end); |
7336 | 619 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
620 void move (const dir_info& di, bool at_end, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
621 const std::string& pname = std::string ()); |
7336 | 622 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
623 void remove (const dir_info& di, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
624 const std::string& pname = std::string ()); |
5832 | 625 |
6365 | 626 void do_initialize (bool set_initial_path); |
5832 | 627 |
15008
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
628 void do_clear (void); |
5832 | 629 |
15008
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
630 void do_set (const std::string& p, bool warn, bool is_init = false); |
5867 | 631 |
15008
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
632 void do_append (const std::string& dir, bool warn); |
5832 | 633 |
5867 | 634 void do_prepend (const std::string& dir, bool warn); |
5832 | 635 |
15008
ff9a638a5555
preserve order of path elements when doing "path (new_path)"
John W. Eaton <jwe@octave.org>
parents:
14861
diff
changeset
|
636 void do_add (const std::string& dir, bool at_end, bool warn); |
5832 | 637 |
638 bool do_remove (const std::string& dir); | |
639 | |
640 void do_update (void) const; | |
641 | |
7336 | 642 static bool |
643 check_file_type (std::string& fname, int type, int possible_types, | |
10313 | 644 const std::string& fcn, const char *who); |
7336 | 645 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
646 loader& get_loader (const std::string& name) const |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
647 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
648 if (! name.empty ()) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
649 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
650 loader_map_iterator l = loader_map.find (name); |
5832 | 651 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
652 if (l == loader_map.end ()) |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
653 l = loader_map.insert (loader_map.end (), |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
654 loader_map_type::value_type (name, loader (name))); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
655 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
656 return l->second; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
657 } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
658 |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
659 return default_loader; |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
660 } |
7336 | 661 |
662 std::string do_find_method (const std::string& class_name, | |
10313 | 663 const std::string& meth, |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
664 std::string& dir_name) const; |
7336 | 665 |
666 std::list<std::string> do_methods (const std::string& class_name) const; | |
667 | |
10321
97b4bd6f0925
partially rewrite function handles
Jaroslav Hajek <highegg@gmail.com>
parents:
10313
diff
changeset
|
668 std::list<std::string> do_overloads (const std::string& meth) const; |
9458
0c7d84a65386
allow taking handles of methods with no base overload
Jaroslav Hajek <highegg@gmail.com>
parents:
9261
diff
changeset
|
669 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
670 bool do_find_package (const std::string& package_name) const |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
671 { |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
672 return (loader_map.find (package_name) != loader_map.end ()); |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
673 } |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
674 |
5832 | 675 std::string do_find_file (const std::string& file) const; |
676 | |
8041
a14bdf90be55
Add a search for Contents.m files to the help function
David Bateman <dbateman@free.fr>
parents:
8008
diff
changeset
|
677 std::string do_find_dir (const std::string& dir) const; |
a14bdf90be55
Add a search for Contents.m files to the help function
David Bateman <dbateman@free.fr>
parents:
8008
diff
changeset
|
678 |
9806
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9748
diff
changeset
|
679 string_vector do_find_matching_dirs (const std::string& dir) const; |
8e345f2fe4d6
improved support for Contents.m files
John W. Eaton <jwe@octave.org>
parents:
9748
diff
changeset
|
680 |
5832 | 681 std::string do_find_first_of (const string_vector& files) const; |
682 | |
683 string_vector do_find_all_first_of (const string_vector& files) const; | |
684 | |
685 string_vector do_dirs (void) const; | |
686 | |
687 std::list<std::string> do_dir_list (void) const; | |
688 | |
9261
95445f9f5976
omit file extensions from __list_functions__ output
John W. Eaton <jwe@octave.org>
parents:
9010
diff
changeset
|
689 string_vector do_files (const std::string& dir, bool omit_exts) const; |
5832 | 690 |
691 string_vector do_fcn_names (void) const; | |
692 | |
693 std::string do_path (void) const; | |
694 | |
7336 | 695 friend void print_types (std::ostream& os, int types); |
696 | |
697 friend string_vector get_file_list (const dir_info::fcn_file_map_type& lst); | |
698 | |
699 friend void | |
700 print_fcn_list (std::ostream& os, const dir_info::fcn_file_map_type& lst); | |
701 | |
5832 | 702 void do_display (std::ostream& os) const; |
703 | |
6629 | 704 std::string do_system_path (void) const { return sys_path; } |
6626 | 705 |
8586
31ab3b83bc8a
savepath: Respect cmd-line and env paths.
Ben Abbott <bpabbott@mac.com>
parents:
8329
diff
changeset
|
706 std::string do_get_command_line_path (void) const { return command_line_path; } |
31ab3b83bc8a
savepath: Respect cmd-line and env paths.
Ben Abbott <bpabbott@mac.com>
parents:
8329
diff
changeset
|
707 |
16676
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
708 void add (const dir_info& di, bool at_end, |
7368654f302f
Initial support for (classdef) packages.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
16547
diff
changeset
|
709 const std::string& pname = std::string ()) const; |
7336 | 710 |
711 friend dir_info::fcn_file_map_type get_fcn_files (const std::string& d); | |
5832 | 712 }; |
713 | |
714 extern std::string | |
715 genpath (const std::string& dir, const string_vector& skip = "private"); | |
716 | |
717 extern void execute_pkg_add (const std::string& dir); | |
718 extern void execute_pkg_del (const std::string& dir); | |
719 | |
720 #endif |