Mercurial > octave
annotate libinterp/octave-value/ov-builtin.cc @ 30919:4ed7dfe28584
move eval of anon fcn handles and built-in and mex functions to pt-eval.cc
For consistency with the evaluation of user-defined functions and
scripts, move the evaluation of anonymous function handles and
built-in and mex functions to the tree_evaluator class in pt-eval.cc.
* pt-eval.h, pt-eval.cc (tree_evaluator::evaluate_anon_fcn_handle,
tree_evaluator::execute_builtin_function,
tree_evaluator::execute_mex_function): New functions extracted
from tree_anon_fcn_handle::evalueate, octave_builtin::execute and
octave_mex_function::execute, respectively.
* ov-builtin.cc (octave_builtin::execute):
Forward to tree_evaluator::execute_builtin_function.
* ov-mex-fcn.cc (octave_mex_function::execute):
Forward to tree_evaluator::execute_mex_function.
* pt-fcn-handle.cc (tree_anon_fcn_handle::evaluate):
Forward to tree_evaluator::evaluate_anon_fcn_handle.
* mex.cc: Move call_mex inside octave namespace.
* mex-private.h: New file.
* libinterp/corefcn/module.mk: Update.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 08 Apr 2022 14:11:05 -0400 |
parents | 796f54d4ddbf |
children | 597f3ee61a48 |
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:
29949
diff
changeset
|
3 // Copyright (C) 1996-2022 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
2974 | 25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21200
diff
changeset
|
27 # include "config.h" |
2974 | 28 #endif |
29 | |
30 #include "error.h" | |
21100
e39e05d90788
Switch gripe_XXX to either err_XXX or warn_XXX naming scheme.
Rik <rik@octave.org>
parents:
21055
diff
changeset
|
31 #include "errwarn.h" |
23518 | 32 #include "interpreter-private.h" |
33 #include "interpreter.h" | |
2974 | 34 #include "ov-builtin.h" |
35 #include "ov.h" | |
23518 | 36 #include "ovl.h" |
12783
ad9263d965dc
First experimental profiler implementation with flat profile.
Daniel Kraft <d@domob.eu>
parents:
11523
diff
changeset
|
37 #include "profiler.h" |
4748 | 38 #include "unwind-prot.h" |
2974 | 39 |
40 | |
4612 | 41 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_builtin, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10184
diff
changeset
|
42 "built-in function", |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10184
diff
changeset
|
43 "built-in function"); |
2974 | 44 |
45 octave_value_list | |
28429
8eb8ba8aff9a
refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
46 octave_builtin::execute (octave::tree_evaluator& tw, int nargout, |
8eb8ba8aff9a
refactor octave_function call method
John W. Eaton <jwe@octave.org>
parents:
27923
diff
changeset
|
47 const octave_value_list& args) |
2974 | 48 { |
30919
4ed7dfe28584
move eval of anon fcn handles and built-in and mex functions to pt-eval.cc
John W. Eaton <jwe@octave.org>
parents:
30564
diff
changeset
|
49 return tw.execute_builtin_function (*this, nargout, args); |
2974 | 50 } |
10887
f10d0bc8f9cc
make isargout available to DEFUNs
Jaroslav Hajek <highegg@gmail.com>
parents:
10315
diff
changeset
|
51 |
14974
e3cd4c9d7ccc
Generalize builtin specification in JIT and add support for cos and exp
Max Brister <max@2bass.com>
parents:
14973
diff
changeset
|
52 octave_builtin::fcn |
e3cd4c9d7ccc
Generalize builtin specification in JIT and add support for cos and exp
Max Brister <max@2bass.com>
parents:
14973
diff
changeset
|
53 octave_builtin::function (void) const |
e3cd4c9d7ccc
Generalize builtin specification in JIT and add support for cos and exp
Max Brister <max@2bass.com>
parents:
14973
diff
changeset
|
54 { |
29466
7c8a70e4daad
use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
55 return m_fcn; |
14974
e3cd4c9d7ccc
Generalize builtin specification in JIT and add support for cos and exp
Max Brister <max@2bass.com>
parents:
14973
diff
changeset
|
56 } |
e3cd4c9d7ccc
Generalize builtin specification in JIT and add support for cos and exp
Max Brister <max@2bass.com>
parents:
14973
diff
changeset
|
57 |
23518 | 58 octave_builtin::meth |
59 octave_builtin::method (void) const | |
60 { | |
29466
7c8a70e4daad
use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
61 return m_meth; |
23518 | 62 } |
63 | |
22897
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
64 void |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
65 octave_builtin::push_dispatch_class (const std::string& dispatch_type) |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
66 { |
29466
7c8a70e4daad
use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
67 m_dispatch_classes.insert (dispatch_type); |
22897
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
68 } |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
69 |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
70 bool |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
71 octave_builtin::handles_dispatch_class (const std::string& dispatch_type) const |
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
72 { |
29466
7c8a70e4daad
use "m_" prefix for class members in a few more classes
John W. Eaton <jwe@octave.org>
parents:
29358
diff
changeset
|
73 return m_dispatch_classes.find (dispatch_type) != m_dispatch_classes.end (); |
22897
4090c32fccf8
store set of dispatch classes in built-in function objects
John W. Eaton <jwe@octave.org>
parents:
22755
diff
changeset
|
74 } |