Mercurial > octave
annotate libinterp/octave-value/cdef-manager.cc @ 26975:de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
* bp-table.h, bp-table.cc (bp_table::add_breakpoint): New argument,
CLASS_NAME. Change all uses. Pass class name on to
tree_evaluator::get_user_code.
* cdef-class.h, cdef-class.cc (cdef_class::get_method,
cdef_class::cdef_class_rep::get_method): New functions.
* cdef-manager.h, cdef-manager.cc (cdef_manager::find_method):
New function.
* pt-eval.h, pt-eval.cc (tree_evaluator::get_user_code): New argument,
CLASS_NAME. If given class name, look for classdef methods.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 26 Mar 2019 02:42:38 +0000 |
parents | 340d44f2f942 |
children | 84ff9953faa1 |
rev | line source |
---|---|
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1 /* |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
2 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
3 Copyright (C) 2012-2019 Michael Goffioul |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
4 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
6 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
10 (at your option) any later version. |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
11 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
15 GNU General Public License for more details. |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
16 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
20 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
21 */ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
22 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
24 # include "config.h" |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 #endif |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 #include "cdef-manager.h" |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #include "cdef-utils.h" |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 #include "interpreter.h" |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include "interpreter-private.h" |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include "ov-classdef.h" |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
33 namespace octave |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 { |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
35 static octave_value |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
36 make_fcn_handle (octave_builtin::fcn ff, const std::string& nm) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
37 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
38 octave_value fcn (new octave_builtin (ff, nm)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
40 octave_value fcn_handle (new octave_fcn_handle (fcn, nm)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
42 return fcn_handle; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
43 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
44 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
45 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
46 class_get_properties (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
47 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
48 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
50 if (args.length () == 1 && args(0).type_name () == "object") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
51 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
52 cdef_class cls (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
54 retval(0) = cls.get_properties (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
55 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
57 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
58 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
60 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
61 class_get_methods (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
62 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
63 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
65 if (args.length () == 1 && args(0).type_name () == "object") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
66 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
67 cdef_class cls (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
69 retval(0) = cls.get_methods (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
70 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
72 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
73 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
75 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
76 class_get_superclasses (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
77 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
78 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
80 if (args.length () == 1 && args(0).type_name () == "object" |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
81 && args(0).class_name () == "meta.class") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
82 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
83 cdef_class cls (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
85 Cell classes = cls.get ("SuperClasses").cell_value (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
86 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
87 retval(0) = to_ov (lookup_classes (classes)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
88 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
90 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
91 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
92 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
93 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
94 class_get_inferiorclasses (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
95 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
96 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
98 if (args.length () == 1 && args(0).type_name () == "object" |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
99 && args(0).class_name () == "meta.class") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
100 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
101 cdef_class cls (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
103 Cell classes = cls.get ("InferiorClasses").cell_value (); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
105 retval(0) = to_ov (lookup_classes (classes)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
106 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
107 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
108 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
109 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
110 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
111 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
112 class_fromName (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
113 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
114 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
115 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
116 if (args.length () != 1) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
117 error ("fromName: invalid number of parameters"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
118 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
119 std::string name = args(0).xstring_value ("fromName: CLASS_NAME must be a string"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
120 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
121 retval(0) = to_ov (lookup_class (name, false)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
122 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
123 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
124 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
125 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
126 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
127 class_fevalStatic (const octave_value_list& args, int nargout) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
128 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
129 if (args.length () <= 1 || args(0).type_name () != "object") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
130 error ("fevalStatic: first argument must be a meta.class object"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
131 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
132 cdef_class cls (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
133 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
134 std::string meth_name = args(1).xstring_value ("fevalStatic: method name must be a string"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
135 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
136 cdef_method meth = cls.find_method (meth_name); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
137 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
138 if (! meth.ok ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
139 error ("fevalStatic: method not found: %s", meth_name.c_str ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
140 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
141 if (! meth.is_static ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
142 error ("fevalStatic: method `%s' is not static", meth_name.c_str ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
144 return meth.execute (args.splice (0, 2), nargout, true, "fevalStatic"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
145 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
146 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
147 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
148 class_getConstant (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
149 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
150 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
151 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
152 if (args.length () != 2 || args(0).type_name () != "object" |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
153 || args(0).class_name () != "meta.class") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
154 error ("getConstant: first argument must be a meta.class object"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
155 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
156 cdef_class cls = to_cdef (args(0)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
157 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
158 std::string prop_name = args(1).xstring_value ("getConstant: property name must be a string"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
159 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
160 cdef_property prop = cls.find_property (prop_name); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
162 if (! prop.ok ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
163 error ("getConstant: property not found: %s", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
164 prop_name.c_str ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
165 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
166 if (! prop.is_constant ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
167 error ("getConstant: property `%s' is not constant", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
168 prop_name.c_str ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
169 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
170 retval(0) = prop.get_value (true, "getConstant"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
171 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
172 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
173 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
174 |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
175 #define META_CLASS_CMP(OP, CLSA, CLSB, FUN) \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
176 static octave_value_list \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
177 class_ ## OP (const octave_value_list& args, int /* nargout */) \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
178 { \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
179 octave_value_list retval; \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
180 \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
181 if (args.length () != 2 \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
182 || args(0).type_name () != "object" \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
183 || args(1).type_name () != "object" \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
184 || args(0).class_name () != "meta.class" \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
185 || args(1).class_name () != "meta.class") \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
186 error (#OP ": invalid arguments"); \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
187 \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
188 cdef_class clsa = to_cdef (args(0)); \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
189 \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
190 cdef_class clsb = to_cdef (args(1)); \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
191 \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
192 retval(0) = FUN (CLSA, CLSB); \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
193 \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
194 return retval; \ |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
195 } |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
196 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
197 META_CLASS_CMP (lt, clsb, clsa, is_strict_superclass) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
198 META_CLASS_CMP (le, clsb, clsa, is_superclass) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
199 META_CLASS_CMP (gt, clsa, clsb, is_strict_superclass) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
200 META_CLASS_CMP (ge, clsa, clsb, is_superclass) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
201 META_CLASS_CMP (eq, clsa, clsb, operator==) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
202 META_CLASS_CMP (ne, clsa, clsb, operator!=) |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
203 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
204 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
205 property_get_defaultvalue (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
206 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
207 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
208 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
209 if (args.length () == 1 && args(0).type_name () == "object") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
210 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
211 cdef_property prop (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
212 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
213 retval(0) = prop.get ("DefaultValue"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
214 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
215 if (! retval(0).is_defined ()) |
26870
d05863145670
Fix typo in error_with_id and "Octave:class:NoDefaultDefined".
Rik <rik@octave.org>
parents:
26781
diff
changeset
|
216 error_with_id ("Octave:class:NoDefaultDefined", |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
217 "no default value for property `%s'", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
218 prop.get_name ().c_str ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
219 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
220 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
221 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
222 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
223 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
224 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
225 handle_delete (const octave_value_list& /* args */, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
226 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
227 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
228 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
229 // FIXME: implement this. Wait, what is this supposed to do? |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
230 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
231 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
232 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
233 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
234 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
235 package_get_classes (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
236 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
237 octave_value_list retval (1, Matrix ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
238 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
239 if (args.length () == 1 && args(0).type_name () == "object" |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
240 && args(0).class_name () == "meta.package") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
241 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
242 cdef_package pack (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
243 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
244 retval(0) = pack.get_classes (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
245 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
246 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
247 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
248 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
249 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
250 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
251 package_get_functions (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
252 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
253 octave_value_list retval (1, Matrix ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
254 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
255 if (args.length () == 0 && args(0).type_name () == "object" |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
256 && args(0).class_name () == "meta.package") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
257 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
258 cdef_package pack (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
259 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
260 retval(0) = pack.get_functions (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
261 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
262 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
263 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
264 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
265 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
266 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
267 package_get_packages (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
268 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
269 octave_value_list retval (1, Matrix ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
271 if (args.length () == 0 && args(0).type_name () == "object" |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
272 && args(0).class_name () == "meta.package") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
273 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
274 cdef_package pack (to_cdef (args(0))); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
275 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
276 retval(0) = pack.get_packages (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
277 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
278 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
279 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
280 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
281 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
282 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
283 package_getAllPackages (interpreter& interp, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
284 const octave_value_list& /* args */, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
285 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
286 std::map<std::string, cdef_package> toplevel_packages; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
287 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
288 load_path& lp = interp.get_load_path (); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
289 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
290 std::list<std::string> names = lp.get_all_package_names (); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
291 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
292 cdef_manager& cdm = __get_cdef_manager__ ("package_getAllPackages"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
293 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
294 toplevel_packages["meta"] = cdm.find_package ("meta", false, false); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
295 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
296 for (const auto& nm : names) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
297 toplevel_packages[nm] = cdm.find_package (nm, false, true); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
298 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
299 Cell c (toplevel_packages.size (), 1); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
300 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
301 int i = 0; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
302 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
303 for (const auto& nm_pkg : toplevel_packages) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
304 c(i++,0) = to_ov (nm_pkg.second); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
305 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
306 return octave_value_list (octave_value (c)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
307 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
308 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
309 static octave_value_list |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
310 package_fromName (const octave_value_list& args, int /* nargout */) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
311 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
312 octave_value_list retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
313 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
314 if (args.length () != 1) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
315 error ("fromName: invalid number of parameters"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
316 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
317 std::string name = args(0).xstring_value ("fromName: PACKAGE_NAME must be a string"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
318 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
319 retval(0) = to_ov (lookup_package (name, false)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
320 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
321 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
322 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
323 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
324 cdef_manager::cdef_manager (interpreter& interp) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
325 : m_interpreter (interp), m_all_classes (), m_all_packages (), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
326 m_meta_class (), m_meta_property (), m_meta_method (), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
327 m_meta_package (), m_meta () |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
328 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
329 type_info& ti = m_interpreter.get_type_info (); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
330 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
331 octave_classdef::register_type (ti); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
332 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
333 // bootstrap |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
334 cdef_class tmp_handle = make_class ("handle"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
335 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
336 m_meta_class = make_meta_class ("meta.class", tmp_handle); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
337 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
338 tmp_handle.set_class (m_meta_class); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
339 m_meta_class.set_class (m_meta_class); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
340 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
341 // meta classes |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
342 m_meta_property = make_meta_class ("meta.property", tmp_handle); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
343 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
344 m_meta_method = make_meta_class ("meta.method", tmp_handle); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
345 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
346 m_meta_package = make_meta_class ("meta.package", tmp_handle); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
347 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
348 cdef_class tmp_meta_event |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
349 = make_meta_class ("meta.event", tmp_handle); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
350 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
351 cdef_class tmp_meta_dynproperty |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
352 = make_meta_class ("meta.dynamicproperty", tmp_handle); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
353 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
354 // meta.class properties |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
355 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
356 (make_attribute (m_meta_class, "Abstract")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
357 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
358 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
359 (make_attribute (m_meta_class, "ConstructOnLoad")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
360 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
361 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
362 (make_property (m_meta_class, "ContainingPackage")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
363 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
364 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
365 (make_property (m_meta_class, "Description")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
366 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
367 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
368 (make_property (m_meta_class, "DetailedDescription")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
369 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
370 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
371 (make_property (m_meta_class, "Events")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
372 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
373 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
374 (make_attribute (m_meta_class, "HandleCompatible")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
375 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
376 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
377 (make_attribute (m_meta_class, "Hidden")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
378 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
379 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
380 (make_property (m_meta_class, "InferiorClasses", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
381 make_fcn_handle (class_get_inferiorclasses, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
382 "meta.class>get.InferiorClasses"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
383 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
384 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
385 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
386 (make_property (m_meta_class, "Methods", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
387 make_fcn_handle (class_get_methods, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
388 "meta.class>get.Methods"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
389 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
390 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
391 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
392 (make_property (m_meta_class, "MethodList", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
393 make_fcn_handle (class_get_methods, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
394 "meta.class>get.MethodList"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
395 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
396 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
397 m_meta_class.install_property (make_attribute (m_meta_class, "Name")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
398 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
399 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
400 (make_property (m_meta_class, "Properties", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
401 make_fcn_handle (class_get_properties, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
402 "meta.class>get.Properties"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
403 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
404 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
405 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
406 (make_property (m_meta_class, "PropertyList", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
407 make_fcn_handle (class_get_properties, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
408 "meta.class>get.PropertyList"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
409 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
410 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
411 m_meta_class.install_property (make_attribute (m_meta_class, "Sealed")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
412 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
413 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
414 (make_property (m_meta_class, "SuperClasses", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
415 make_fcn_handle (class_get_superclasses, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
416 "meta.class>get.SuperClasses"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
417 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
418 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
419 m_meta_class.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
420 (make_property (m_meta_class, "SuperClassList", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
421 make_fcn_handle (class_get_superclasses, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
422 "meta.class>get.SuperClassList"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
423 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
424 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
425 // meta.class methods |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
426 m_meta_class.install_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
427 (make_method (m_meta_class, "fromName", class_fromName, "public", true)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
428 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
429 m_meta_class.install_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
430 (make_method (m_meta_class, "fevalStatic", class_fevalStatic, "public", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
431 false)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
432 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
433 m_meta_class.install_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
434 (make_method (m_meta_class, "getConstant", class_getConstant, "public", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
435 false)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
436 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
437 m_meta_class.install_method (make_method (m_meta_class, "eq", class_eq)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
438 m_meta_class.install_method (make_method (m_meta_class, "ne", class_ne)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
439 m_meta_class.install_method (make_method (m_meta_class, "lt", class_lt)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
440 m_meta_class.install_method (make_method (m_meta_class, "le", class_le)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
441 m_meta_class.install_method (make_method (m_meta_class, "gt", class_gt)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
442 m_meta_class.install_method (make_method (m_meta_class, "ge", class_ge)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
443 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
444 // meta.method properties |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
445 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
446 (make_attribute (m_meta_method, "Abstract")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
447 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
448 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
449 (make_attribute (m_meta_method, "Access")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
450 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
451 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
452 (make_attribute (m_meta_method, "DefiningClass")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
453 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
454 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
455 (make_attribute (m_meta_method, "Description")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
456 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
457 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
458 (make_attribute (m_meta_method, "DetailedDescription")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
459 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
460 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
461 (make_attribute (m_meta_method, "Hidden")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
462 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
463 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
464 (make_attribute (m_meta_method, "Name")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
465 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
466 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
467 (make_attribute (m_meta_method, "Sealed")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
468 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
469 m_meta_method.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
470 (make_attribute (m_meta_method, "Static")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
471 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
472 // meta.property properties |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
473 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
474 (make_attribute (m_meta_property, "Name")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
475 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
476 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
477 (make_attribute (m_meta_property, "Description")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
478 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
479 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
480 (make_attribute (m_meta_property, "DetailedDescription")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
481 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
482 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
483 (make_attribute (m_meta_property, "Abstract")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
484 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
485 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
486 (make_attribute (m_meta_property, "Constant")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
487 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
488 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
489 (make_attribute (m_meta_property, "GetAccess")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
490 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
491 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
492 (make_attribute (m_meta_property, "SetAccess")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
493 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
494 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
495 (make_attribute (m_meta_property, "Dependent")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
496 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
497 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
498 (make_attribute (m_meta_property, "Transient")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
499 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
500 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
501 (make_attribute (m_meta_property, "Hidden")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
502 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
503 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
504 (make_attribute (m_meta_property, "GetObservable")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
505 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
506 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
507 (make_attribute (m_meta_property, "SetObservable")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
508 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
509 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
510 (make_attribute (m_meta_property, "GetMethod")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
511 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
512 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
513 (make_attribute (m_meta_property, "SetMethod")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
514 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
515 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
516 (make_attribute (m_meta_property, "DefiningClass")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
517 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
518 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
519 (make_property (m_meta_property, "DefaultValue", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
520 make_fcn_handle (property_get_defaultvalue, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
521 "meta.property>get.DefaultValue"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
522 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
523 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
524 m_meta_property.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
525 (make_attribute (m_meta_property, "HasDefault")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
526 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
527 // meta.property events |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
528 // FIXME: add events |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
529 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
530 // handle methods |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
531 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
532 tmp_handle.install_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
533 (make_method (tmp_handle, "delete", handle_delete)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
534 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
535 // meta.package properties |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
536 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
537 m_meta_package.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
538 (make_attribute (m_meta_package, "Name")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
539 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
540 m_meta_package.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
541 (make_property (m_meta_package, "ContainingPackage")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
542 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
543 m_meta_package.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
544 (make_property (m_meta_package, "ClassList", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
545 make_fcn_handle (package_get_classes, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
546 "meta.package>get.ClassList"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
547 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
548 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
549 m_meta_package.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
550 (make_property (m_meta_package, "Classes", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
551 make_fcn_handle (package_get_classes, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
552 "meta.package>get.Classes"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
553 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
554 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
555 m_meta_package.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
556 (make_property (m_meta_package, "FunctionList", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
557 make_fcn_handle (package_get_functions, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
558 "meta.package>get.FunctionList"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
559 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
560 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
561 m_meta_package.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
562 (make_property (m_meta_package, "Functions", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
563 make_fcn_handle (package_get_functions, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
564 "meta.package>get.Functions"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
565 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
566 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
567 m_meta_package.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
568 (make_property (m_meta_package, "PackageList", |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
569 make_fcn_handle (package_get_packages, |
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
570 "meta.package>get.PackageList"), |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
571 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
572 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
573 m_meta_package.install_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
574 (make_property (m_meta_package, "Packages", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
575 make_fcn_handle (package_get_packages, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
576 "meta.package>get.Packages"), |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
577 "public", Matrix (), "private")); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
578 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
579 m_meta_package.install_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
580 (make_method (m_meta_package, "fromName", package_fromName, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
581 "public", true)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
582 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
583 m_meta_package.install_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
584 (make_method (m_meta_package, "getAllPackages", package_getAllPackages, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
585 "public", true)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
586 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
587 // create "meta" package |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
588 cdef_package package_meta |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
589 = m_meta |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
590 = make_package ("meta"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
591 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
592 package_meta.install_class (m_meta_class, "class"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
593 package_meta.install_class (m_meta_property, "property"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
594 package_meta.install_class (m_meta_method, "method"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
595 package_meta.install_class (m_meta_package, "package"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
596 package_meta.install_class (tmp_meta_event, "event"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
597 package_meta.install_class (tmp_meta_dynproperty, "dynproperty"); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
598 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
599 symbol_table& symtab = m_interpreter.get_symbol_table (); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
600 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
601 // install built-in classes into the symbol table |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
602 symtab.install_built_in_function |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
603 ("meta.class", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
604 octave_value (m_meta_class.get_constructor_function ())); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
605 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
606 symtab.install_built_in_function |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
607 ("meta.method", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
608 octave_value (m_meta_method.get_constructor_function ())); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
609 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
610 symtab.install_built_in_function |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
611 ("meta.property", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
612 octave_value (m_meta_property.get_constructor_function ())); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
613 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
614 symtab.install_built_in_function |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
615 ("meta.package", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
616 octave_value (m_meta_package.get_constructor_function ())); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
617 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
618 // FIXME: meta.event and meta.dynproperty are not implemented |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
619 // and should not be installed into symbol table. |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
620 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
621 // symtab.install_built_in_function |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
622 // ("meta.event", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
623 // octave_value (tmp_meta_event.get_constructor_function ())); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
624 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
625 // symtab.install_built_in_function |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
626 // ("meta.dynproperty", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
627 // octave_value (tmp_meta_dynproperty.get_constructor_function ())); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
628 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
629 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
630 cdef_class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
631 cdef_manager::find_class (const std::string& name, bool error_if_not_found, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
632 bool load_if_not_found) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
633 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
634 auto it = m_all_classes.find (name); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
635 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
636 if (it == m_all_classes.end ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
637 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
638 if (load_if_not_found) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
639 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
640 octave_value ov_cls; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
641 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
642 size_t pos = name.rfind ('.'); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
643 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
644 if (pos == std::string::npos) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
645 ov_cls = m_interpreter.find (name); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
646 else |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
647 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
648 std::string pack_name = name.substr (0, pos); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
649 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
650 cdef_package pack = find_package (pack_name, false, true); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
651 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
652 if (pack.ok ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
653 ov_cls = pack.find (name.substr (pos+1)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
654 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
655 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
656 if (ov_cls.is_defined ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
657 it = m_all_classes.find (name); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
658 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
659 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
660 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
661 if (it == m_all_classes.end ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
662 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
663 if (error_if_not_found) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
664 error ("class not found: %s", name.c_str ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
665 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
666 else |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
667 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
668 cdef_class cls = it->second; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
669 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
670 if (! cls.is_builtin ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
671 cls = lookup_class (cls); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
672 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
673 if (cls.ok ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
674 return cls; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
675 else |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
676 m_all_classes.erase (it); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
677 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
678 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
679 return cdef_class (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
680 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
681 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
682 octave_function * |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
683 cdef_manager::find_method_symbol (const std::string& method_name, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
684 const std::string& class_name) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
685 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
686 octave_function *retval = nullptr; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
687 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
688 cdef_class cls = find_class (class_name, false, false); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
689 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
690 if (cls.ok ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
691 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
692 cdef_method meth = cls.find_method (method_name); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
693 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
694 if (meth.ok ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
695 retval = new octave_classdef_meta (meth); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
696 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
697 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
698 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
699 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
700 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
701 cdef_package |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
702 cdef_manager::find_package (const std::string& name, bool error_if_not_found, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
703 bool load_if_not_found) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
704 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
705 cdef_package retval; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
706 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
707 std::map<std::string, cdef_package>::const_iterator it |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
708 = m_all_packages.find (name); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
709 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
710 if (it != m_all_packages.end ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
711 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
712 retval = it->second; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
713 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
714 if (! retval.ok ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
715 error ("invalid package `%s'", name.c_str ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
716 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
717 else |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
718 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
719 load_path& lp = m_interpreter.get_load_path (); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
720 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
721 if (load_if_not_found && lp.find_package (name)) |
26970
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
722 { |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
723 size_t pos = name.rfind ('.'); |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
724 |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
725 if (pos == std::string::npos) |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
726 retval = make_package (name, ""); |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
727 else |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
728 { |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
729 std::string parent_name = name.substr (0, pos); |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
730 |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
731 retval = make_package (name, parent_name); |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
732 } |
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
733 } |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
734 else if (error_if_not_found) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
735 error ("unknown package `%s'", name.c_str ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
736 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
737 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
738 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
739 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
740 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
741 octave_function * |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
742 cdef_manager::find_package_symbol (const std::string& pack_name) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
743 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
744 octave_function *retval = nullptr; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
745 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
746 cdef_package pack = find_package (pack_name, false); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
747 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
748 if (pack.ok ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
749 retval = new octave_classdef_meta (pack); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
750 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
751 return retval; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
752 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
753 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
754 cdef_class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
755 cdef_manager::make_class (const std::string& name, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
756 const std::list<octave::cdef_class>& super_list) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
757 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
758 cdef_class cls (name, super_list); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
759 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
760 cls.set_class (meta_class ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
761 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
762 cls.put ("Abstract", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
763 cls.put ("ConstructOnLoad", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
764 cls.put ("ContainingPackage", Matrix ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
765 cls.put ("Description", ""); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
766 cls.put ("DetailedDescription", ""); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
767 cls.put ("Events", Cell ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
768 cls.put ("Hidden", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
769 cls.put ("InferiorClasses", Cell ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
770 cls.put ("Methods", Cell ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
771 cls.put ("Properties", Cell ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
772 cls.put ("Sealed", false); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
773 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
774 if (name == "handle") |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
775 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
776 cls.put ("HandleCompatible", true); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
777 cls.mark_as_handle_class (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
778 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
779 else if (super_list.empty ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
780 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
781 cls.put ("HandleCompatible", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
782 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
783 else |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
784 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
785 bool all_handle_compatible = true; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
786 bool has_handle_class = false; |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
787 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
788 for (const auto& cl : super_list) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
789 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
790 all_handle_compatible = all_handle_compatible |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
791 && cl.get ("HandleCompatible").bool_value (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
792 has_handle_class = has_handle_class || cl.is_handle_class (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
793 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
794 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
795 if (has_handle_class && ! all_handle_compatible) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
796 error ("%s: cannot mix handle and non-HandleCompatible classes", |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
797 name.c_str ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
798 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
799 cls.put ("HandleCompatible", all_handle_compatible); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
800 if (has_handle_class) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
801 cls.mark_as_handle_class (); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
802 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
803 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
804 if (! name.empty ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
805 register_class (cls); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
806 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
807 return cls; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
808 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
809 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
810 cdef_class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
811 cdef_manager::make_class (const std::string& name, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
812 const cdef_class& super) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
813 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
814 return make_class (name, std::list<cdef_class> (1, super)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
815 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
816 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
817 cdef_class |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
818 cdef_manager::make_meta_class (const std::string& name, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
819 const cdef_class& super) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
820 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
821 cdef_class cls = make_class (name, super); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
822 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
823 cls.put ("Sealed", true); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
824 cls.mark_as_meta_class (); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
825 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
826 return cls; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
827 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
828 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
829 cdef_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
830 cdef_manager::make_property (const cdef_class& cls, const std::string& name, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
831 const octave_value& get_method, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
832 const std::string& get_access, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
833 const octave_value& set_method, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
834 const std::string& set_access) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
835 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
836 cdef_property prop (name); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
837 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
838 prop.set_class (meta_property ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
839 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
840 prop.put ("Description", ""); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
841 prop.put ("DetailedDescription", ""); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
842 prop.put ("Abstract", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
843 prop.put ("Constant", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
844 prop.put ("GetAccess", get_access); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
845 prop.put ("SetAccess", set_access); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
846 prop.put ("Dependent", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
847 prop.put ("Transient", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
848 prop.put ("Hidden", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
849 prop.put ("GetObservable", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
850 prop.put ("SetObservable", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
851 prop.put ("GetMethod", get_method); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
852 prop.put ("SetMethod", set_method); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
853 prop.put ("DefiningClass", to_ov (cls)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
854 prop.put ("DefaultValue", octave_value ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
855 prop.put ("HasDefault", false); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
856 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
857 std::string class_name = cls.get_name (); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
858 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
859 if (! get_method.isempty ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
860 make_function_of_class (class_name, get_method); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
861 if (! set_method.isempty ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
862 make_function_of_class (class_name, set_method); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
863 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
864 return prop; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
865 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
866 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
867 cdef_property |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
868 cdef_manager::make_attribute (const cdef_class& cls, const std::string& name) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
869 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
870 return make_property (cls, name, Matrix (), "public", Matrix (), "private"); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
871 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
872 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
873 cdef_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
874 cdef_manager::make_method (const cdef_class& cls, const std::string& name, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
875 const octave_value& fcn, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
876 const std::string& m_access, bool is_static) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
877 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
878 cdef_method meth (name); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
879 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
880 meth.set_class (meta_method ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
881 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
882 meth.put ("Abstract", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
883 meth.put ("Access", m_access); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
884 meth.put ("DefiningClass", to_ov (cls)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
885 meth.put ("Description", ""); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
886 meth.put ("DetailedDescription", ""); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
887 meth.put ("Hidden", false); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
888 meth.put ("Sealed", true); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
889 meth.put ("Static", is_static); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
890 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
891 if (fcn.is_defined ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
892 make_function_of_class (cls, fcn); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
893 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
894 meth.set_function (fcn); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
895 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
896 if (is_dummy_method (fcn)) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
897 meth.mark_as_external (cls.get_name ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
898 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
899 return meth; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
900 } |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
901 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
902 cdef_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
903 cdef_manager::make_method (const cdef_class& cls, const std::string& name, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
904 octave_builtin::fcn ff, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
905 const std::string& m_access, bool is_static) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
906 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
907 octave_value fcn (new octave_builtin (ff, name)); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
908 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
909 return make_method (cls, name, fcn, m_access, is_static); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
910 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
911 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
912 cdef_method |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
913 cdef_manager::make_method (const cdef_class& cls, const std::string& name, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
914 octave_builtin::meth mm, |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
915 const std::string& m_access, bool is_static) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
916 { |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
917 octave_value fcn (new octave_builtin (mm, name)); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
918 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
919 return make_method (cls, name, fcn, m_access, is_static); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
920 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
921 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
922 cdef_package |
26970
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
923 cdef_manager::make_package (const std::string& nm, const std::string& parent) |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
924 { |
26970
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
925 cdef_package pack (nm); |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
926 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
927 pack.set_class (meta_package ()); |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
928 |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
929 if (parent.empty ()) |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
930 pack.put ("ContainingPackage", Matrix ()); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
931 else |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
932 pack.put ("ContainingPackage", to_ov (find_package (parent))); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
933 |
26970
340d44f2f942
backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents:
26870
diff
changeset
|
934 if (! nm.empty ()) |
26774
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
935 register_package (pack); |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
936 |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
937 return pack; |
568c2ab2782d
move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
26769
diff
changeset
|
938 } |
26975
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
939 |
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
940 octave_value |
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
941 cdef_manager::find_method (const std::string& class_name, |
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
942 const std::string& name) const |
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
943 { |
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
944 cdef_class cls = lookup_class (class_name); |
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
945 |
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
946 return cls.get_method (name); |
de826e69a5ea
make breakpoints in classdef methods work (bug #45404, bug #46451)
John W. Eaton <jwe@octave.org>
parents:
26970
diff
changeset
|
947 } |
26769
2f847e3e8d6b
split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
948 } |