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