annotate libinterp/octave-value/cdef-manager.cc @ 31605:e88a07dec498 stable

maint: Use macros to begin/end C++ namespaces. * oct-conf-post-public.in.h: Define two macros (OCTAVE_BEGIN_NAMESPACE, OCTAVE_END_NAMESPACE) that can be used to start/end a namespace. * mk-opts.pl, build-env.h, build-env.in.cc, __betainc__.cc, __contourc__.cc, __dsearchn__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc, __isprimelarge__.cc, __lin_interpn__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, auto-shlib.cc, auto-shlib.h, balance.cc, base-text-renderer.cc, base-text-renderer.h, besselj.cc, bitfcns.cc, bsxfun.cc, c-file-ptr-stream.cc, c-file-ptr-stream.h, call-stack.cc, call-stack.h, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, data.h, debug.cc, defaults.cc, defaults.h, defun-int.h, defun.cc, det.cc, dirfns.cc, display.cc, display.h, dlmread.cc, dmperm.cc, dot.cc, dynamic-ld.cc, dynamic-ld.h, eig.cc, ellipj.cc, environment.cc, environment.h, error.cc, error.h, errwarn.h, event-manager.cc, event-manager.h, event-queue.cc, event-queue.h, fcn-info.cc, fcn-info.h, fft.cc, fft2.cc, fftn.cc, file-io.cc, filter.cc, find.cc, ft-text-renderer.cc, ft-text-renderer.h, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, gl-render.cc, gl-render.h, gl2ps-print.cc, gl2ps-print.h, graphics-toolkit.cc, graphics-toolkit.h, graphics.cc, graphics.in.h, gsvd.cc, gtk-manager.cc, gtk-manager.h, hash.cc, help.cc, help.h, hess.cc, hex2num.cc, hook-fcn.cc, hook-fcn.h, input.cc, input.h, interpreter-private.cc, interpreter-private.h, interpreter.cc, interpreter.h, inv.cc, jsondecode.cc, jsonencode.cc, kron.cc, latex-text-renderer.cc, latex-text-renderer.h, load-path.cc, load-path.h, load-save.cc, load-save.h, lookup.cc, ls-ascii-helper.cc, ls-ascii-helper.h, ls-oct-text.cc, ls-utils.cc, ls-utils.h, lsode.cc, lu.cc, mappers.cc, matrix_type.cc, max.cc, mex-private.h, mex.cc, mgorth.cc, nproc.cc, oct-fstrm.cc, oct-fstrm.h, oct-hdf5-types.cc, oct-hdf5-types.h, oct-hist.cc, oct-hist.h, oct-iostrm.cc, oct-iostrm.h, oct-opengl.h, oct-prcstrm.cc, oct-prcstrm.h, oct-procbuf.cc, oct-procbuf.h, oct-process.cc, oct-process.h, oct-stdstrm.h, oct-stream.cc, oct-stream.h, oct-strstrm.cc, oct-strstrm.h, oct-tex-lexer.in.ll, oct-tex-parser.yy, ordqz.cc, ordschur.cc, pager.cc, pager.h, pinv.cc, pow2.cc, pr-flt-fmt.cc, pr-output.cc, procstream.cc, procstream.h, psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, settings.cc, settings.h, sighandlers.cc, sighandlers.h, sparse-xdiv.cc, sparse-xdiv.h, sparse-xpow.cc, sparse-xpow.h, sparse.cc, spparms.cc, sqrtm.cc, stack-frame.cc, stack-frame.h, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, sylvester.cc, symbfact.cc, syminfo.cc, syminfo.h, symrcm.cc, symrec.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, symtab.h, syscalls.cc, sysdep.cc, sysdep.h, text-engine.cc, text-engine.h, text-renderer.cc, text-renderer.h, time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, url-handle-manager.cc, url-handle-manager.h, urlwrite.cc, utils.cc, utils.h, variables.cc, variables.h, xdiv.cc, xdiv.h, xnorm.cc, xnorm.h, xpow.cc, xpow.h, __delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, fftw.cc, gzip.cc, mk-build-env-features.sh, mk-builtins.pl, cdef-class.cc, cdef-class.h, cdef-fwd.h, cdef-manager.cc, cdef-manager.h, cdef-method.cc, cdef-method.h, cdef-object.cc, cdef-object.h, cdef-package.cc, cdef-package.h, cdef-property.cc, cdef-property.h, cdef-utils.cc, cdef-utils.h, ov-base.cc, ov-base.h, ov-bool-mat.cc, ov-builtin.h, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-classdef.h, ov-complex.cc, ov-fcn-handle.cc, ov-fcn-handle.h, ov-fcn.h, ov-java.cc, ov-java.h, ov-mex-fcn.h, ov-null-mat.cc, ov-oncleanup.cc, ov-struct.cc, ov-typeinfo.cc, ov-typeinfo.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, octave.cc, octave.h, mk-ops.sh, op-b-b.cc, op-b-bm.cc, op-b-sbm.cc, op-bm-b.cc, op-bm-bm.cc, op-bm-sbm.cc, op-cdm-cdm.cc, op-cell.cc, op-chm.cc, op-class.cc, op-cm-cm.cc, op-cm-cs.cc, op-cm-m.cc, op-cm-s.cc, op-cm-scm.cc, op-cm-sm.cc, op-cs-cm.cc, op-cs-cs.cc, op-cs-m.cc, op-cs-s.cc, op-cs-scm.cc, op-cs-sm.cc, op-dm-dm.cc, op-dm-scm.cc, op-dm-sm.cc, op-dm-template.cc, op-dms-template.cc, op-fcdm-fcdm.cc, op-fcm-fcm.cc, op-fcm-fcs.cc, op-fcm-fm.cc, op-fcm-fs.cc, op-fcn.cc, op-fcs-fcm.cc, op-fcs-fcs.cc, op-fcs-fm.cc, op-fcs-fs.cc, op-fdm-fdm.cc, op-fm-fcm.cc, op-fm-fcs.cc, op-fm-fm.cc, op-fm-fs.cc, op-fs-fcm.cc, op-fs-fcs.cc, op-fs-fm.cc, op-fs-fs.cc, op-i16-i16.cc, op-i32-i32.cc, op-i64-i64.cc, op-i8-i8.cc, op-int-concat.cc, op-m-cm.cc, op-m-cs.cc, op-m-m.cc, op-m-s.cc, op-m-scm.cc, op-m-sm.cc, op-mi.cc, op-pm-pm.cc, op-pm-scm.cc, op-pm-sm.cc, op-pm-template.cc, op-range.cc, op-s-cm.cc, op-s-cs.cc, op-s-m.cc, op-s-s.cc, op-s-scm.cc, op-s-sm.cc, op-sbm-b.cc, op-sbm-bm.cc, op-sbm-sbm.cc, op-scm-cm.cc, op-scm-cs.cc, op-scm-m.cc, op-scm-s.cc, op-scm-scm.cc, op-scm-sm.cc, op-sm-cm.cc, op-sm-cs.cc, op-sm-m.cc, op-sm-s.cc, op-sm-scm.cc, op-sm-sm.cc, op-str-m.cc, op-str-s.cc, op-str-str.cc, op-struct.cc, op-ui16-ui16.cc, op-ui32-ui32.cc, op-ui64-ui64.cc, op-ui8-ui8.cc, ops.h, anon-fcn-validator.cc, anon-fcn-validator.h, bp-table.cc, bp-table.h, comment-list.cc, comment-list.h, filepos.h, lex.h, lex.ll, oct-lvalue.cc, oct-lvalue.h, oct-parse.yy, parse.h, profiler.cc, profiler.h, pt-anon-scopes.cc, pt-anon-scopes.h, pt-arg-list.cc, pt-arg-list.h, pt-args-block.cc, pt-args-block.h, pt-array-list.cc, pt-array-list.h, pt-assign.cc, pt-assign.h, pt-binop.cc, pt-binop.h, pt-bp.cc, pt-bp.h, pt-cbinop.cc, pt-cbinop.h, pt-cell.cc, pt-cell.h, pt-check.cc, pt-check.h, pt-classdef.cc, pt-classdef.h, pt-cmd.h, pt-colon.cc, pt-colon.h, pt-const.cc, pt-const.h, pt-decl.cc, pt-decl.h, pt-eval.cc, pt-eval.h, pt-except.cc, pt-except.h, pt-exp.cc, pt-exp.h, pt-fcn-handle.cc, pt-fcn-handle.h, pt-id.cc, pt-id.h, pt-idx.cc, pt-idx.h, pt-jump.h, pt-loop.cc, pt-loop.h, pt-mat.cc, pt-mat.h, pt-misc.cc, pt-misc.h, pt-pr-code.cc, pt-pr-code.h, pt-select.cc, pt-select.h, pt-spmd.cc, pt-spmd.h, pt-stmt.cc, pt-stmt.h, pt-tm-const.cc, pt-tm-const.h, pt-unop.cc, pt-unop.h, pt-vm-eval.cc, pt-walk.cc, pt-walk.h, pt.cc, pt.h, token.cc, token.h, Range.cc, Range.h, idx-vector.cc, idx-vector.h, range-fwd.h, CollocWt.cc, CollocWt.h, aepbalance.cc, aepbalance.h, chol.cc, chol.h, gepbalance.cc, gepbalance.h, gsvd.cc, gsvd.h, hess.cc, hess.h, lo-mappers.cc, lo-mappers.h, lo-specfun.cc, lo-specfun.h, lu.cc, lu.h, oct-convn.cc, oct-convn.h, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-norm.h, oct-rand.cc, oct-rand.h, oct-spparms.cc, oct-spparms.h, qr.cc, qr.h, qrp.cc, qrp.h, randgamma.cc, randgamma.h, randmtzig.cc, randmtzig.h, randpoisson.cc, randpoisson.h, schur.cc, schur.h, sparse-chol.cc, sparse-chol.h, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, sparse-qr.h, svd.cc, svd.h, child-list.cc, child-list.h, dir-ops.cc, dir-ops.h, file-ops.cc, file-ops.h, file-stat.cc, file-stat.h, lo-sysdep.cc, lo-sysdep.h, lo-sysinfo.cc, lo-sysinfo.h, mach-info.cc, mach-info.h, oct-env.cc, oct-env.h, oct-group.cc, oct-group.h, oct-password.cc, oct-password.h, oct-syscalls.cc, oct-syscalls.h, oct-time.cc, oct-time.h, oct-uname.cc, oct-uname.h, action-container.cc, action-container.h, base-list.h, cmd-edit.cc, cmd-edit.h, cmd-hist.cc, cmd-hist.h, f77-fcn.h, file-info.cc, file-info.h, lo-array-errwarn.cc, lo-array-errwarn.h, lo-hash.cc, lo-hash.h, lo-ieee.h, lo-regexp.cc, lo-regexp.h, lo-utils.cc, lo-utils.h, oct-base64.cc, oct-base64.h, oct-glob.cc, oct-glob.h, oct-inttypes.h, oct-mutex.cc, oct-mutex.h, oct-refcount.h, oct-shlib.cc, oct-shlib.h, oct-sparse.cc, oct-sparse.h, oct-string.h, octave-preserve-stream-state.h, pathsearch.cc, pathsearch.h, quit.cc, quit.h, unwind-prot.cc, unwind-prot.h, url-transfer.cc, url-transfer.h : Use new macros to begin/end C++ namespaces.
author Rik <rik@octave.org>
date Thu, 01 Dec 2022 14:23:45 -0800
parents c9788d7f6e65
children aac27ad79be6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 30390
diff changeset
3 // Copyright (C) 2012-2022 The Octave Project Developers
27923
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
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30896
diff changeset
35 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30896
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
28439
e760fef2829c refactor octave_fcn_handle class
John W. Eaton <jwe@octave.org>
parents: 27932
diff changeset
42 return octave_value (new octave_fcn_handle (fcn));
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
43 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
45 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
46 class_get_properties (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
47 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
48 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
50 if (args.length () == 1 && args(0).type_name () == "object")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
51 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
52 cdef_class cls (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
54 retval(0) = cls.get_properties ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
55 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
57 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
58 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
60 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
61 class_get_methods (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
62 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
63 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
65 if (args.length () == 1 && args(0).type_name () == "object")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
66 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
67 cdef_class cls (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
69 retval(0) = cls.get_methods ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
70 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
72 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
73 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
75 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
76 class_get_superclasses (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
77 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
78 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
80 if (args.length () == 1 && args(0).type_name () == "object"
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
81 && args(0).class_name () == "meta.class")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
82 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
83 cdef_class cls (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
85 Cell classes = cls.get ("SuperClasses").cell_value ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
86
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
87 retval(0) = to_ov (lookup_classes (classes));
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
88 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
90 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
91 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
93 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
94 class_get_inferiorclasses (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
95 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
96 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
98 if (args.length () == 1 && args(0).type_name () == "object"
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
99 && args(0).class_name () == "meta.class")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
100 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
101 cdef_class cls (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
103 Cell classes = cls.get ("InferiorClasses").cell_value ();
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
105 retval(0) = to_ov (lookup_classes (classes));
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
106 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
107
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
108 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
109 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
111 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
112 class_fromName (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
113 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
114 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
116 if (args.length () != 1)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
117 error ("fromName: invalid number of parameters");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
119 std::string name = args(0).xstring_value ("fromName: CLASS_NAME must be a string");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
121 retval(0) = to_ov (lookup_class (name, false));
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
122
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
123 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
124 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
126 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
127 class_fevalStatic (const octave_value_list& args, int nargout)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
128 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
129 if (args.length () <= 1 || args(0).type_name () != "object")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
130 error ("fevalStatic: first argument must be a meta.class object");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
132 cdef_class cls (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
134 std::string meth_name = args(1).xstring_value ("fevalStatic: method name must be a string");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
136 cdef_method meth = cls.find_method (meth_name);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
138 if (! meth.ok ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
139 error ("fevalStatic: method not found: %s", meth_name.c_str ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
141 if (! meth.is_static ())
27216
823b4bcf79fc unless necessary for formatting or code, use ' instead of `
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
142 error ("fevalStatic: method '%s' is not static", meth_name.c_str ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
144 return meth.execute (args.splice (0, 2), nargout, true, "fevalStatic");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
145 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
147 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
148 class_getConstant (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
149 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
150 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
151
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
152 if (args.length () != 2 || args(0).type_name () != "object"
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
153 || args(0).class_name () != "meta.class")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
154 error ("getConstant: first argument must be a meta.class object");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
155
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
156 cdef_class cls = to_cdef (args(0));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
158 std::string prop_name = args(1).xstring_value ("getConstant: property name must be a string");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
160 cdef_property prop = cls.find_property (prop_name);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
162 if (! prop.ok ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
163 error ("getConstant: property not found: %s",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
164 prop_name.c_str ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
166 if (! prop.is_constant ())
27216
823b4bcf79fc unless necessary for formatting or code, use ' instead of `
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
167 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
168 prop_name.c_str ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
170 retval(0) = prop.get_value (true, "getConstant");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
172 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
173 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30565
diff changeset
175 #define META_CLASS_CMP(OP, CLSA, CLSB, FCN) \
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176 static octave_value_list \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177 class_ ## OP (const octave_value_list& args, int /* nargout */) \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178 { \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
179 octave_value_list retval; \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
180 \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181 if (args.length () != 2 \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
182 || args(0).type_name () != "object" \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
183 || args(1).type_name () != "object" \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
184 || args(0).class_name () != "meta.class" \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185 || args(1).class_name () != "meta.class") \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
186 error (#OP ": invalid arguments"); \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
187 \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
188 cdef_class clsa = to_cdef (args(0)); \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
189 \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
190 cdef_class clsb = to_cdef (args(1)); \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191 \
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30565
diff changeset
192 retval(0) = FCN (CLSA, CLSB); \
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
193 \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
194 return retval; \
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
195 }
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
196
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
197 META_CLASS_CMP (lt, clsb, clsa, is_strict_superclass)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
198 META_CLASS_CMP (le, clsb, clsa, is_superclass)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
199 META_CLASS_CMP (gt, clsa, clsb, is_strict_superclass)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
200 META_CLASS_CMP (ge, clsa, clsb, is_superclass)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
201 META_CLASS_CMP (eq, clsa, clsb, operator==)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
202 META_CLASS_CMP (ne, clsa, clsb, operator!=)
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
203
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
204 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
205 property_get_defaultvalue (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
206 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
207 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
208
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
209 if (args.length () == 1 && args(0).type_name () == "object")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
210 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
211 cdef_property prop (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
212
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
213 retval(0) = prop.get ("DefaultValue");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
214
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
215 if (! retval(0).is_defined ())
26870
d05863145670 Fix typo in error_with_id and "Octave:class:NoDefaultDefined".
Rik <rik@octave.org>
parents: 26781
diff changeset
216 error_with_id ("Octave:class:NoDefaultDefined",
27216
823b4bcf79fc unless necessary for formatting or code, use ' instead of `
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
217 "no default value for property '%s'",
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
218 prop.get_name ().c_str ());
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
219 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
220
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
221 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
222 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
224 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
225 handle_delete (const octave_value_list& /* args */, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
226 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
227 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
229 // FIXME: implement this. Wait, what is this supposed to do?
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
230
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
231 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
232 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
234 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
235 package_get_classes (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
236 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
237 octave_value_list retval (1, Matrix ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
238
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
239 if (args.length () == 1 && args(0).type_name () == "object"
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
240 && args(0).class_name () == "meta.package")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
241 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
242 cdef_package pack (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
243
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
244 retval(0) = pack.get_classes ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
245 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
246
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
247 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
248 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
250 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
251 package_get_functions (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
252 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
253 octave_value_list retval (1, Matrix ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
254
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
255 if (args.length () == 0 && args(0).type_name () == "object"
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
256 && args(0).class_name () == "meta.package")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
257 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
258 cdef_package pack (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
259
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
260 retval(0) = pack.get_functions ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
261 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
262
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
263 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
264 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
265
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
266 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
267 package_get_packages (const octave_value_list& args, int /* nargout */)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
268 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
269 octave_value_list retval (1, Matrix ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
270
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
271 if (args.length () == 0 && args(0).type_name () == "object"
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
272 && args(0).class_name () == "meta.package")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
273 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
274 cdef_package pack (to_cdef (args(0)));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
275
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
276 retval(0) = pack.get_packages ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
277 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
278
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
279 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
280 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
281
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
282 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
283 package_getAllPackages (interpreter& interp,
30346
91c6288781ba maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29572
diff changeset
284 const octave_value_list& /* args */,
91c6288781ba maint: Shorten some long lines in libinterp to <= 80 characters (bug #57599)
Rik <rik@octave.org>
parents: 29572
diff changeset
285 int /* nargout */)
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
286 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
287 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
288
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
289 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
290
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
291 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
292
27444
160930a3e5ee eliminate some calls to global __get_SUBSYSTEM__ functions
John W. Eaton <jwe@octave.org>
parents: 27419
diff changeset
293 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
294
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
295 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
296
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
297 for (const auto& nm : names)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
298 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
299
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
300 Cell c (toplevel_packages.size (), 1);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
301
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
302 int i = 0;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
303
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
304 for (const auto& nm_pkg : toplevel_packages)
30390
a61e1a0f6024 maint: style check C++ files in libinterp/ ahead of 7.1 release.
Rik <rik@octave.org>
parents: 29572
diff changeset
305 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
306
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
307 return octave_value_list (octave_value (c));
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
308 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
309
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
310 static octave_value_list
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
311 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
312 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
313 octave_value_list retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
314
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
315 if (args.length () != 1)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
316 error ("fromName: invalid number of parameters");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
317
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
318 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
319
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
320 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
321
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
322 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
323 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
325 cdef_manager::cdef_manager (interpreter& interp)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
326 : 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
327 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
328 m_meta_package (), m_meta ()
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
329 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
330 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
331
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
332 octave_classdef::register_type (ti);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
333
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
334 // bootstrap
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
335 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
336
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
337 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
338
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
339 tmp_handle.set_class (m_meta_class);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
340 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
341
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
342 // meta classes
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
343 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
344
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
345 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
346
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
347 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
348
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
349 cdef_class tmp_meta_event
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
350 = 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
351
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
352 cdef_class tmp_meta_dynproperty
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
353 = 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
354
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
355 // meta.class properties
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
356 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
357 (make_attribute (m_meta_class, "Abstract"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
358
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
359 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
360 (make_attribute (m_meta_class, "ConstructOnLoad"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
361
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
362 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
363 (make_property (m_meta_class, "ContainingPackage"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
364
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
365 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
366 (make_property (m_meta_class, "Description"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
367
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
368 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
369 (make_property (m_meta_class, "DetailedDescription"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
370
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
371 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
372 (make_property (m_meta_class, "Events"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
373
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
374 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
375 (make_attribute (m_meta_class, "HandleCompatible"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
376
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
377 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
378 (make_attribute (m_meta_class, "Hidden"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
379
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
380 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
381 (make_property (m_meta_class, "InferiorClasses",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
382 make_fcn_handle (class_get_inferiorclasses,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
383 "meta.class>get.InferiorClasses"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
384 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
385
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
386 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
387 (make_property (m_meta_class, "Methods",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
388 make_fcn_handle (class_get_methods,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
389 "meta.class>get.Methods"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
390 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
391
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
392 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
393 (make_property (m_meta_class, "MethodList",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
394 make_fcn_handle (class_get_methods,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
395 "meta.class>get.MethodList"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
396 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
397
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
398 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
399
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
400 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
401 (make_property (m_meta_class, "Properties",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
402 make_fcn_handle (class_get_properties,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
403 "meta.class>get.Properties"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
404 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
405
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
406 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
407 (make_property (m_meta_class, "PropertyList",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
408 make_fcn_handle (class_get_properties,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
409 "meta.class>get.PropertyList"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
410 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
411
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
412 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
413
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
414 m_meta_class.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
415 (make_property (m_meta_class, "SuperClasses",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
416 make_fcn_handle (class_get_superclasses,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
417 "meta.class>get.SuperClasses"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
418 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
419
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
420 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
421 (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
422 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
423 "meta.class>get.SuperclassList"),
40fc49d73ce2 Rename meta.class property to "SuperclassList" for Matlab compatibility (bug #55476).
Rik <rik@octave.org>
parents: 27216
diff changeset
424 "public", Matrix (), "private"));
40fc49d73ce2 Rename meta.class property to "SuperclassList" for Matlab compatibility (bug #55476).
Rik <rik@octave.org>
parents: 27216
diff changeset
425
40fc49d73ce2 Rename meta.class property to "SuperclassList" for Matlab compatibility (bug #55476).
Rik <rik@octave.org>
parents: 27216
diff changeset
426 // 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
427 // 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
428 // 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
429 m_meta_class.install_property
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
430 (make_property (m_meta_class, "SuperClassList",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
431 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
432 "meta.class>get.SuperclassList"),
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
433 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
434
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
435 // meta.class methods
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
436 m_meta_class.install_method
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
437 (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
438
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
439 m_meta_class.install_method
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
440 (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
441 false));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
442
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
443 m_meta_class.install_method
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
444 (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
445 false));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
446
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
447 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
448 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
449 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
450 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
451 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
452 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
453
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
454 // meta.method properties
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
455 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
456 (make_attribute (m_meta_method, "Abstract"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
457
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
458 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
459 (make_attribute (m_meta_method, "Access"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
460
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
461 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
462 (make_attribute (m_meta_method, "DefiningClass"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
463
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
464 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
465 (make_attribute (m_meta_method, "Description"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
466
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
467 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
468 (make_attribute (m_meta_method, "DetailedDescription"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
469
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
470 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
471 (make_attribute (m_meta_method, "Hidden"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
472
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
473 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
474 (make_attribute (m_meta_method, "Name"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
475
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
476 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
477 (make_attribute (m_meta_method, "Sealed"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
478
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
479 m_meta_method.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
480 (make_attribute (m_meta_method, "Static"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
481
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
482 // meta.property properties
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
483 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
484 (make_attribute (m_meta_property, "Name"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
485
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
486 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
487 (make_attribute (m_meta_property, "Description"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
488
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
489 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
490 (make_attribute (m_meta_property, "DetailedDescription"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
491
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
492 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
493 (make_attribute (m_meta_property, "Abstract"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
494
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
495 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
496 (make_attribute (m_meta_property, "Constant"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
497
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
498 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
499 (make_attribute (m_meta_property, "GetAccess"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
500
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
501 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
502 (make_attribute (m_meta_property, "SetAccess"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
503
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
504 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
505 (make_attribute (m_meta_property, "Dependent"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
506
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
507 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
508 (make_attribute (m_meta_property, "Transient"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
509
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
510 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
511 (make_attribute (m_meta_property, "Hidden"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
512
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
513 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
514 (make_attribute (m_meta_property, "GetObservable"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
515
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
516 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
517 (make_attribute (m_meta_property, "SetObservable"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
518
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
519 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
520 (make_attribute (m_meta_property, "GetMethod"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
521
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
522 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
523 (make_attribute (m_meta_property, "SetMethod"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
524
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
525 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
526 (make_attribute (m_meta_property, "DefiningClass"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
527
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
528 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
529 (make_property (m_meta_property, "DefaultValue",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
530 make_fcn_handle (property_get_defaultvalue,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
531 "meta.property>get.DefaultValue"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
532 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
533
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
534 m_meta_property.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
535 (make_attribute (m_meta_property, "HasDefault"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
536
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
537 // meta.property events
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
538 // FIXME: add events
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
539
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
540 // handle methods
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
541
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
542 tmp_handle.install_method
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
543 (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
544
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
545 // meta.package properties
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
546
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
547 m_meta_package.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
548 (make_attribute (m_meta_package, "Name"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
549
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
550 m_meta_package.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
551 (make_property (m_meta_package, "ContainingPackage"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
552
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
553 m_meta_package.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
554 (make_property (m_meta_package, "ClassList",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
555 make_fcn_handle (package_get_classes,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
556 "meta.package>get.ClassList"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
557 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
558
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
559 m_meta_package.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
560 (make_property (m_meta_package, "Classes",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
561 make_fcn_handle (package_get_classes,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
562 "meta.package>get.Classes"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
563 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
564
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
565 m_meta_package.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
566 (make_property (m_meta_package, "FunctionList",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
567 make_fcn_handle (package_get_functions,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
568 "meta.package>get.FunctionList"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
569 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
570
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
571 m_meta_package.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
572 (make_property (m_meta_package, "Functions",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
573 make_fcn_handle (package_get_functions,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
574 "meta.package>get.Functions"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
575 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
576
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
577 m_meta_package.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
578 (make_property (m_meta_package, "PackageList",
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
579 make_fcn_handle (package_get_packages,
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
580 "meta.package>get.PackageList"),
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
581 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
582
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
583 m_meta_package.install_property
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
584 (make_property (m_meta_package, "Packages",
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
585 make_fcn_handle (package_get_packages,
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
586 "meta.package>get.Packages"),
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
587 "public", Matrix (), "private"));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
588
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
589 m_meta_package.install_method
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
590 (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
591 "public", true));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
592
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
593 m_meta_package.install_method
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
594 (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
595 "public", true));
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
596
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
597 // create "meta" package
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
598 cdef_package package_meta
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
599 = m_meta
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
600 = make_package ("meta");
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
601
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
602 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
603 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
604 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
605 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
606 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
607 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
608
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
609 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
610
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
611 // 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
612 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
613 ("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
614
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
615 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
616 ("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
617
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
618 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
619 ("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
620
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
621 symtab.install_built_in_function
27505
c409d16b7190 eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents: 27444
diff changeset
622 ("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
623
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
624 // 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
625 // 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
626
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
627 // 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
628 // ("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
629
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
630 // 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
631 // ("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
632 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
633
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
634 cdef_class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
635 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
636 bool load_if_not_found)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
637 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
638 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
639
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
640 if (it == m_all_classes.end ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
641 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
642 if (load_if_not_found)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
643 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
644 octave_value ov_cls;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
645
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
646 std::size_t pos = name.rfind ('.');
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
647
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
648 if (pos == std::string::npos)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
649 ov_cls = m_interpreter.find (name);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
650 else
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
651 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
652 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
653
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
654 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
655
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
656 if (pack.ok ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
657 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
658 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
659
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
660 if (ov_cls.is_defined ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
661 it = m_all_classes.find (name);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
662 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
663 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
664
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
665 if (it == m_all_classes.end ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
666 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
667 if (error_if_not_found)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
668 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
669 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
670 else
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
671 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
672 cdef_class cls = it->second;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
673
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
674 if (! cls.is_builtin ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
675 cls = lookup_class (cls);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
676
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
677 if (cls.ok ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
678 return cls;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
679 else
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
680 m_all_classes.erase (it);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
681 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
682
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
683 return cdef_class ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
684 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
685
27505
c409d16b7190 eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents: 27444
diff changeset
686 octave_value
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
687 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
688 const std::string& class_name)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
689 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
690 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
691
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
692 if (cls.ok ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
693 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
694 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
695
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
696 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
697 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
698 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
699
27505
c409d16b7190 eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents: 27444
diff changeset
700 return octave_value ();
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
701 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
702
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
703 cdef_package
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
704 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
705 bool load_if_not_found)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
706 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
707 cdef_package retval;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
708
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
709 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
710 = m_all_packages.find (name);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
711
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
712 if (it != m_all_packages.end ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
713 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
714 retval = it->second;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
715
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
716 if (! retval.ok ())
27216
823b4bcf79fc unless necessary for formatting or code, use ' instead of `
John W. Eaton <jwe@octave.org>
parents: 27102
diff changeset
717 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
718 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
719 else
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
720 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
721 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
722
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
723 if (load_if_not_found && lp.find_package (name))
26970
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
724 {
29572
aef11bb4e6d1 use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
725 std::size_t pos = name.rfind ('.');
26970
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
726
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
727 if (pos == std::string::npos)
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
728 retval = make_package (name, "");
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
729 else
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
730 {
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
731 std::string parent_name = name.substr (0, pos);
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
732
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
733 retval = make_package (name, parent_name);
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
734 }
340d44f2f942 backout changeset 98f1a964ff33
John W. Eaton <jwe@octave.org>
parents: 26870
diff changeset
735 }
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
736 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
737 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
738 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
739
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
740 return retval;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
741 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
742
27505
c409d16b7190 eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents: 27444
diff changeset
743 octave_value
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
744 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
745 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
746 cdef_package pack = find_package (pack_name, false);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
747
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
748 if (pack.ok ())
27505
c409d16b7190 eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents: 27444
diff changeset
749 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
750
27505
c409d16b7190 eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents: 27444
diff changeset
751 return octave_value ();
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
752 }
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
753
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
754 cdef_class
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
755 cdef_manager::make_class (const std::string& name,
27102
84ff9953faa1 where possible, eliminate octave:: namespace qualifier inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26975
diff changeset
756 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
757 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
758 cdef_class cls (name, super_list);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
759
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
760 cls.set_class (meta_class ());
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
761
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
762 cls.put ("Abstract", false);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
763 cls.put ("ConstructOnLoad", false);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
764 cls.put ("ContainingPackage", Matrix ());
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
765 cls.put ("Description", "");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
766 cls.put ("DetailedDescription", "");
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
767 cls.put ("Events", Cell ());
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
768 cls.put ("Hidden", false);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
769 cls.put ("InferiorClasses", Cell ());
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
770 cls.put ("Methods", Cell ());
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
771 cls.put ("Properties", Cell ());
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
772 cls.put ("Sealed", false);
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
773
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
774 if (name == "handle")
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
775 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
776 cls.put ("HandleCompatible", true);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
777 cls.mark_as_handle_class ();
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
778 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
779 else if (super_list.empty ())
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
780 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
781 cls.put ("HandleCompatible", false);
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
782 }
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
783 else
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
784 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
785 bool all_handle_compatible = true;
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
786 bool has_handle_class = false;
26769
2f847e3e8d6b split classdef into multiple smaller source files
John W. Eaton <jwe@octave.org>
parents:
diff changeset
787
26774
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
788 for (const auto& cl : super_list)
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
789 {
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
790 all_handle_compatible = all_handle_compatible
568c2ab2782d move classdef classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 26769
diff changeset
791 && cl.get ("HandleCompatible").bool_value ();
27932
b018f553fd85 maint: Use Octave coding conventions in libinterp/
Rik <rik@octave.org>
parents: 27923
diff changeset
792
26774
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 }
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30896
diff changeset
949
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30896
diff changeset
950 OCTAVE_END_NAMESPACE(octave)