Mercurial > octave
annotate libinterp/corefcn/fcn-info.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 | 670a0d878af1 |
children | aac27ad79be6 |
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:
29960
diff
changeset
|
3 // Copyright (C) 1993-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 //////////////////////////////////////////////////////////////////////// |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
27 # include "config.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #endif |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
30 #include "file-ops.h" |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
31 #include "file-stat.h" |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
32 #include "oct-env.h" |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
33 |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
34 #include "defun.h" |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #include "fcn-info.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
36 #include "interpreter-private.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 #include "interpreter.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
38 #include "load-path.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 #include "ov-fcn.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
40 #include "ov-usr-fcn.h" |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
41 #include "parse.h" |
24269
f494b87d2a93
rename scope to symbol_scope
John W. Eaton <jwe@octave.org>
parents:
24263
diff
changeset
|
42 #include "symscope.h" |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
43 #include "symtab.h" |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
44 #include "utils.h" |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
45 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
46 // Should Octave always check to see if function files have changed |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
47 // since they were last compiled? |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
48 static int Vignore_function_time_stamp = 1; |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
50 OCTAVE_BEGIN_NAMESPACE(octave) |
29960
939bef0b66e0
merge "namespace octave" and OCTAVE_NAMESPACE_BEGIN/END blocks
John W. Eaton <jwe@octave.org>
parents:
29958
diff
changeset
|
51 |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 fcn_info::fcn_info_rep::load_private_function (const std::string& dir_name) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
54 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
55 octave_value retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
56 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
57 load_path& lp = __get_load_path__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
58 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
59 std::string file_name = lp.find_private_fcn (dir_name, name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
60 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
61 if (file_name.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
62 return retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
63 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 octave_value ov_fcn = load_fcn_from_file (file_name, dir_name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
65 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
66 if (ov_fcn.is_undefined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
67 return retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
68 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
69 octave_function *tmpfcn = ov_fcn.function_value (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
70 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
71 if (! tmpfcn) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 return retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
73 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
74 std::string class_name; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
75 |
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
|
76 std::size_t pos = dir_name.find_last_of (sys::file_ops::dir_sep_chars ()); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
77 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
78 if (pos != std::string::npos) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
79 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
80 std::string tmp = dir_name.substr (pos+1); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
81 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
82 if (tmp[0] == '@') |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 class_name = tmp.substr (1); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
84 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
85 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
86 tmpfcn->mark_as_private_function (class_name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
87 |
28857
43ad651cf5a0
eliminate unnecessary uses of octave:: namespace qualifier
John W. Eaton <jwe@octave.org>
parents:
28710
diff
changeset
|
88 private_functions[sys::canonicalize_file_name (dir_name)] = ov_fcn; |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
89 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
90 return ov_fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
91 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
92 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
93 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
94 fcn_info::fcn_info_rep::load_class_constructor (void) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
95 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
96 octave_value retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
97 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
98 std::string dir_name; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
99 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
100 load_path& lp = __get_load_path__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
101 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
102 std::string file_name = lp.find_method (name, name, dir_name, package_name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
103 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
104 if (! file_name.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
105 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
106 octave_value ov_fcn |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
107 = load_fcn_from_file (file_name, dir_name, name, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
108 package_name); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
109 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
110 if (ov_fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
111 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
112 // Note: ov_fcn may be an octave_classdef_meta object instead |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
113 // of the actual constructor function. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
114 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
115 retval = ov_fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
116 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
117 class_constructors[name] = retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
118 class_methods[name] = retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
119 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
120 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
121 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
122 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
123 // Classdef constructors can be defined anywhere in the path, not |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
124 // necessarily in @-folders. Look for a normal function and load it. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
125 // If the loaded function is a classdef constructor, store it as such |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
126 // and restore function_on_path to its previous value. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
127 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
128 octave_value old_function_on_path = function_on_path; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
129 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
130 octave_value maybe_cdef_ctor = find_user_function (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
131 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
132 if (maybe_cdef_ctor.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
133 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
134 octave_function *fcn = maybe_cdef_ctor.function_value (true); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
135 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
136 if (fcn && fcn->is_classdef_constructor ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
137 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
138 retval = maybe_cdef_ctor; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
139 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
140 class_constructors[name] = retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
141 class_methods[name] = retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
142 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
143 function_on_path = old_function_on_path; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
144 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
145 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
146 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
147 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
148 return retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
149 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
150 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
151 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
152 fcn_info::fcn_info_rep::load_class_method (const std::string& dispatch_type) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
153 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
154 octave_value retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
155 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
156 if (full_name () == dispatch_type) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
157 retval = load_class_constructor (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
158 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
159 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
160 cdef_manager& cdm = __get_cdef_manager__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
161 |
27505
c409d16b7190
eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents:
27408
diff
changeset
|
162 retval = cdm.find_method_symbol (name, dispatch_type); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
163 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
164 if (! retval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
165 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
166 std::string dir_name; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
167 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
168 load_path& lp = __get_load_path__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
169 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
170 std::string file_name = lp.find_method (dispatch_type, name, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
171 dir_name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
172 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
173 if (! file_name.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
174 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
175 octave_value ov_fcn |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
176 = load_fcn_from_file (file_name, dir_name, |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
177 dispatch_type); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
178 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
179 if (ov_fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
180 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
181 octave_function *tmpfcn = ov_fcn.function_value (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
182 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
183 if (tmpfcn && tmpfcn->is_class_method (dispatch_type)) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
184 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
185 retval = ov_fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
186 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
187 class_methods[dispatch_type] = retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
188 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
189 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
190 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
191 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
192 if (retval.is_undefined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
193 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
194 // Search parent classes |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
195 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
196 symbol_table& symtab = __get_symbol_table__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
197 |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
198 const std::list<std::string>& plist |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
199 = symtab.parent_classes (dispatch_type); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
200 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
201 auto it = plist.begin (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
202 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
203 while (it != plist.end ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
204 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
205 retval = find_method (*it); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
206 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
207 if (retval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
208 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
209 class_methods[dispatch_type] = retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
210 break; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
211 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
212 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
213 it++; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
214 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
215 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
216 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
217 if (retval.is_undefined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
218 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
219 // Search for built-in functions that are declared to |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
220 // handle specific types. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
221 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
222 if (built_in_function.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
223 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
224 octave_function *fcn = built_in_function.function_value (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
225 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
226 if (fcn && fcn->handles_dispatch_class (dispatch_type)) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
227 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
228 retval = built_in_function; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
229 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
230 class_methods[dispatch_type] = retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
231 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
232 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
233 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
234 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
235 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
236 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
237 return retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
238 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
239 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
240 // :-) JWE, can you parse this? Returns a 2D array with second dimension equal |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
241 // to btyp_num_types (static constant). Only the leftmost dimension can be |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
242 // variable in C/C++. Typedefs are boring. |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
243 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
244 static builtin_type_t (*build_sup_table (void))[btyp_num_types] |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
245 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
246 static builtin_type_t sup_table[btyp_num_types][btyp_num_types]; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
247 for (int i = 0; i < btyp_num_types; i++) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
248 for (int j = 0; j < btyp_num_types; j++) |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
249 { |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
250 builtin_type_t ityp = static_cast<builtin_type_t> (i); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
251 builtin_type_t jtyp = static_cast<builtin_type_t> (j); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
252 // FIXME: Is this really right? |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
253 bool use_j |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
254 = (jtyp == btyp_func_handle || ityp == btyp_bool |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
255 || (btyp_isarray (ityp) |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
256 && (! btyp_isarray (jtyp) |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
257 || (btyp_isinteger (jtyp) && ! btyp_isinteger (ityp)) |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
258 || ((ityp == btyp_double || ityp == btyp_complex |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
259 || ityp == btyp_char) |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
260 && (jtyp == btyp_float |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
261 || jtyp == btyp_float_complex))))); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
262 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
263 sup_table[i][j] = (use_j ? jtyp : ityp); |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
264 } |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
265 |
24722
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
266 return sup_table; |
af6c1ed60581
avoid splitting namespace blocks unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
267 } |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
268 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
269 std::string |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
270 get_dispatch_type (const octave_value_list& args, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
271 builtin_type_t& builtin_type) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
272 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
273 static builtin_type_t (*sup_table)[btyp_num_types] = build_sup_table (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
274 std::string dispatch_type; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
275 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
276 int n = args.length (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
277 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
278 if (n > 0) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
279 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
280 int i = 0; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
281 builtin_type = args(0).builtin_type (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
282 if (builtin_type != btyp_unknown) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
283 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
284 for (i = 1; i < n; i++) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
285 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
286 builtin_type_t bti = args(i).builtin_type (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
287 if (bti != btyp_unknown) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
288 builtin_type = sup_table[builtin_type][bti]; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
289 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
290 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
291 builtin_type = btyp_unknown; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
292 break; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
293 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
294 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
295 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
296 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
297 if (builtin_type == btyp_unknown) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
298 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
299 // There's a non-builtin class in the argument list. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
300 dispatch_type = args(i).class_name (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
301 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
302 symbol_table& symtab = __get_symbol_table__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
303 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
304 for (int j = i+1; j < n; j++) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
305 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
306 octave_value arg = args(j); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
307 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
308 if (arg.builtin_type () == btyp_unknown) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
309 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
310 std::string cname = arg.class_name (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
311 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
312 // Only switch to type of ARG if it is marked superior |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
313 // to the current DISPATCH_TYPE. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
314 if (! symtab.is_superiorto (dispatch_type, cname) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
315 && symtab.is_superiorto (cname, dispatch_type)) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
316 dispatch_type = cname; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
317 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
318 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
319 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
320 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
321 dispatch_type = btyp_class_name[builtin_type]; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
322 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
323 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
324 builtin_type = btyp_unknown; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
325 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
326 return dispatch_type; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
327 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
328 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
329 std::string |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
330 get_dispatch_type (const octave_value_list& args) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
331 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
332 builtin_type_t builtin_type; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
333 return get_dispatch_type (args, builtin_type); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
334 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
335 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
336 // Find function definition according to the following precedence list: |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
337 // |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
338 // nested functions (and subfunctions) |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
339 // local functions in the current file |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
340 // private function |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
341 // class method |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
342 // class constructor |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
343 // command-line function |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
344 // autoload function |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
345 // functions on the load_path (current directory is always first) |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
346 // package (FIXME: does this belong here?) |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
347 // built-in function |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
348 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
349 octave_value |
26846
4ff25d9b1eec
set default scope in symbol_table find functions instead of fcn_info
John W. Eaton <jwe@octave.org>
parents:
26845
diff
changeset
|
350 fcn_info::fcn_info_rep::find (const symbol_scope& scope, |
4ff25d9b1eec
set default scope in symbol_table find functions instead of fcn_info
John W. Eaton <jwe@octave.org>
parents:
26845
diff
changeset
|
351 const octave_value_list& args) |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
352 { |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
353 symbol_scope search_scope |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
354 = (scope |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
355 ? scope : __get_current_scope__ ()); |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
356 |
26846
4ff25d9b1eec
set default scope in symbol_table find functions instead of fcn_info
John W. Eaton <jwe@octave.org>
parents:
26845
diff
changeset
|
357 octave_value retval = xfind (search_scope, args); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
358 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
359 if (retval.is_undefined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
360 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
361 // It is possible that the user created a file on the fly since |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
362 // the last prompt or chdir, so try updating the load path and |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
363 // searching again. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
364 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
365 load_path& lp = __get_load_path__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
366 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
367 lp.update (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
368 |
26846
4ff25d9b1eec
set default scope in symbol_table find functions instead of fcn_info
John W. Eaton <jwe@octave.org>
parents:
26845
diff
changeset
|
369 retval = xfind (search_scope, args); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
370 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
371 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
372 return retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
373 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
374 |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
375 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
376 static void |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
377 split_name_with_package (const std::string& name, std::string& fname, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
378 std::string& pname) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
379 { |
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
|
380 std::size_t pos = name.rfind ('.'); |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
381 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
382 fname.clear (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
383 pname.clear (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
384 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
385 if (pos != std::string::npos) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
386 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
387 fname = name.substr (pos + 1); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
388 pname = name.substr (0, pos); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
389 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
390 else |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
391 fname = name; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
392 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
393 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
394 // Check the load path to see if file that defined this is still |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
395 // visible. If the file is no longer visible, then erase the |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
396 // definition and move on. If the file is visible, then we also |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
397 // need to check to see whether the file has changed since the |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
398 // function was loaded/parsed. However, this check should only |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
399 // happen once per prompt (for files found from relative path |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
400 // elements, we also check if the working directory has changed |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
401 // since the last time the function was loaded/parsed). |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
402 // |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
403 // FIXME: perhaps this should be done for all loaded functions when |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
404 // the prompt is printed or the directory has changed, and then we |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
405 // would not check for it when finding symbol definitions. |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
406 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
407 static inline bool |
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
408 load_out_of_date_fcn (const std::string& file_name, |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
409 const std::string& dir_name_arg, |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
410 octave_value& function, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
411 const std::string& dispatch_type = "", |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
412 const std::string& package_name = "") |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
413 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
414 bool retval = false; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
415 |
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
416 std::string dir_name = dir_name_arg; |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
417 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
418 if (dir_name.empty ()) |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
419 { |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29458
diff
changeset
|
420 std::size_t pos = file_name.find_last_of (sys::file_ops::dir_sep_chars ()); |
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
421 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
422 dir_name = file_name.substr (0, pos); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
423 } |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
424 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
425 // FIXME: do the following job of determining private status and |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
426 // class membership in a separate function? |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
427 |
29572
aef11bb4e6d1
use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents:
29458
diff
changeset
|
428 std::size_t pos = dir_name.find_last_of (sys::file_ops::dir_sep_chars ()); |
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
429 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
430 bool is_private_fcn |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
431 = pos != std::string::npos && dir_name.substr (pos+1) == "private"; |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
432 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
433 if (is_private_fcn) |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
434 dir_name = dir_name.substr (0, pos); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
435 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
436 std::string class_name; |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
437 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
438 pos = dir_name.find_last_of (sys::file_ops::dir_sep_chars ()); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
439 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
440 if (pos != std::string::npos) |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
441 { |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
442 std::string tmp = dir_name.substr (pos+1); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
443 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
444 if (tmp[0] == '@') |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
445 class_name = tmp.substr (1); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
446 } |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
447 |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
448 octave_value ov_fcn |
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
449 = load_fcn_from_file (file_name, dir_name, dispatch_type, |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
450 package_name); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
451 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
452 if (ov_fcn.is_defined ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
453 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
454 retval = true; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
455 |
28710
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
456 octave_function *fcn = ov_fcn.function_value (); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
457 |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
458 if (is_private_fcn) |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
459 fcn->mark_as_private_function (class_name); |
68c792e54d19
check and mark private status when reloading functions (bug #40117)
John W. Eaton <jwe@octave.org>
parents:
28437
diff
changeset
|
460 |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
461 function = ov_fcn; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
462 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
463 else |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
464 function = octave_value (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
465 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
466 return retval; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
467 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
468 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
469 static bool |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
470 out_of_date_check (octave_value& function, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
471 const std::string& dispatch_type = "", |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
472 bool check_relative = true) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
473 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
474 bool retval = false; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
475 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
476 octave_function *fcn = function.function_value (true); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
477 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
478 if (fcn) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
479 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
480 // FIXME: we need to handle subfunctions properly here. |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
481 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
482 if (! (fcn->is_subfunction () || fcn->is_anonymous_function ())) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
483 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
484 std::string ff = fcn->fcn_file_name (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
485 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
486 if (! ff.empty ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
487 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
488 sys::time tc = fcn->time_checked (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
489 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
490 bool relative = check_relative && fcn->is_relative (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
491 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
492 if (tc <= Vlast_prompt_time |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
493 || (relative && tc < Vlast_chdir_time)) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
494 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
495 bool clear_breakpoints = false; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
496 std::string nm = fcn->name (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
497 std::string pack = fcn->package_name (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
498 std::string canonical_nm = fcn->canonical_name (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
499 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
500 bool is_same_file = false; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
501 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
502 std::string file; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
503 std::string dir_name; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
504 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
505 if (check_relative) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
506 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
507 int nm_len = nm.length (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
508 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
509 if (sys::env::absolute_pathname (nm) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
510 && ((nm_len > 4 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
511 && (nm.substr (nm_len-4) == ".oct" |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
512 || nm.substr (nm_len-4) == ".mex")) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
513 || (nm_len > 2 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
514 && nm.substr (nm_len-2) == ".m"))) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
515 file = nm; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
516 else |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
517 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
518 // We don't want to make this an absolute name, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
519 // because load_fcn_file looks at the name to |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
520 // decide whether it came from a relative lookup. |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
521 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
522 if (! dispatch_type.empty ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
523 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
524 load_path& lp = __get_load_path__ (); |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
525 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
526 file = lp.find_method (dispatch_type, nm, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
527 dir_name, pack); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
528 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
529 if (file.empty ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
530 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
531 std::string s_name; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
532 std::string s_pack; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
533 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
534 symbol_table& symtab = __get_symbol_table__ (); |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
535 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
536 const std::list<std::string>& plist |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
537 = symtab.parent_classes (dispatch_type); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
538 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
539 std::list<std::string>::const_iterator it |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
540 = plist.begin (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
541 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
542 while (it != plist.end ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
543 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
544 split_name_with_package (*it, s_name, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
545 s_pack); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
546 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
547 file = lp.find_method (*it, nm, dir_name, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
548 s_pack); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
549 if (! file.empty ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
550 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
551 pack = s_pack; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
552 break; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
553 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
554 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
555 it++; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
556 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
557 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
558 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
559 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
560 // Maybe it's an autoload? |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
561 if (file.empty ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
562 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
563 tree_evaluator& tw = __get_evaluator__ (); |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
564 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
565 file = tw.lookup_autoload (nm); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
566 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
567 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
568 if (file.empty ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
569 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
570 load_path& lp = __get_load_path__ (); |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
571 file = lp.find_fcn (nm, dir_name, pack); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
572 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
573 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
574 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
575 if (! file.empty ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
576 is_same_file = same_file (file, ff); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
577 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
578 else |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
579 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
580 is_same_file = true; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
581 file = ff; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
582 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
583 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
584 if (file.empty ()) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
585 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
586 // Can't see this function from current |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
587 // directory, so we should clear it. |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
588 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
589 function = octave_value (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
590 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
591 clear_breakpoints = true; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
592 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
593 else if (is_same_file) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
594 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
595 // Same file. If it is out of date, then reload it. |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
596 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
597 sys::time ottp = fcn->time_parsed (); |
30826
243b51ec9ff0
Remove `time_t` from API (bug #61821).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
598 OCTAVE_TIME_T tp = ottp.unix_time (); |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
599 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
600 fcn->mark_fcn_file_up_to_date (sys::time ()); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
601 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
602 if (! (Vignore_function_time_stamp == 2 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
603 || (Vignore_function_time_stamp |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
604 && fcn->is_system_fcn_file ()))) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
605 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
606 sys::file_stat fs (ff); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
607 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
608 if (fs) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
609 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
610 if (fs.is_newer (tp)) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
611 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
612 retval = load_out_of_date_fcn (ff, dir_name, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
613 function, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
614 dispatch_type, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
615 pack); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
616 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
617 clear_breakpoints = true; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
618 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
619 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
620 else |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
621 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
622 function = octave_value (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
623 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
624 clear_breakpoints = true; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
625 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
626 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
627 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
628 else |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
629 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
630 // Not the same file, so load the new file in |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
631 // place of the old. |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
632 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
633 retval = load_out_of_date_fcn (file, dir_name, function, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
634 dispatch_type, pack); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
635 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
636 clear_breakpoints = true; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
637 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
638 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
639 // If the function has been replaced then clear any |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
640 // breakpoints associated with it |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
641 if (clear_breakpoints) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
642 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
643 bp_table& bptab = __get_bp_table__ (); |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
644 |
29458
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
645 bptab.remove_all_breakpoints_from_function (canonical_nm, |
c0f86150aa6c
begin allowing breakpoints to be set using file name
John W. Eaton <jwe@octave.org>
parents:
29359
diff
changeset
|
646 true); |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
647 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
648 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
649 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
650 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
651 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
652 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
653 return retval; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
654 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
655 |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
656 octave_value |
28434
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
657 fcn_info::fcn_info_rep::find_scoped_function (const symbol_scope& search_scope) |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
658 { |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
659 if (search_scope) |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
660 { |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
661 // Subfunction. |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
662 |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
663 octave_value fcn = search_scope.find_subfunction (name); |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
664 |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
665 if (fcn.is_defined ()) |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
666 return fcn; |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
667 |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
668 // Local function. |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
669 |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
670 std::string fcn_file = search_scope.fcn_file_name (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
671 |
26119
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
672 // For anonymous functions we look at the parent scope so that if |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
673 // they were defined within class methods and use local functions |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
674 // (helper functions) we can still use those anonymous functions |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
675 |
26119
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
676 if (! fcn_file.empty ()) |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
677 { |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
678 auto r = local_functions.find (fcn_file); |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
679 |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
680 if (r != local_functions.end ()) |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
681 { |
26119
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
682 // We shouldn't need an out-of-date check here since |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
683 // local functions may ultimately be called only from |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
684 // a primary function or method defined in the same |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
685 // file. |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
686 |
26119
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
687 return r->second; |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
688 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
689 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
690 |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
691 // Private function. |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
692 |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
693 return find_private_function (search_scope.dir_name ()); |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
694 } |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
695 |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
696 return octave_value (); |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
697 } |
26119
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
698 |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
699 octave_value |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
700 fcn_info::fcn_info_rep::find_private_function (const std::string& dir_name) |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
701 { |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
702 if (! dir_name.empty ()) |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
703 { |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
704 auto q = private_functions.find (dir_name); |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
705 |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
706 if (q == private_functions.end ()) |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
707 { |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
708 octave_value val = load_private_function (dir_name); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
709 |
28437
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
710 if (val.is_defined ()) |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
711 return val; |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
712 } |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
713 else |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
714 { |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
715 octave_value& fval = q->second; |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
716 |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
717 if (fval.is_defined ()) |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
718 out_of_date_check (fval, "", false); |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
719 |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
720 if (fval.is_defined ()) |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
721 return fval; |
8f3aedc5ab4f
split search for private functions into separate function
John W. Eaton <jwe@octave.org>
parents:
28434
diff
changeset
|
722 else |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
723 { |
26119
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
724 octave_value val = load_private_function (dir_name); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
725 |
26119
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
726 if (val.is_defined ()) |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
727 return val; |
1dd0e16b82e3
eliminate some unnecessary function arguments
John W. Eaton <jwe@octave.org>
parents:
25337
diff
changeset
|
728 } |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
729 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
730 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
731 |
28434
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
732 return octave_value (); |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
733 } |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
734 |
28434
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
735 octave_value |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
736 fcn_info::fcn_info_rep::find_method (const octave_value_list& args) |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
737 { |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
738 if (! args.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
739 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
740 std::string dispatch_type = get_dispatch_type (args); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
741 |
28434
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
742 return find_method (dispatch_type); |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
743 } |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
744 |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
745 return octave_value (); |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
746 } |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
747 |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
748 octave_value |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
749 fcn_info::fcn_info_rep::xfind (const symbol_scope& search_scope, |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
750 const octave_value_list& args) |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
751 { |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
752 // Subfunction, local function, or private function. |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
753 |
28434
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
754 octave_value fcn; |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
755 |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
756 fcn = find_scoped_function (search_scope); |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
757 |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
758 if (fcn.is_defined ()) |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
759 return fcn; |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
760 |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
761 // Class methods. |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
762 |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
763 fcn = find_method (args); |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
764 |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
765 if (fcn.is_defined ()) |
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
766 return fcn; |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
767 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
768 // Class constructors. The class name and function name are the same. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
769 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
770 auto q = class_constructors.find (name); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
771 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
772 if (q == class_constructors.end ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
773 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
774 octave_value val = load_class_constructor (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
775 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
776 if (val.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
777 return val; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
778 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
779 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
780 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
781 octave_value& fval = q->second; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
782 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
783 if (fval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
784 out_of_date_check (fval, name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
785 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
786 if (fval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
787 return fval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
788 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
789 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
790 octave_value val = load_class_constructor (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
791 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
792 if (val.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
793 return val; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
794 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
795 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
796 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
797 // Command-line function. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
798 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
799 if (cmdline_function.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
800 return cmdline_function; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
801 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
802 // Autoload? |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
803 |
28434
48c1e8d88ea2
new functions for finding scoped functions and class methods
John W. Eaton <jwe@octave.org>
parents:
28026
diff
changeset
|
804 fcn = find_autoload (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
805 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
806 if (fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
807 return fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
808 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
809 // Function on the path. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
810 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
811 fcn = find_user_function (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
812 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
813 if (fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
814 return fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
815 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
816 // Package |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
817 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
818 fcn = find_package (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
819 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
820 if (fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
821 return fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
822 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
823 // Built-in function (might be undefined). |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
824 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
825 return built_in_function; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
826 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
827 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
828 // Find the definition of NAME according to the following precedence |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
829 // list: |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
830 // |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
831 // built-in function |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
832 // function on the path |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
833 // autoload function |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
834 // command-line function |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
835 // private function |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
836 // subfunction |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
837 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
838 // This function is used to implement the "builtin" function, which |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
839 // searches for "built-in" functions. In Matlab, "builtin" only |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
840 // returns functions that are actually built-in to the interpreter. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
841 // But since the list of built-in functions is different in Octave and |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
842 // Matlab, we also search up the precedence list until we find |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
843 // something that matches. Note that we are only searching by name, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
844 // so class methods and constructors are skipped. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
845 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
846 octave_value |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
847 fcn_info::fcn_info_rep::builtin_find (const symbol_scope& scope) |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
848 { |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
849 symbol_scope search_scope |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
850 = (scope |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
851 ? scope : __get_current_scope__ ()); |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
852 |
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
853 octave_value retval = x_builtin_find (search_scope); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
854 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
855 if (! retval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
856 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
857 // It is possible that the user created a file on the fly since |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
858 // the last prompt or chdir, so try updating the load path and |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
859 // searching again. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
860 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
861 load_path& lp = __get_load_path__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
862 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
863 lp.update (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
864 |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
865 retval = x_builtin_find (search_scope); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
866 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
867 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
868 return retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
869 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
870 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
871 octave_value |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
872 fcn_info::fcn_info_rep::x_builtin_find (const symbol_scope& search_scope) |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
873 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
874 // Built-in function. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
875 if (built_in_function.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
876 return built_in_function; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
877 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
878 // Function on the path. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
879 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
880 octave_value fcn = find_user_function (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
881 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
882 if (fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
883 return fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
884 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
885 // Autoload? |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
886 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
887 fcn = find_autoload (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
888 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
889 if (fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
890 return fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
891 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
892 // Command-line function. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
893 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
894 if (cmdline_function.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
895 return cmdline_function; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
896 |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
897 // Private function, local function, or subfunction. |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
898 |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
899 if (search_scope) |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
900 { |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
901 // Private function. |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
902 |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
903 std::string dir_name = search_scope.dir_name (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
904 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
905 if (! dir_name.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
906 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
907 auto q = private_functions.find (dir_name); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
908 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
909 if (q == private_functions.end ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
910 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
911 octave_value val = load_private_function (dir_name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
912 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
913 if (val.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
914 return val; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
915 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
916 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
917 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
918 octave_value& fval = q->second; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
919 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
920 if (fval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
921 out_of_date_check (fval); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
922 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
923 if (fval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
924 return fval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
925 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
926 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
927 octave_value val = load_private_function (dir_name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
928 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
929 if (val.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
930 return val; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
931 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
932 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
933 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
934 |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
935 // Local function. |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
936 |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
937 std::string fcn_file = search_scope.fcn_file_name (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
938 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
939 if (! fcn_file.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
940 { |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
941 auto r = local_functions.find (fcn_file); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
942 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
943 if (r != local_functions.end ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
944 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
945 // We shouldn't need an out-of-date check here since local |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
946 // functions may ultimately be called only from a primary |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
947 // function or method defined in the same file. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
948 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
949 return r->second; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
950 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
951 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
952 |
28026
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
953 // Subfunction. I think it only makes sense to check for |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
954 // subfunctions if we are currently executing a function defined |
262cdfc6faf9
allow reloading of handles to private functions (bug #57439)
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
955 // from a .m file. |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
956 |
26845
6322d51c655c
allow function search in arbitrary scope
John W. Eaton <jwe@octave.org>
parents:
26661
diff
changeset
|
957 octave_value val = search_scope.find_subfunction (name); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
958 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
959 if (val.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
960 return val; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
961 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
962 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
963 return octave_value (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
964 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
965 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
966 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
967 fcn_info::fcn_info_rep::find_method (const std::string& dispatch_type) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
968 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
969 octave_value retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
970 |
25337
3ff9192b676e
use auto keyword to declare iterator variables where possible
John W. Eaton <jwe@octave.org>
parents:
25103
diff
changeset
|
971 auto q = class_methods.find (dispatch_type); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
972 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
973 if (q == class_methods.end ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
974 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
975 octave_value val = load_class_method (dispatch_type); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
976 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
977 if (val.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
978 return val; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
979 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
980 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
981 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
982 octave_value& fval = q->second; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
983 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
984 if (fval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
985 out_of_date_check (fval, dispatch_type); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
986 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
987 if (fval.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
988 return fval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
989 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
990 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
991 octave_value val = load_class_method (dispatch_type); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
992 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
993 if (val.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
994 return val; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
995 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
996 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
997 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
998 return retval; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
999 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1000 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1001 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1002 fcn_info::fcn_info_rep::find_autoload (void) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1003 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1004 // Autoloaded function. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1005 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1006 if (autoload_function.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1007 out_of_date_check (autoload_function); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1008 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1009 if (! autoload_function.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1010 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
1011 tree_evaluator& tw = __get_evaluator__ (); |
27016
9b261300a001
move file-scope static autoload map variable and functions to evaluator
John W. Eaton <jwe@octave.org>
parents:
27000
diff
changeset
|
1012 |
9b261300a001
move file-scope static autoload map variable and functions to evaluator
John W. Eaton <jwe@octave.org>
parents:
27000
diff
changeset
|
1013 std::string file_name = tw.lookup_autoload (name); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1014 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1015 if (! file_name.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1016 { |
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
|
1017 std::size_t pos = file_name.find_last_of (sys::file_ops::dir_sep_chars ()); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1018 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1019 std::string dir_name = file_name.substr (0, pos); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1020 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1021 octave_value ov_fcn |
25103
078b795c5219
maint: style check C++ ahead of 4.4 release.
Rik <rik@octave.org>
parents:
25054
diff
changeset
|
1022 = load_fcn_from_file (file_name, dir_name, "", "", name, true); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1023 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1024 if (ov_fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1025 autoload_function = octave_value (ov_fcn); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1026 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1027 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1028 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1029 return autoload_function; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1030 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1031 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1032 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1033 fcn_info::fcn_info_rep::find_user_function (void) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1034 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1035 // Function on the path. |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1036 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1037 if (function_on_path.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1038 out_of_date_check (function_on_path); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1039 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1040 if (function_on_path.is_undefined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1041 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1042 std::string dir_name; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1043 |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
1044 load_path& lp = __get_load_path__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1045 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1046 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1047 std::string file_name = lp.find_fcn (name, dir_name, package_name); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1048 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1049 if (! file_name.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1050 { |
27277
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
1051 octave_value ov_fcn |
db687716fed6
style fixes: generally aim to break long lines before operators, not after
John W. Eaton <jwe@octave.org>
parents:
27110
diff
changeset
|
1052 = load_fcn_from_file (file_name, dir_name, "", package_name); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1053 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1054 if (ov_fcn.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1055 function_on_path = ov_fcn; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1056 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1057 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1058 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1059 return function_on_path; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1060 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1061 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1062 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1063 fcn_info::fcn_info_rep::find_package (void) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1064 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1065 // FIXME: implement correct way to check out of date package |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1066 //if (package.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1067 // out_of_date_check (package); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1068 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1069 if (package.is_undefined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1070 { |
31105
670a0d878af1
eliminate WHO arguments from interpreter-private functions
John W. Eaton <jwe@octave.org>
parents:
30826
diff
changeset
|
1071 cdef_manager& cdm = __get_cdef_manager__ (); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1072 |
27505
c409d16b7190
eliminate some uses of bare pointers to octave_function objects
John W. Eaton <jwe@octave.org>
parents:
27408
diff
changeset
|
1073 package = cdm.find_package_symbol (full_name ()); |
24263
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1074 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1075 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1076 return package; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1077 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1078 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1079 void |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1080 fcn_info::fcn_info_rep::install_built_in_dispatch (const std::string& klass) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1081 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1082 if (built_in_function.is_defined ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1083 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1084 octave_function *fcn = built_in_function.function_value (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1085 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1086 if (fcn) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1087 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1088 if (fcn->handles_dispatch_class (klass)) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1089 warning ("install_built_in_dispatch: '%s' already defined for class '%s'", |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1090 name.c_str (), klass.c_str ()); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1091 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1092 fcn->push_dispatch_class (klass); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1093 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1094 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1095 else |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1096 error ("install_built_in_dispatch: '%s' is not a built-in function", |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1097 name.c_str ()); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1098 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1099 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1100 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1101 fcn_info::fcn_info_rep::dump (void) const |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1102 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1103 std::map<std::string, octave_value> m |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1104 = {{ "name", full_name () }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1105 { "package", package.dump () }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1106 { "local_functions", dump_function_map (local_functions) }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1107 { "private_functions", dump_function_map (private_functions) }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1108 { "class_methods", dump_function_map (class_methods) }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1109 { "class_constructors", dump_function_map (class_constructors) }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1110 { "cmdline_function", cmdline_function.dump () }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1111 { "autoload_function", autoload_function.dump () }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1112 { "function_on_path", function_on_path.dump () }, |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1113 { "built_in_function", built_in_function.dump () }}; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1114 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1115 return octave_value (m); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1116 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1117 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1118 octave_value |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1119 dump_function_map (const std::map<std::string, octave_value>& fcn_map) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1120 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1121 if (fcn_map.empty ()) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1122 return octave_value (Matrix ()); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1123 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1124 std::map<std::string, octave_value> info_map; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1125 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1126 for (const auto& nm_fcn : fcn_map) |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1127 { |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1128 std::string nm = nm_fcn.first; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1129 const octave_value& fcn = nm_fcn.second; |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1130 info_map[nm] = fcn.dump (); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1131 } |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1132 |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1133 return octave_value (info_map); |
3b302b2890d7
disentangle symbol_record, scope, and fcn_info from symbol_table class
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
1134 } |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
1135 |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1136 DEFUN (ignore_function_time_stamp, args, nargout, |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1137 doc: /* -*- texinfo -*- |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1138 @deftypefn {} {@var{val} =} ignore_function_time_stamp () |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1139 @deftypefnx {} {@var{old_val} =} ignore_function_time_stamp (@var{new_val}) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1140 Query or set the internal variable that controls whether Octave checks |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1141 the time stamp on files each time it looks up functions defined in |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1142 function files. |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1143 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1144 If the internal variable is set to @qcode{"system"}, Octave will not |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1145 automatically recompile function files in subdirectories of |
28880
68e6e6f083f3
doc: Correct some installation paths (bug #59236).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28437
diff
changeset
|
1146 @file{@var{octave-home}/share/@var{version}/m} if they have changed since |
68e6e6f083f3
doc: Correct some installation paths (bug #59236).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28437
diff
changeset
|
1147 they were last compiled, but will recompile other function files in the |
68e6e6f083f3
doc: Correct some installation paths (bug #59236).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28437
diff
changeset
|
1148 search path if they change. |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1149 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1150 If set to @qcode{"all"}, Octave will not recompile any function files |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1151 unless their definitions are removed with @code{clear}. |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1152 |
28880
68e6e6f083f3
doc: Correct some installation paths (bug #59236).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28437
diff
changeset
|
1153 If set to @qcode{"none"}, Octave will always check time stamps on files |
68e6e6f083f3
doc: Correct some installation paths (bug #59236).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28437
diff
changeset
|
1154 to determine whether functions defined in function files need to |
68e6e6f083f3
doc: Correct some installation paths (bug #59236).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28437
diff
changeset
|
1155 recompiled. |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1156 @end deftypefn */) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1157 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1158 int nargin = args.length (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1159 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1160 if (nargin > 1) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1161 print_usage (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1162 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1163 octave_value retval; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1164 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1165 if (nargout > 0 || nargin == 0) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1166 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1167 switch (Vignore_function_time_stamp) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1168 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1169 case 1: |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1170 retval = "system"; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1171 break; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1172 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1173 case 2: |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1174 retval = "all"; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1175 break; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1176 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1177 default: |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1178 retval = "none"; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1179 break; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1180 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1181 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1182 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1183 if (nargin == 1) |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1184 { |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1185 std::string sval = args(0).xstring_value ("ignore_function_time_stamp: first argument must be a string"); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1186 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1187 if (sval == "all") |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1188 Vignore_function_time_stamp = 2; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1189 else if (sval == "system") |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1190 Vignore_function_time_stamp = 1; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1191 else if (sval == "none") |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1192 Vignore_function_time_stamp = 0; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1193 else |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1194 error (R"(ignore_function_time_stamp: argument must be one of "all", "system", or "none")"); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1195 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1196 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1197 return retval; |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1198 } |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1199 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1200 /* |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1201 %!shared old_state |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1202 %! old_state = ignore_function_time_stamp (); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1203 %!test |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1204 %! state = ignore_function_time_stamp ("all"); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1205 %! assert (state, old_state); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1206 %! assert (ignore_function_time_stamp (), "all"); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1207 %! state = ignore_function_time_stamp ("system"); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1208 %! assert (state, "all"); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1209 %! assert (ignore_function_time_stamp (), "system"); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1210 %! ignore_function_time_stamp (old_state); |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1211 |
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1212 ## Test input validation |
28930
2883b3d08b7e
maint: Remove unnecessary parentheses bracketing %!error BIST tests.
Rik <rik@octave.org>
parents:
28881
diff
changeset
|
1213 %!error ignore_function_time_stamp ("all", "all") |
2883b3d08b7e
maint: Remove unnecessary parentheses bracketing %!error BIST tests.
Rik <rik@octave.org>
parents:
28881
diff
changeset
|
1214 %!error ignore_function_time_stamp ("UNKNOWN_VALUE") |
2883b3d08b7e
maint: Remove unnecessary parentheses bracketing %!error BIST tests.
Rik <rik@octave.org>
parents:
28881
diff
changeset
|
1215 %!error ignore_function_time_stamp (42) |
27110
85233937b6b7
move out_of_date_check to fcn-info.cc and declare static
John W. Eaton <jwe@octave.org>
parents:
27016
diff
changeset
|
1216 */ |
29958
32c3a5805893
move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
29655
diff
changeset
|
1217 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31105
diff
changeset
|
1218 OCTAVE_END_NAMESPACE(octave) |