annotate libinterp/octave-value/ov-usr-fcn.h @ 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: 30179
diff changeset
3 // Copyright (C) 1996-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 ////////////////////////////////////////////////////////////////////////
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19861
diff changeset
26 #if ! defined (octave_ov_usr_fcn_h)
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17787
diff changeset
27 #define octave_ov_usr_fcn_h 1
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 21139
diff changeset
30
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
31 #include <string>
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
32
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
33 #include "comment-list.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20791
diff changeset
34 #include "ovl.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
35 #include "ov-fcn.h"
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
36 #include "ov-typeinfo.h"
24362
3fc24b792a24 avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents: 24361
diff changeset
37 #include "symscope.h"
10637
9cd5aa83fa62 implement 'local' parameter to pseudo-variables
Jaroslav Hajek <highegg@gmail.com>
parents: 10313
diff changeset
38 #include "unwind-prot.h"
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
39
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
40 class string_vector;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
41
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
42 class octave_value;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
43
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30896
diff changeset
44 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30896
diff changeset
45
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
46 class file_info;
26661
cf9e10ce3351 move variable values from symbol_record objects to stack_frame objects
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
47 class stack_frame;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
48 class tree_parameter_list;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
49 class tree_statement_list;
23481
73558a835b64 eliminate lvalue list arguments from evaluator functions
John W. Eaton <jwe@octave.org>
parents: 23457
diff changeset
50 class tree_evaluator;
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
51 class tree_expression;
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
52 class tree_walker;
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30896
diff changeset
53
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30896
diff changeset
54 OCTAVE_END_NAMESPACE(octave)
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
55
11586
12df7854fa7c strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
56 class
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
57 octave_user_code : public octave_function
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
58 {
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
59 protected:
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
60
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
61 octave_user_code (const std::string& fnm = "", const std::string& nm = "",
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24285
diff changeset
62 const octave::symbol_scope& scope = octave::symbol_scope (),
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
63 octave::tree_statement_list *cmds = nullptr,
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
64 const std::string& ds = "")
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
65 : octave_function (nm, ds), m_scope (scope), m_file_name (fnm),
30826
243b51ec9ff0 Remove `time_t` from API (bug #61821).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
66 m_t_parsed (static_cast<OCTAVE_TIME_T> (0)),
243b51ec9ff0 Remove `time_t` from API (bug #61821).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
67 m_t_checked (static_cast<OCTAVE_TIME_T> (0)),
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
68 m_file_info (nullptr), m_cmd_list (cmds)
27745
7a45100a40c4 allow private scripts to be called from other private scripts
John W. Eaton <jwe@octave.org>
parents: 26917
diff changeset
69 {
7a45100a40c4 allow private scripts to be called from other private scripts
John W. Eaton <jwe@octave.org>
parents: 26917
diff changeset
70 if (m_scope)
7a45100a40c4 allow private scripts to be called from other private scripts
John W. Eaton <jwe@octave.org>
parents: 26917
diff changeset
71 m_scope.set_user_code (this);
7a45100a40c4 allow private scripts to be called from other private scripts
John W. Eaton <jwe@octave.org>
parents: 26917
diff changeset
72 }
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
73
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
74 public:
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
75
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
76 // No copying!
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
77
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
78 octave_user_code (const octave_user_code& f) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
79
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
80 octave_user_code& operator = (const octave_user_code& f) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
81
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
82 ~octave_user_code (void);
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
83
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
84 bool is_user_code (void) const { return true; }
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
85
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
86 std::string get_code_line (std::size_t line);
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
87
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
88 std::deque<std::string> get_code_lines (std::size_t line,
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
89 std::size_t num_lines);
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
90
23730
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
91 void cache_function_text (const std::string& text,
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
92 const octave::sys::time& timestamp);
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
93
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24285
diff changeset
94 octave::symbol_scope scope (void) { return m_scope; }
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23796
diff changeset
95
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
96 void stash_fcn_file_name (const std::string& nm) { m_file_name = nm; }
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
97
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
98 void mark_fcn_file_up_to_date (const octave::sys::time& t)
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
99 { m_t_checked = t; }
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
100
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
101 void stash_fcn_file_time (const octave::sys::time& t)
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
102 {
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
103 m_t_parsed = t;
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
104 mark_fcn_file_up_to_date (t);
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
105 }
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
106
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
107 std::string fcn_file_name (void) const { return m_file_name; }
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
108
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
109 octave::sys::time time_parsed (void) const { return m_t_parsed; }
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
110
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
111 octave::sys::time time_checked (void) const { return m_t_checked; }
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
112
26065
2eb71b83d3e2 partially refactor function lookup in symbol table
John W. Eaton <jwe@octave.org>
parents: 26039
diff changeset
113 virtual octave_value find_subfunction (const std::string&) const
2eb71b83d3e2 partially refactor function lookup in symbol table
John W. Eaton <jwe@octave.org>
parents: 26039
diff changeset
114 {
2eb71b83d3e2 partially refactor function lookup in symbol table
John W. Eaton <jwe@octave.org>
parents: 26039
diff changeset
115 return octave_value ();
2eb71b83d3e2 partially refactor function lookup in symbol table
John W. Eaton <jwe@octave.org>
parents: 26039
diff changeset
116 }
2eb71b83d3e2 partially refactor function lookup in symbol table
John W. Eaton <jwe@octave.org>
parents: 26039
diff changeset
117
16596
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
118 virtual std::map<std::string, octave_value> subfunctions (void) const;
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
119
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
120 octave::tree_statement_list * body (void) { return m_cmd_list; }
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
121
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
122 octave_value dump (void) const;
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
123
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
124 protected:
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
125
23730
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
126 void get_file_info (void);
85f1d31956c0 make echo work for command-line functions
John W. Eaton <jwe@octave.org>
parents: 23729
diff changeset
127
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23796
diff changeset
128 // Our symbol table scope.
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24285
diff changeset
129 octave::symbol_scope m_scope;
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
130
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
131 // The name of the file we parsed.
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
132 std::string m_file_name;
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
133
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
134 // The time the file was parsed.
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
135 octave::sys::time m_t_parsed;
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
136
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
137 // The time the file was last checked to see if it needs to be
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
138 // parsed again.
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
139 octave::sys::time m_t_checked;
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
140
23728
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
141 // Cached text of function or script code with line offsets
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
142 // calculated.
b40b7243a782 new class for caching file contents for debug and echo
John W. Eaton <jwe@octave.org>
parents: 23723
diff changeset
143 octave::file_info *m_file_info;
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23796
diff changeset
144
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
145 // The list of commands that make up the body of this function.
30179
5bef5b36747e maint: use "m_" prefix for protected member variables in class octave_user_code.
Rik <rik@octave.org>
parents: 30106
diff changeset
146 octave::tree_statement_list *m_cmd_list;
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
147 };
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
148
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
149 // Scripts.
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
150
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
151 class
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
152 octave_user_script : public octave_user_code
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
153 {
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
154 public:
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
155
7731
2d2a969c731c fix max_recursion_limit exceeded at startup with Intel C++
Jaroslav Hajek <highegg@gmail.com>
parents: 7719
diff changeset
156 octave_user_script (void);
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
157
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
158 octave_user_script (const std::string& fnm, const std::string& nm,
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24285
diff changeset
159 const octave::symbol_scope& scope = octave::symbol_scope (),
24037
21915520ac7b use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents: 23796
diff changeset
160 octave::tree_statement_list *cmds = nullptr,
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
161 const std::string& ds = "");
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
162
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
163 octave_user_script (const std::string& fnm, const std::string& nm,
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24285
diff changeset
164 const octave::symbol_scope& scope = octave::symbol_scope (),
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
165 const std::string& ds = "");
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
166
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
167 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
168
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
169 octave_user_script (const octave_user_script& f) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
170
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
171 octave_user_script& operator = (const octave_user_script& f) = delete;
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
172
25359
b93522e36446 move common function and script data to octave_user_code class
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
173 ~octave_user_script (void) = default;
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
174
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
175 octave_function * function_value (bool = false) { return this; }
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
176
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
177 octave_user_script * user_script_value (bool = false) { return this; }
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
178
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
179 octave_user_code * user_code_value (bool = false) { return this; }
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
180
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
181 // Scripts and user functions are both considered "scripts" because
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
182 // they are written in Octave's scripting language.
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
183
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
184 bool is_user_script (void) const { return true; }
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
185
28429
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
186 // We must overload the call method so that we call the proper
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
187 // push_stack_frame method, which is overloaded for pointers to
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
188 // octave_function, octave_user_function, and octave_user_script
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
189 // objects.
26917
9dd1d8973877 avoid some overloaded virtual warnings (bug #55741)
John W. Eaton <jwe@octave.org>
parents: 26825
diff changeset
190
23653
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
191 octave_value_list
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
192 call (octave::tree_evaluator& tw, int nargout = 0,
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
193 const octave_value_list& args = octave_value_list ());
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
194
28429
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
195 octave_value_list
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
196 execute (octave::tree_evaluator& tw, int nargout = 0,
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
197 const octave_value_list& args = octave_value_list ());
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
198
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
199 void accept (octave::tree_walker& tw);
7715
5b4d278ec828 parse scripts completely before executing
John W. Eaton <jwe@octave.org>
parents: 7651
diff changeset
200
5744
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
201 private:
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
202
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
203 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
204 };
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
205
1c36a2e82266 [project @ 2006-04-06 19:38:34 by jwe]
jwe
parents: 5307
diff changeset
206 // User-defined functions.
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
207
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
208 class
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
209 octave_user_function : public octave_user_code
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
210 {
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
211 public:
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
212
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24285
diff changeset
213 octave_user_function (const octave::symbol_scope& scope = octave::symbol_scope (),
23457
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23446
diff changeset
214 octave::tree_parameter_list *pl = nullptr,
21baad6b35c4 maint: Use C++11 nullptr rather than 0 or NULL when possible.
Rik <rik@octave.org>
parents: 23446
diff changeset
215 octave::tree_parameter_list *rl = nullptr,
28430
5bfa8e018704 store local init vars for anonymous functions in handle, not function object
John W. Eaton <jwe@octave.org>
parents: 28429
diff changeset
216 octave::tree_statement_list *cl = nullptr);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
217
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
218 // No copying!
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
219
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30826
diff changeset
220 octave_user_function (const octave_user_function& fcn) = delete;
22869
f75d289645ec make deleted functions public
John W. Eaton <jwe@octave.org>
parents: 22868
diff changeset
221
30896
c9788d7f6e65 maint: Use "fcn" as preferred abbreviation for "function" in libinterp/.
Rik <rik@octave.org>
parents: 30826
diff changeset
222 octave_user_function& operator = (const octave_user_function& fcn) = delete;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
223
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
224 ~octave_user_function (void);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
225
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
226 octave_function * function_value (bool = false) { return this; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
227
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
228 octave_user_function * user_function_value (bool = false) { return this; }
4700
ca3a1d687bba [project @ 2004-01-21 03:28:31 by jwe]
jwe
parents: 4661
diff changeset
229
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
230 octave_user_code * user_code_value (bool = false) { return this; }
7719
87eda1f8faaa octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents: 7715
diff changeset
231
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
232 octave_user_function * define_param_list (octave::tree_parameter_list *t);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
233
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
234 octave_user_function * define_ret_list (octave::tree_parameter_list *t);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
235
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
236 void stash_fcn_location (int line, int col)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
237 {
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
238 m_location_line = line;
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
239 m_location_column = col;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
240 }
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
241
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
242 int beginning_line (void) const { return m_location_line; }
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
243 int beginning_column (void) const { return m_location_column; }
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
244
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
245 void stash_fcn_end_location (int line, int col)
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
246 {
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
247 m_end_location_line = line;
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
248 m_end_location_column = col;
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
249 }
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
250
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
251 int ending_line (void) const { return m_end_location_line; }
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
252 int ending_column (void) const { return m_end_location_column; }
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
253
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
254 void maybe_relocate_end (void);
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
255
24361
8bcfddad15ec use shared_ptr to manage symbol_scope objects
John W. Eaton <jwe@octave.org>
parents: 24285
diff changeset
256 void stash_parent_fcn_scope (const octave::symbol_scope& ps);
7968
0d607e8dbbfa eliminate curr_parent_function; fix subfunction lookup
John W. Eaton <jwe@octave.org>
parents: 7876
diff changeset
257
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
258 void stash_leading_comment (octave::comment_list *lc) { m_lead_comm = lc; }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
259
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
260 void stash_trailing_comment (octave::comment_list *tc) { m_trail_comm = tc; }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
261
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
262 std::string profiler_name (void) const;
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
263
30105
67994b92a613 eliminate redundant storage of parent function name in function objects
John W. Eaton <jwe@octave.org>
parents: 30034
diff changeset
264 std::string parent_fcn_name (void) const
67994b92a613 eliminate redundant storage of parent function name in function objects
John W. Eaton <jwe@octave.org>
parents: 30034
diff changeset
265 {
67994b92a613 eliminate redundant storage of parent function name in function objects
John W. Eaton <jwe@octave.org>
parents: 30034
diff changeset
266 octave::symbol_scope pscope = parent_fcn_scope ();
67994b92a613 eliminate redundant storage of parent function name in function objects
John W. Eaton <jwe@octave.org>
parents: 30034
diff changeset
267
67994b92a613 eliminate redundant storage of parent function name in function objects
John W. Eaton <jwe@octave.org>
parents: 30034
diff changeset
268 return pscope.fcn_name ();
67994b92a613 eliminate redundant storage of parent function name in function objects
John W. Eaton <jwe@octave.org>
parents: 30034
diff changeset
269 }
6323
ea65de49e18e [project @ 2007-02-17 02:51:02 by jwe]
jwe
parents: 6149
diff changeset
270
25394
9e39a53b4e00 make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
271 octave::symbol_scope parent_fcn_scope (void) const
9e39a53b4e00 make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
272 {
9e39a53b4e00 make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
273 return m_scope.parent_scope ();
9e39a53b4e00 make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
274 }
9e39a53b4e00 make listing local functions for command completion work again (bug #53925)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
275
28432
71c34141cc2d refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents: 28430
diff changeset
276 std::list<std::string> parent_fcn_names (void) const
71c34141cc2d refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents: 28430
diff changeset
277 {
71c34141cc2d refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents: 28430
diff changeset
278 return m_scope.parent_fcn_names ();
71c34141cc2d refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents: 28430
diff changeset
279 }
71c34141cc2d refactor handling of parent functions and localfunctions
John W. Eaton <jwe@octave.org>
parents: 28430
diff changeset
280
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
281 void mark_as_system_fcn_file (void);
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
282
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
283 bool is_system_fcn_file (void) const { return m_system_fcn_file; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
284
4748
7b145222fea3 [project @ 2004-02-07 06:27:27 by jwe]
jwe
parents: 4700
diff changeset
285 bool is_user_function (void) const { return true; }
7b145222fea3 [project @ 2004-02-07 06:27:27 by jwe]
jwe
parents: 4700
diff changeset
286
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23532
diff changeset
287 void erase_subfunctions (void);
7876
8447a5024650 clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents: 7761
diff changeset
288
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
289 bool takes_varargs (void) const;
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
290
5848
415ae81d331b [project @ 2006-06-08 20:37:29 by jwe]
jwe
parents: 5744
diff changeset
291 bool takes_var_return (void) const;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
292
23599
5cb3a2bb5e1e don't use singleton for symbol_table
John W. Eaton <jwe@octave.org>
parents: 23532
diff changeset
293 void mark_as_private_function (const std::string& cname = "");
11445
40f311a69417 fix OO field access in subfunctions of private functions
John W. Eaton <jwe@octave.org>
parents: 11220
diff changeset
294
7761
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
295 void lock_subfunctions (void);
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
296
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
297 void unlock_subfunctions (void);
5adeea5de26c symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents: 7752
diff changeset
298
16596
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
299 std::map<std::string, octave_value> subfunctions (void) const;
645672f1c873 handle setting breakpoints in subfunctions in GUI editor
John W. Eaton <jwe@octave.org>
parents: 16442
diff changeset
300
26065
2eb71b83d3e2 partially refactor function lookup in symbol table
John W. Eaton <jwe@octave.org>
parents: 26039
diff changeset
301 octave_value find_subfunction (const std::string& subfuns) const;
2eb71b83d3e2 partially refactor function lookup in symbol table
John W. Eaton <jwe@octave.org>
parents: 26039
diff changeset
302
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
303 bool has_subfunctions (void) const;
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
304
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
305 void stash_subfunction_names (const std::list<std::string>& names);
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
306
24285
d22d2936f580 store subfunction names in scope instead of function object
John W. Eaton <jwe@octave.org>
parents: 24270
diff changeset
307 std::list<std::string> subfunction_names (void) const;
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
308
9522
e79470be3ecb implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
309 octave_value_list all_va_args (const octave_value_list& args);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
310
30034
0edbd0efb69d maint: use "m_" prefix for member variables in octave_function class.
Rik <rik@octave.org>
parents: 29949
diff changeset
311 void stash_function_name (const std::string& s) { m_name = s; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
312
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
313 void mark_as_subfunction (void) { m_subfunction = true; }
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
314
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
315 bool is_subfunction (void) const { return m_subfunction; }
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
316
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
317 void mark_as_inline_function (void) { m_inline_function = true; }
6149
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
318
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
319 bool is_inline_function (void) const { return m_inline_function; }
6149
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
320
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
321 void mark_as_anonymous_function (void) { m_anonymous_function = true; }
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
322
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
323 bool is_anonymous_function (void) const { return m_anonymous_function; }
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
324
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
325 bool is_anonymous_function_of_class
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
326 (const std::string& cname = "") const
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
327 {
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
328 return m_anonymous_function
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
329 ? (cname.empty ()
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
330 ? (! dispatch_class ().empty ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
331 : cname == dispatch_class ())
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
332 : false;
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
333 }
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
334
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
335 // If we are a special expression, then the function body consists of exactly
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21743
diff changeset
336 // one expression. The expression's result is the return value of the
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
337 // function.
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
338 bool is_special_expr (void) const
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
339 {
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
340 return is_inline_function () || is_anonymous_function ();
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
341 }
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
342
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
343 void mark_as_nested_function (void) { m_nested_function = true; }
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
344
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
345 bool is_nested_function (void) const { return m_nested_function; }
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
346
26825
6e9034836239 allow handles to nested functions to work (bug #39257)
John W. Eaton <jwe@octave.org>
parents: 26794
diff changeset
347 bool is_parent_function (void) const { return m_scope.is_parent (); }
6e9034836239 allow handles to nested functions to work (bug #39257)
John W. Eaton <jwe@octave.org>
parents: 26794
diff changeset
348
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
349 void mark_as_legacy_constructor (void) { m_class_constructor = legacy; }
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
350
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
351 bool is_legacy_constructor (const std::string& cname = "") const
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
352 {
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
353 return (m_class_constructor == legacy
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
354 ? (cname.empty () ? true : cname == dispatch_class ()) : false);
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
355 }
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
356
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
357 void mark_as_classdef_constructor (void) { m_class_constructor = classdef; }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
358
21017
93748bcaec17 maint: Replace emtpy 'std::string ()' calls with "".
Rik <rik@octave.org>
parents: 20940
diff changeset
359 bool is_classdef_constructor (const std::string& cname = "") const
17856
97e49b588f5d maint: periodic merge of default to classdef
John W. Eaton <jwe@octave.org>
parents: 17745 17822
diff changeset
360 {
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
361 return (m_class_constructor == classdef
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
362 ? (cname.empty () ? true : cname == dispatch_class ()) : false);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
363 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
364
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
365 void mark_as_legacy_method (void) { m_class_method = legacy; }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
366
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
367 bool is_legacy_method (const std::string& cname = "") const
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
368 {
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
369 return (m_class_method == legacy
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
370 ? (cname.empty () ? true : cname == dispatch_class ()) : false);
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
371 }
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
372
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
373 void mark_as_classdef_method (void) { m_class_method = classdef; }
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
374
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
375 bool is_classdef_method (const std::string& cname = "") const
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
376 {
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
377 return (m_class_method == classdef
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
378 ? (cname.empty () ? true : cname == dispatch_class ()) : false);
17787
175b392e91fe Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents: 17744
diff changeset
379 }
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
380
28429
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
381 // We must overload the call method so that we call the proper
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
382 // push_stack_frame method, which is overloaded for pointers to
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
383 // octave_function, octave_user_function, and octave_user_script
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
384 // objects.
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
385
23653
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
386 octave_value_list
3bb0a937c071 avoid possible memory errors when parsing function files
John W. Eaton <jwe@octave.org>
parents: 23602
diff changeset
387 call (octave::tree_evaluator& tw, int nargout = 0,
28429
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
388 const octave_value_list& args = octave_value_list ());
26825
6e9034836239 allow handles to nested functions to work (bug #39257)
John W. Eaton <jwe@octave.org>
parents: 26794
diff changeset
389
6e9034836239 allow handles to nested functions to work (bug #39257)
John W. Eaton <jwe@octave.org>
parents: 26794
diff changeset
390 octave_value_list
28429
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
391 execute (octave::tree_evaluator& tw, int nargout = 0,
8eb8ba8aff9a refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents: 28426
diff changeset
392 const octave_value_list& args = octave_value_list ());
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
393
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
394 octave::tree_parameter_list * parameter_list (void) { return m_param_list; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
395
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
396 octave::tree_parameter_list * return_list (void) { return m_ret_list; }
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
397
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
398 octave::comment_list * leading_comment (void) { return m_lead_comm; }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
399
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
400 octave::comment_list * trailing_comment (void) { return m_trail_comm; }
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
401
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
402 // If is_special_expr is true, retrieve the sigular expression that forms the
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 21743
diff changeset
403 // body. May be null (even if is_special_expr is true).
23446
cd4e1ee28716 maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents: 23220
diff changeset
404 octave::tree_expression * special_expr (void);
15337
3f43e9d6d86e JIT compile anonymous functions
Max Brister <max@2bass.com>
parents: 15195
diff changeset
405
9522
e79470be3ecb implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
406 bool subsasgn_optimization_ok (void);
e79470be3ecb implement subsasgn this-arg optimization
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
407
23075
4e3d47dc7e25 move parse tree classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22869
diff changeset
408 void accept (octave::tree_walker& tw);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
409
23680
ef71711f6d64 rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents: 23653
diff changeset
410 octave_value dump (void) const;
3933
f9ea3dcf58ee [project @ 2002-05-15 03:21:00 by jwe]
jwe
parents: 3875
diff changeset
411
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
412 private:
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
413
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
414 enum class_method_type
19861
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
415 {
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
416 none,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
417 legacy,
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
418 classdef
19755f4fc851 maint: Cleanup C++ code to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
419 };
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
420
23680
ef71711f6d64 rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents: 23653
diff changeset
421 std::string ctor_type_str (void) const;
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
422 std::string method_type_str (void) const;
23680
ef71711f6d64 rework __dump_symbol_table__ function
John W. Eaton <jwe@octave.org>
parents: 23653
diff changeset
423
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
424 // List of arguments for this function. These are local variables.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
425 octave::tree_parameter_list *m_param_list;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
426
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
427 // List of parameters we return. These are also local variables in
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
428 // this function.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
429 octave::tree_parameter_list *m_ret_list;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
430
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
431 // The comments preceding the FUNCTION token.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
432 octave::comment_list *m_lead_comm;
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
433
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
434 // The comments preceding the ENDFUNCTION token.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
435 octave::comment_list *m_trail_comm;
3665
0689afb1d001 [project @ 2000-05-11 19:07:56 by jwe]
jwe
parents: 3544
diff changeset
436
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
437 // Location where this function was defined.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
438 int m_location_line;
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
439 int m_location_column;
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
440 int m_end_location_line;
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
441 int m_end_location_column;
12783
ad9263d965dc First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents: 11586
diff changeset
442
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
443 // True if this function came from a file that is considered to be a
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
444 // system function. This affects whether we check the time stamp
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
445 // on the file to see if it has changed.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
446 bool m_system_fcn_file;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
447
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
448 // The number of arguments that have names.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
449 int m_num_named_args;
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
450
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
451 // TRUE means this is a m_subfunction of a primary function.
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
452 bool m_subfunction;
4238
a5a68c0afe56 [project @ 2002-12-25 21:04:33 by jwe]
jwe
parents: 4219
diff changeset
453
6149
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
454 // TRUE means this is an inline function.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
455 bool m_inline_function;
6149
3a68a2dc6eb1 [project @ 2006-11-09 18:26:56 by jwe]
jwe
parents: 5848
diff changeset
456
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
457 // TRUE means this is an anonymous function.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
458 bool m_anonymous_function;
13241
2a8dcb5b3a00 improve default indexing for objects
John W. Eaton <jwe@octave.org>
parents: 12783
diff changeset
459
26825
6e9034836239 allow handles to nested functions to work (bug #39257)
John W. Eaton <jwe@octave.org>
parents: 26794
diff changeset
460 // TRUE means this is a nested function.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
461 bool m_nested_function;
14544
be18c9e359bf Nested function support (bug #35772)
Max Brister <max@2bass.com>
parents: 14138
diff changeset
462
15869
5e5705b3e505 Implement some embryonic handle-classdef semantic.
Michael Goffioul <michael.goffioul@gmail.com>
parents: 15427
diff changeset
463 // Enum describing whether this function is the constructor for class object.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
464 class_method_type m_class_constructor;
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
465
26794
287eba9ed14b refactor predicates for classdef methods/constructors
John W. Eaton <jwe@octave.org>
parents: 26661
diff changeset
466 // Enum describing whether this function is a method for a class.
29466
7c8a70e4daad use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
467 class_method_type m_class_method;
7336
745a8299c2b5 [project @ 2007-12-28 20:56:55 by jwe]
jwe
parents: 7017
diff changeset
468
16627
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
469 void maybe_relocate_end_internal (void);
de91b1621260 adjust location of eof marker for files with subfunctions but no explicit end statements
John W. Eaton <jwe@octave.org>
parents: 16596
diff changeset
470
23723
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23704
diff changeset
471 void print_code_function_header (const std::string& prefix);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
472
23723
ab8831d346c1 revamp echo command and move related variables inside tree_evaluator class
John W. Eaton <jwe@octave.org>
parents: 23704
diff changeset
473 void print_code_function_trailer (const std::string& prefix);
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
474
25400
d423ce60f5c8 evaluate script and function code in tree_evaluator methods
John W. Eaton <jwe@octave.org>
parents: 25399
diff changeset
475 // XXX FIXME (public)
d423ce60f5c8 evaluate script and function code in tree_evaluator methods
John W. Eaton <jwe@octave.org>
parents: 25399
diff changeset
476 public:
d423ce60f5c8 evaluate script and function code in tree_evaluator methods
John W. Eaton <jwe@octave.org>
parents: 25399
diff changeset
477
15427
6823ad7a25b1 implement local option for warnings
John W. Eaton <jwe@octave.org>
parents: 15337
diff changeset
478 void restore_warning_states (void);
6823ad7a25b1 implement local option for warnings
John W. Eaton <jwe@octave.org>
parents: 15337
diff changeset
479
4612
d44675070f1a [project @ 2003-11-14 19:49:56 by jwe]
jwe
parents: 4346
diff changeset
480 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
2974
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
481 };
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
482
ebbc34ff7f66 [project @ 1997-05-15 19:36:16 by jwe]
jwe
parents:
diff changeset
483 #endif